mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- osd-setup: some more code nicenings
Conflicts: src/gui/osd_setup.cpp src/gui/osd_setup.h Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -286,7 +286,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;
|
||||
|
||||
@@ -307,13 +308,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;
|
||||
|
||||
@@ -322,25 +325,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))
|
||||
@@ -358,9 +367,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;
|
||||
}
|
||||
@@ -370,7 +384,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;
|
||||
|
||||
@@ -378,25 +393,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);
|
||||
}
|
||||
@@ -562,7 +584,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);
|
||||
}
|
||||
@@ -677,15 +700,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 = "-";
|
||||
@@ -742,7 +768,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())
|
||||
@@ -1021,7 +1048,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));
|
||||
}
|
||||
|
||||
@@ -1050,7 +1078,8 @@ public:
|
||||
return input.exec(parent, action_Key);
|
||||
}
|
||||
|
||||
std::string &getValue(void) {
|
||||
std::string &getValue(void)
|
||||
{
|
||||
value = getOption();
|
||||
return value;
|
||||
}
|
||||
@@ -1091,8 +1120,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++)
|
||||
{
|
||||
@@ -1312,7 +1339,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;
|
||||
@@ -1379,14 +1407,6 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist)
|
||||
menu_chanlist->addItem(mc);
|
||||
channellistNotifier->addItem(mc);
|
||||
|
||||
//NI
|
||||
#if 0
|
||||
//show channel logo
|
||||
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELLOGO, &g_settings.channellist_show_channellogo, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
||||
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO);
|
||||
menu_chanlist->addItem(mc);
|
||||
#endif
|
||||
|
||||
// show numbers
|
||||
mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELNUMBER, &g_settings.channellist_show_numbers, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
|
||||
mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELNUMBER);
|
||||
@@ -1483,37 +1503,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);
|
||||
|
||||
@@ -1567,15 +1594,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;
|
||||
}
|
||||
@@ -1587,7 +1617,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();
|
||||
}
|
||||
@@ -1597,17 +1628,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;
|
||||
}
|
||||
@@ -1618,7 +1653,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;
|
||||
@@ -1688,6 +1725,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));
|
||||
|
||||
@@ -1777,7 +1815,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();
|
||||
@@ -1785,7 +1824,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,6 +64,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
||||
int width;
|
||||
int is_wizard;
|
||||
int show_menu_hints;
|
||||
int show_menu_hints_line;
|
||||
int show_tuner_icon;
|
||||
|
||||
int showOsdSetup();
|
||||
@@ -71,7 +72,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
|
||||
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);
|
||||
|
Reference in New Issue
Block a user