- add submenu to configure and control online services like youtube, shoutcast and tmdb

This commit is contained in:
vanhofen
2016-08-06 22:29:26 +02:00
committed by svenhoefer
parent 5ce13c651d
commit a291b11300
7 changed files with 102 additions and 2 deletions

View File

@@ -47,6 +47,7 @@
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/messagebox.h>
#include <gui/widget/keyboard_input.h>
#include <driver/screen_max.h>
#include <driver/scanepg.h>
@@ -135,6 +136,10 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey)
{
return showMiscSettingsMenuChanlist();
}
else if(actionKey == "onlineservices")
{
return showMiscSettingsMenuOnlineServices();
}
return showMiscSettingsMenu();
}
@@ -270,11 +275,16 @@ int CMiscMenue::showMiscSettingsMenu()
mf->setHint("", LOCALE_MENU_HINT_MISC_ZAPIT);
misc_menue.addItem(mf);
// onlineservices
mf = new CMenuForwarder(LOCALE_MISCSETTINGS_ONLINESERVICES, true, NULL, this, "onlineservices", CRCInput::RC_4);
mf->setHint("", LOCALE_MENU_HINT_MISC_ONLINESERVICES);
misc_menue.addItem(mf);
#ifdef CPU_FREQ
//CPU
CMenuWidget misc_menue_cpu("CPU", NEUTRINO_ICON_SETTINGS, width);
showMiscSettingsMenuCPUFreq(&misc_menue_cpu);
misc_menue.addItem( new CMenuForwarder("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::RC_4));
misc_menue.addItem( new CMenuForwarder("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::RC_5));
#endif /*CPU_FREQ*/
int res = misc_menue.exec(NULL, "");
@@ -536,6 +546,35 @@ int CMiscMenue::showMiscSettingsMenuChanlist()
return res;
}
// online services
int CMiscMenue::showMiscSettingsMenuOnlineServices()
{
CMenuWidget *ms_oservices = new CMenuWidget(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_MISCSETUP_ONLINESERVICES);
ms_oservices->addIntroItems(LOCALE_MISCSETTINGS_ONLINESERVICES);
changeNotify(LOCALE_TMDB_API_KEY, NULL);
CKeyboardInput tmdb_api_key_input(LOCALE_TMDB_API_KEY, &g_settings.tmdb_api_key, 32, this);
CMenuForwarder *mf = new CMenuForwarder(LOCALE_TMDB_API_KEY, true, tmdb_api_key_short, &tmdb_api_key_input);
mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_TMDB_API_KEY);
ms_oservices->addItem(mf);
changeNotify(LOCALE_YOUTUBE_DEV_ID, NULL);
CKeyboardInput youtube_dev_id_input(LOCALE_YOUTUBE_DEV_ID, &g_settings.youtube_dev_id, 38, this);
mf = new CMenuForwarder(LOCALE_YOUTUBE_DEV_ID, true, youtube_dev_id_short, &youtube_dev_id_input);
mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_YOUTUBE_DEV_ID);
ms_oservices->addItem(mf);
changeNotify(LOCALE_SHOUTCAST_DEV_ID, NULL);
CKeyboardInput shoutcast_dev_id_input(LOCALE_SHOUTCAST_DEV_ID, &g_settings.shoutcast_dev_id, 16, this);
mf = new CMenuForwarder(LOCALE_SHOUTCAST_DEV_ID, true, shoutcast_dev_id_short, &shoutcast_dev_id_input);
mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_SHOUTCAST_DEV_ID);
ms_oservices->addItem(mf);
int res = ms_oservices->exec(NULL, "");
delete ms_oservices;
return res;
}
#ifdef CPU_FREQ
//CPU
void CMiscMenue::showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu)
@@ -592,6 +631,29 @@ bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void * /*data*
epg_scan->setActive(g_settings.epg_scan_mode != CEpgScan::MODE_OFF && g_settings.epg_save_mode == 0);
ret = menu_return::RETURN_REPAINT;
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_TMDB_API_KEY))
{
g_settings.tmdb_enabled = ((g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") && !g_settings.tmdb_api_key.empty());
if (g_settings.tmdb_enabled)
tmdb_api_key_short = g_settings.tmdb_api_key.substr(0, 8) + "...";
else
tmdb_api_key_short.clear();
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_YOUTUBE_DEV_ID))
{
g_settings.youtube_enabled = ((g_settings.youtube_dev_id != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") && !g_settings.youtube_dev_id.empty());
if (g_settings.youtube_enabled)
youtube_dev_id_short = g_settings.youtube_dev_id.substr(0, 8) + "...";
else
youtube_dev_id_short.clear();
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SHOUTCAST_DEV_ID))
{
g_settings.shoutcast_enabled = ((g_settings.shoutcast_dev_id != "XXXXXXXXXXXXXXXX") && !g_settings.shoutcast_dev_id.empty());
if (g_settings.shoutcast_enabled)
shoutcast_dev_id_short = g_settings.shoutcast_dev_id.substr(0, 8) + "...";
else
shoutcast_dev_id_short.clear();
}
return ret;
}

View File

@@ -53,12 +53,17 @@ class CMiscMenue : public CMenuTarget, CChangeObserver
std::string epg_old_events;
std::string epg_max_events;
std::string tmdb_api_key_short;
std::string youtube_dev_id_short;
std::string shoutcast_dev_id_short;
int showMiscSettingsMenu();
void showMiscSettingsMenuGeneral(CMenuWidget *ms_general);
void showMiscSettingsMenuEpg(CMenuWidget *ms_epg);
void showMiscSettingsMenuFBrowser(CMenuWidget *ms_fbrowser);
int showMiscSettingsMenuEnergy();
int showMiscSettingsMenuChanlist();
int showMiscSettingsMenuOnlineServices();
#ifdef CPU_FREQ
void showMiscSettingsMenuCPUFreq(CMenuWidget *ms_cpu);
#endif /*CPU_FREQ*/

