mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
osd-setup: some more code nicenings
Origin commit data
------------------
Branch: ni/coolstream
Commit: 53538e4285
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-06-17 (Thu, 17 Jun 2021)
Origin message was:
------------------
- osd-setup: some more code nicenings
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -289,7 +289,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (actionKey == "font_scaling") {
|
||||
else if (actionKey == "font_scaling")
|
||||
{
|
||||
int fs_x = g_settings.font_scaling_x;
|
||||
int fs_y = g_settings.font_scaling_y;
|
||||
|
||||
@@ -310,13 +311,15 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
|
||||
res = fontscale.exec(NULL, "");
|
||||
|
||||
if (fs_x != g_settings.font_scaling_x || fs_y != g_settings.font_scaling_y) {
|
||||
if (fs_x != g_settings.font_scaling_x || fs_y != g_settings.font_scaling_y)
|
||||
{
|
||||
printf("[neutrino] new font scale settings x: %d%% y: %d%%\n", g_settings.font_scaling_x, g_settings.font_scaling_y);
|
||||
CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT | CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT_INST | CNeutrinoFonts::FONTSETUP_DYN_FONT);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if(actionKey=="window_size") {
|
||||
else if (actionKey=="window_size")
|
||||
{
|
||||
int old_window_width = g_settings.window_width;
|
||||
int old_window_height = g_settings.window_height;
|
||||
|
||||
@@ -325,25 +328,31 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||
|
||||
bool loop=true;
|
||||
while (loop) {
|
||||
while (loop)
|
||||
{
|
||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true);
|
||||
|
||||
if (msg <= CRCInput::RC_MaxRC)
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||
|
||||
if ( msg == CRCInput::RC_ok ) {
|
||||
if (msg == CRCInput::RC_ok)
|
||||
{
|
||||
memset(window_size_value, 0, sizeof(window_size_value));
|
||||
snprintf(window_size_value, sizeof(window_size_value), "%d / %d", g_settings.window_width, g_settings.window_height);
|
||||
mfWindowSize->setOption(window_size_value);
|
||||
CNeutrinoApp::getInstance()->channelList->ResetModules();
|
||||
break;
|
||||
} else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) {
|
||||
}
|
||||
else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout))
|
||||
{
|
||||
g_settings.window_width = old_window_width;
|
||||
g_settings.window_height = old_window_height;
|
||||
loop = false;
|
||||
} else if ((msg == CRCInput::RC_page_up) || (msg == CRCInput::RC_page_down) ||
|
||||
}
|
||||
else if ((msg == CRCInput::RC_page_up) || (msg == CRCInput::RC_page_down) ||
|
||||
(msg == CRCInput::RC_left) || (msg == CRCInput::RC_right) ||
|
||||
(msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) {
|
||||
(msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
|
||||
{
|
||||
|
||||
int dir = 1;
|
||||
if ((msg == CRCInput::RC_page_down) || (msg == CRCInput::RC_left) || (msg == CRCInput::RC_down))
|
||||
@@ -361,9 +370,14 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
|
||||
paintWindowSize(g_settings.window_width, g_settings.window_height);
|
||||
|
||||
} else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right)) {
|
||||
} else if (msg > CRCInput::RC_MaxRC) {
|
||||
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
||||
}
|
||||
else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right))
|
||||
{
|
||||
}
|
||||
else if (msg > CRCInput::RC_MaxRC)
|
||||
{
|
||||
if (CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all)
|
||||
{
|
||||
loop = false;
|
||||
res = menu_return::RETURN_EXIT_ALL;
|
||||
}
|
||||
@@ -373,7 +387,8 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
|
||||
return res;
|
||||
}
|
||||
else if(actionKey=="osd.def") {
|
||||
else if (actionKey=="osd.def")
|
||||
{
|
||||
for (int i = 0; i < SNeutrinoSettings::HANDLING_INFOBAR_SETTING_COUNT; i++)
|
||||
g_settings.handling_infobar[i] = handling_infobar_setting[i].default_timing;
|
||||
|
||||
@@ -381,25 +396,32 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
g_settings.timing[i] = timing_setting[i].default_timing;
|
||||
return res;
|
||||
}
|
||||
else if(actionKey=="logo_dir") {
|
||||
else if (actionKey=="logo_dir")
|
||||
{
|
||||
const char *action_str = "logo";
|
||||
chooserDir(g_settings.logo_hdd_dir, false, action_str);
|
||||
return res;
|
||||
}
|
||||
else if(actionKey=="screenshot_dir") {
|
||||
else if (actionKey=="screenshot_dir")
|
||||
{
|
||||
const char *action_str = "screenshot";
|
||||
chooserDir(g_settings.screenshot_dir, true, action_str);
|
||||
return res;
|
||||
}
|
||||
else if(actionKey=="screensaver_dir") {
|
||||
else if(actionKey=="screensaver_dir")
|
||||
{
|
||||
const char *action_str = "screensaver";
|
||||
chooserDir(g_settings.screensaver_dir, false, action_str);
|
||||
return res;
|
||||
}
|
||||
else if(strncmp(actionKey.c_str(), "fontsize.d", 10) == 0) {
|
||||
for (unsigned int i = 0; i < FONT_GROUP_COUNT; i++) {
|
||||
if (actionKey == font_sizes_groups[i].actionkey) {
|
||||
for (unsigned int j = 0; j < font_sizes_groups[i].count; j++) {
|
||||
else if(strncmp(actionKey.c_str(), "fontsize.d", 10) == 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < FONT_GROUP_COUNT; i++)
|
||||
{
|
||||
if (actionKey == font_sizes_groups[i].actionkey)
|
||||
{
|
||||
for (unsigned int j = 0; j < font_sizes_groups[i].count; j++)
|
||||
{
|
||||
SNeutrinoSettings::FONT_TYPES k = font_sizes_groups[i].content[j];
|
||||
CNeutrinoApp::getInstance()->getConfigFile()->setInt32(locale_real_names[neutrino_font[k].name], neutrino_font[k].defaultsize);
|
||||
}
|
||||
@@ -565,7 +587,8 @@ int COsdSetup::showOsdSetup()
|
||||
osd_menu->addIntroItems(LOCALE_MAINSETTINGS_OSD);
|
||||
|
||||
// item menu colors
|
||||
if (osd_menu_colors == NULL){
|
||||
if (osd_menu_colors == NULL)
|
||||
{
|
||||
osd_menu_colors = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_COLORS, width, MN_WIDGET_ID_OSDSETUP_MENUCOLORS);
|
||||
showOsdMenueColorSetup(osd_menu_colors);
|
||||
}
|
||||
@@ -680,15 +703,18 @@ int COsdSetup::showOsdSetup()
|
||||
size_t resCount = frameBuffer->osd_resolutions.size();
|
||||
struct CMenuOptionChooser::keyval_ext kext[resCount];
|
||||
char valname[resCount][255];
|
||||
if (resCount > 0) {
|
||||
for (size_t i = 0; i < resCount; i++) {
|
||||
if (resCount > 0)
|
||||
{
|
||||
for (size_t i = 0; i < resCount; i++)
|
||||
{
|
||||
kext[i].key = i;
|
||||
kext[i].value = NONEXISTANT_LOCALE;
|
||||
snprintf(valname[i], sizeof(valname[resCount]), "%dx%d", frameBuffer->osd_resolutions[i].xRes, frameBuffer->osd_resolutions[i].yRes);
|
||||
kext[i].valname = valname[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
kext[0].key = 0;
|
||||
kext[0].value = NONEXISTANT_LOCALE;
|
||||
kext[0].valname = "-";
|
||||
@@ -745,7 +771,8 @@ int COsdSetup::showOsdSetup()
|
||||
if (oldVolumeSize != g_settings.volume_size)
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
|
||||
if (oldInfoClockSize != g_settings.infoClockFontSize) {
|
||||
if (oldInfoClockSize != g_settings.infoClockFontSize)
|
||||
{
|
||||
CInfoClock::getInstance()->setHeight(g_settings.infoClockFontSize);
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
if (CNeutrinoApp::getInstance()->isMuted())
|
||||
@@ -1023,7 +1050,8 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
std::string getOption(fb_pixel_t * bgcol __attribute__((unused)) = NULL) {
|
||||
std::string getOption(fb_pixel_t * bgcol __attribute__((unused)) = NULL)
|
||||
{
|
||||
return to_string(configfile->getInt32(locale_real_names[name], defaultvalue));
|
||||
}
|
||||
|
||||
@@ -1052,7 +1080,8 @@ public:
|
||||
return input.exec(parent, action_Key);
|
||||
}
|
||||
|
||||
std::string &getValue(void) {
|
||||
std::string &getValue(void)
|
||||
{
|
||||
value = getOption();
|
||||
return value;
|
||||
}
|
||||
@@ -1093,8 +1122,6 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
|
||||
mf->setHint("", LOCALE_MENU_HINT_FONT_SCALING);
|
||||
fontSettings->addItem(mf);
|
||||
|
||||
//fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font"));
|
||||
|
||||
mn_widget_id_t w_index = MN_WIDGET_ID_OSDSETUP_FONTSIZE_MENU;
|
||||
for (unsigned int i = 0; i < FONT_GROUP_COUNT; i++)
|
||||
{
|
||||
@@ -1336,7 +1363,8 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
|
||||
show_tuner_icon = 0;
|
||||
// show possible option if we in single box mode, but don't touch the real settings
|
||||
int *p_show_tuner_icon = &show_tuner_icon;
|
||||
if (CFEManager::getInstance()->getFrontendCount() > 1) {
|
||||
if (CFEManager::getInstance()->getFrontendCount() > 1)
|
||||
{
|
||||
mc_active = true;
|
||||
// use the real value of g_settings.infobar_show_tuner
|
||||
p_show_tuner_icon = &g_settings.infobar_show_tuner;
|
||||
@@ -1499,37 +1527,44 @@ void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock)
|
||||
|
||||
bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
{
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_POS)) {
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_POS))
|
||||
{
|
||||
submenu_menus->hide();
|
||||
return true;
|
||||
}
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_HINTS)) {
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_HINTS))
|
||||
{
|
||||
/* change option after hide, to let hide clear hint */
|
||||
submenu_menus->hide();
|
||||
g_settings.show_menu_hints = * (int*) data;
|
||||
return true;
|
||||
}
|
||||
else if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY))
|
||||
||(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER))) {
|
||||
|| (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER)))
|
||||
{
|
||||
if (g_InfoViewer == NULL)
|
||||
g_InfoViewer = new CInfoViewer;
|
||||
g_InfoViewer->changePB();
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY)){
|
||||
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOBAR_CASYSTEM_DISPLAY))
|
||||
{
|
||||
casystemActivate.Activate(g_settings.infobar_casystem_display < 2);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SCREENSAVER_DELAY)) {
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SCREENSAVER_DELAY))
|
||||
{
|
||||
screensaverActivate.Activate(g_settings.screensaver_delay != 0);
|
||||
screensaverOptActivate.Activate(g_settings.screensaver_delay != 0 && g_settings.screensaver_mode == CScreenSaver::SCR_MODE_IMAGE);
|
||||
return false;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SCREENSAVER_MODE)) {
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SCREENSAVER_MODE))
|
||||
{
|
||||
screensaverOptActivate.Activate(g_settings.screensaver_mode == CScreenSaver::SCR_MODE_IMAGE);
|
||||
return false;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET)) {
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_PRESET))
|
||||
{
|
||||
int preset = * (int *) data;
|
||||
printf("preset %d (setting %d)\n", preset, g_settings.screen_preset);
|
||||
|
||||
@@ -1583,15 +1618,18 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_ROUNDED_CORNERS)) {
|
||||
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_ROUNDED_CORNERS))
|
||||
{
|
||||
osd_menu->hide();
|
||||
g_settings.theme.rounded_corners = * (int*) data;
|
||||
return true;
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT)) {
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_RADIOTEXT))
|
||||
{
|
||||
resetRadioText();
|
||||
}
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS)) {
|
||||
else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_VOLUME_DIGITS))
|
||||
{
|
||||
CVolumeHelper::getInstance()->refresh();
|
||||
return false;
|
||||
}
|
||||
@@ -1620,7 +1658,8 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
#endif
|
||||
else if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOCLOCK)) ||
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SIZE_HEIGHT)) ||
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SECONDS))) {
|
||||
(ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SECONDS)))
|
||||
{
|
||||
CInfoClock::getInstance()->ClearDisplay();
|
||||
FileTimeOSD->Init();
|
||||
}
|
||||
@@ -1630,17 +1669,21 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data)
|
||||
|
||||
void COsdSetup::resetRadioText()
|
||||
{
|
||||
if (getenv("SIMULATE_FE")){
|
||||
if (getenv("SIMULATE_FE"))
|
||||
{
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[COsdSetup][%s - %d] SIMULATE_FE is set, no radiotext function availavble \033[0m\n", __func__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_settings.radiotext_enable) {
|
||||
if (g_settings.radiotext_enable)
|
||||
{
|
||||
if (g_Radiotext == NULL)
|
||||
g_Radiotext = new CRadioText;
|
||||
|
||||
if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio)){
|
||||
if (g_RadiotextWin){
|
||||
if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio))
|
||||
{
|
||||
if (g_RadiotextWin)
|
||||
{
|
||||
delete g_RadiotextWin;
|
||||
g_RadiotextWin = NULL;
|
||||
}
|
||||
@@ -1651,7 +1694,9 @@ void COsdSetup::resetRadioText()
|
||||
g_Radiotext->setPid(pid);
|
||||
printf("\033[32m[COsdSetup] %s - %d: %d\033[0m\n", __func__, __LINE__, pid);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_Radiotext)
|
||||
g_Radiotext->radiotext_stop();
|
||||
delete g_Radiotext;
|
||||
@@ -1721,6 +1766,7 @@ const CMenuOptionChooser::keyval SCREENSHOT_OPTIONS[SCREENSHOT_OPTION_COUNT] =
|
||||
void COsdSetup::showOsdScreenShotSetup(CMenuWidget *menu_screenshot)
|
||||
{
|
||||
menu_screenshot->addIntroItems(LOCALE_SCREENSHOT_MENU);
|
||||
|
||||
if ((uint)g_settings.key_screenshot == CRCInput::RC_nokey)
|
||||
menu_screenshot->addItem( new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCREENSHOT_INFO));
|
||||
|
||||
@@ -1812,7 +1858,8 @@ void COsdSetup::showOsdScreensaverSetup(CMenuWidget *menu_screensaver)
|
||||
|
||||
void COsdSetup::paintWindowSize(int w, int h)
|
||||
{
|
||||
if (win_demo == NULL) {
|
||||
if (win_demo == NULL)
|
||||
{
|
||||
win_demo = new CComponentsShapeSquare(0, 0, 0, 0);
|
||||
win_demo->setFrameThickness(OFFSET_INNER_MID);
|
||||
win_demo->disableShadow();
|
||||
@@ -1820,7 +1867,8 @@ void COsdSetup::paintWindowSize(int w, int h)
|
||||
win_demo->setColorFrame(COL_RED);
|
||||
win_demo->doPaintBg(true);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (win_demo->isPainted())
|
||||
win_demo->kill();
|
||||
}
|
||||
|
@@ -64,17 +64,15 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
||||
int width;
|
||||
int is_wizard;
|
||||
int show_menu_hints;
|
||||
int show_tuner_icon;
|
||||
|
||||
//NI
|
||||
int show_menu_hints_line;
|
||||
int show_tuner_icon;
|
||||
|
||||
int showOsdSetup();
|
||||
void showOsdMenueColorSetup(CMenuWidget *menu_colors);
|
||||
void showOsdFontSizeSetup(CMenuWidget *menu_fonts);
|
||||
void showOsdTimeoutSetup(CMenuWidget *menu_timeout);
|
||||
void showOsdMenusSetup(CMenuWidget *menu_menus);
|
||||
void showOsdChannellogosSetup(CMenuWidget *menu_channellogos); //NI
|
||||
void showOsdChannellogosSetup(CMenuWidget *menu_channellogos);
|
||||
void showOsdInfobarSetup(CMenuWidget *menu_infobar);
|
||||
void showOsdChanlistSetup(CMenuWidget *menu_chanlist);
|
||||
void showOsdEventlistSetup(CMenuWidget *menu_eventlist);
|
||||
@@ -111,7 +109,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
||||
COsdSetup(int wizard_mode = SNeutrinoSettings::WIZARD_OFF);
|
||||
~COsdSetup();
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
bool changeNotify(const neutrino_locale_t OptionName, void * data); //NI
|
||||
bool changeNotify(const neutrino_locale_t OptionName, void * data);
|
||||
int showContextChanlistMenu(CChannelList *parent_channellist = NULL);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user