don't try to switch to theme 'default' if it doesn't exist

This commit is contained in:
Chris Danford
2006-06-15 06:39:08 +00:00
parent aa9eea16e0
commit 960da85a05
2 changed files with 11 additions and 2 deletions
+5
View File
@@ -93,6 +93,11 @@ public:
return m_currentValue;
}
const T &GetDefault() const
{
return m_defaultValue;
}
operator const T () const
{
return Get();
+6 -2
View File
@@ -22,6 +22,7 @@
#include "LocalizedString.h"
#include "SpecialFiles.h"
#include "EnumHelper.h"
#include "PrefsManager.h"
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
@@ -187,6 +188,9 @@ bool ThemeManager::DoesThemeExist( const RString &sThemeName )
bool ThemeManager::IsThemeSelectable( const RString &sThemeName )
{
if( !DoesThemeExist(sThemeName) )
return false;
return sThemeName.Left(1) != "_";
}
@@ -346,8 +350,8 @@ void ThemeManager::SwitchThemeAndLanguage( const RString &sThemeName_, const RSt
{
RString sThemeName = sThemeName_;
RString sLanguage = sLanguage_;
if( !DoesThemeExist(sThemeName) )
sThemeName = SpecialFiles::BASE_THEME_NAME;
if( !IsThemeSelectable(sThemeName) )
sThemeName = PREFSMAN->m_sTheme.GetDefault();
/* We havn't actually loaded the theme yet, so we can't check whether sLanguage
* exists. Just check for empty. */