- themes: allow progressbar-settings in themes

This commit is contained in:
svenhoefer
2016-12-29 00:47:34 +01:00
parent 8dc96ec830
commit 888bfb6687
9 changed files with 82 additions and 55 deletions

View File

@@ -1898,7 +1898,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
int prg_offset = 0;
int title_offset = 0;
int rec_mode;
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF)
if(g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
{
prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00");
title_offset = OFFSET_INNER_SMALL;
@@ -2020,11 +2020,11 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
int pb_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getDigitHeight();
CProgressBar pb(x + OFFSET_INNER_SMALL + numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0);
pb.setType(CProgressBar::PB_TIMESCALE);
pb.setDesign(g_settings.channellist_progressbar_design);
pb.setDesign(g_settings.theme.progressbar_design_channellist);
pb.setCornerType(0);
pb.setStatusColors(COL_MENUCONTENT_PLUS_3, COL_MENUCONTENT_PLUS_1);
int pb_frame = 0;
if (g_settings.channellist_progressbar_design == CProgressBar::PB_MONO && !g_settings.progressbar_gradient)
if (g_settings.theme.progressbar_design_channellist == CProgressBar::PB_MONO && !g_settings.theme.progressbar_gradient)
{
// add small frame to mono progressbars w/o gradient for a better visibility
pb_frame = 1;
@@ -2046,7 +2046,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
if ((int) ch_desc_len > max_desc_len)
ch_desc_len = max_desc_len;
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) {
if(g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF) {
if(displayNext)
{
struct tm *pStartZeit = localtime(&p_event->startTime);
@@ -2081,7 +2081,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
}
else
{
if (g_settings.channellist_progressbar_design != CProgressBar::PB_OFF)
if (g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
{
pb.setValues(0, pb_max);
pb.paint();

View File

@@ -72,8 +72,8 @@ CProgressBar::CProgressBar( const int x_pos,
pb_active_col = active_col;
pb_passive_col = passive_col;
pb_design = &g_settings.progressbar_design;
pb_gradient = &g_settings.progressbar_gradient;
pb_design = &g_settings.theme.progressbar_design;
pb_gradient = &g_settings.theme.progressbar_gradient;
pb_type = PB_REDLEFT;
pb_last_width = -1;
@@ -440,7 +440,7 @@ void CProgressBar::paintProgress(bool do_save_bg)
return;
}
if (pb_type == PB_TIMESCALE)
setRgb(g_settings.progressbar_timescale_red, g_settings.progressbar_timescale_green, g_settings.progressbar_timescale_yellow);
setRgb(g_settings.theme.progressbar_timescale_red, g_settings.theme.progressbar_timescale_green, g_settings.theme.progressbar_timescale_yellow);
if (!pb_red && !pb_yellow && !pb_green)
pb_green = 1;
@@ -462,7 +462,7 @@ void CProgressBar::paintProgress(bool do_save_bg)
paintInit(do_save_bg);
//progress
bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.progressbar_timescale_invert);
bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.theme.progressbar_timescale_invert);
if (cc_allow_paint){
if (!is_painted || (pb_active_width != pb_last_width)) {

View File

@@ -152,10 +152,10 @@ class CProgressBar : public CComponentsItem
void setType(pb_type_t type);
//set design (overides g_settings.progressbar_design)
//set design (overides g_settings.theme.progressbar_design)
void setDesign(int &design) { pb_design = &design; }
//set gradient (overides g_settings.progressbar_gradient)
//set gradient (overides g_settings.theme.progressbar_gradient)
void setGradient(int &gradient) { pb_gradient = &gradient; }
};

View File

@@ -84,10 +84,10 @@ int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &actionKey)
printf("[neutrino] init progressbar menu setup...\n");
if (actionKey == "reset") {
g_settings.progressbar_timescale_red = 0;
g_settings.progressbar_timescale_green = 100;
g_settings.progressbar_timescale_yellow = 70;
g_settings.progressbar_timescale_invert = false;
g_settings.theme.progressbar_timescale_red = 0;
g_settings.theme.progressbar_timescale_green = 100;
g_settings.theme.progressbar_timescale_yellow = 70;
g_settings.theme.progressbar_timescale_invert = false;
return menu_return::RETURN_REPAINT;
}
@@ -105,12 +105,12 @@ int CProgressbarSetup::showMenu()
// general progress bar design
CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_LONG,
&g_settings.progressbar_design, PROGRESSBAR_COLOR_OPTIONS + 1, PROGRESSBAR_COLOR_OPTION_COUNT - 1, true, this);
&g_settings.theme.progressbar_design, PROGRESSBAR_COLOR_OPTIONS + 1, PROGRESSBAR_COLOR_OPTION_COUNT - 1, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR);
m.addItem(mc);
// progress bar gradient
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_GRADIENT, &g_settings.progressbar_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_GRADIENT, &g_settings.theme.progressbar_gradient, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_GRADIENT);
m.addItem(mc);
@@ -122,25 +122,25 @@ int CProgressbarSetup::showMenu()
CMenuOptionNumberChooser *nc;
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_RED, &g_settings.progressbar_timescale_red, true, 0, 100, this);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_RED, &g_settings.theme.progressbar_timescale_red, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_RED);
m.addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_YELLOW, &g_settings.progressbar_timescale_yellow, true, 0, 100, this);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_YELLOW, &g_settings.theme.progressbar_timescale_yellow, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_YELLOW);
m.addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_GREEN, &g_settings.progressbar_timescale_green, true, 0, 100, this);
nc = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_GREEN, &g_settings.theme.progressbar_timescale_green, true, 0, 100, this);
nc->setNumericInput(true);
nc->setNumberFormat("%d %%");
nc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_GREEN);
m.addItem(nc);
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_INVERT, &g_settings.progressbar_timescale_invert, PROGRESSBAR_TIMESCALE_INVERT_OPTIONS, PROGRESSBAR_TIMESCALE_INVERT_OPTION_COUNT, true, this);
mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_TIMESCALE_INVERT, &g_settings.theme.progressbar_timescale_invert, PROGRESSBAR_TIMESCALE_INVERT_OPTIONS, PROGRESSBAR_TIMESCALE_INVERT_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_TIMESCALE_INVERT);
m.addItem(mc);
@@ -156,14 +156,14 @@ int CProgressbarSetup::showMenu()
// extended channel list (progressbars)
m.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MAINMENU_CHANNELS));
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.channellist_progressbar_design, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this);
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.theme.progressbar_design_channellist, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED);
m.addItem(mc);
mb = new CMenuProgressbar(LOCALE_MISCSETTINGS_PROGRESSBAR_PREVIEW);
mb->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_PREVIEW);
mb->getScale()->setType(CProgressBar::PB_TIMESCALE);
mb->getScale()->setDesign(g_settings.channellist_progressbar_design);
mb->getScale()->setDesign(g_settings.theme.progressbar_design_channellist);
mb->getScale()->doPaintBg(false);
m.addItem(mb);

