setting_helpers: cleanup unused code

Origin commit data
------------------
Branch: ni/coolstream
Commit: 40ec967468
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-01-13 (Fri, 13 Jan 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-01-13 14:49:04 +04:00
parent 686299f159
commit 8f21970b46
2 changed files with 15 additions and 366 deletions

View File

@@ -90,160 +90,6 @@ extern cDemux *pcrDemux;
extern "C" int pinghost( const char *hostname );
CSatelliteSetupNotifier::CSatelliteSetupNotifier()
{
}
/* items1 enabled for advanced diseqc settings, items2 for diseqc != NO_DISEQC, items3 disabled for NO_DISEQC */
bool CSatelliteSetupNotifier::changeNotify(const neutrino_locale_t, void * Data)
{
std::vector<CMenuItem*>::iterator it;
int type = *((int*) Data);
if (type == NO_DISEQC) {
for(it = items1.begin(); it != items1.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(false);
}
for(it = items2.begin(); it != items2.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(false);
}
for(it = items3.begin(); it != items3.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(false);
}
}
else if(type < DISEQC_ADVANCED) {
for(it = items1.begin(); it != items1.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(false);
}
for(it = items2.begin(); it != items2.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(true);
}
for(it = items3.begin(); it != items3.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(true);
}
}
else if(type == DISEQC_ADVANCED) {
for(it = items1.begin(); it != items1.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(true);
}
for(it = items2.begin(); it != items2.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(false);
}
for(it = items3.begin(); it != items3.end(); it++) {
//(*it)->init(-1, 0, 0, 0);
(*it)->setActive(true);
}
}
g_Zapit->setDiseqcType((diseqc_t) type);
g_Zapit->setDiseqcRepeat( CNeutrinoApp::getInstance()->getScanSettings().diseqcRepeat);
return true;
}
void CSatelliteSetupNotifier::addItem(int list, CMenuItem* item)
{
switch(list) {
case 0:
items1.push_back(item);
break;
case 1:
items2.push_back(item);
break;
case 2:
items3.push_back(item);
break;
default:
break;
}
}
bool CSatDiseqcNotifier::changeNotify(const neutrino_locale_t, void * Data)
{
if (*((int*) Data) == NO_DISEQC)
{
satMenu->setActive(true);
extMenu->setActive(false);
extMotorMenu->setActive(false);
repeatMenu->init(-1, 0, 0, 0);
repeatMenu->setActive(false);
motorControl->setActive(false);
}
else
if (*((int*) Data) == DISEQC_1_2)
{
satMenu->setActive(true);
extMenu->setActive(true);
extMotorMenu->setActive(true);
repeatMenu->init(-1, 0, 0, 0);
repeatMenu->setActive(true);
motorControl->setActive(true);
}
else
{
satMenu->setActive(true);
extMenu->setActive(true);
extMotorMenu->setActive(false);
repeatMenu->init(-1, 0, 0, 0);
repeatMenu->setActive((*((int*) Data) != DISEQC_1_0));
motorControl->setActive(false);
}
g_Zapit->setDiseqcType( *((diseqc_t*) Data) );
g_Zapit->setDiseqcRepeat( CNeutrinoApp::getInstance()->getScanSettings().diseqcRepeat);
return true;
}
CTP_scanNotifier::CTP_scanNotifier(CMenuOptionChooser* i1, CMenuOptionChooser* i2, CMenuForwarder* i3, CMenuForwarder* i4)
{
toDisable1[0]=i1;
toDisable1[1]=i2;
toDisable2[0]=i3;
toDisable2[1]=i4;
}
bool CTP_scanNotifier::changeNotify(const neutrino_locale_t, void * Data)
{
int val = *((int*) Data);
//printf("CTP_scanNotifier::changeNotify: data %d\n", val);
//FIXME: test
//bool set_true_false=CNeutrinoApp::getInstance()->getScanSettings().TP_scan;
bool set_true_false = (val == 2);
for (int i=0; i<2; i++)
{
toDisable1[i]->setActive(set_true_false);
toDisable2[i]->setActive(set_true_false);
}
return true;
}
#if 0 // not used
CDHCPNotifier::CDHCPNotifier( CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwarder* a3, CMenuForwarder* a4, CMenuForwarder* a5, CMenuForwarder* a6)
{
toDisable[0] = a1;
toDisable[1] = a2;
toDisable[2] = a3;
toDisable[3] = a4;
toDisable[4] = a5;
toEnable[0] = a6;
}
bool CDHCPNotifier::changeNotify(const neutrino_locale_t, void * data)
{
CNetworkConfig::getInstance()->inet_static = ((*(int*)(data)) == 0);
for(int x=0;x<5;x++)
toDisable[x]->setActive(CNetworkConfig::getInstance()->inet_static);
toEnable[0]->setActive(!CNetworkConfig::getInstance()->inet_static);
return true;
}
#endif
COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5)
{
number = 0;
@@ -275,6 +121,7 @@ bool CRecordingSafetyNotifier::changeNotify(const neutrino_locale_t, void *)
return true;
}
//used in gui/miscsettings_menu.cpp
CMiscNotifier::CMiscNotifier( CMenuItem* i1, CMenuItem* i2)
{
toDisable[0]=i1;
@@ -440,7 +287,7 @@ bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void
//FIXME
#define IOC_IR_SET_F_DELAY _IOW(0xDD, 5, unsigned int) /* set the delay time before the first repetition */
#define IOC_IR_SET_X_DELAY _IOW(0xDD, 6, unsigned int) /* set the delay time between all other repetitions */
//used ./gui/keybind_setup.cpp
bool CKeySetupNotifier::changeNotify(const neutrino_locale_t, void *)
{
unsigned int fdelay = atoi(g_settings.repeat_blocker);
@@ -455,26 +302,7 @@ bool CKeySetupNotifier::changeNotify(const neutrino_locale_t, void *)
return false;
}
#if 0 // not used
bool CIPChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
{
char ip[16];
unsigned char _ip[4];
sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]);
sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]);
CNetworkConfig::getInstance()->broadcast = ip;
CNetworkConfig::getInstance()->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0";
sprintf(ip, "%hhu.%hhu.%hhu.1", _ip[0], _ip[1], _ip[2]);
CNetworkConfig::getInstance()->nameserver = ip;
CNetworkConfig::getInstance()->gateway = ip;
return true;
}
#endif
// used in ./gui/osd_setup.cpp:
bool CTimingSettingsNotifier::changeNotify(const neutrino_locale_t OptionName, void *)
{
for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++)
@@ -488,6 +316,7 @@ bool CTimingSettingsNotifier::changeNotify(const neutrino_locale_t OptionName, v
return false;
}
// used in ./gui/osd_setup.cpp:
bool CFontSizeNotifier::changeNotify(const neutrino_locale_t, void *)
{
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FONTSIZE_HINT)); // UTF-8
@@ -703,130 +532,6 @@ std::string CNetAdapter::getMacAddr(void)
}
}
#if 0 // not used, moved to gui/network_setup.cpp
const char * mypinghost(const char * const host)
{
int retvalue = pinghost(host);
switch (retvalue)
{
case 1: return (g_Locale->getText(LOCALE_PING_OK));
case 0: return (g_Locale->getText(LOCALE_PING_UNREACHABLE));
case -1: return (g_Locale->getText(LOCALE_PING_PROTOCOL));
case -2: return (g_Locale->getText(LOCALE_PING_SOCKET));
}
return "";
}
void testNetworkSettings(const char* ip, const char* netmask, const char* broadcast, const char* gateway, const char* nameserver, bool ip_static)
{
char our_ip[16];
char our_mask[16];
char our_broadcast[16];
char our_gateway[16];
char our_nameserver[16];
std::string text, ethID, testsite;
//set default testdomain and wiki-IP
std::string defaultsite = "www.google.de", wiki_IP = "89.31.143.1";
//set physical adress
static CNetAdapter netadapter; ethID=netadapter.getMacAddr();
//get www-domain testsite from /.version
CConfigFile config('\t');
config.loadConfig("/.version");
testsite = config.getString("homepage",defaultsite);
testsite.replace( 0, testsite.find("www",0), "" );
//use default testdomain if testsite missing
if (testsite.length()==0) testsite = defaultsite;
if (ip_static)
{
strcpy(our_ip, ip);
strcpy(our_mask, netmask);
strcpy(our_broadcast, broadcast);
strcpy(our_gateway, gateway);
strcpy(our_nameserver, nameserver);
}
else
{
char eth[] = "eth0";
netGetIP(eth, our_ip, our_mask, our_broadcast);
netGetDefaultRoute(our_gateway);
netGetNameserver(our_nameserver);
}
printf("testNw IP: %s\n", our_ip);
printf("testNw MAC-address: %s\n", ethID.c_str());
printf("testNw Netmask: %s\n", our_mask);
printf("testNw Broadcast: %s\n", our_broadcast);
printf("testNw Gateway: %s\n", our_gateway);
printf("testNw Nameserver: %s\n", our_nameserver);
printf("testNw Testsite %s\n", testsite.c_str());
if (our_ip[0] == 0)
{
text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE_NETWORK);
}
else
{
text = "Box: " + ethID + "\n ";
text += (std::string)our_ip + " " + (std::string)mypinghost(our_ip);
text += "\n";
text += g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY);
text += " (Router)\n ";
text += (std::string)our_gateway + " " +(std::string)mypinghost(our_gateway);
text += "\n";
text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER);
text += "\n ";
text += (std::string)our_nameserver + " " + (std::string)mypinghost(our_nameserver);
text += "\n";
text += "wiki.neutrino-hd.de:\n ";
text += "via IP (" + wiki_IP + "): " + (std::string)mypinghost(wiki_IP.c_str());
text += ":\n ";
if (1 == pinghost(our_nameserver))
{
text += "via DNS: " + (std::string)mypinghost("wiki.neutrino-hd.de");
text += "\n";
text += testsite + ":\n ";
text += "via DNS: " + (std::string)mypinghost(testsite.c_str()) + ":\n";
}
}
ShowMsgUTF(LOCALE_NETWORKMENU_TEST, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
}
void showCurrentNetworkSettings()
{
char ip[16];
char mask[16];
char broadcast[16];
char router[16];
char nameserver[16];
std::string text;
char eth[] = "eth0";
netGetIP(eth, ip, mask, broadcast);
if (ip[0] == 0) {
text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE_NETWORK);
}
else {
netGetNameserver(nameserver);
netGetDefaultRoute(router);
CNetworkConfig networkConfig;
std::string dhcp = networkConfig.inet_static ? g_Locale->getText(LOCALE_OPTIONS_OFF) : g_Locale->getText(LOCALE_OPTIONS_ON);
text = (std::string)g_Locale->getText(LOCALE_NETWORKMENU_DHCP) + ": " + dhcp + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_IPADDRESS ) + ": " + ip + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_NETMASK ) + ": " + mask + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_BROADCAST ) + ": " + broadcast + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ": " + nameserver + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY ) + ": " + router;
}
ShowMsgUTF(LOCALE_NETWORKMENU_SHOW, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
}
#endif
uint64_t getcurrenttime()
{
struct timeval tv;
@@ -963,18 +668,6 @@ printf("CScreenPresetNotifier::changeNotify preset %d (setting %d)\n", preset, g
return true;
}
#endif
bool CAllUsalsNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, void * data)
{
int onoff = * (int *) data;
printf("CAllUsalsNotifier::changeNotify: %s\n", onoff ? "ON" : "OFF");
sat_iterator_t sit;
for (sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) {
sit->second.use_usals = onoff;
}
return true;
}
extern CMenuOptionChooser::keyval_ext VIDEOMENU_VIDEOMODE_OPTIONS[];
bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, void * /* data */)
@@ -1031,5 +724,3 @@ int check_dir(const char * newdir)
}
return 1; // error
}