View File

@@ -121,6 +121,7 @@ enum MN_WIDGET_ID
MN_WIDGET_ID_MISCSETUP_EPG,
MN_WIDGET_ID_MISCSETUP_FILEBROWSER,
MN_WIDGET_ID_MISCSETUP_CHANNELLIST,
MN_WIDGET_ID_MISCSETUP_ONLINESERVICES,
//media menu
MN_WIDGET_ID_MEDIA,

View File

@@ -1206,6 +1206,7 @@ typedef enum
LOCALE_MENU_HINT_MISC_EPG,
LOCALE_MENU_HINT_MISC_FILEBROWSER,
LOCALE_MENU_HINT_MISC_GENERAL,
LOCALE_MENU_HINT_MISC_ONLINESERVICES,
LOCALE_MENU_HINT_MISC_ZAPIT,
LOCALE_MENU_HINT_MOVIE,
LOCALE_MENU_HINT_MOVIEBROWSER_SETUP,
@@ -1418,6 +1419,7 @@ typedef enum
LOCALE_MENU_HINT_SERVICE,
LOCALE_MENU_HINT_SERVICE_SCAN,
LOCALE_MENU_HINT_SETTINGS,
LOCALE_MENU_HINT_SHOUTCAST_DEV_ID,
LOCALE_MENU_HINT_SHOW_MUTE_ICON,
LOCALE_MENU_HINT_SHUTDOWN,
LOCALE_MENU_HINT_SHUTDOWN_COUNT,
@@ -1445,6 +1447,7 @@ typedef enum
LOCALE_MENU_HINT_TIMEOUTS,
LOCALE_MENU_HINT_TIMERS,
LOCALE_MENU_HINT_TIMEZONE,
LOCALE_MENU_HINT_TMDB_API_KEY,
LOCALE_MENU_HINT_TOOLS,
LOCALE_MENU_HINT_TVMODE,
LOCALE_MENU_HINT_TVRADIO_SWITCH,
@@ -1482,6 +1485,7 @@ typedef enum
LOCALE_MENU_HINT_VOLUME_SIZE,
LOCALE_MENU_HINT_WEBTV_SETUP,
LOCALE_MENU_HINT_WINDOW_SIZE,
LOCALE_MENU_HINT_YOUTUBE_DEV_ID,
LOCALE_MENU_HINT_YTPLAY,
LOCALE_MENU_HINT_YTPLAY_SETUP,
LOCALE_MENU_HINT_ZAP_CYCLE,
@@ -1560,6 +1564,7 @@ typedef enum
LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD,
LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER,
LOCALE_MISCSETTINGS_INFOCLOCK,
LOCALE_MISCSETTINGS_ONLINESERVICES,
LOCALE_MISCSETTINGS_PROGRESSBAR,
LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR,
LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN,
@@ -2272,6 +2277,7 @@ typedef enum
LOCALE_SETTINGS_POS_TOP_RIGHT,
LOCALE_SETTINGS_RESTORE,
LOCALE_SETTINGS_RESTORE_WARN,
LOCALE_SHOUTCAST_DEV_ID,
LOCALE_SHUTDOWN_RECORDING_QUERY,
LOCALE_SHUTDOWNTIMER_ANNOUNCE,
LOCALE_SLEEPTIMERBOX_ANNOUNCE,
@@ -2391,6 +2397,7 @@ typedef enum
LOCALE_TIMING_MENU,
LOCALE_TIMING_NUMERICZAP,
LOCALE_TIMING_VOLUMEBAR,
LOCALE_TMDB_API_KEY,
LOCALE_TMDB_READ_DATA,
LOCALE_UNICABLE_LNB,
LOCALE_UNICABLE_QRG,
@@ -2498,6 +2505,7 @@ typedef enum
LOCALE_WIZARD_WELCOME_TEXT,
LOCALE_WORD_FROM,
LOCALE_WORD_IN,
LOCALE_YOUTUBE_DEV_ID,
LOCALE_ZAPIT_SCANTYPE,
LOCALE_ZAPIT_SCANTYPE_ALL,
LOCALE_ZAPIT_SCANTYPE_RADIO,

