diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 81dfbb169..74dc5a3ee 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -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(); diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 1221f31dc..c4126f6dc 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -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)) { diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index c346d600e..610402687 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -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; } }; diff --git a/src/gui/osd_progressbar_setup.cpp b/src/gui/osd_progressbar_setup.cpp index 6f2dac976..3ff47cfc7 100644 --- a/src/gui/osd_progressbar_setup.cpp +++ b/src/gui/osd_progressbar_setup.cpp @@ -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); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 7e42f8308..73b9e0ad9 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -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); diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index eba23ef63..8e510b37a 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -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() diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d852de5e1..e08949eb9 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -339,6 +339,9 @@ int CNeutrinoApp::loadSetup(const char * fname) } parentallocked = !access(NEUTRINO_PARENTALLOCKED_FILE, R_OK); + //theme/color options + CThemes::getTheme(configfile); + g_settings.easymenu = configfile.getInt32("easymenu", 0); g_settings.softupdate_autocheck = configfile.getBool("softupdate_autocheck" , false); /* if file present and no config file found, force easy mode */ @@ -487,15 +490,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); g_settings.infobar_buttons_usertitle = configfile.getBool("infobar_buttons_usertitle", false ); - g_settings.progressbar_gradient = configfile.getBool("progressbar_gradient", true ); - g_settings.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_COLOR); - bool pb_color = configfile.getBool("progressbar_color", true ); - if (!pb_color) - g_settings.progressbar_design = CProgressBar::PB_MONO; - g_settings.progressbar_timescale_red = configfile.getInt32("progressbar_timescale_red", 0); - g_settings.progressbar_timescale_green = configfile.getInt32("progressbar_timescale_green", 100); - g_settings.progressbar_timescale_yellow = configfile.getInt32("progressbar_timescale_yellow", 70); - g_settings.progressbar_timescale_invert = configfile.getBool("progressbar_timescale_invert", false); g_settings.infobar_show = configfile.getInt32("infobar_show", configfile.getInt32("infobar_cn", 1)); g_settings.infobar_show_channellogo = configfile.getInt32("infobar_show_channellogo" , 3 ); g_settings.infobar_progressbar = configfile.getInt32("infobar_progressbar" , 1 ); // below channel name @@ -574,8 +568,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.widget_fade = false; g_settings.widget_fade = configfile.getBool("widget_fade" , false ); - //theme/color options - CThemes::getTheme(configfile); g_settings.osd_colorsettings_advanced_mode = configfile.getBool("osd_colorsettings_advanced_mode", false); //personalize @@ -720,7 +712,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.eventlist_additional = configfile.getInt32("eventlist_additional", 0); g_settings.eventlist_epgplus = configfile.getInt32("eventlist_epgplus", 1); g_settings.channellist_epgtext_align_right = configfile.getBool("channellist_epgtext_align_right" , false); - g_settings.channellist_progressbar_design = configfile.getInt32("channellist_progressbar_design", g_settings.progressbar_design); g_settings.channellist_foot = configfile.getInt32("channellist_foot" , 1);//default next Event g_settings.channellist_new_zap_mode = configfile.getInt32("channellist_new_zap_mode", 1); g_settings.channellist_sort_mode = configfile.getInt32("channellist_sort_mode", 0);//sort mode: alpha, freq, sat @@ -962,6 +953,8 @@ int CNeutrinoApp::loadSetup(const char * fname) void CNeutrinoApp::upgradeSetup(const char * fname) { + dprintf(DEBUG_NORMAL, "upgrade/cleanup %s\n", fname); + if (g_settings.version_pseudo < "20160226110000") { if (g_settings.usermenu[SNeutrinoSettings::BUTTON_YELLOW]->items == "7") @@ -970,12 +963,35 @@ void CNeutrinoApp::upgradeSetup(const char * fname) configfile.setString("usermenu_tv_yellow", g_settings.usermenu[SNeutrinoSettings::BUTTON_YELLOW]->items); } } + if (g_settings.version_pseudo < "20162912080000") + { + //convert and remove obsolete progressbar_* keys + + g_settings.theme.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_COLOR); + bool pb_color = configfile.getBool("progressbar_color", true ); + if (!pb_color) + g_settings.theme.progressbar_design = CProgressBar::PB_MONO; + g_settings.theme.progressbar_design_channellist = configfile.getInt32("channellist_progressbar_design", g_settings.theme.progressbar_design); + g_settings.theme.progressbar_gradient = configfile.getBool("progressbar_gradient", true ); + g_settings.theme.progressbar_timescale_red = configfile.getInt32("progressbar_timescale_red", 0); + g_settings.theme.progressbar_timescale_green = configfile.getInt32("progressbar_timescale_green", 100); + g_settings.theme.progressbar_timescale_yellow = configfile.getInt32("progressbar_timescale_yellow", 70); + g_settings.theme.progressbar_timescale_invert = configfile.getBool("progressbar_timescale_invert", false); + + configfile.deleteKey("progressbar_design"); + configfile.deleteKey("channellist_progressbar_design"); + configfile.deleteKey("progressbar_color"); + configfile.deleteKey("progressbar_gradient"); + configfile.deleteKey("progressbar_timescale_red"); + configfile.deleteKey("progressbar_timescale_green"); + configfile.deleteKey("progressbar_timescale_yellow"); + configfile.deleteKey("progressbar_timescale_invert"); + } g_settings.version_pseudo = NEUTRINO_VERSION_PSEUDO; configfile.setString("version_pseudo", g_settings.version_pseudo); - if (configfile.getModifiedFlag()) - configfile.saveConfig(fname); + saveSetup(NEUTRINO_SETTINGS_FILE); } /************************************************************************************** @@ -989,6 +1005,9 @@ void CNeutrinoApp::saveSetup(const char * fname) dprintf(DEBUG_NORMAL, "error while saving scan-settings!\n"); } + //theme/color options + CThemes::setTheme(configfile); + //video configfile.setInt32( "video_Mode", g_settings.video_Mode ); configfile.setInt32( "analog_mode1", g_settings.analog_mode1 ); @@ -1092,12 +1111,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); configfile.setBool("infobar_buttons_usertitle", g_settings.infobar_buttons_usertitle); - configfile.setBool("progressbar_gradient", g_settings.progressbar_gradient); - configfile.setInt32("progressbar_design", g_settings.progressbar_design); - configfile.setInt32("progressbar_timescale_red", g_settings.progressbar_timescale_red); - configfile.setInt32("progressbar_timescale_green", g_settings.progressbar_timescale_green); - configfile.setInt32("progressbar_timescale_yellow", g_settings.progressbar_timescale_yellow); - configfile.setInt32("progressbar_timescale_invert", g_settings.progressbar_timescale_invert); configfile.setInt32("infobar_show", g_settings.infobar_show); configfile.setInt32("infobar_show_channellogo" , g_settings.infobar_show_channellogo ); configfile.setInt32("infobar_progressbar" , g_settings.infobar_progressbar ); @@ -1167,8 +1180,6 @@ void CNeutrinoApp::saveSetup(const char * fname) //widget settings configfile.setBool("widget_fade" , g_settings.widget_fade ); - //theme/color options - CThemes::setTheme(configfile); configfile.setBool("osd_colorsettings_advanced_mode", g_settings.osd_colorsettings_advanced_mode); //personalize @@ -1276,7 +1287,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("eventlist_epgplus", g_settings.eventlist_epgplus); configfile.setInt32("channellist_additional", g_settings.channellist_additional); configfile.setBool("channellist_epgtext_align_right", g_settings.channellist_epgtext_align_right); - configfile.setInt32("channellist_progressbar_design", g_settings.channellist_progressbar_design); configfile.setInt32("channellist_foot", g_settings.channellist_foot); configfile.setInt32("channellist_new_zap_mode", g_settings.channellist_new_zap_mode); configfile.setInt32("remote_control_hardware", g_settings.remote_control_hardware); diff --git a/src/system/settings.h b/src/system/settings.h index 9d0290f78..bb82c729a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -143,6 +143,14 @@ struct SNeutrinoTheme unsigned char clock_Digit_red; unsigned char clock_Digit_green; unsigned char clock_Digit_blue; + + int progressbar_design; + int progressbar_design_channellist; + int progressbar_gradient; + int progressbar_timescale_red; + int progressbar_timescale_green; + int progressbar_timescale_yellow; + int progressbar_timescale_invert; }; struct timer_remotebox_item @@ -195,12 +203,6 @@ struct SNeutrinoSettings int infobar_show; int infobar_show_channellogo; int infobar_progressbar; - int progressbar_design; - int progressbar_gradient; - int progressbar_timescale_red; - int progressbar_timescale_green; - int progressbar_timescale_yellow; - int progressbar_timescale_invert; int infobar_casystem_display; int infobar_casystem_dotmatrix; int infobar_casystem_frame; @@ -588,7 +590,6 @@ struct SNeutrinoSettings int eventlist_epgplus; int channellist_additional; int channellist_epgtext_align_right; - int channellist_progressbar_design; int channellist_foot; int channellist_new_zap_mode; int channellist_sort_mode; diff --git a/version_pseudo.h b/version_pseudo.h index 56e5e0b75..bdfc25f5d 100644 --- a/version_pseudo.h +++ b/version_pseudo.h @@ -1 +1 @@ -#define NEUTRINO_VERSION_PSEUDO "20160226110000" +#define NEUTRINO_VERSION_PSEUDO "20162912080000"