Permalink
Browse files

Minor readability improvements suggested by Lars

  • Loading branch information...
1 parent d0757c8 commit f0ef6996cf55c14713c7034191ea4177b70e0058 John Rennie committed Nov 17, 2011
Showing with 18 additions and 22 deletions.
  1. +2 −2 system/peripherals.xml
  2. +1 −2 xbmc/Application.cpp
  3. +14 −17 xbmc/input/ButtonTranslator.cpp
  4. +1 −1 xbmc/input/ButtonTranslator.h
@@ -1,14 +1,14 @@
<peripherals>
<peripheral vendor="1915" product="003B" bus="usb" name="Motorola Nyxboard Hybrid" mapTo="nyxboard">
- <setting key="keymap_enabled" type="bool" value="0" label="35008" />
+ <setting key="keymap_enabled" type="bool" value="1" label="35008" />
<setting key="keymap" value="nyxboard" label="35007" configurable="0" />
<setting key="enable_flip_commands" type="bool" value="1" label="36005" />
<setting key="flip_keyboard" value="XBMC.VideoLibrary.Search" label="36002" />
<setting key="flip_remote" value="Dialog.Close(virtualkeyboard)" label="36003" />
<setting key="key_user" value="" label="36004" />
</peripheral>
<peripheral vendor="22B8" product="003B" bus="usb" name="Motorola Nyxboard Hybrid" mapTo="nyxboard">
- <setting key="keymap_enabled" type="bool" value="0" label="35008" />
+ <setting key="keymap_enabled" type="bool" value="1" label="35008" />
<setting key="keymap" value="nyxboard" label="35007" configurable="0" />
<setting key="enable_flip_commands" type="bool" value="1" label="36005" />
<setting key="flip_keyboard" value="XBMC.VideoLibrary.Search" label="36002" />
@@ -748,8 +748,7 @@ bool CApplication::Create()
// The key mappings may already have been loaded by a peripheral
CLog::Log(LOGINFO, "load keymapping");
- if (!CButtonTranslator::GetInstance().Loaded())
- if (!CButtonTranslator::GetInstance().Load())
+ if (!CButtonTranslator::GetInstance().Loaded() && !CButtonTranslator::GetInstance().Load())
FatalErrorHandler(false, false, true);
int iResolution = g_graphicsContext.GetVideoResolution();
@@ -367,7 +367,7 @@ CButtonTranslator::CButtonTranslator()
CButtonTranslator::~CButtonTranslator()
{}
-bool CButtonTranslator::Load(const char* Device)
+bool CButtonTranslator::Load(const char* szDevice)
{
translatorMap.clear();
@@ -387,7 +387,7 @@ bool CButtonTranslator::Load(const char* Device)
{
CFileItemList files;
XFILE::CDirectory::GetDirectory(DIRS_TO_CHECK[dirIndex], files, "*.xml");
- //sort the list for filesystem based prioties, e.g. 01-keymap.xml, 02-keymap-overrides.xml
+ //sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC);
for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
success |= LoadKeymap(files[fileIndex]->GetPath());
@@ -427,24 +427,21 @@ bool CButtonTranslator::Load(const char* Device)
#endif
// If we were called with a device name try loading mappings for that device now
- if (Device)
+ if (szDevice && strlen(szDevice) != 0)
{
- if (strlen(Device) != 0)
+ for(unsigned int dirIndex = 0; dirIndex < sizeof(DIRS_TO_CHECK)/sizeof(DIRS_TO_CHECK[0]); ++dirIndex)
{
- for(unsigned int dirIndex = 0; dirIndex < sizeof(DIRS_TO_CHECK)/sizeof(DIRS_TO_CHECK[0]); ++dirIndex)
+ CStdString devicedir = DIRS_TO_CHECK[dirIndex];
+ devicedir.append(szDevice);
+ devicedir.append("/");
+ if( XFILE::CDirectory::Exists(devicedir) )
{
- CStdString devicedir = DIRS_TO_CHECK[dirIndex];
- devicedir.append(Device);
- devicedir.append("/");
- if( XFILE::CDirectory::Exists(devicedir) )
- {
- CFileItemList files;
- XFILE::CDirectory::GetDirectory(devicedir, files, "*.xml");
- //sort the list for filesystem based prioties, e.g. 01-keymap.xml, 02-keymap-overrides.xml
- files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC);
- for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
- success |= LoadKeymap(files[fileIndex]->GetPath());
- }
+ CFileItemList files;
+ XFILE::CDirectory::GetDirectory(devicedir, files, "*.xml");
+ //sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml
+ files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC);
+ for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
+ success |= LoadKeymap(files[fileIndex]->GetPath());
}
}
}
@@ -65,7 +65,7 @@ class CButtonTranslator
static CButtonTranslator& GetInstance();
/// loads Lircmap.xml/IRSSmap.xml (if enabled) and Keymap.xml
- bool Load(const char* Device = NULL);
+ bool Load(const char* szDevice = NULL);
/// clears the maps
void Clear();
/// map has been loaded

0 comments on commit f0ef699

Please sign in to comment.