View File

@@ -1206,6 +1206,7 @@ const char * locale_real_names[] =
"menu.hint_misc_epg",
"menu.hint_misc_filebrowser",
"menu.hint_misc_general",
"menu.hint_misc_onlineservices",
"menu.hint_misc_zapit",
"menu.hint_movie",
"menu.hint_moviebrowser_setup",
@@ -1418,6 +1419,7 @@ const char * locale_real_names[] =
"menu.hint_service",
"menu.hint_service_scan",
"menu.hint_settings",
"menu.hint_shoutcast_dev_id",
"menu.hint_show_mute_icon",
"menu.hint_shutdown",
"menu.hint_shutdown_count",
@@ -1445,6 +1447,7 @@ const char * locale_real_names[] =
"menu.hint_timeouts",
"menu.hint_timers",
"menu.hint_timezone",
"menu.hint_tmdb_api_key",
"menu.hint_tools",
"menu.hint_tvmode",
"menu.hint_tvradio_switch",
@@ -1482,6 +1485,7 @@ const char * locale_real_names[] =
"menu.hint_volume_size",
"menu.hint_webtv_setup",
"menu.hint_window_size",
"menu.hint_youtube_dev_id",
"menu.hint_ytplay",
"menu.hint_ytplay_setup",
"menu.hint_zap_cycle",
@@ -1560,6 +1564,7 @@ const char * locale_real_names[] =
"miscsettings.infobar_show_sysfs_hdd",
"miscsettings.infobar_show_tuner",
"miscsettings.infoclock",
"miscsettings.onlineservices",
"miscsettings.progressbar",
"miscsettings.progressbar_color",
"miscsettings.progressbar_design",
@@ -2272,6 +2277,7 @@ const char * locale_real_names[] =
"settings.pos_top_right",
"settings.restore",
"settings.restore_warn",
"shoutcast.dev_id",
"shutdown.recording_query",
"shutdowntimer.announce",
"sleeptimerbox.announce",
@@ -2391,6 +2397,7 @@ const char * locale_real_names[] =
"timing.menu",
"timing.numericzap",
"timing.volumebar",
"tmdb.api_key",
"tmdb.read_data",
"unicable.lnb",
"unicable.qrg",
@@ -2498,6 +2505,7 @@ const char * locale_real_names[] =
"wizard.welcome_text",
"word.from",
"word.in",
"youtube.dev_id",
"zapit.scantype",
"zapit.scantype.all",
"zapit.scantype.radio",