diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 0abc7b438..7c816a9ec 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -244,13 +244,13 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) parent->hide(); printf("[neutrino] CScanSetup::%s: %s \n", __FUNCTION__, actionKey.c_str()); - if(actionKey=="save_scansettings") + if(actionKey == "save_scansettings") { printf("[neutrino] CScanSetup::%s save_scansettings...\n", __FUNCTION__); saveScanSetup(); return res; } - else if(actionKey=="reloadchannels") + else if(actionKey == "reloadchannels") { printf("[neutrino] CScanSetup::%s reloadchannels...\n", __FUNCTION__); if (reloadhintBox) @@ -261,18 +261,22 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) CNeutrinoApp::getInstance ()->SDTreloadChannels = false; return res; } - else if(actionKey=="satsetup") + else if(actionKey == "satsetup") { return showScanMenuLnbSetup(); } - else if(actionKey=="unisetup") + else if(actionKey == "unisetup") { return showUnicableSetup(); } - else if(actionKey=="satfind") + else if(actionKey == "satfind") { return showScanMenuSatFind(); } + else if(actionKey == "setup_frontend") + { + return showScanMenuFrontendSetup(); + } else if((loc = actionKey.find("config_frontend", 0)) != std::string::npos) { int number = actionKey.at(15) - '0'; @@ -281,7 +285,7 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) } //starting scan - if(actionKey=="cable") { + if(actionKey == "cable") { printf("[neutrino] CScanSetup::%s: simple cable scan\n", __FUNCTION__); saveScanSetup(); /* for simple cable scan, force some options */ @@ -386,9 +390,12 @@ int CScanSetup::showScanMenu() //sat/provider selector if(CFEManager::getInstance()->haveSat() || CFEManager::getInstance()->getFrontendCount() > 1) { +#if 0 CMenuWidget * setupMenu = new CMenuWidget(LOCALE_SATSETUP_FE_SETUP, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_SCAN_FE_SETUP); addScanMenuFrontendSetup(setupMenu); mf = new CMenuDForwarder(LOCALE_SATSETUP_FE_SETUP, allow_start, NULL, setupMenu, "", CRCInput::convertDigitToKey(shortcut++)); +#endif + mf = new CMenuForwarder(LOCALE_SATSETUP_FE_SETUP, allow_start, NULL, this, "setup_frontend", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_FESETUP); settings->addItem(mf); } @@ -550,11 +557,14 @@ int CScanSetup::showScanMenu() return res; } -void CScanSetup::addScanMenuFrontendSetup(CMenuWidget * setupMenu) +int CScanSetup::showScanMenuFrontendSetup() { CMenuForwarder * mf; int shortcut = 1; + fe_restart = false; + + CMenuWidget * setupMenu = new CMenuWidget(LOCALE_SATSETUP_FE_SETUP, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_SCAN_FE_SETUP); setupMenu->addIntroItems(); int count = CFEManager::getInstance()->getFrontendCount(); @@ -618,6 +628,17 @@ void CScanSetup::addScanMenuFrontendSetup(CMenuWidget * setupMenu) nc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_USALS_REPEAT, (int *)&zapitCfg.repeatUsals, true, 0, 10, NULL, 0, 0, LOCALE_OPTIONS_OFF); nc->setHint("", LOCALE_MENU_HINT_SCAN_USALS_REPEAT); setupMenu->addItem(nc); + + int res = setupMenu->exec(NULL, ""); + delete setupMenu; + if (fe_restart) { + fe_restart = false; + CFEManager::getInstance()->linkFrontends(true); + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + if (live_channel_id) + CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(live_channel_id, true); + } + return res; } int CScanSetup::showFrontendSetup(int number) @@ -1351,7 +1372,12 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_DISEQC)) { printf("[neutrino] CScanSetup::%s: diseqc %d fenumber %d\n", __FUNCTION__, dmode, fenumber); CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); + if (fe->getDiseqcType() == (diseqc_t)dmode) + return ret; + + fe_restart = true; fe->setDiseqcType((diseqc_t) dmode); + fe->setTsidOnid(0); #if 0 if(femode != CFEManager::FE_MODE_ALONE) @@ -1408,6 +1434,10 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* fillSatSelect(satSelect); #endif CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); + if (fe->getMode() == femode) + return ret; + + fe_restart = true; fe->setMode(femode); if (fe && fe->getType() == FE_QPSK) { if (linkfe) diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index 7ef59fe33..0db76cc42 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -80,6 +80,8 @@ class CScanSetup : public CMenuTarget, public CChangeObserver /* flag to allow any operations which can damage recordings */ bool allow_start; + /* flag to re-init frontends */ + bool fe_restart; bool is_wizard; @@ -101,7 +103,7 @@ class CScanSetup : public CMenuTarget, public CChangeObserver void fillSatSelect(CMenuOptionStringChooser *select); void fillCableSelect(CMenuOptionStringChooser *select); - void addScanMenuFrontendSetup(CMenuWidget *settings); + int showScanMenuFrontendSetup(); void addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t &satconfig); void addScanMenuManualScan(CMenuWidget *manual_Scan); void addScanMenuAutoScanAll(CMenuWidget *auto_ScanAll);