gui/scan_setup.cpp: fix memleaks

Origin commit data
------------------
Commit: 4e48e81914
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-11-27 (Wed, 27 Nov 2013)
This commit is contained in:
[CST] Focus
2013-11-27 12:07:56 +04:00
parent a26e1c09e7
commit e25d3a5ae8
2 changed files with 21 additions and 22 deletions

View File

@@ -197,8 +197,6 @@ CScanSetup::CScanSetup(bool wizard_mode)
width = w_max (40, 10);
is_wizard = wizard_mode;
satSelect = NULL;
cableSelect = NULL;
satOnOff = NULL;
fautoScanAll = NULL;
frontendSetup = NULL;
@@ -214,8 +212,6 @@ CScanSetup::CScanSetup(bool wizard_mode)
allow_start = true;
if (CFEManager::getInstance()->haveCable())
nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE);
if (CFEManager::getInstance()->haveSat())
satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
}
CScanSetup* CScanSetup::getInstance()
@@ -232,7 +228,6 @@ CScanSetup* CScanSetup::getInstance()
CScanSetup::~CScanSetup()
{
delete satSelect;
delete nid;
}
@@ -402,14 +397,8 @@ int CScanSetup::showScanMenu()
//settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_RECEIVING_SYSTEM ));
//satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE);
satOnOff = new CMenuWidget(LOCALE_SATSETUP_SATELLITE, NEUTRINO_ICON_SETTINGS, width);
/* add configured satellites to satSelect */
fillSatSelect(satSelect);
//auto scan
char autoscan[64];
std::string s_capt_part = g_Locale->getText(LOCALE_SATSETUP_SATELLITE);
@@ -417,14 +406,14 @@ int CScanSetup::showScanMenu()
CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN);
addScanMenuAutoScan(autoScan);
mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO);
settings->addItem(mf);
//manual scan
CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN);
addScanMenuManualScan(manualScan);
mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL);
settings->addItem(mf);
//auto scan all
@@ -445,12 +434,9 @@ int CScanSetup::showScanMenu()
if (CFEManager::getInstance()->haveCable()) {
r_system = DVB_C;
cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE);
//--------------------------------------------------------------
settings->addItem(GenericMenuSeparatorLine);
//--------------------------------------------------------------
fillCableSelect(cableSelect);
//tune timeout
if(CFEManager::getInstance()->getFrontendCount() <= 1) {
CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100);
@@ -467,14 +453,14 @@ int CScanSetup::showScanMenu()
CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN);
addScanMenuAutoScan(autoScan);
mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED);
mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED);
mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO);
settings->addItem(mf);
//manual scan
CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN);
addScanMenuManualScan(manualScan);
mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN);
mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN);
mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL);
settings->addItem(mf);
//simple cable scan
@@ -736,7 +722,7 @@ int CScanSetup::showFrontendSetup(int number)
mc->setHint("", LOCALE_MENU_HINT_SCAN_SATENABLE);
satToSelect->addItem(mc);
}
fsatSelect = new CMenuForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++));
fsatSelect = new CMenuDForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++));
fsatSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATADD);
setupMenu->addItem(fsatSelect);
@@ -1067,12 +1053,19 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan)
manual_Scan->addIntroItems();
//----------------------------------------------------------------------
if (r_system == DVB_C) {
CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE);
fillCableSelect(cableSelect);
manual_Scan->addItem(cableSelect);
mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
mf->setHint("", LOCALE_MENU_HINT_SCAN_NID);
manual_Scan->addItem(mf);
mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "cable", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
} else {
CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE);
/* add configured satellites to satSelect */
fillSatSelect(satSelect);
manual_Scan->addItem(satSelect);
mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "sat", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN);
}
@@ -1163,12 +1156,20 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan)
auto_Scan->addIntroItems();
if (r_system == DVB_C) { //cable
CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE);
fillCableSelect(cableSelect);
auto_Scan->addItem(cableSelect);
mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid);
mf->setHint("", LOCALE_MENU_HINT_SCAN_NID);
auto_Scan->addItem(mf);
} else
} else {
CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true);
satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE);
/* add configured satellites to satSelect */
fillSatSelect(satSelect);
auto_Scan->addItem(satSelect);
}
auto_Scan->addItem(GenericMenuSeparatorLine);
//----------------------------------------------------------------------