mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CThemes: visualize current selected or applied theme
This commit is contained in:
@@ -97,6 +97,8 @@ int CThemes::exec(CMenuTarget* parent, const std::string & actionKey)
|
|||||||
readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_SUFFIX).c_str());
|
readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_SUFFIX).c_str());
|
||||||
g_settings.theme_name = themeFile;
|
g_settings.theme_name = themeFile;
|
||||||
}
|
}
|
||||||
|
OnAfterSelectTheme();
|
||||||
|
CFrameBuffer::getInstance()->clearIconCache();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +148,7 @@ void CThemes::readThemes(CMenuWidget &themes)
|
|||||||
oj = new CMenuForwarder(file, true, "", this, userThemeFile.c_str());
|
oj = new CMenuForwarder(file, true, "", this, userThemeFile.c_str());
|
||||||
} else
|
} else
|
||||||
oj = new CMenuForwarder(file, true, "", this, file);
|
oj = new CMenuForwarder(file, true, "", this, file);
|
||||||
|
|
||||||
themes.addItem( oj );
|
themes.addItem( oj );
|
||||||
}
|
}
|
||||||
free(themelist[count]);
|
free(themelist[count]);
|
||||||
@@ -153,6 +156,13 @@ void CThemes::readThemes(CMenuWidget &themes)
|
|||||||
free(themelist);
|
free(themelist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//on first paint exec this methode to set marker to item
|
||||||
|
markSelectedTheme(&themes);
|
||||||
|
|
||||||
|
//for all next menu paints markers are setted with this slot inside exec()
|
||||||
|
if (OnAfterSelectTheme.empty())
|
||||||
|
OnAfterSelectTheme.connect(sigc::bind(sigc::mem_fun(this, &CThemes::markSelectedTheme), &themes));
|
||||||
}
|
}
|
||||||
|
|
||||||
int CThemes::Show()
|
int CThemes::Show()
|
||||||
@@ -206,8 +216,10 @@ void CThemes::rememberOldTheme(bool remember)
|
|||||||
{
|
{
|
||||||
if ( remember ) {
|
if ( remember ) {
|
||||||
oldTheme = t;
|
oldTheme = t;
|
||||||
|
oldTheme_name = g_settings.theme_name;
|
||||||
} else {
|
} else {
|
||||||
t = oldTheme;
|
t = oldTheme;
|
||||||
|
g_settings.theme_name = oldTheme_name;
|
||||||
|
|
||||||
changeNotify(NONEXISTANT_LOCALE, NULL);
|
changeNotify(NONEXISTANT_LOCALE, NULL);
|
||||||
hasThemeChanged = false;
|
hasThemeChanged = false;
|
||||||
@@ -512,3 +524,12 @@ void CThemes::move_userDir()
|
|||||||
remove(USERDIR);
|
remove(USERDIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CThemes::markSelectedTheme(CMenuWidget *w)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < w->getItemsCount(); i++){
|
||||||
|
w->getItem(i)->setInfoIconRight(NULL);
|
||||||
|
if (g_settings.theme_name == w->getItem(i)->getName())
|
||||||
|
w->getItem(i)->setInfoIconRight(NEUTRINO_ICON_MARKER_DIALOG_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -27,14 +27,17 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <configfile.h>
|
#include <configfile.h>
|
||||||
#include <system/setting_helpers.h>
|
#include <system/setting_helpers.h>
|
||||||
|
#include <sigc++/signal.h>
|
||||||
|
#include <sigc++/bind.h>
|
||||||
|
|
||||||
class CThemes : public CMenuTarget, CColorSetupNotifier
|
class CThemes : public CMenuTarget, CColorSetupNotifier, public sigc::trackable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CConfigFile themefile;
|
CConfigFile themefile;
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
SNeutrinoTheme oldTheme;
|
SNeutrinoTheme oldTheme;
|
||||||
|
std::string oldTheme_name;
|
||||||
|
|
||||||
bool hasThemeChanged;
|
bool hasThemeChanged;
|
||||||
|
|
||||||
@@ -45,6 +48,9 @@ class CThemes : public CMenuTarget, CColorSetupNotifier
|
|||||||
void rememberOldTheme(bool remember);
|
void rememberOldTheme(bool remember);
|
||||||
void move_userDir();
|
void move_userDir();
|
||||||
bool applyDefaultTheme();
|
bool applyDefaultTheme();
|
||||||
|
///signal after select theme is completed
|
||||||
|
sigc::signal<void> OnAfterSelectTheme;
|
||||||
|
void markSelectedTheme(CMenuWidget *w);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CThemes();
|
CThemes();
|
||||||
|
Reference in New Issue
Block a user