From d5e57f8877aa9adb12ace81c8ffc2447e3043fc2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 28 Jun 2013 15:53:12 +0400 Subject: [PATCH] start wizard: add easy mode as requested by customers, which only ask for gui language and show fast scan (sat) and/or simple cable scan menu --- data/locale/english.locale | 5 +++ src/gui/osdlang_setup.h | 2 +- src/gui/scan_setup.cpp | 13 +++++-- src/gui/scan_setup.h | 8 ++--- src/gui/start_wizard.cpp | 74 ++++++++++++++++++++++++++++---------- src/system/locals.h | 5 +++ src/system/locals_intern.h | 5 +++ 7 files changed, 85 insertions(+), 27 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index 73b50b659..a56761b7c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1935,6 +1935,11 @@ videomenu.videoformat_43 4:3 videomenu.videomode Digital video mode wizard.initial_settings Initial settings found wizard.install_settings Do you want to install channels for Astra 19.2°E? +wizard.setup First installation +wizard.setup_advanced Advanced +wizard.setup_easy Easy +wizard.setup_type Installation type +wizard.setup_type_hint Easy to setup for CanalDigitaal/TéléSAT/TV Vlaanderen providers or simple cable scan wizard.welcome_head Welcome to the Setup Wizard wizard.welcome_text Next steps will guide you through initial installation of the device.\nImportant: Your CST set-top box can be conveniently controlled\nwith the web interface for timer management or live TV on the Web browser.\nDo not make it accessible to untrusted networks!\nDo you want to continue? word.from from diff --git a/src/gui/osdlang_setup.h b/src/gui/osdlang_setup.h index 5add67954..1e181b46b 100644 --- a/src/gui/osdlang_setup.h +++ b/src/gui/osdlang_setup.h @@ -56,7 +56,6 @@ class COsdLangSetup : public CMenuTarget, CChangeObserver bool is_wizard; int showLocalSetup(); - void showLanguageSetup(CMenuWidget *osdl_setup); void showPrefMenu(CMenuWidget *prefMenu, CLangSelectNotifier *langNotifier); CMenuOptionStringChooser* getTzItems(); @@ -74,6 +73,7 @@ class COsdLangSetup : public CMenuTarget, CChangeObserver COsdLangSetup(bool wizard_mode = OSDLANG_SETUP_MODE_WIZARD_NO); ~COsdLangSetup(); int exec(CMenuTarget* parent, const std::string & actionKey); + void showLanguageSetup(CMenuWidget *osdl_setup); }; #endif diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 2180b252b..462f33817 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -218,6 +218,9 @@ CScanSetup::CScanSetup(bool wizard_mode) lcnhd = NULL; linkfe = NULL; in_menu = false; + allow_start = true; + if (CFEManager::getInstance()->haveCable()) + nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); } CScanSetup* CScanSetup::getInstance() @@ -302,6 +305,8 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) } CScanTs scanTs(FE_QAM); scanTs.exec(NULL, "manual"); + if (is_wizard) + return menu_return::RETURN_EXIT_ALL; return res; } std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; @@ -320,6 +325,8 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) //...then start scan CScanTs scanTs(delsys); scanTs.exec(NULL, scants_key[i]); + if (is_wizard && as == "fast") + return menu_return::RETURN_EXIT_ALL; return res; } } @@ -452,7 +459,7 @@ int CScanSetup::showScanMenu() settings->addItem(fautoScanAll); #ifdef ENABLE_FASTSCAN //fast scan - CMenuWidget * fastScanMenu = new CMenuWidget(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, MN_WIDGET_ID_SCAN_FAST_SCAN); + CMenuWidget * fastScanMenu = new CMenuWidget(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, w, MN_WIDGET_ID_SCAN_FAST_SCAN); addScanMenuFastScan(fastScanMenu); mf = new CMenuDForwarder(LOCALE_SATSETUP_FASTSCAN_HEAD, true, NULL, fastScanMenu, "", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_FAST); @@ -474,7 +481,7 @@ int CScanSetup::showScanMenu() nc->setHint("", LOCALE_MENU_HINT_SCAN_FETIMEOUT); settings->addItem(nc); } - nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + //nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); //auto scan char autoscan[64]; @@ -559,7 +566,7 @@ int CScanSetup::showScanMenu() //delete satSelect; delete satOnOff; delete settings; - delete nid; + //delete nid; return res; } diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index 3b5515834..42dd6d5af 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -111,11 +111,7 @@ class CScanSetup : public CMenuTarget, public CChangeObserver void addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t &satconfig); void addScanMenuManualScan(CMenuWidget *manual_Scan); void addScanMenuAutoScanAll(CMenuWidget *auto_ScanAll); -#ifdef ENABLE_FASTSCAN - void addScanMenuFastScan(CMenuWidget *fast_ScanMenu); -#endif void addScanMenuAutoScan(CMenuWidget *auto_Scan); - void addScanMenuCable(CMenuWidget *menu); int addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut = 1); int addListFlagsItems(CMenuWidget *listflags_menu, const int &shortcut = 1, bool manual = false); @@ -140,6 +136,10 @@ class CScanSetup : public CMenuTarget, public CChangeObserver int exec(CMenuTarget* parent, const std::string & actionKey = ""); bool changeNotify(const neutrino_locale_t OptionName, void * /*data*/); +#ifdef ENABLE_FASTSCAN + void addScanMenuFastScan(CMenuWidget *fast_ScanMenu); +#endif + void addScanMenuCable(CMenuWidget *menu); }; class CTPSelectHandler : public CMenuTarget //CScanSetup diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index f0191dd56..b0a8de716 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -54,19 +54,23 @@ #include extern cVideo * videoDecoder; +extern Zapit_config zapitCfg; using namespace std; - CStartUpWizard::CStartUpWizard() { - } CStartUpWizard::~CStartUpWizard() { - } +const CMenuOptionChooser::keyval WIZARD_SETUP_TYPE[] = +{ + { 0, LOCALE_WIZARD_SETUP_EASY }, + { 1, LOCALE_WIZARD_SETUP_ADVANCED }, +}; + int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) { int res = menu_return::RETURN_REPAINT; @@ -74,26 +78,43 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) if (parent) parent->hide(); - + COsdLangSetup languageSettings(COsdLangSetup::OSDLANG_SETUP_MODE_WIZARD); - + +#if 0 languageSettings.exec(NULL, ""); +#endif + //language setup + CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, 45, MN_WIDGET_ID_LANGUAGESETUP_LOCALE); + osdl_setup.setWizardMode(true); + languageSettings.showLanguageSetup(&osdl_setup); + osdl_setup.exec(NULL, ""); - if(ShowMsgUTF (LOCALE_WIZARD_WELCOME_HEAD, g_Locale->getText(LOCALE_WIZARD_WELCOME_TEXT), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbrCancel) == CMessageBox::mbrYes) + if(ShowMsgUTF (LOCALE_WIZARD_WELCOME_HEAD, g_Locale->getText(LOCALE_WIZARD_WELCOME_TEXT), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbrCancel) == CMessageBox::mbrYes) { + int advanced = 1; +#ifdef ENABLE_FASTSCAN + advanced = 0; + CMenuWidget wtype(LOCALE_WIZARD_SETUP); + wtype.setWizardMode(true); + wtype.addIntroItems(); + CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_WIZARD_SETUP_TYPE, &advanced, WIZARD_SETUP_TYPE, 2, true, NULL); + mc->setHint("", LOCALE_WIZARD_SETUP_TYPE_HINT); + wtype.addItem(mc); + wtype.exec(NULL, ""); +#endif //open video settings in wizardmode - g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD); - - COsdSetup osdSettings(COsdSetup::OSD_SETUP_MODE_WIZARD); - - res = g_videoSettings->exec(NULL, ""); - g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD_NO); - - if(res != menu_return::RETURN_EXIT_ALL) + if(advanced && res != menu_return::RETURN_EXIT_ALL) { + g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD); + res = g_videoSettings->exec(NULL, ""); + g_videoSettings->setWizardMode(CVideoSettings::V_SETUP_MODE_WIZARD_NO); + } + if(advanced && res != menu_return::RETURN_EXIT_ALL) { + COsdSetup osdSettings(COsdSetup::OSD_SETUP_MODE_WIZARD); res = osdSettings.exec(NULL, ""); } - if(res != menu_return::RETURN_EXIT_ALL) + if(advanced && res != menu_return::RETURN_EXIT_ALL) { CNetworkSetup::getInstance()->setWizardMode(CNetworkSetup::N_SETUP_MODE_WIZARD); res = CNetworkSetup::getInstance()->exec(NULL, ""); @@ -113,19 +134,34 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) CZapit::getInstance()->PrepareChannels(); } } - if(res != menu_return::RETURN_EXIT_ALL) + if(res != menu_return::RETURN_EXIT_ALL) { CScanSetup::getInstance()->setWizardMode(CScanSetup::SCAN_SETUP_MODE_WIZARD); - res = CScanSetup::getInstance()->exec(NULL, ""); + if (advanced) { + res = CScanSetup::getInstance()->exec(NULL, ""); + } else { + CZapit::getInstance()->GetConfig(zapitCfg); + if (CFEManager::getInstance()->haveSat()) { + CMenuWidget fastScanMenu(LOCALE_SATSETUP_FASTSCAN_HEAD, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_FAST_SCAN); + fastScanMenu.setWizardMode(true); + CScanSetup::getInstance()->addScanMenuFastScan(&fastScanMenu); + res = fastScanMenu.exec(NULL, ""); + } + if (CFEManager::getInstance()->haveCable()) { + CMenuWidget cableScan(LOCALE_SATSETUP_CABLE, NEUTRINO_ICON_SETTINGS, 45, MN_WIDGET_ID_SCAN_CABLE_SCAN); + cableScan.setWizardMode(true); + CScanSetup::getInstance()->addScanMenuCable(&cableScan); + res = cableScan.exec(NULL, ""); + } + } CScanSetup::getInstance()->setWizardMode(CScanSetup::SCAN_SETUP_MODE_WIZARD_NO); } } - + killBackgroundLogo(); return res; } - inline void CStartUpWizard::showBackgroundLogo() { videoDecoder->ShowPicture(DATADIR "/neutrino/icons/start.jpg"); diff --git a/src/system/locals.h b/src/system/locals.h index 82a303ff3..e2c795a09 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1962,6 +1962,11 @@ typedef enum LOCALE_VIDEOMENU_VIDEOMODE, LOCALE_WIZARD_INITIAL_SETTINGS, LOCALE_WIZARD_INSTALL_SETTINGS, + LOCALE_WIZARD_SETUP, + LOCALE_WIZARD_SETUP_ADVANCED, + LOCALE_WIZARD_SETUP_EASY, + LOCALE_WIZARD_SETUP_TYPE, + LOCALE_WIZARD_SETUP_TYPE_HINT, LOCALE_WIZARD_WELCOME_HEAD, LOCALE_WIZARD_WELCOME_TEXT, LOCALE_WORD_FROM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 66616dfe8..4fbfb8e5a 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1962,6 +1962,11 @@ const char * locale_real_names[] = "videomenu.videomode", "wizard.initial_settings", "wizard.install_settings", + "wizard.setup", + "wizard.setup_advanced", + "wizard.setup_easy", + "wizard.setup_type", + "wizard.setup_type_hint", "wizard.welcome_head", "wizard.welcome_text", "word.from",