View File

@@ -39,53 +39,21 @@
uint64_t getcurrenttime();
class CSatelliteSetupNotifier : public CChangeObserver
class CGenericMenuActivate
{
private:
std::vector<CMenuItem*> items1;
std::vector<CMenuItem*> items2;
std::vector<CMenuItem*> items3;
std::vector<CMenuItem*> items;
public:
CSatelliteSetupNotifier();
void addItem(int list, CMenuItem* item);
bool changeNotify(const neutrino_locale_t, void * Data);
};
CGenericMenuActivate() {};
~CGenericMenuActivate() { items.clear(); };
class CSatDiseqcNotifier : public CChangeObserver
void Add(CMenuItem* item) { items.push_back(item); }
void Clear() { items.clear(); }
void Activate(bool enable)
{
private:
CMenuItem* satMenu;
CMenuItem* extMenu;
CMenuItem* extMotorMenu;
CMenuItem* repeatMenu;
CMenuItem* motorControl;
protected:
CSatDiseqcNotifier( ) : CChangeObserver(){}; // prevent calling constructor without data we need
public:
CSatDiseqcNotifier( CMenuItem* SatMenu, CMenuItem* ExtMenu, CMenuItem* ExtMotorMenu, CMenuItem* RepeatMenu, CMenuItem* MotorControl) : CChangeObserver()
{ satMenu = SatMenu; extMenu = ExtMenu; extMotorMenu = ExtMotorMenu; repeatMenu = RepeatMenu; motorControl = MotorControl;};
bool changeNotify(const neutrino_locale_t, void * Data);
};
class CTP_scanNotifier : public CChangeObserver
{
private:
CMenuOptionChooser* toDisable1[2];
CMenuForwarder* toDisable2[2];
public:
CTP_scanNotifier(CMenuOptionChooser*, CMenuOptionChooser*, CMenuForwarder*, CMenuForwarder*);
bool changeNotify(const neutrino_locale_t, void * Data);
};
class CDHCPNotifier : public CChangeObserver
{
private:
CMenuForwarder* toDisable[5];
CMenuForwarder* toEnable[1];
public:
CDHCPNotifier( CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*);
bool changeNotify(const neutrino_locale_t, void * data);
for(std::vector<CMenuItem*>::iterator it = items.begin(); it != items.end(); it++)
(*it)->setActive(enable);
}
};
class COnOffNotifier : public CChangeObserver
@@ -220,12 +188,9 @@ class CUCodeCheckExec : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey);
};
void testNetworkSettings(const char* ip, const char* netmask, const char* broadcast, const char* gateway, const char* nameserver, bool dhcp);
void showCurrentNetworkSettings();
int safe_mkdir(char * path);
int check_dir(const char * newdir);
class CTZChangeNotifier : public CChangeObserver
{
public:
@@ -255,7 +220,6 @@ class CCpuFreqNotifier : public CChangeObserver
public:
bool changeNotify(const neutrino_locale_t, void * data);
};
#if 0
class CScreenPresetNotifier : public CChangeObserver
{
@@ -263,12 +227,6 @@ public:
bool changeNotify(const neutrino_locale_t, void * data);
};
#endif
class CAllUsalsNotifier : public CChangeObserver
{
public:
bool changeNotify(const neutrino_locale_t, void * data);
};
class CAutoModeNotifier : public CChangeObserver
{
public: