aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Rennie <john.rennie@ratsauce.co.uk>2011-11-17 15:23:00 +0000
committerJohn Rennie <john.rennie@ratsauce.co.uk>2011-11-17 15:23:00 +0000
commitf0ef6996cf55c14713c7034191ea4177b70e0058 (patch)
treed35bbb70d75a1392936cf6257180ab9bca043165
parentd0757c8a19f7e87fcaec026e23e567e15317c68d (diff)
Minor readability improvements suggested by Lars
-rw-r--r--system/peripherals.xml4
-rw-r--r--xbmc/Application.cpp3
-rw-r--r--xbmc/input/ButtonTranslator.cpp31
-rw-r--r--xbmc/input/ButtonTranslator.h2
4 files changed, 18 insertions, 22 deletions
diff --git a/system/peripherals.xml b/system/peripherals.xml
index 872266215b..038543be3c 100644
--- a/system/peripherals.xml
+++ b/system/peripherals.xml
@@ -1,6 +1,6 @@
<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" />
@@ -8,7 +8,7 @@
<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" />
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index f2432aeed6..0fbbea47e4 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -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();
diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp
index 90ef81216a..e3dfc92af8 100644
--- a/xbmc/input/ButtonTranslator.cpp
+++ b/xbmc/input/ButtonTranslator.cpp
@@ -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());
}
}
}
diff --git a/xbmc/input/ButtonTranslator.h b/xbmc/input/ButtonTranslator.h
index 791a415e47..6b75e4912a 100644
--- a/xbmc/input/ButtonTranslator.h
+++ b/xbmc/input/ButtonTranslator.h
@@ -65,7 +65,7 @@ public:
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