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
This commit is contained in:
martii
2013-12-22 20:40:37 +01:00
committed by svenhoefer
parent 9b299824d6
commit 697b1a75b3
10 changed files with 46 additions and 61 deletions

View File

@@ -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 Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs und mehr
menu.hint_osd_language Wählen Sie ihre Menü-Sprache 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_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_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_lockage Legen Sie fest, bei welcher Altersklasse die Abfrage der PIN erfolgt
menu.hint_parentallock_menu Menüs mit PIN Code sichern menu.hint_parentallock_menu Menüs mit PIN Code sichern

View File

@@ -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 Colors, fonts, screen size\nGUI look and feel options
menu.hint_osd_language Select OSD language menu.hint_osd_language Select OSD language
menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV 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_changepin Change PIN code
menu.hint_parentallock_lockage Select age allowed to watch menu.hint_parentallock_lockage Select age allowed to watch
menu.hint_parentallock_menu Lock menus with pin code menu.hint_parentallock_menu Lock menus with pin code

View File

@@ -63,8 +63,6 @@
extern CRemoteControl * g_RemoteControl; extern CRemoteControl * g_RemoteControl;
static CTimingSettingsNotifier timingsettingsnotifier;
extern const char * locale_real_names[]; extern const char * locale_real_names[];
extern std::string ttx_font_file; extern std::string ttx_font_file;
@@ -329,8 +327,6 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
else if(actionKey=="osd.def") { else if(actionKey=="osd.def") {
for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++) for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++)
g_settings.timing[i] = timing_setting[i].default_timing; g_settings.timing[i] = timing_setting[i].default_timing;
CNeutrinoApp::getInstance()->SetupTiming();
return res; return res;
} }
else if(actionKey=="logo_dir") { else if(actionKey=="logo_dir") {
@@ -811,10 +807,14 @@ void COsdSetup::showOsdTimeoutSetup(CMenuWidget* menu_timeout)
{ {
menu_timeout->addIntroItems(LOCALE_COLORMENU_TIMING); 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++) 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); CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(timing_setting[i].name, &g_settings.timing[i], true, 0, 99);
menu_timeout->addItem(new CMenuDForwarder(timing_setting[i].name, true, g_settings.timing_string[i], timing_item)); ch->setNumberFormat(nf);
ch->setHint("", LOCALE_MENU_HINT_OSD_TIMING);
menu_timeout->addItem(ch);
} }
menu_timeout->addItem(GenericMenuSeparatorLine); menu_timeout->addItem(GenericMenuSeparatorLine);

View File

