+ bool themeLoaded = false;
+ bool loading = false;
+
+ // If we haven't loaded a theme, or the stored theme file is empty, or
+ // the previously loaded theme is different to the requested theme,
+ // first reset the builder and load the default theme.
+ if( ! mThemeBuilder || mThemeFile.empty() || mThemeFile.compare( themeFile ) != 0 )
+ {
+ loading = true;
+ mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+ themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); // Sets themeLoaded to true if theme exists
+ }
+
+ if( themeFile.compare(DEFAULT_THEME) != 0 )
+ {
+ // The theme is different to the default: Merge it
+ loading = true;
+ themeLoaded |= LoadJSON( mThemeBuilder, themeFile );
+ }