mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
Neutrino: rework COnOffNotifier and use it if possible, ported from tuxbox cvs
Origin commit data
------------------
Branch: ni/coolstream
Commit: 7b06b3fd38
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-10-11 (Thu, 11 Oct 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -281,8 +281,10 @@ void CMiscMenue::showMiscSettingsMenuEnergy(CMenuWidget *ms_energy)
|
||||
CStringInput * miscSettings_shutdown_count = new CStringInput(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, g_settings.shutdown_count, 3, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT2, "0123456789 ");
|
||||
CMenuForwarder *m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, !g_settings.shutdown_real, g_settings.shutdown_count, miscSettings_shutdown_count);
|
||||
m2->setHint("", LOCALE_MENU_HINT_SHUTDOWN_COUNT);
|
||||
|
||||
miscNotifier = new CMiscNotifier( m1, m2 );
|
||||
|
||||
miscNotifier = new COnOffNotifier(1);
|
||||
miscNotifier->addItem(m1);
|
||||
miscNotifier->addItem(m2);
|
||||
|
||||
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_SHUTDOWN_REAL, &g_settings.shutdown_real, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, miscNotifier);
|
||||
mc->setHint("", LOCALE_MENU_HINT_SHUTDOWN_REAL);
|
||||
|
@@ -40,7 +40,7 @@ class CMiscMenue : public CMenuTarget
|
||||
private:
|
||||
CFanControlNotifier *fanNotifier;
|
||||
CSectionsdConfigNotifier* sectionsdConfigNotifier;
|
||||
CMiscNotifier* miscNotifier;
|
||||
COnOffNotifier* miscNotifier;
|
||||
|
||||
int width;
|
||||
|
||||
|
@@ -2977,7 +2977,8 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/)
|
||||
{
|
||||
dirInput[i] = new CFileChooser(&m_settings.storageDir[i]);
|
||||
forwarder[i] = new CMenuForwarder(LOCALE_MOVIEBROWSER_DIR, m_settings.storageDirUsed[i], m_settings.storageDir[i], dirInput[i]);
|
||||
notifier[i] = new COnOffNotifier(forwarder[i]);
|
||||
notifier[i] = new COnOffNotifier();
|
||||
notifier[i]->addItem(forwarder[i]);
|
||||
chooser[i] = new CMenuOptionChooser(LOCALE_MOVIEBROWSER_USE_DIR , &m_settings.storageDirUsed[i] , MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true,notifier[i]);
|
||||
optionsMenuDir.addItem(chooser[i] );
|
||||
optionsMenuDir.addItem(forwarder[i] );
|
||||
|
@@ -51,37 +51,9 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/mount.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <neutrino.h>
|
||||
#include <zapit/client/zapittools.h>
|
||||
|
||||
class CNFSMountGuiNotifier : public CChangeObserver
|
||||
{
|
||||
private:
|
||||
CMenuForwarder *m_opt1,*m_opt2, *m_user, *m_pass;
|
||||
int *m_type;
|
||||
public:
|
||||
CNFSMountGuiNotifier( CMenuForwarder* a3, CMenuForwarder* a4 , int* type)
|
||||
{
|
||||
m_user = a3;
|
||||
m_pass = a4;
|
||||
m_type = type;
|
||||
}
|
||||
bool changeNotify(const neutrino_locale_t /*OptionName*/, void *)
|
||||
{
|
||||
if(*m_type == (int)CFSMounter::NFS)
|
||||
{
|
||||
m_user->setActive (false);
|
||||
m_pass->setActive (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_user->setActive (true);
|
||||
m_pass->setActive (true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
CNFSMountGui::CNFSMountGui()
|
||||
{
|
||||
// FIXME #warning move probing from exec() to fsmounter
|
||||
@@ -266,7 +238,9 @@ int CNFSMountGui::menuEntry(int nr)
|
||||
CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
|
||||
CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, true, NULL, this, cmd);
|
||||
mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
|
||||
CNFSMountGuiNotifier notifier(username_fwd, password_fwd, type);
|
||||
COnOffNotifier notifier(CFSMounter::NFS);
|
||||
notifier.addItem(username_fwd);
|
||||
notifier.addItem(password_fwd);
|
||||
|
||||
mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier));
|
||||
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
|
||||
|
@@ -90,15 +90,4 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
||||
int showContextChanlistMenu();
|
||||
};
|
||||
|
||||
|
||||
class COsdSetupChannelLogoNotifier : public CChangeObserver
|
||||
{
|
||||
private:
|
||||
CMenuForwarder* toDisable1;
|
||||
CMenuOptionChooser* toDisable2;
|
||||
public:
|
||||
COsdSetupChannelLogoNotifier( CMenuForwarder*, CMenuOptionChooser* );
|
||||
bool changeNotify(const neutrino_locale_t, void * Data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -88,43 +88,24 @@ extern cDemux *pcrDemux;
|
||||
|
||||
extern "C" int pinghost( const char *hostname );
|
||||
|
||||
// gui/moviebrowser.cpp
|
||||
COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5)
|
||||
COnOffNotifier::COnOffNotifier(int OffValue)
|
||||
{
|
||||
number = 0;
|
||||
if(a1 != NULL){ toDisable[0] =a1;number++;};
|
||||
if(a2 != NULL){ toDisable[1] =a2;number++;};
|
||||
if(a3 != NULL){ toDisable[2] =a3;number++;};
|
||||
if(a4 != NULL){ toDisable[3] =a4;number++;};
|
||||
if(a5 != NULL){ toDisable[4] =a5;number++;};
|
||||
offValue = OffValue;
|
||||
}
|
||||
|
||||
bool COnOffNotifier::changeNotify(const neutrino_locale_t, void *Data)
|
||||
{
|
||||
if(*(int*)(Data) == 0)
|
||||
{
|
||||
for (int i=0; i<number ; i++)
|
||||
toDisable[i]->setActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; i<number ; i++)
|
||||
toDisable[i]->setActive(true);
|
||||
}
|
||||
return false;
|
||||
bool active = (*(int*)(Data) != offValue);
|
||||
|
||||
for (std::vector<CMenuItem*>::iterator it = toDisable.begin(); it != toDisable.end(); it++)
|
||||
(*it)->setActive(active);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//used in gui/miscsettings_menu.cpp
|
||||
CMiscNotifier::CMiscNotifier( CMenuItem* i1, CMenuItem* i2)
|
||||
void COnOffNotifier::addItem(CMenuItem* menuItem)
|
||||
{
|
||||
toDisable[0]=i1;
|
||||
toDisable[1]=i2;
|
||||
}
|
||||
bool CMiscNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
{
|
||||
toDisable[0]->setActive(!g_settings.shutdown_real);
|
||||
toDisable[1]->setActive(!g_settings.shutdown_real);
|
||||
return false;
|
||||
toDisable.push_back(menuItem);
|
||||
}
|
||||
|
||||
bool CSectionsdConfigNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
|
@@ -55,22 +55,16 @@ class CGenericMenuActivate
|
||||
};
|
||||
|
||||
class COnOffNotifier : public CChangeObserver
|
||||
{
|
||||
private:
|
||||
int number;
|
||||
CMenuItem* toDisable[5];
|
||||
public:
|
||||
COnOffNotifier (CMenuItem* a1,CMenuItem* a2 = NULL,CMenuItem* a3 = NULL,CMenuItem* a4 = NULL,CMenuItem* a5 = NULL);
|
||||
bool changeNotify(const neutrino_locale_t, void *Data);
|
||||
};
|
||||
|
||||
class CMiscNotifier : public CChangeObserver
|
||||
{
|
||||
private:
|
||||
CMenuItem* toDisable[2];
|
||||
int offValue;
|
||||
std::vector<CMenuItem*> toDisable;
|
||||
|
||||
public:
|
||||
CMiscNotifier( CMenuItem*, CMenuItem* );
|
||||
bool changeNotify(const neutrino_locale_t, void *);
|
||||
COnOffNotifier(int OffValue = 0);
|
||||
bool changeNotify(const neutrino_locale_t, void *Data);
|
||||
|
||||
void addItem(CMenuItem* menuItem);
|
||||
};
|
||||
|
||||
class CSectionsdConfigNotifier : public CChangeObserver
|
||||
|
Reference in New Issue
Block a user