@@ -218,6 +218,7 @@ int CRecordSetup::showRecordSetup()
//rec hours //rec hours
CMenuOptionNumberChooser * mc = new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME, &g_settings.record_hours, true, 1, 24, NULL); 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); mc->setHint("", LOCALE_MENU_HINT_RECORD_TIME);
recordingSettings->addItem(mc); recordingSettings->addItem(mc);
@@ -280,31 +281,40 @@ void CRecordSetup::showRecordTimerSetup(CMenuWidget *menu_timersettings)
//recording start/end correcture //recording start/end correcture
int pre,post; int pre,post;
g_Timerd->getRecordingSafety(pre,post); g_Timerd->getRecordingSafety(pre,post);
sprintf(g_settings.record_safety_time_before, "%02d", pre/60); g_settings.record_safety_time_before = pre/60;
sprintf(g_settings.record_safety_time_after, "%02d", post/60); g_settings.record_safety_time_after = 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);
menu_timersettings->addIntroItems(LOCALE_TIMERSETTINGS_SEPARATOR); 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(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) || if (ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER)) { 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) || } 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_ALT) ||
ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_AC3)) { ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_AC3)) {

View File

@@ -1608,12 +1608,6 @@ void CNeutrinoApp::SetupFonts(int fmode)
/************************************************************************************** /**************************************************************************************
* CNeutrinoApp - setup the menu timouts * * 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_RADIO_MODE (6 * 1000 * 1000)
#define LCD_UPDATE_TIME_TV_MODE (60 * 1000 * 1000) #define LCD_UPDATE_TIME_TV_MODE (60 * 1000 * 1000)
@@ -1807,7 +1801,6 @@ TIMER_START();
/* setup GUI */ /* setup GUI */
neutrinoFonts = CNeutrinoFonts::getInstance(); neutrinoFonts = CNeutrinoFonts::getInstance();
SetupFonts(); SetupFonts();
SetupTiming();
g_PicViewer = new CPictureViewer(); g_PicViewer = new CPictureViewer();
CColorSetupNotifier::setPalette(); CColorSetupNotifier::setPalette();

View File

@@ -1031,6 +1031,7 @@ typedef enum
LOCALE_MENU_HINT_OSD, LOCALE_MENU_HINT_OSD,
LOCALE_MENU_HINT_OSD_LANGUAGE, LOCALE_MENU_HINT_OSD_LANGUAGE,
LOCALE_MENU_HINT_OSD_PRESET, LOCALE_MENU_HINT_OSD_PRESET,
LOCALE_MENU_HINT_OSD_TIMING,
LOCALE_MENU_HINT_PARENTALLOCK_CHANGEPIN, LOCALE_MENU_HINT_PARENTALLOCK_CHANGEPIN,
LOCALE_MENU_HINT_PARENTALLOCK_LOCKAGE, LOCALE_MENU_HINT_PARENTALLOCK_LOCKAGE,
LOCALE_MENU_HINT_PARENTALLOCK_MENU, LOCALE_MENU_HINT_PARENTALLOCK_MENU,

View File

@@ -1031,6 +1031,7 @@ const char * locale_real_names[] =
"menu.hint_osd", "menu.hint_osd",
"menu.hint_osd_language", "menu.hint_osd_language",
"menu.hint_osd_preset", "menu.hint_osd_preset",
"menu.hint_osd_timing",
"menu.hint_parentallock_changepin", "menu.hint_parentallock_changepin",
"menu.hint_parentallock_lockage", "menu.hint_parentallock_lockage",
"menu.hint_parentallock_menu", "menu.hint_parentallock_menu",

View File

@@ -296,20 +296,6 @@ bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void
return false; 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: // used in ./gui/osd_setup.cpp:
bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *) 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()->saveSetup(NEUTRINO_SETTINGS_FILE);
//CNeutrinoApp::getInstance()->loadColors(NEUTRINO_SETTINGS_FILE); //CNeutrinoApp::getInstance()->loadColors(NEUTRINO_SETTINGS_FILE);
CNeutrinoApp::getInstance()->SetupFonts(); CNeutrinoApp::getInstance()->SetupFonts();
CNeutrinoApp::getInstance()->SetupTiming();
CColorSetupNotifier::setPalette(); CColorSetupNotifier::setPalette();
CVFD::getInstance()->setlcdparameter(); CVFD::getInstance()->setlcdparameter();
CFrameBuffer::getInstance()->Clear(); CFrameBuffer::getInstance()->Clear();

View File

@@ -97,12 +97,6 @@ class CAudioSetupNotifier : public CChangeObserver
bool changeNotify(const neutrino_locale_t OptionName, void *); 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 class CFontSizeNotifier : public CChangeObserver
{ {
public: public:

View File

@@ -71,8 +71,8 @@ struct SNeutrinoSettings
char shutdown_count[4]; char shutdown_count[4];
char shutdown_min[4]; char shutdown_min[4];
int sleeptimer_min; int sleeptimer_min;
char record_safety_time_before[3]; int record_safety_time_before;
char record_safety_time_after[3]; int record_safety_time_after;
int zapto_pre_time; int zapto_pre_time;
int infobar_sat_display; int infobar_sat_display;
int infobar_show_channeldesc; int infobar_show_channeldesc;
@@ -256,8 +256,7 @@ struct SNeutrinoSettings
TIMING_SETTING_COUNT TIMING_SETTING_COUNT
}; };
int timing [TIMING_SETTING_COUNT] ; int timing [TIMING_SETTING_COUNT];
char timing_string[TIMING_SETTING_COUNT][4];
//widget settings //widget settings
int widget_fade; int widget_fade;