mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
move some more stuff from ni-menu to service-menu
Origin commit data
------------------
Commit: b600bcefa7
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-12 (Tue, 12 Sep 2017)
Origin message was:
------------------
- move some more stuff from ni-menu to service-menu
This commit is contained in:
@@ -1163,7 +1163,7 @@ menu.hint_blank_screen Schaltet den VideoDecoder bis zum nächsten Event (Tasten
|
||||
menu.hint_buildinfo Informationen über Compiler, Compilerflags, Kernel
|
||||
menu.hint_ca_init Konfiguration der CA-Systemhardware, CA-Modul und Kartenschächte
|
||||
menu.hint_cache_txt Startet das Zwischenspeichern des Teletextes nach einem Kanalwechsel
|
||||
menu.hint_camd Softcam und Emulator Einstellungen\nStart, Stop, Versionsinfo
|
||||
menu.hint_camd_control Softcams und Emulatoren\nStart, Stop, Versionsinfo
|
||||
menu.hint_camd_reset Aktive Softcam und/oder Emulator neu starten
|
||||
menu.hint_cec_mode CEC-Modus
|
||||
menu.hint_cec_standby CEC-Standby
|
||||
|
@@ -1162,7 +1162,7 @@ menu.hint_blank_screen Turn off VideoDecoder until next event (keypress, timer e
|
||||
menu.hint_buildinfo Information about compilers, compiler flags, kernel
|
||||
menu.hint_ca_init Configuration of CA-system hardware, CA-module and card slots
|
||||
menu.hint_cache_txt Start teletext caching after channel switch
|
||||
menu.hint_camd Softcam and emulator settings\nStart, stop, version info
|
||||
menu.hint_camd_control Softcams and emulators\nStart, stop, version info
|
||||
menu.hint_camd_reset Restart the active softcam and/or emulator
|
||||
menu.hint_cec_mode CEC mode
|
||||
menu.hint_cec_standby CEC standby
|
||||
|
@@ -107,3 +107,121 @@ int CDaemonControlMenu::show()
|
||||
daemonControlMenu->hide();
|
||||
return res;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
CCamdControlMenu::CCamdControlMenu()
|
||||
{
|
||||
width = 40;
|
||||
}
|
||||
|
||||
CCamdControlMenu::~CCamdControlMenu()
|
||||
{
|
||||
}
|
||||
|
||||
int CCamdControlMenu::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||
{
|
||||
if (parent)
|
||||
parent->hide();
|
||||
|
||||
return show();
|
||||
}
|
||||
|
||||
typedef struct camds_data_t
|
||||
{
|
||||
neutrino_locale_t name;
|
||||
neutrino_locale_t desc;
|
||||
const char * camd_name;
|
||||
const char * camd_file;
|
||||
int camd_exist;
|
||||
int camd_runs;
|
||||
}
|
||||
camds_data_struct;
|
||||
|
||||
camds_data_t camds_data[]=
|
||||
{
|
||||
{LOCALE_CAMD_ITEM_MGCAMD_NAME, LOCALE_CAMD_ITEM_MGCAMD_HINT, "MGCAMD", "mgcamd", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_DOSCAM_NAME, LOCALE_CAMD_ITEM_DOSCAM_HINT, "DOSCAM", "doscam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_NCAM_NAME, LOCALE_CAMD_ITEM_NCAM_HINT, "NCAM", "ncam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_OSCAM_NAME, LOCALE_CAMD_ITEM_OSCAM_HINT, "OSCAM", "oscam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_OSEMU_NAME, LOCALE_CAMD_ITEM_OSEMU_HINT, "OSEMU", "osemu", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_NEWCS_NAME, LOCALE_CAMD_ITEM_NEWCS_HINT, "NEWCS", "newcs", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_GBOX_NAME, LOCALE_CAMD_ITEM_GBOX_HINT, "GBOX.NET", "gbox", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_CS2GBOX_NAME, LOCALE_CAMD_ITEM_CS2GBOX_HINT, "CS2GBOX", "cs2gbox", 0, 0}
|
||||
};
|
||||
#define CAMDS_COUNT (sizeof(camds_data)/sizeof(struct camds_data_t))
|
||||
|
||||
int CCamdControlMenu::show()
|
||||
{
|
||||
int camd_shortcut = 0;
|
||||
|
||||
std::ostringstream buf;
|
||||
char *buffer;
|
||||
ssize_t read;
|
||||
size_t len;
|
||||
FILE *fh;
|
||||
|
||||
CMenuWidget* camdControlMenu = new CMenuWidget(LOCALE_CAMD_CONTROL, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_CAMD_CONTROL);
|
||||
camdControlMenu->addIntroItems();
|
||||
|
||||
// camd reset
|
||||
CMenuForwarder *mf = new CMenuForwarder(LOCALE_CAMD_RESET, true, NULL, CNeutrinoApp::getInstance(), "camd_reset", CRCInput::RC_red);
|
||||
mf->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_CAMD_RESET);
|
||||
camdControlMenu->addItem(mf);
|
||||
|
||||
camdControlMenu->addItem(GenericMenuSeparatorLine);
|
||||
|
||||
CMenuOptionChooser *mc;
|
||||
for (unsigned int i = 0; i < CAMDS_COUNT; i++)
|
||||
{
|
||||
std::string vinfo = "";
|
||||
|
||||
buf.str("");
|
||||
buf << "/var/bin/" << camds_data[i].camd_file;
|
||||
|
||||
camds_data[i].camd_exist = file_exists(buf.str().c_str());
|
||||
|
||||
if (camds_data[i].camd_exist)
|
||||
{
|
||||
buf.str("");
|
||||
buf << "vinfo " << camds_data[i].camd_name << " /var/bin/" << camds_data[i].camd_file;
|
||||
|
||||
buffer = NULL;
|
||||
if ((fh = popen(buf.str().c_str(), "r")))
|
||||
{
|
||||
while ((read = getline(&buffer, &len, fh)) != -1)
|
||||
vinfo += buffer;
|
||||
pclose(fh);
|
||||
if (buffer)
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
printf("[vinfo] popen error\n" );
|
||||
}
|
||||
|
||||
if (getpidof(camds_data[i].camd_file))
|
||||
camds_data[i].camd_runs = 1;
|
||||
else
|
||||
camds_data[i].camd_runs = 0;
|
||||
|
||||
//remove linebreaks from vinfo output
|
||||
std::string::size_type spos = vinfo.find_first_of("\r\n");
|
||||
while (spos != std::string::npos)
|
||||
{
|
||||
vinfo.replace(spos, 1, " ");
|
||||
spos = vinfo.find_first_of("\r\n");
|
||||
}
|
||||
std::string hint(g_Locale->getText(camds_data[i].desc));
|
||||
hint.append("\nvinfo: " + vinfo);
|
||||
|
||||
CFlagFileNotifier * flagFileNotifier = new CFlagFileNotifier(camds_data[i].camd_file);
|
||||
|
||||
mc = new CMenuOptionChooser(camds_data[i].name, &camds_data[i].camd_runs, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, camds_data[i].camd_exist, flagFileNotifier, CRCInput::convertDigitToKey(camd_shortcut++));
|
||||
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint);
|
||||
camdControlMenu->addItem(mc);
|
||||
}
|
||||
|
||||
int res = camdControlMenu->exec(NULL,"");
|
||||
camdControlMenu->hide();
|
||||
return res;
|
||||
}
|
||||
|
@@ -38,5 +38,20 @@ class CDaemonControlMenu : public CMenuTarget
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class CCamdControlMenu : public CMenuTarget
|
||||
{
|
||||
private:
|
||||
int show();
|
||||
|
||||
protected:
|
||||
int width;
|
||||
|
||||
public:
|
||||
CCamdControlMenu();
|
||||
~CCamdControlMenu();
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -47,29 +47,6 @@
|
||||
|
||||
#include <driver/screen_max.h>
|
||||
|
||||
typedef struct emu_menu_data_t
|
||||
{
|
||||
neutrino_locale_t name;
|
||||
neutrino_locale_t hint;
|
||||
const char * cam_name;
|
||||
const char * cam_file;
|
||||
int cam_exist;
|
||||
int flag_exist;
|
||||
} emu_menu_data_struct;
|
||||
|
||||
emu_menu_data_t emu_menu[]=
|
||||
{
|
||||
{LOCALE_CAMD_ITEM_MGCAMD_NAME, LOCALE_CAMD_ITEM_MGCAMD_HINT, "MGCAMD", "mgcamd", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_DOSCAM_NAME, LOCALE_CAMD_ITEM_DOSCAM_HINT, "DOSCAM", "doscam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_NCAM_NAME, LOCALE_CAMD_ITEM_NCAM_HINT, "NCAM", "ncam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_OSCAM_NAME, LOCALE_CAMD_ITEM_OSCAM_HINT, "OSCAM", "oscam", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_OSEMU_NAME, LOCALE_CAMD_ITEM_OSEMU_HINT, "OSEMU", "osemu", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_NEWCS_NAME, LOCALE_CAMD_ITEM_NEWCS_HINT, "NEWCS", "newcs", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_GBOX_NAME, LOCALE_CAMD_ITEM_GBOX_HINT, "GBOX.NET", "gbox", 0, 0},
|
||||
{LOCALE_CAMD_ITEM_CS2GBOX_NAME, LOCALE_CAMD_ITEM_CS2GBOX_HINT, "CS2GBOX", "cs2gbox", 0, 0}
|
||||
};
|
||||
#define MAXEMU (sizeof(emu_menu)/sizeof(struct emu_menu_data_t))
|
||||
|
||||
CNIMenu::CNIMenu()
|
||||
{
|
||||
width = 40;
|
||||
@@ -108,85 +85,12 @@ bool CNIMenu::changeNotify(const neutrino_locale_t OptionName, void * /*data*/)
|
||||
int CNIMenu::show()
|
||||
{
|
||||
int shortcut = 1;
|
||||
int cam_shortcut = 1;
|
||||
|
||||
std::ostringstream buf;
|
||||
char *buffer;
|
||||
ssize_t read;
|
||||
size_t len;
|
||||
FILE *fh;
|
||||
|
||||
CMenuWidget* ni_menu = new CMenuWidget(LOCALE_NIMENU_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_NI_MENU);
|
||||
ni_menu->addIntroItems();
|
||||
|
||||
// --- camd settings ---
|
||||
ni_menu->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_CENTER | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_CAMD_CONTROL));
|
||||
|
||||
// camd reset
|
||||
mf = new CMenuForwarder(LOCALE_CAMD_RESET, true, NULL, this, "camd_reset", CRCInput::convertDigitToKey(shortcut++));
|
||||
mf->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_CAMD_RESET);
|
||||
ni_menu->addItem(mf);
|
||||
|
||||
// camd settings
|
||||
CMenuWidget* emuMenu = new CMenuWidget(LOCALE_CAMD_CONTROL, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_CAMD_CONTROL);
|
||||
emuMenu->addIntroItems();
|
||||
|
||||
for (unsigned int i = 0; i < MAXEMU; i++)
|
||||
{
|
||||
std::string vinfo = "";
|
||||
|
||||
buf.str("");
|
||||
buf << "/var/bin/" << emu_menu[i].cam_file;
|
||||
|
||||
emu_menu[i].cam_exist = file_exists(buf.str().c_str());
|
||||
|
||||
if (emu_menu[i].cam_exist)
|
||||
{
|
||||
buf.str("");
|
||||
buf << "vinfo " << emu_menu[i].cam_name << " /var/bin/" << emu_menu[i].cam_file;
|
||||
|
||||
buffer=NULL;
|
||||
if ((fh = popen(buf.str().c_str(), "r")))
|
||||
{
|
||||
while ((read = getline(&buffer, &len, fh)) != -1)
|
||||
vinfo += buffer;
|
||||
pclose(fh);
|
||||
if (buffer)
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
printf("[vinfo] popen error\n" );
|
||||
}
|
||||
|
||||
if (getpidof(emu_menu[i].cam_file))
|
||||
emu_menu[i].flag_exist = 1;
|
||||
else
|
||||
emu_menu[i].flag_exist = 0;
|
||||
|
||||
//remove linebreaks from vinfo output
|
||||
std::string::size_type spos = vinfo.find_first_of("\r\n");
|
||||
while (spos != std::string::npos)
|
||||
{
|
||||
vinfo.replace(spos, 1, " ");
|
||||
spos = vinfo.find_first_of("\r\n");
|
||||
}
|
||||
|
||||
|
||||
std::string hint(g_Locale->getText(emu_menu[i].hint));
|
||||
hint.append("\nvinfo: " + vinfo);
|
||||
|
||||
mc = new CMenuOptionChooser(emu_menu[i].name, &emu_menu[i].flag_exist, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, emu_menu[i].cam_exist, new CFlagFileNotifier(emu_menu[i].cam_file), CRCInput::convertDigitToKey(cam_shortcut++));
|
||||
mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, hint);
|
||||
emuMenu->addItem(mc);
|
||||
}
|
||||
|
||||
mf = new CMenuForwarder(LOCALE_CAMD_CONTROL, true, NULL, emuMenu, "", CRCInput::convertDigitToKey(shortcut++));
|
||||
mf->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_CAMD);
|
||||
ni_menu->addItem(mf);
|
||||
|
||||
// --- Special settings ---
|
||||
ni_menu->addItem(new CMenuSeparator(CMenuSeparator::ALIGN_CENTER | CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_NIMENU_HEAD_SPECIAL));
|
||||
|
||||
// NetFS Setup
|
||||
CNETFSSetup netfs_setup;
|
||||
mf = new CMenuForwarder(LOCALE_NETFS_MENU_MAIN_HEAD, true, NULL, &netfs_setup, NULL, CRCInput::convertDigitToKey(shortcut++));
|
||||
@@ -197,7 +101,6 @@ int CNIMenu::show()
|
||||
|
||||
ni_menu->hide();
|
||||
delete ni_menu;
|
||||
delete emuMenu;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@@ -545,6 +545,10 @@ void CNeutrinoApp::InitMenuService()
|
||||
mf->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_DAEMON_CONTROL);
|
||||
personalize.addItem(MENU_SERVICE, mf, &g_settings.personalize[SNeutrinoSettings::P_MSER_DAEMON_CONTROL]);
|
||||
|
||||
mf = new CMenuForwarder(LOCALE_CAMD_CONTROL, true, NULL, new CCamdControlMenu(), NULL);
|
||||
mf->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_CAMD_CONTROL);
|
||||
personalize.addItem(MENU_SERVICE, mf, &g_settings.personalize[SNeutrinoSettings::P_MSER_CAMD_CONTROL]);
|
||||
|
||||
if (!g_settings.easymenu) {
|
||||
personalize.addSeparator(MENU_SERVICE);
|
||||
|
||||
|
@@ -1189,7 +1189,7 @@ typedef enum
|
||||
LOCALE_MENU_HINT_BUILDINFO,
|
||||
LOCALE_MENU_HINT_CA_INIT,
|
||||
LOCALE_MENU_HINT_CACHE_TXT,
|
||||
LOCALE_MENU_HINT_CAMD,
|
||||
LOCALE_MENU_HINT_CAMD_CONTROL,
|
||||
LOCALE_MENU_HINT_CAMD_RESET,
|
||||
LOCALE_MENU_HINT_CEC_MODE,
|
||||
LOCALE_MENU_HINT_CEC_STANDBY,
|
||||
|
@@ -1189,7 +1189,7 @@ const char * locale_real_names[] =
|
||||
"menu.hint_buildinfo",
|
||||
"menu.hint_ca_init",
|
||||
"menu.hint_cache_txt",
|
||||
"menu.hint_camd",
|
||||
"menu.hint_camd_control",
|
||||
"menu.hint_camd_reset",
|
||||
"menu.hint_cec_mode",
|
||||
"menu.hint_cec_standby",
|
||||
|
@@ -83,6 +83,7 @@ const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SE
|
||||
{"personalize_bouquet_edit" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_reset_channels" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_daemon_control" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_camd_control" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_restart" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_restart_tuner" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, //NI
|
||||
{"personalize_reload_plugins" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
|
@@ -381,6 +381,7 @@ struct SNeutrinoSettings
|
||||
P_MSER_BOUQUET_EDIT,
|
||||
P_MSER_RESET_CHANNELS,
|
||||
P_MSER_DAEMON_CONTROL,
|
||||
P_MSER_CAMD_CONTROL,
|
||||
P_MSER_RESTART,
|
||||
P_MSER_RESTART_TUNER, //NI
|
||||
P_MSER_RELOAD_PLUGINS,
|
||||
|
Reference in New Issue
Block a user