mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-11 15:41:08 +02:00
- usermenu: formatting code using astyle; some manual code nicenings
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -87,6 +87,7 @@
|
||||
#include <driver/record.h>
|
||||
#include <driver/screen_max.h>
|
||||
|
||||
#include <system/debug.h>
|
||||
#include <system/helpers.h>
|
||||
#include <zapit/zapit.h>
|
||||
#include <hardware/video.h>
|
||||
@@ -97,8 +98,6 @@ extern CPlugins * g_Plugins; /* neutrino.cpp */
|
||||
extern cVideo *videoDecoder;
|
||||
extern CCAMMenuHandler *g_CamHandler;
|
||||
std::string CUserMenu::tmp;
|
||||
//
|
||||
#include <system/debug.h>
|
||||
|
||||
CUserMenu::CUserMenu()
|
||||
{
|
||||
@@ -115,7 +114,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
int dummy = 0;
|
||||
unsigned ums = g_settings.usermenu.size();
|
||||
for (unsigned int i = 0; i < ums; i++)
|
||||
if (g_settings.usermenu[i]->key == msg) {
|
||||
if (g_settings.usermenu[i]->key == msg)
|
||||
{
|
||||
button = i;
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +124,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
return false;
|
||||
|
||||
int pers = -1;
|
||||
switch(msg) {
|
||||
switch (msg)
|
||||
{
|
||||
case CRCInput::RC_red:
|
||||
pers = SNeutrinoSettings::P_MAIN_RED_BUTTON;
|
||||
button = SNeutrinoSettings::BUTTON_RED;
|
||||
@@ -145,7 +146,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
|
||||
CNeutrinoApp::getInstance()->StopSubtitles();
|
||||
|
||||
if (pers > -1 && (g_settings.personalize[pers] != CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)) {
|
||||
if (pers > -1 && (g_settings.personalize[pers] != CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED))
|
||||
{
|
||||
ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT), 450, 10);
|
||||
CNeutrinoApp::getInstance()->StartSubtitles();
|
||||
return true;
|
||||
@@ -196,13 +198,15 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) &&
|
||||
(CZapit::getInstance()->GetCurrentChannel() && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
||||
|
||||
// int rec_mode = (CRecordManager::getInstance()->GetRecordMode() & CRecordManager::RECMODE_REC_TSHIFT);
|
||||
bool timeshift = CMoviePlayerGui::getInstance().timeshift;
|
||||
bool adzap_active = CAdZapMenu::getInstance()->isActive();
|
||||
|
||||
std::string itemstr_last("1");
|
||||
|
||||
std::vector<std::string> items = ::split(g_settings.usermenu[button]->items, ',');
|
||||
for (std::vector<std::string>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
for (std::vector<std::string>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
if (it->empty())
|
||||
continue;
|
||||
if (*it == itemstr_last)
|
||||
@@ -274,7 +278,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
break;
|
||||
if (_mode_webtv)
|
||||
break;
|
||||
// NVOD/SubService- Kanal!
|
||||
// NVOD/SubService-Kanal
|
||||
CMenuWidget *tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_STARTTIME, NEUTRINO_ICON_VIDEO);
|
||||
if (!subchanselect.getNVODMenu(tmpNVODSelector))
|
||||
{
|
||||
@@ -320,13 +324,13 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
menu_item->setHint(NEUTRINO_ICON_HINT_TIMERS, LOCALE_MENU_HINT_TIMERS);
|
||||
break;
|
||||
}
|
||||
case SNeutrinoSettings::ITEM_VTXT:
|
||||
{
|
||||
keyhelper.get(&key,&icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); //CRCInput::RC_blue
|
||||
menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, CPluginsExec::getInstance(), "teletext", key, icon);
|
||||
// FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
break;
|
||||
}
|
||||
// case SNeutrinoSettings::ITEM_VTXT:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); // CRCInput::RC_blue
|
||||
// menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, CPluginsExec::getInstance(), "teletext", key, icon);
|
||||
// menu_item->setHint(NEUTRINO_ICON_HINT_VTXT, LOCALE_USERMENU_ITEM_VTXT);
|
||||
// break;
|
||||
// }
|
||||
case SNeutrinoSettings::ITEM_FAVORITS:
|
||||
{
|
||||
keyhelper.get(&key, &icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_FAVORIT]].key); // CRCInput::RC_green
|
||||
@@ -426,6 +430,27 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
menu_item->setHint(NEUTRINO_ICON_HINT_SCRIPTS, LOCALE_MENU_HINT_SCRIPTS);
|
||||
break;
|
||||
}
|
||||
// case SNeutrinoSettings::ITEM_ECMINFO:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon);
|
||||
// menu_item = new CMenuForwarder(LOCALE_ECMINFO_SHOW, file_size("/tmp/ecm.info"), NULL, neutrino, "ecmInfo", key, icon);
|
||||
// // FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
// break;
|
||||
// }
|
||||
// case SNeutrinoSettings::ITEM_CAMD_RESET:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon);
|
||||
// menu_item = new CMenuForwarder(LOCALE_CAMD_RESET, !rec_mode, NULL, neutrino, "camd_reset", key, icon);
|
||||
// // FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
// break;
|
||||
// }
|
||||
// case SNeutrinoSettings::ITEM_INFOICONS:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon);
|
||||
// menu_item = new CMenuForwarder(!g_settings.mode_icons ? LOCALE_INFOICONS_SWITCH_ON : LOCALE_INFOICONS_SWITCH_OFF, g_settings.mode_icons_skin != INFOICONS_INFOVIEWER, NULL, new CInfoIconsSetup, "infoicons_switch", key, icon);
|
||||
// // FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
// break;
|
||||
// }
|
||||
#if ENABLE_YOUTUBE_PLAYER
|
||||
case SNeutrinoSettings::ITEM_YOUTUBE:
|
||||
{
|
||||
@@ -463,6 +488,13 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
// FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
break;
|
||||
}
|
||||
// case SNeutrinoSettings::ITEM_TUNER_RESTART:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon);
|
||||
// menu_item = new CMenuForwarder(LOCALE_SERVICEMENU_RESTART_TUNER, true, NULL, neutrino, "restarttuner", key, icon);
|
||||
// menu_item->setHint(NEUTRINO_ICON_HINT_RELOAD_CHANNELS, LOCALE_MENU_HINT_RESTART_TUNER);
|
||||
// break;
|
||||
// }
|
||||
case SNeutrinoSettings::ITEM_HDDMENU:
|
||||
{
|
||||
keyhelper.get(&key, &icon);
|
||||
@@ -523,15 +555,24 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
menu_item->setHint(NEUTRINO_ICON_HINT_ADZAP, adzap_active ? LOCALE_MENU_HINT_ADZAP_ACTIVE : LOCALE_MENU_HINT_ADZAP);
|
||||
break;
|
||||
}
|
||||
// case SNeutrinoSettings::ITEM_TESTMENU:
|
||||
// {
|
||||
// keyhelper.get(&key, &icon);
|
||||
// menu_item = new CMenuDForwarder(LOCALE_TESTMENU, true, NULL, new CTestMenu(), NULL, key, icon);
|
||||
// // FIXME menu_item->setHint("", NONEXISTANT_LOCALE);
|
||||
// break;
|
||||
// }
|
||||
case -1: // plugin
|
||||
{
|
||||
int number_of_plugins = g_Plugins->getNumberOfPlugins();
|
||||
if (!number_of_plugins)
|
||||
continue;
|
||||
int count = 0;
|
||||
for(; count < number_of_plugins; count++) {
|
||||
for (; count < number_of_plugins; count++)
|
||||
{
|
||||
const char *pname = g_Plugins->getFileName(count);
|
||||
if (pname && (std::string(pname) == *it) && !g_Plugins->isHidden(count)) {
|
||||
if (pname && (std::string(pname) == *it) && !g_Plugins->isHidden(count))
|
||||
{
|
||||
neutrino_msg_t d_key = g_Plugins->getKey(count);
|
||||
keyhelper.get(&key, &icon, d_key);
|
||||
menu_item = new CMenuForwarder(g_Plugins->getName(count), true, NULL, CPluginsExec::getInstance(), to_string(count).c_str(), key, icon);
|
||||
@@ -546,7 +587,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
} // switch end
|
||||
|
||||
itemstr_last = *it;
|
||||
if (menu_item) {
|
||||
if (menu_item)
|
||||
{
|
||||
menu_items++;
|
||||
menu->addItem(menu_item, false);
|
||||
last_menu_item = menu_item;
|
||||
@@ -554,6 +596,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
}
|
||||
|
||||
CInfoClock::getInstance()->enableInfoClock(false);
|
||||
// CInfoIcons::getInstance()->enableInfoIcons(false);
|
||||
// show menu if there are more than 2 items only
|
||||
// otherwise, we start the item directly (must be the last one)
|
||||
if (menu_items > 1)
|
||||
@@ -562,6 +605,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
|
||||
last_menu_item->exec(NULL);
|
||||
|
||||
CInfoClock::getInstance()->enableInfoClock(true);
|
||||
// CInfoIcons::getInstance()->enableInfoIcons(true);
|
||||
CNeutrinoApp::getInstance()->StartSubtitles();
|
||||
|
||||
if (button < COL_BUTTONMAX)
|
||||
@@ -582,19 +626,24 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
const char *text = NULL;
|
||||
int mode = CNeutrinoApp::getInstance()->getMode();
|
||||
std::vector<std::string> items = ::split(g_settings.usermenu[button]->items, ',');
|
||||
for (std::vector<std::string>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
for (std::vector<std::string>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
int item = -1;
|
||||
if (it->find_first_not_of("0123456789") == std::string::npos)
|
||||
item = atoi(*it);
|
||||
|
||||
switch(item) {
|
||||
switch (item)
|
||||
{
|
||||
case -1:
|
||||
if (loc != NONEXISTANT_LOCALE || text)
|
||||
return_title = true;
|
||||
else {
|
||||
else
|
||||
{
|
||||
int nop = g_Plugins->getNumberOfPlugins();
|
||||
for(int count = 0; count < nop; count++) {
|
||||
if (std::string(g_Plugins->getFileName(count)) == *it) {
|
||||
for (int count = 0; count < nop; count++)
|
||||
{
|
||||
if (std::string(g_Plugins->getFileName(count)) == *it)
|
||||
{
|
||||
tmp = g_Plugins->getName(count);
|
||||
text = tmp.c_str();
|
||||
active = true;
|
||||
@@ -606,8 +655,10 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
case SNeutrinoSettings::ITEM_NONE:
|
||||
case SNeutrinoSettings::ITEM_BAR:
|
||||
case SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION:
|
||||
if (mode == NeutrinoModes::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) {
|
||||
if(loc == NONEXISTANT_LOCALE && !text) {
|
||||
if (mode == NeutrinoModes::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty())
|
||||
{
|
||||
if (loc == NONEXISTANT_LOCALE && !text)
|
||||
{
|
||||
CWebTVResolution webtvres;
|
||||
tmp = webtvres.getResolutionValue();
|
||||
if (!(videoDecoder->getBlank()))
|
||||
@@ -623,10 +674,13 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
text = tmp.c_str();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
text = tmp.c_str();
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
return_title = true;
|
||||
active = true;
|
||||
}
|
||||
@@ -636,7 +690,8 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
active = true;
|
||||
continue;
|
||||
case SNeutrinoSettings::ITEM_SUBCHANNEL:
|
||||
if (!g_RemoteControl->subChannels.empty()) {
|
||||
if (!g_RemoteControl->subChannels.empty())
|
||||
{
|
||||
if (loc == NONEXISTANT_LOCALE && !text)
|
||||
loc = g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_STARTTIME;
|
||||
else
|
||||
@@ -655,17 +710,20 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
active = true;
|
||||
continue;
|
||||
case SNeutrinoSettings::ITEM_AUDIO_SELECT:
|
||||
if(loc == NONEXISTANT_LOCALE && !text) {
|
||||
if (mode == NeutrinoModes::mode_webtv){
|
||||
if (loc == NONEXISTANT_LOCALE && !text)
|
||||
{
|
||||
if (mode == NeutrinoModes::mode_webtv)
|
||||
{
|
||||
tmp = CMoviePlayerGui::getInstance(true).CurrentAudioName(); // use instance_bg.
|
||||
text = tmp.c_str();
|
||||
}
|
||||
else if (!g_RemoteControl->current_PIDs.APIDs.empty()){
|
||||
tmp = g_RemoteControl->current_PIDs.APIDs[
|
||||
g_RemoteControl->current_PIDs.PIDs.selected_apid].desc;
|
||||
else if (!g_RemoteControl->current_PIDs.APIDs.empty())
|
||||
{
|
||||
tmp = g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].desc;
|
||||
text = tmp.c_str();
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
return_title = true;
|
||||
active = true;
|
||||
continue;
|
||||
@@ -681,12 +739,15 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
break;
|
||||
}
|
||||
|
||||
if (return_title) {
|
||||
if (return_title)
|
||||
{
|
||||
if (!g_settings.usermenu[button]->title.empty())
|
||||
return g_settings.usermenu[button]->title.c_str();
|
||||
if (button < USERMENU_ITEMS_COUNT)
|
||||
return g_Locale->getText(usermenu[button].def_name);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text)
|
||||
return text;
|
||||
if (loc != NONEXISTANT_LOCALE)
|
||||
@@ -696,12 +757,10 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu
|
||||
return "";
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
* changeNotify - features menu recording start / stop *
|
||||
**************************************************************************************/
|
||||
bool CUserMenu::changeNotify(const neutrino_locale_t OptionName, void *Data)
|
||||
{
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_PAUSESECTIONSD)) {
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MAINMENU_PAUSESECTIONSD))
|
||||
{
|
||||
g_Sectionsd->setPauseScanning((*((int *)Data)) == 0);
|
||||
}
|
||||
|
||||
|
@@ -80,7 +80,6 @@ class CUserMenu : public CChangeObserver
|
||||
static const char *getUserMenuButtonName(int button, bool &active, bool return_title = false);
|
||||
};
|
||||
|
||||
|
||||
// This is just a quick helper for the usermenu and pluginlist.
|
||||
class CColorKeyHelper
|
||||
{
|
||||
@@ -100,11 +99,13 @@ class CColorKeyHelper
|
||||
color_key_used[i] = false;
|
||||
};
|
||||
|
||||
/* Returns the next available button, to be used in menu as 'direct' keys. Appropriate
|
||||
/*
|
||||
* Returns the next available button, to be used in menu as 'direct' keys. Appropriate
|
||||
* definitions are returnd in msp and icon
|
||||
* A color button could be requested as prefered button (other buttons are not supported yet).
|
||||
* If the appropriate button is already in used, the next number_key button is returned instead
|
||||
* (first 1-9 and than 0). */
|
||||
* (first 1-9 and than 0).
|
||||
*/
|
||||
bool get(neutrino_msg_t *msg, const char **icon, neutrino_msg_t prefered_key = CRCInput::RC_nokey)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -121,7 +122,8 @@ class CColorKeyHelper
|
||||
*msg = CRCInput::RC_nokey;
|
||||
*icon = "";
|
||||
if (button >= 0 && button < COL_BUTTONMAX)
|
||||
{ // try to get color button
|
||||
{
|
||||
// try to get color button
|
||||
if (color_key_used[button] == false)
|
||||
{
|
||||
color_key_used[button] = true;
|
||||
|
Reference in New Issue
Block a user