View File

@@ -1205,7 +1205,7 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist)
menu_chanlist->addItem(mc);
// extended channel list
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.channellist_progressbar_design, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this);
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.theme.progressbar_design_channellist, PROGRESSBAR_COLOR_OPTIONS, PROGRESSBAR_COLOR_OPTION_COUNT, true, this);
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED);
menu_chanlist->addItem(mc);

View File

@@ -321,6 +321,14 @@ void CThemes::setTheme(CConfigFile &configfile)
configfile.setInt32( "clock_Digit_red", t.clock_Digit_red );
configfile.setInt32( "clock_Digit_green", t.clock_Digit_green );
configfile.setInt32( "clock_Digit_blue", t.clock_Digit_blue );
configfile.setInt32( "progressbar_design", t.progressbar_design);
configfile.setInt32( "progressbar_design_channellist", t.progressbar_design_channellist);
configfile.setInt32( "progressbar_gradient", t.progressbar_gradient);
configfile.setInt32( "progressbar_timescale_red", t.progressbar_timescale_red);
configfile.setInt32( "progressbar_timescale_green", t.progressbar_timescale_green);
configfile.setInt32( "progressbar_timescale_yellow", t.progressbar_timescale_yellow);
configfile.setInt32( "progressbar_timescale_invert", t.progressbar_timescale_invert);
}
void CThemes::getTheme(CConfigFile &configfile)
@@ -412,6 +420,14 @@ void CThemes::getTheme(CConfigFile &configfile)
t.clock_Digit_red = configfile.getInt32( "clock_Digit_red", t.menu_Content_Text_red );
t.clock_Digit_green = configfile.getInt32( "clock_Digit_green", t.menu_Content_Text_green );
t.clock_Digit_blue = configfile.getInt32( "clock_Digit_blue", t.menu_Content_Text_blue );
t.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_COLOR);
t.progressbar_design_channellist = configfile.getInt32("progressbar_design_channellist", t.progressbar_design);
t.progressbar_gradient = configfile.getInt32("progressbar_gradient", 1);
t.progressbar_timescale_red = configfile.getInt32("progressbar_timescale_red", 0);
t.progressbar_timescale_green = configfile.getInt32("progressbar_timescale_green", 100);
t.progressbar_timescale_yellow = configfile.getInt32("progressbar_timescale_yellow", 70);
t.progressbar_timescale_invert = configfile.getInt32("progressbar_timescale_invert", 0);
}
void CThemes::move_userDir()