From af4fcb301d1bce31ccefd4993e0937e10d03ac02 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 15 May 2015 03:25:54 +0200 Subject: [PATCH] start_wizard: add settingsmanager menu ... ... to allow restoring of backups Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f3044134b1ea56bf89d80a4ec801c7ce339f5602 Author: vanhofen Date: 2015-05-15 (Fri, 15 May 2015) Origin message was: ------------------ - start_wizard: add settingsmanager menu ... ... to allow restoring of backups ------------------ This commit was generated by Migit --- src/gui/settings_manager.cpp | 29 +++++++++++++++++++++++++++-- src/gui/settings_manager.h | 14 +++++++++++--- src/gui/start_wizard.cpp | 4 ++++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp index 47b312ee4..9271dcd85 100644 --- a/src/gui/settings_manager.cpp +++ b/src/gui/settings_manager.cpp @@ -48,9 +48,10 @@ -CSettingsManager::CSettingsManager() +CSettingsManager::CSettingsManager(bool wizard_mode) { width = 40; + is_wizard = wizard_mode; } @@ -136,11 +137,35 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - res = showMenu(); + res = is_wizard ? showMenu_wizard() : showMenu(); return res; } +//use a own small menu for start_wizard, because i don't want to fiddle around the easymenu code +int CSettingsManager::showMenu_wizard() +{ + printf("[neutrino] CSettingsManager call %s...\n", __FUNCTION__); + + CMenuWidget * mset = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_SETTINGS_MNGR); + mset->setWizardMode(is_wizard); + mset->addIntroItems(LOCALE_MAINSETTINGS_MANAGE); + + CMenuForwarder * mf; + + mf = new CMenuForwarder(LOCALE_EXTRA_LOADCONFIG, true, NULL, this, "loadconfig", CRCInput::RC_red); + mf->setHint(NEUTRINO_ICON_HINT_LOAD, LOCALE_MENU_HINT_LOAD); + mset->addItem(mf); + + mf = new CMenuForwarder(LOCALE_SETTINGS_RESTORE, true, NULL, this, "restore", CRCInput::RC_green); + mf->setHint(NEUTRINO_ICON_HINT_BACKUP, LOCALE_MENU_HINT_BACKUP); + mset->addItem(mf); + + int res = mset->exec(NULL, ""); + delete mset; + return res; +} + int CSettingsManager::showMenu() { printf("[neutrino] CSettingsManager call %s...\n", __FUNCTION__); diff --git a/src/gui/settings_manager.h b/src/gui/settings_manager.h index 52ef67bbb..e94d77795 100644 --- a/src/gui/settings_manager.h +++ b/src/gui/settings_manager.h @@ -39,11 +39,19 @@ class CSettingsManager : public CMenuTarget { private: int width; - + bool is_wizard; + int showMenu(); - + int showMenu_wizard(); + public: - CSettingsManager(); + enum SETTINGSMANAGER_MODE + { + SETTINGSMANAGER_MODE_WIZARD_NO = 0, + SETTINGSMANAGER_MODE_WIZARD = 1 + }; + + CSettingsManager(bool wizard_mode = SETTINGSMANAGER_MODE_WIZARD_NO); ~CSettingsManager(); int exec(CMenuTarget* parent, const std::string & actionKey = ""); diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index 13d7dd128..28c9304ed 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -46,6 +46,7 @@ #include "osd_setup.h" #include "osdlang_setup.h" #include "scan_setup.h" +#include "settings_manager.h" #include "videosettings.h" #include #include @@ -91,6 +92,9 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) languageSettings.showLanguageSetup(&osdl_setup); osdl_setup.exec(NULL, ""); + CSettingsManager settingsManager(CSettingsManager::SETTINGSMANAGER_MODE_WIZARD); + settingsManager.exec(NULL, ""); + if(ShowMsg (LOCALE_WIZARD_WELCOME_HEAD, g_Locale->getText(LOCALE_WIZARD_WELCOME_TEXT), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbrCancel) == CMessageBox::mbrYes) { int advanced = 1;