gui/scan_setup.cpp: update NID menu item, if NID found for cable provider;

add simplified cable scan menu - not tested yet
This commit is contained in:
[CST] Focus
2012-07-31 18:28:44 +04:00
parent a009146954
commit 3fd7a24c89
2 changed files with 128 additions and 29 deletions

View File

@@ -45,7 +45,6 @@
#include "gui/widget/hintbox.h" #include "gui/widget/hintbox.h"
#include "gui/widget/stringinput.h" #include "gui/widget/stringinput.h"
#include "gui/widget/stringinput_ext.h"
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
@@ -221,6 +220,7 @@ CScanSetup::CScanSetup(bool wizard_mode)
satSelect = NULL; satSelect = NULL;
frontendSetup = NULL; frontendSetup = NULL;
nid = NULL;
} }
CScanSetup* CScanSetup::getInstance() CScanSetup* CScanSetup::getInstance()
@@ -281,6 +281,21 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey)
} }
//starting scan //starting scan
if(actionKey=="cable") {
printf("[neutrino] CScanSetup::%s: simple cable scan\n", __FUNCTION__);
saveScanSetup();
/* for simple cable scan, force some options */
scansettings.scan_reset_numbers = 0;
scansettings.scan_nit_manual = 1;
scansettings.scan_fta_flag = 0;
if (scansettings.scan_logical_numbers) {
g_settings.keep_channel_numbers = 1;
CServiceManager::getInstance()->KeepNumbers(g_settings.keep_channel_numbers);
}
CScanTs scanTs;
scanTs.exec(NULL, "manual");
return res;
}
std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/};
for (uint i=0; i< (sizeof(scants_key)/sizeof(scants_key[0])); i++) for (uint i=0; i< (sizeof(scants_key)/sizeof(scants_key[0])); i++)
@@ -363,7 +378,7 @@ int CScanSetup::showScanMenu()
settings->addItem(mc); settings->addItem(mc);
//sat/provider selector //sat/provider selector
satSelect = new CMenuOptionStringChooser(satprov_locale, scansettings.satNameNoDiseqc, true, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); satSelect = new CMenuOptionStringChooser(satprov_locale, scansettings.satNameNoDiseqc, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
satOnOff = new CMenuWidget(satprov_locale, NEUTRINO_ICON_SETTINGS, width); satOnOff = new CMenuWidget(satprov_locale, NEUTRINO_ICON_SETTINGS, width);
if (r_system == DVB_S) //sat if (r_system == DVB_S) //sat
@@ -376,7 +391,7 @@ int CScanSetup::showScanMenu()
mf->setHint("", LOCALE_MENU_HINT_SCAN_FESETUP); mf->setHint("", LOCALE_MENU_HINT_SCAN_FESETUP);
settings->addItem(mf); settings->addItem(mf);
/* add configured satellites to satSelect */ /* add configured satellites to satSelect */
fillSatSelect(); fillSatSelect(satSelect);
} }
else if (r_system == DVB_C) //cable else if (r_system == DVB_C) //cable
{ {
@@ -384,7 +399,7 @@ int CScanSetup::showScanMenu()
//-------------------------------------------------------------- //--------------------------------------------------------------
settings->addItem(GenericMenuSeparatorLine); settings->addItem(GenericMenuSeparatorLine);
//-------------------------------------------------------------- //--------------------------------------------------------------
fillCableSelect(); fillCableSelect(satSelect);
//tune timeout //tune timeout
CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100);
nc->setHint("", LOCALE_MENU_HINT_SCAN_FETIMEOUT); nc->setHint("", LOCALE_MENU_HINT_SCAN_FETIMEOUT);
@@ -395,6 +410,7 @@ int CScanSetup::showScanMenu()
mc->setHint("", LOCALE_MENU_HINT_SCAN_FEMODE); mc->setHint("", LOCALE_MENU_HINT_SCAN_FEMODE);
settings->addItem(mc); settings->addItem(mc);
} }
nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE);
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_SCAN)); settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_SCAN));
@@ -438,12 +454,21 @@ int CScanSetup::showScanMenu()
settings->addItem(mf); settings->addItem(mf);
#endif /*ENABLE_FASTSCAN*/ #endif /*ENABLE_FASTSCAN*/
} }
else if (r_system == DVB_C) //cable
{
CMenuWidget * cableScan = new CMenuWidget(LOCALE_SATSETUP_CABLE, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_CABLE_SCAN);
addScanMenuCable(cableScan);
CMenuForwarder * fcableScan = new CMenuDForwarder(LOCALE_SATSETUP_CABLE, true, NULL, cableScan, "", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE);
fcableScan->setHint("", LOCALE_MENU_HINT_SCAN_CABLE_SIMPLE);
settings->addItem(fcableScan);
}
int res = settings->exec(NULL, ""); int res = settings->exec(NULL, "");
//delete satSelect; //delete satSelect;
delete satOnOff; delete satOnOff;
delete settings; delete settings;
delete nid;
return res; return res;
} }
@@ -577,7 +602,7 @@ int CScanSetup::showFrontendSetup(int number)
feselected = setupMenu->getSelected(); feselected = setupMenu->getSelected();
/* add configured satellites to satSelect in case they changed */ /* add configured satellites to satSelect in case they changed */
fillSatSelect(); fillSatSelect(satSelect);
delete setupMenu; delete setupMenu;
return res; return res;
@@ -635,12 +660,12 @@ int CScanSetup::showScanMenuLnbSetup()
return res; return res;
} }
void CScanSetup::fillSatSelect() void CScanSetup::fillSatSelect(CMenuOptionStringChooser * select)
{ {
std::set<int> satpos; std::set<int> satpos;
std::set<int>::iterator tmpit; std::set<int>::iterator tmpit;
satSelect->removeOptions(); select->removeOptions();
satOnOff->resetWidget(true); satOnOff->resetWidget(true);
satOnOff->addIntroItems(); satOnOff->addIntroItems();
@@ -654,7 +679,7 @@ void CScanSetup::fillSatSelect()
tmpit = satpos.find(sit->first); tmpit = satpos.find(sit->first);
if(sit->second.configured && tmpit == satpos.end()) { if(sit->second.configured && tmpit == satpos.end()) {
std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first); std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first);
satSelect->addOption(satname.c_str()); select->addOption(satname.c_str());
satpos.insert(sit->first); satpos.insert(sit->first);
if (!sfound && strcmp(scansettings.satNameNoDiseqc, satname.c_str()) == 0) if (!sfound && strcmp(scansettings.satNameNoDiseqc, satname.c_str()) == 0)
@@ -681,7 +706,7 @@ void CScanSetup::fillSatSelect()
} }
//init cable provider menu //init cable provider menu
void CScanSetup::fillCableSelect() void CScanSetup::fillCableSelect(CMenuOptionStringChooser * select)
{ {
printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__);
//don't misunderstand the name "satSelect", in this context it's actually for cable providers //don't misunderstand the name "satSelect", in this context it's actually for cable providers
@@ -690,7 +715,7 @@ void CScanSetup::fillCableSelect()
for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++) for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++)
{ {
printf("Adding cable menu for %s position %d\n", sit->second.name.c_str(), sit->first); printf("Adding cable menu for %s position %d\n", sit->second.name.c_str(), sit->first);
satSelect->addOption(sit->second.name.c_str()); select->addOption(sit->second.name.c_str());
if (!sfound && strcmp(scansettings.satNameNoDiseqc, sit->second.name.c_str()) == 0) if (!sfound && strcmp(scansettings.satNameNoDiseqc, sit->second.name.c_str()) == 0)
sfound = true; sfound = true;
@@ -808,8 +833,11 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
manual_Scan->addItem(satSelect); manual_Scan->addItem(satSelect);
if (r_system == DVB_C) { //cable if (r_system == DVB_C) { //cable
#if 0
CIntInput* nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput* nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE);
mf = new CMenuDForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf = new CMenuDForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
#endif
mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID);
manual_Scan->addItem(mf); manual_Scan->addItem(mf);
} }
@@ -901,8 +929,11 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan)
auto_Scan->addItem(satSelect); auto_Scan->addItem(satSelect);
if (r_system == DVB_C) { //cable if (r_system == DVB_C) { //cable
#if 0
CIntInput* nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); CIntInput* nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE);
mf = new CMenuDForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf = new CMenuDForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
#endif
mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID);
auto_Scan->addItem(mf); auto_Scan->addItem(mf);
} }
@@ -916,6 +947,63 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan)
auto_Scan->addItem(mf); auto_Scan->addItem(mf);
} }
//init simple cable scan menu
void CScanSetup::addScanMenuCable(CMenuWidget *menu)
{
printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__);
int shortCut = 1;
CMenuForwarder * mf;
menu->addIntroItems();
//----------------------------------------------------------------------
CMenuOptionStringChooser * select = new CMenuOptionStringChooser(satprov_locale, scansettings.satNameNoDiseqc, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
fillCableSelect(select);
menu->addItem(select);
mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
mf->setHint("", LOCALE_MENU_HINT_SCAN_NID);
menu->addItem(mf);
mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "test", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_SCAN_TPSELECT);
menu->addItem(mf);
menu->addItem(GenericMenuSeparatorLine);
CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, (char *) scansettings.TP_freq, freq_length, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789");
CMenuForwarder *Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++));
Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ);
CStringInput *rate = new CStringInput(LOCALE_EXTRA_TP_RATE, (char *) scansettings.TP_rate, 8, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789");
CMenuForwarder *Rate = new CMenuDForwarder(LOCALE_EXTRA_TP_RATE, true, scansettings.TP_rate, rate, "", CRCInput::convertDigitToKey(shortCut++));
Rate->setHint("", LOCALE_MENU_HINT_SCAN_RATE);
CMenuOptionChooser * mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++));
mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD);
menu->addItem(Freq);
menu->addItem(Rate);
menu->addItem(mod_pol);
CMenuOptionChooser *lcn = new CMenuOptionChooser(LOCALE_SATSETUP_LOGICAL_NUMBERS, (int *)&scansettings.scan_logical_numbers, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortCut++));
lcn->setHint("", LOCALE_MENU_HINT_SCAN_LOGICAL);
menu->addItem(lcn);
lcnhd = new CMenuOptionChooser(LOCALE_SATSETUP_LOGICAL_HD, (int *)&scansettings.scan_logical_hd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, scansettings.scan_logical_numbers, NULL, CRCInput::convertDigitToKey(shortCut++));
lcnhd->setHint("", LOCALE_MENU_HINT_SCAN_LOGICAL_HD);
menu->addItem(lcnhd);
menu->addItem(GenericMenuSeparatorLine);
#if 0
mf = new CMenuForwarder(LOCALE_SCANTS_TEST, allow_start, NULL, this, "test", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW);
mf->setHint("", LOCALE_MENU_HINT_SCAN_TEST);
menu->addItem(mf);
#endif
mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "cable", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE);
mf->setHint("", LOCALE_MENU_HINT_SCAN_START);
menu->addItem(mf);
}
//create scan options items //create scan options items
int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut) int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut)
{ {
@@ -1012,6 +1100,8 @@ void CScanSetup::saveScanSetup()
bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/)
{ {
bool ret = false;
if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_USE_USALS)) { if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_USE_USALS)) {
CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); CFrontend * fe = CFEManager::getInstance()->getFE(fenumber);
printf("[neutrino] CScanSetup::%s: all usals %d \n", __FUNCTION__, all_usals); printf("[neutrino] CScanSetup::%s: all usals %d \n", __FUNCTION__, all_usals);
@@ -1026,27 +1116,12 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*
fautoScanAll->setActive(dmode != NO_DISEQC); fautoScanAll->setActive(dmode != NO_DISEQC);
if(dmode == NO_DISEQC) { if(dmode == NO_DISEQC) {
ojDiseqcRepeats->setActive(false); ojDiseqcRepeats->setActive(false);
#if 0
itemsForAnyDiseqc.Activate(false);
itemsForAdvancedDiseqc.Activate(false);
itemsForNonAdvancedDiseqc.Activate(false);
#endif
} }
else if(dmode < DISEQC_ADVANCED) { else if(dmode < DISEQC_ADVANCED) {
ojDiseqcRepeats->setActive(true); ojDiseqcRepeats->setActive(true);
#if 0
itemsForAnyDiseqc.Activate(true);
itemsForAdvancedDiseqc.Activate(false);
itemsForNonAdvancedDiseqc.Activate(true);
#endif
} }
else if(dmode == DISEQC_ADVANCED) { else if(dmode == DISEQC_ADVANCED) {
ojDiseqcRepeats->setActive(true); ojDiseqcRepeats->setActive(true);
#if 0
itemsForAnyDiseqc.Activate(true);
itemsForAdvancedDiseqc.Activate(true);
itemsForNonAdvancedDiseqc.Activate(false);
#endif
} }
CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); CFrontend * fe = CFEManager::getInstance()->getFE(fenumber);
fe->setDiseqcType((diseqc_t) dmode); fe->setDiseqcType((diseqc_t) dmode);
@@ -1061,9 +1136,29 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*
if(femode != CFEManager::FE_MODE_ALONE) if(femode != CFEManager::FE_MODE_ALONE)
CFEManager::getInstance()->saveSettings(true); CFEManager::getInstance()->saveSettings(true);
if (r_system == DVB_S) //sat if (r_system == DVB_S) //sat
fillSatSelect(); fillSatSelect(satSelect);
} }
return false; else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_CABLESETUP_PROVIDER)) {
printf("[neutrino] CScanSetup::%s: new provider: [%s]\n", __FUNCTION__, scansettings.satNameNoDiseqc);
satellite_map_t & satmap = CServiceManager::getInstance()->SatelliteList();
for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++)
{
if (strcmp(scansettings.satNameNoDiseqc, sit->second.name.c_str()) == 0) {
if(sit->second.cable_nid > 0) {
scansettings.cable_nid = sit->second.cable_nid;
nid->updateValue();
ret = true;
}
break;
}
}
}
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_LOGICAL_NUMBERS)) {
printf("[neutrino] CScanSetup::%s: logical numbers %d\n", __FUNCTION__, scansettings.scan_logical_numbers);
lcnhd->setActive(scansettings.scan_logical_numbers);
}
return ret;
} }
void CScanSetup::updateManualSettings() void CScanSetup::updateManualSettings()

