mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
webchannels-setup: rework g_settings.livestreamResolution option chooser
Origin commit data
------------------
Branch: ni/coolstream
Commit: ee51b216f3
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-09-28 (Tue, 28 Sep 2021)
Origin message was:
------------------
- webchannels-setup: rework g_settings.livestreamResolution option chooser
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -40,6 +40,20 @@
|
|||||||
#include <mymenu.h>
|
#include <mymenu.h>
|
||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
|
|
||||||
|
const CMenuOptionChooser::keyval_ext LIVESTREAM_RESOLUTION_OPTIONS[] =
|
||||||
|
{
|
||||||
|
#if !HAVE_CST_HARDWARE
|
||||||
|
{ 3840, NONEXISTANT_LOCALE, "3840x2160" },
|
||||||
|
{ 2560, NONEXISTANT_LOCALE, "2560x1440" },
|
||||||
|
#endif
|
||||||
|
{ 1920, NONEXISTANT_LOCALE, "1920x1080" },
|
||||||
|
{ 1280, NONEXISTANT_LOCALE, "1280x720" },
|
||||||
|
{ 854, NONEXISTANT_LOCALE, "854x480" },
|
||||||
|
{ 640, NONEXISTANT_LOCALE, "640x360" },
|
||||||
|
{ 480, NONEXISTANT_LOCALE, "480x270" }
|
||||||
|
};
|
||||||
|
#define LIVESTREAM_RESOLUTION_OPTION_COUNT (sizeof(LIVESTREAM_RESOLUTION_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext))
|
||||||
|
|
||||||
CWebChannelsSetup::CWebChannelsSetup()
|
CWebChannelsSetup::CWebChannelsSetup()
|
||||||
{
|
{
|
||||||
webradio = false;
|
webradio = false;
|
||||||
@@ -47,6 +61,8 @@ CWebChannelsSetup::CWebChannelsSetup()
|
|||||||
selected = -1;
|
selected = -1;
|
||||||
item_offset = 0;
|
item_offset = 0;
|
||||||
changed = false;
|
changed = false;
|
||||||
|
m = NULL;
|
||||||
|
livestreamResolution = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct button_label CWebChannelsSetupFooterButtons[] =
|
static const struct button_label CWebChannelsSetupFooterButtons[] =
|
||||||
@@ -199,29 +215,32 @@ int CWebChannelsSetup::Show()
|
|||||||
|
|
||||||
int shortcut = 1;
|
int shortcut = 1;
|
||||||
|
|
||||||
CMenuForwarder *mf;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) &&
|
bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) &&
|
||||||
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
||||||
|
|
||||||
|
#if 0
|
||||||
bool _mode_webradio = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) &&
|
bool _mode_webradio = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) &&
|
||||||
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
||||||
|
|
||||||
|
CMenuForwarder *mf;
|
||||||
|
|
||||||
mf = new CMenuForwarder(LOCALE_LIVESTREAM_SCRIPTPATH, !_mode_webtv || !_mode_webradio, g_settings.livestreamScriptPath, this, "script_path", CRCInput::convertDigitToKey(shortcut++));
|
mf = new CMenuForwarder(LOCALE_LIVESTREAM_SCRIPTPATH, !_mode_webtv || !_mode_webradio, g_settings.livestreamScriptPath, this, "script_path", CRCInput::convertDigitToKey(shortcut++));
|
||||||
m->addItem(mf);
|
m->addItem(mf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CMenuOptionChooser *oc;
|
||||||
|
|
||||||
if (!webradio)
|
if (!webradio)
|
||||||
{
|
{
|
||||||
mf = new CMenuForwarder(LOCALE_LIVESTREAM_RESOLUTION, true, NULL, new CWebTVResolution(), NULL, CRCInput::convertDigitToKey(shortcut++));
|
livestreamResolution = g_settings.livestreamResolution;
|
||||||
m->addItem(mf);
|
oc = new CMenuOptionChooser(LOCALE_LIVESTREAM_RESOLUTION, &livestreamResolution, LIVESTREAM_RESOLUTION_OPTIONS, LIVESTREAM_RESOLUTION_OPTION_COUNT, _mode_webtv, this, CRCInput::convertDigitToKey(shortcut++), "", true);
|
||||||
|
// FIXME oc->setHint(NEUTRINO_ICON_HINT_DEFAULT, NONEXISTANT_LOCALE);
|
||||||
|
m->addItem(oc);
|
||||||
|
|
||||||
m->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, webradio ? LOCALE_WEBRADIO_XML : LOCALE_WEBTV_XML));
|
m->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, webradio ? LOCALE_WEBRADIO_XML : LOCALE_WEBTV_XML));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: show/hide autoloaded content when switching g_settings.webradio/webtv_xml_auto
|
// TODO: show/hide autoloaded content when switching g_settings.webradio/webtv_xml_auto
|
||||||
CMenuOptionChooser *oc;
|
|
||||||
char hint_text[1024];
|
char hint_text[1024];
|
||||||
if (webradio)
|
if (webradio)
|
||||||
{
|
{
|
||||||
@@ -292,7 +311,7 @@ int CWebChannelsSetup::Show()
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWebChannelsSetup::changeNotify(const neutrino_locale_t OptionName, void */*data*/)
|
bool CWebChannelsSetup::changeNotify(const neutrino_locale_t OptionName, void *data)
|
||||||
{
|
{
|
||||||
int ret = menu_return::RETURN_NONE;
|
int ret = menu_return::RETURN_NONE;
|
||||||
|
|
||||||
@@ -301,6 +320,17 @@ bool CWebChannelsSetup::changeNotify(const neutrino_locale_t OptionName, void */
|
|||||||
changed = true;
|
changed = true;
|
||||||
ret = menu_return::RETURN_REPAINT;
|
ret = menu_return::RETURN_REPAINT;
|
||||||
}
|
}
|
||||||
|
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LIVESTREAM_RESOLUTION))
|
||||||
|
{
|
||||||
|
if (livestreamResolution != g_settings.livestreamResolution)
|
||||||
|
{
|
||||||
|
m->hide();
|
||||||
|
g_settings.livestreamResolution = *(int *)data;
|
||||||
|
CWebTVResolution webtvresolution;
|
||||||
|
webtvresolution.RestartStream();
|
||||||
|
ret = menu_return::RETURN_REPAINT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -436,20 +466,6 @@ CWebTVResolution::CWebTVResolution()
|
|||||||
width = 40;
|
width = 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CMenuOptionChooser::keyval_ext LIVESTREAM_RESOLUTION_OPTIONS[] =
|
|
||||||
{
|
|
||||||
#if !HAVE_CST_HARDWARE
|
|
||||||
{ 3840, NONEXISTANT_LOCALE, "3840x2160" },
|
|
||||||
{ 2560, NONEXISTANT_LOCALE, "2560x1440" },
|
|
||||||
#endif
|
|
||||||
{ 1920, NONEXISTANT_LOCALE, "1920x1080" },
|
|
||||||
{ 1280, NONEXISTANT_LOCALE, "1280x720" },
|
|
||||||
{ 854, NONEXISTANT_LOCALE, "854x480" },
|
|
||||||
{ 640, NONEXISTANT_LOCALE, "640x360" },
|
|
||||||
{ 480, NONEXISTANT_LOCALE, "480x270" }
|
|
||||||
};
|
|
||||||
#define LIVESTREAM_RESOLUTION_OPTION_COUNT (sizeof(LIVESTREAM_RESOLUTION_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext))
|
|
||||||
|
|
||||||
int CWebTVResolution::exec(CMenuTarget *parent, const std::string & /*actionKey*/)
|
int CWebTVResolution::exec(CMenuTarget *parent, const std::string & /*actionKey*/)
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
@@ -469,14 +485,21 @@ int CWebTVResolution::Show()
|
|||||||
true, NULL, CRCInput::RC_nokey, NULL, true);
|
true, NULL, CRCInput::RC_nokey, NULL, true);
|
||||||
m->addItem(mc);
|
m->addItem(mc);
|
||||||
|
|
||||||
int oldRes = g_settings.livestreamResolution;
|
int livestreamResolution = g_settings.livestreamResolution;
|
||||||
int res = m->exec(NULL, "");
|
int res = m->exec(NULL, "");
|
||||||
m->hide();
|
m->hide();
|
||||||
delete m;
|
delete m;
|
||||||
|
|
||||||
bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) &&
|
bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) &&
|
||||||
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
(!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty());
|
||||||
if (oldRes != g_settings.livestreamResolution && _mode_webtv)
|
|
||||||
|
if (livestreamResolution != g_settings.livestreamResolution && _mode_webtv)
|
||||||
|
RestartStream();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWebTVResolution::RestartStream()
|
||||||
{
|
{
|
||||||
CZapitChannel *cc = CZapit::getInstance()->GetCurrentChannel();
|
CZapitChannel *cc = CZapit::getInstance()->GetCurrentChannel();
|
||||||
if (cc && IS_WEBCHAN(cc->getChannelID()))
|
if (cc && IS_WEBCHAN(cc->getChannelID()))
|
||||||
@@ -486,8 +509,6 @@ int CWebTVResolution::Show()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *CWebTVResolution::getResolutionValue()
|
const char *CWebTVResolution::getResolutionValue()
|
||||||
{
|
{
|
||||||
|
@@ -40,6 +40,8 @@ class CWebChannelsSetup : public CMenuTarget, CChangeObserver
|
|||||||
int item_offset;
|
int item_offset;
|
||||||
bool changed;
|
bool changed;
|
||||||
CMenuWidget *m;
|
CMenuWidget *m;
|
||||||
|
int livestreamResolution;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWebChannelsSetup();
|
CWebChannelsSetup();
|
||||||
int exec(CMenuTarget *parent, const std::string &actionKey);
|
int exec(CMenuTarget *parent, const std::string &actionKey);
|
||||||
@@ -65,6 +67,7 @@ class CWebTVResolution : public CMenuTarget
|
|||||||
CMenuWidget *m;
|
CMenuWidget *m;
|
||||||
public:
|
public:
|
||||||
CWebTVResolution();
|
CWebTVResolution();
|
||||||
|
void RestartStream();
|
||||||
const char *getResolutionValue();
|
const char *getResolutionValue();
|
||||||
int exec(CMenuTarget *parent, const std::string &actionKey);
|
int exec(CMenuTarget *parent, const std::string &actionKey);
|
||||||
int Show();
|
int Show();
|
||||||
|
Reference in New Issue
Block a user