mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
CThemes: visualize current selected or applied theme
Origin commit data
------------------
Commit: 1aaaf8cb86
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-04-11 (Wed, 11 Apr 2018)
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());
|
||||
g_settings.theme_name = themeFile;
|
||||
}
|
||||
OnAfterSelectTheme();
|
||||
CFrameBuffer::getInstance()->clearIconCache();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -146,6 +148,7 @@ void CThemes::readThemes(CMenuWidget &themes)
|
||||
oj = new CMenuForwarder(file, true, "", this, userThemeFile.c_str());
|
||||
} else
|
||||
oj = new CMenuForwarder(file, true, "", this, file);
|
||||
|
||||
themes.addItem( oj );
|
||||
}
|
||||
free(themelist[count]);
|
||||
@@ -153,6 +156,13 @@ void CThemes::readThemes(CMenuWidget &themes)
|
||||
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()
|
||||
@@ -206,8 +216,10 @@ void CThemes::rememberOldTheme(bool remember)
|
||||
{
|
||||
if ( remember ) {
|
||||
oldTheme = t;
|
||||
oldTheme_name = g_settings.theme_name;
|
||||
} else {
|
||||
t = oldTheme;
|
||||
g_settings.theme_name = oldTheme_name;
|
||||
|
||||
changeNotify(NONEXISTANT_LOCALE, NULL);
|
||||
hasThemeChanged = false;
|
||||
@@ -512,3 +524,12 @@ void CThemes::move_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 <configfile.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:
|
||||
CConfigFile themefile;
|
||||
|
||||
int width;
|
||||
SNeutrinoTheme oldTheme;
|
||||
std::string oldTheme_name;
|
||||
|
||||
bool hasThemeChanged;
|
||||
|
||||
@@ -45,6 +48,9 @@ class CThemes : public CMenuTarget, CColorSetupNotifier
|
||||
void rememberOldTheme(bool remember);
|
||||
void move_userDir();
|
||||
bool applyDefaultTheme();
|
||||
///signal after select theme is completed
|
||||
sigc::signal<void> OnAfterSelectTheme;
|
||||
void markSelectedTheme(CMenuWidget *w);
|
||||
|
||||
public:
|
||||
CThemes();
|
||||
|
Reference in New Issue
Block a user