View File

@@ -32,6 +32,7 @@
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/widget/stringinput_ext.h>
#include <system/setting_helpers.h> #include <system/setting_helpers.h>
#include <system/settings.h> #include <system/settings.h>
@@ -57,6 +58,8 @@ class CScanSetup : public CMenuTarget, public CChangeObserver
CMenuForwarder *frontendSetup; CMenuForwarder *frontendSetup;
CMenuForwarder *fsatSetup; CMenuForwarder *fsatSetup;
CMenuOptionNumberChooser * ojDiseqcRepeats; CMenuOptionNumberChooser * ojDiseqcRepeats;
CIntInput * nid;
CMenuOptionChooser * lcnhd;
/* variables for selected frontend */ /* variables for selected frontend */
/* diseqc mode */ /* diseqc mode */
@@ -82,8 +85,8 @@ class CScanSetup : public CMenuTarget, public CChangeObserver
int showFrontendSetup(int number); int showFrontendSetup(int number);
int showScanMenuLnbSetup(); int showScanMenuLnbSetup();
int showScanMenuSatFind(); int showScanMenuSatFind();
void fillSatSelect(); void fillSatSelect(CMenuOptionStringChooser *select);
void fillCableSelect(); void fillCableSelect(CMenuOptionStringChooser *select);
void addScanMenuFrontendSetup(CMenuWidget *settings); void addScanMenuFrontendSetup(CMenuWidget *settings);
void addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t &satconfig); void addScanMenuTempSat(CMenuWidget *temp_sat, sat_config_t &satconfig);
@@ -93,6 +96,7 @@ class CScanSetup : public CMenuTarget, public CChangeObserver
void addScanMenuFastScan(CMenuWidget *fast_ScanMenu); void addScanMenuFastScan(CMenuWidget *fast_ScanMenu);
#endif #endif
void addScanMenuAutoScan(CMenuWidget *auto_Scan); void addScanMenuAutoScan(CMenuWidget *auto_Scan);
void addScanMenuCable(CMenuWidget *menu);
int addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut = 1); int addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut = 1);
int addListFlagsItems(CMenuWidget *listflags_menu, const int &shortcut = 1, bool manual = false); int addListFlagsItems(CMenuWidget *listflags_menu, const int &shortcut = 1, bool manual = false);