From 697b1a75b3aad88a66c423b3af3eb89714c4bc93 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 22 Dec 2013 20:40:37 +0100 Subject: [PATCH] gui/osd_setup, gui/record_setup: use CMenuOptionNumberChooser ... ... instead of CStringInput to enter numbers * neutrino.cpp: drop SetupTiming method * system/settings: use integers for timing values# * system/setting_helpers: drop CTimingSettingsNotifier --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/osd_setup.cpp | 12 ++++---- src/gui/record_setup.cpp | 56 ++++++++++++++++++++-------------- src/neutrino.cpp | 7 ----- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/setting_helpers.cpp | 15 --------- src/system/setting_helpers.h | 6 ---- src/system/settings.h | 7 ++--- 10 files changed, 46 insertions(+), 61 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 900dd04e4..c282451ab 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1004,6 +1004,7 @@ menu.hint_numeric_adjust Adjust channel list mode on numeric zap menu.hint_osd Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs und mehr menu.hint_osd_language Wählen Sie ihre Menü-Sprache menu.hint_osd_preset Wählen Sie zwischen Röhren-TV (CRT) oder Flachbildschirm (LCD) +menu.hint_osd_timing Einblendzeit, die das OSD auf dem TV angezeigt wird menu.hint_parentallock_changepin Geben Sie den 4-stelligen PIN-Code ein, der dann ggf. abgefragt wird menu.hint_parentallock_lockage Legen Sie fest, bei welcher Altersklasse die Abfrage der PIN erfolgt menu.hint_parentallock_menu Menüs mit PIN Code sichern diff --git a/data/locale/english.locale b/data/locale/english.locale index 7cb0635d1..3f0b35370 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1004,6 +1004,7 @@ menu.hint_numeric_adjust Adjust channel list mode on numeric zap menu.hint_osd Colors, fonts, screen size\nGUI look and feel options menu.hint_osd_language Select OSD language menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV +menu.hint_osd_timing After this time the OSD will be faded out menu.hint_parentallock_changepin Change PIN code menu.hint_parentallock_lockage Select age allowed to watch menu.hint_parentallock_menu Lock menus with pin code diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 40ca388bc..5782c4a36 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -63,8 +63,6 @@ extern CRemoteControl * g_RemoteControl; -static CTimingSettingsNotifier timingsettingsnotifier; - extern const char * locale_real_names[]; extern std::string ttx_font_file; @@ -329,8 +327,6 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) else if(actionKey=="osd.def") { for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++) g_settings.timing[i] = timing_setting[i].default_timing; - - CNeutrinoApp::getInstance()->SetupTiming(); return res; } else if(actionKey=="logo_dir") { @@ -811,10 +807,14 @@ void COsdSetup::showOsdTimeoutSetup(CMenuWidget* menu_timeout) { menu_timeout->addIntroItems(LOCALE_COLORMENU_TIMING); + std::string nf("%d "); + nf += g_Locale->getText(LOCALE_UNIT_SHORT_SECOND); for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++) { - CStringInput * timing_item = new CStringInput(timing_setting[i].name, g_settings.timing_string[i], 3, LOCALE_TIMING_HINT_1, LOCALE_TIMING_HINT_2, "0123456789 ", &timingsettingsnotifier); - menu_timeout->addItem(new CMenuDForwarder(timing_setting[i].name, true, g_settings.timing_string[i], timing_item)); + CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(timing_setting[i].name, &g_settings.timing[i], true, 0, 99); + ch->setNumberFormat(nf); + ch->setHint("", LOCALE_MENU_HINT_OSD_TIMING); + menu_timeout->addItem(ch); } menu_timeout->addItem(GenericMenuSeparatorLine); diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 9e69ca291..055b16c72 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -218,6 +218,7 @@ int CRecordSetup::showRecordSetup() //rec hours CMenuOptionNumberChooser * mc = new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24, NULL); + mc->setNumberFormat(std::string("%d ") + g_Locale->getText(LOCALE_UNIT_SHORT_HOUR)); mc->setHint("", LOCALE_MENU_HINT_RECORD_TIME); recordingSettings->addItem(mc); @@ -280,31 +281,40 @@ void CRecordSetup::showRecordTimerSetup(CMenuWidget *menu_timersettings) //recording start/end correcture int pre,post; g_Timerd->getRecordingSafety(pre,post); - sprintf(g_settings.record_safety_time_before, "%02d", pre/60); - sprintf(g_settings.record_safety_time_after, "%02d", post/60); - - //start - CStringInput * timerBefore = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, g_settings.record_safety_time_before, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE_HINT_2,"0123456789 ", this); - CMenuForwarder *fTimerBefore = new CMenuDForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, true, g_settings.record_safety_time_before, timerBefore); - fTimerBefore->setHint("", LOCALE_MENU_HINT_RECORD_TIMEBEFORE); - - //end - CStringInput * timerAfter = new CStringInput(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, g_settings.record_safety_time_after, 2, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_1, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER_HINT_2,"0123456789 ", this); - CMenuForwarder *fTimerAfter = new CMenuDForwarder(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, true, g_settings.record_safety_time_after, timerAfter); - fTimerAfter->setHint("", LOCALE_MENU_HINT_RECORD_TIMEAFTER); - - //announce - CMenuOptionChooser* chzapAnnounce = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - chzapAnnounce->setHint("", LOCALE_MENU_HINT_RECORD_ZAP); - - CMenuOptionNumberChooser *chzapCorr = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_ZAPTO_PRE_TIME, &g_settings.zapto_pre_time, true, 0, 10); - chzapCorr->setHint("", LOCALE_MENU_HINT_RECORD_ZAP_PRE_TIME); + g_settings.record_safety_time_before = pre/60; + g_settings.record_safety_time_after = post/60; menu_timersettings->addIntroItems(LOCALE_TIMERSETTINGS_SEPARATOR); - menu_timersettings->addItem(fTimerBefore); - menu_timersettings->addItem(fTimerAfter); + + std::string nf = "%d "; + nf += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); + + //start + CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, + &g_settings.record_safety_time_before, true, 0, 99, NULL); + ch->setNumberFormat(nf); + ch->setHint("", LOCALE_MENU_HINT_RECORD_TIMEBEFORE); + menu_timersettings->addItem(ch); + + //end + ch = new CMenuOptionNumberChooser(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, + &g_settings.record_safety_time_after, true, 0, 99, NULL); + ch->setNumberFormat(nf); + ch->setHint("", LOCALE_MENU_HINT_RECORD_TIMEAFTER); + menu_timersettings->addItem(ch); + + //announce + CMenuOptionChooser* chzapAnnounce = new CMenuOptionChooser(LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, + &g_settings.recording_zap_on_announce, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + chzapAnnounce->setHint("", LOCALE_MENU_HINT_RECORD_ZAP); menu_timersettings->addItem(chzapAnnounce); - menu_timersettings->addItem(chzapCorr); + + //zapto + ch = new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_ZAPTO_PRE_TIME, + &g_settings.zapto_pre_time, true, 0, 10); + ch->setHint("", LOCALE_MENU_HINT_RECORD_ZAP_PRE_TIME); + ch->setNumberFormat(nf); + menu_timersettings->addItem(ch); } @@ -381,7 +391,7 @@ bool CRecordSetup::changeNotify(const neutrino_locale_t OptionName, void * /*dat { if (ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE) || ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER)) { - g_Timerd->setRecordingSafety(atoi(g_settings.record_safety_time_before)*60, atoi(g_settings.record_safety_time_after)*60); + g_Timerd->setRecordingSafety(g_settings.record_safety_time_before*60, g_settings.record_safety_time_after); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_STD) || ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_ALT) || ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_AC3)) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 12c79db4d..424082e53 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1608,12 +1608,6 @@ void CNeutrinoApp::SetupFonts(int fmode) /************************************************************************************** * CNeutrinoApp - setup the menu timouts * **************************************************************************************/ -void CNeutrinoApp::SetupTiming() -{ - for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++) - sprintf(g_settings.timing_string[i], "%d", g_settings.timing[i]); -} - #define LCD_UPDATE_TIME_RADIO_MODE (6 * 1000 * 1000) #define LCD_UPDATE_TIME_TV_MODE (60 * 1000 * 1000) @@ -1807,7 +1801,6 @@ TIMER_START(); /* setup GUI */ neutrinoFonts = CNeutrinoFonts::getInstance(); SetupFonts(); - SetupTiming(); g_PicViewer = new CPictureViewer(); CColorSetupNotifier::setPalette(); diff --git a/src/system/locals.h b/src/system/locals.h index cc58505c7..030ccaa16 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1031,6 +1031,7 @@ typedef enum LOCALE_MENU_HINT_OSD, LOCALE_MENU_HINT_OSD_LANGUAGE, LOCALE_MENU_HINT_OSD_PRESET, + LOCALE_MENU_HINT_OSD_TIMING, LOCALE_MENU_HINT_PARENTALLOCK_CHANGEPIN, LOCALE_MENU_HINT_PARENTALLOCK_LOCKAGE, LOCALE_MENU_HINT_PARENTALLOCK_MENU, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 6380df612..08ea33855 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1031,6 +1031,7 @@ const char * locale_real_names[] = "menu.hint_osd", "menu.hint_osd_language", "menu.hint_osd_preset", + "menu.hint_osd_timing", "menu.hint_parentallock_changepin", "menu.hint_parentallock_lockage", "menu.hint_parentallock_menu", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index b2ca12c00..7f7f58d34 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -296,20 +296,6 @@ bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void return false; } -// used in ./gui/osd_setup.cpp: -bool CTimingSettingsNotifier::changeNotify(const neutrino_locale_t OptionName, void *) -{ - for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++) - { - if (ARE_LOCALES_EQUAL(OptionName, timing_setting[i].name)) - { - g_settings.timing[i] = atoi(g_settings.timing_string[i]); - return true; - } - } - return false; -} - // used in ./gui/osd_setup.cpp: bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *) { @@ -555,7 +541,6 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CNeutrinoApp::getInstance()->saveSetup(NEUTRINO_SETTINGS_FILE); //CNeutrinoApp::getInstance()->loadColors(NEUTRINO_SETTINGS_FILE); CNeutrinoApp::getInstance()->SetupFonts(); - CNeutrinoApp::getInstance()->SetupTiming(); CColorSetupNotifier::setPalette(); CVFD::getInstance()->setlcdparameter(); CFrameBuffer::getInstance()->Clear(); diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 88207dc36..52db018f1 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -97,12 +97,6 @@ class CAudioSetupNotifier : public CChangeObserver bool changeNotify(const neutrino_locale_t OptionName, void *); }; -class CTimingSettingsNotifier : public CChangeObserver -{ - public: - bool changeNotify(const neutrino_locale_t OptionName, void *); -}; - class CFontSizeNotifier : public CChangeObserver { public: diff --git a/src/system/settings.h b/src/system/settings.h index 33d1a7674..3ec475ed1 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -71,8 +71,8 @@ struct SNeutrinoSettings char shutdown_count[4]; char shutdown_min[4]; int sleeptimer_min; - char record_safety_time_before[3]; - char record_safety_time_after[3]; + int record_safety_time_before; + int record_safety_time_after; int zapto_pre_time; int infobar_sat_display; int infobar_show_channeldesc; @@ -256,8 +256,7 @@ struct SNeutrinoSettings TIMING_SETTING_COUNT }; - int timing [TIMING_SETTING_COUNT] ; - char timing_string[TIMING_SETTING_COUNT][4]; + int timing [TIMING_SETTING_COUNT]; //widget settings int widget_fade;