diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 02aad2a17..89aad57c5 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1327,6 +1327,8 @@ usermenu.item_epg_misc EPG Funktionen usermenu.item_none (frei) usermenu.item_vtxt Teletext usermenu.msg_info_is_empty Es wurde kein Name für dieses Menü vergeben.\nVerwende Standardname:\n +usermenu.msg_warning_name Sie haben mehrere Menüpunkte für dieses Menü angelegt,\naber keinen neuen Namen festgelegt.\nEs ist daher empfohlen, einen neuen Namen zu vergeben! +usermenu.msg_warning_no_items Sie haben keine Menüpunkte für dieses Menü angelegt!\nDer Menüname wird daher zurückgesetzt! usermenu.name Name video_mode_ok Video-Einstellungen OK? videomenu.43mode 4:3 Anzeigeverhalten diff --git a/data/locale/english.locale b/data/locale/english.locale index a493dd164..7d75e75a6 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1327,6 +1327,8 @@ usermenu.item_epg_misc EPG functions usermenu.item_none (empty) usermenu.item_vtxt Videotext usermenu.msg_info_is_empty You don't have definied a name for this menu!\nUsing default name:\n +usermenu.msg_warning_name You have more than one items created for this menu,\nbut none new name for this menue defined.\nIt is recommended to enter a new name! +usermenu.msg_warning_no_items No items defined!\nThe menu name is reset! usermenu.name Name video_mode_ok Is this video mode working ok ? videomenu.43mode 4:3 Content mode diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 2d204f676..f0319859f 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1955,7 +1955,7 @@ void CInfoViewer::showButton_Audio () frameBuffer->paintBoxRel(sx, BBarY, asize, InfoHeightY_Info, COL_INFOBAR_BUTTONS_BACKGROUND); - if (txt.empty()) + if (txt.empty() || (txt == g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD))) txt = g_RemoteControl->current_PIDs.APIDs[selected].desc; g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(sx, BBarFontY, asize, diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 4fba9c472..12880afee 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -354,8 +354,10 @@ void CPersonalizeGui::ShowUserMenu(CMenuWidget* p_widget, vectorgetText(usermenu[i].def_name) : g_settings.usermenu_text[i].c_str(); + if (v_umenu[i]->getUsedItemsCount() > 0) + g_settings.usermenu_text[i] = g_settings.usermenu_text[i].empty() ? g_Locale->getText(usermenu[i].def_name) : g_settings.usermenu_text[i].c_str(); v_umenu_fw.push_back(new CMenuForwarder(usermenu[i].menue_title, true, g_settings.usermenu_text[i], v_umenu[i], NULL, usermenu[i].DirectKey, usermenu[i].IconName)); } diff --git a/src/gui/user_menue.h b/src/gui/user_menue.h index 98ddf204e..05bec067e 100644 --- a/src/gui/user_menue.h +++ b/src/gui/user_menue.h @@ -1,6 +1,6 @@ /* user_menue setup implementation - Neutrino-GUI - based up implementation by Günther + based up implementation by Günther Copyright (C) 2001 Steffen Hehn 'McClean' and some other guys diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index 85fdfd975..e69a25f52 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -54,11 +54,16 @@ CUserMenuSetup::CUserMenuSetup(neutrino_locale_t menue_title, int menue_button) button = menue_button; max_char = 24; width = w_max (40, 10); + pref_name = g_settings.usermenu_text[button]; //set current button name as prefered name + ums = NULL; + mf = NULL; } CUserMenuSetup::~CUserMenuSetup() { - + delete ums; + if (mf != NULL) + delete mf; } @@ -93,20 +98,28 @@ int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &) parent->hide(); int res = showSetup(); - checkItem(); + checkButtonName(); return res; } int CUserMenuSetup::showSetup() { - mn_widget_id_t widget_id = MN_WIDGET_ID_USERMENU_RED + button; //add up ''button'' and becomes to MN_WIDGET_ID_USERMENU_ GREEN, MN_WIDGET_ID_USERMENU_ YELLOW, MN_WIDGET_ID_USERMENU_BLUE - CMenuWidget * ums = new CMenuWidget(local, NEUTRINO_ICON_KEYBINDING, width, widget_id); + if (ums == NULL) { + mn_widget_id_t widget_id = MN_WIDGET_ID_USERMENU_RED + button; //add up ''button'' and becomes to MN_WIDGET_ID_USERMENU_ GREEN, MN_WIDGET_ID_USERMENU_ YELLOW, MN_WIDGET_ID_USERMENU_BLUE + ums = new CMenuWidget(local, NEUTRINO_ICON_KEYBINDING, width, widget_id); + }else{ + //if widget not clean, ensure that we have an empty widget without any item and set the last selected item + int sel = ums->getSelected(); + ums->resetWidget(); + ums->setSelected(sel); + } //CUserMenuNotifier *notify = new CUserMenuNotifier(); CStringInputSMS name(LOCALE_USERMENU_NAME, &g_settings.usermenu_text[button], 11, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzäöüß/- "/*, notify*/); - CMenuForwarder *mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, g_settings.usermenu_text[button],&name); + if (mf == NULL) + mf = new CMenuForwarder(LOCALE_USERMENU_NAME, true, g_settings.usermenu_text[button],&name); //------------------------------------- ums->addIntroItems(); @@ -119,26 +132,88 @@ int CUserMenuSetup::showSetup() { snprintf(text,max_char,"%d.",item+1); text[max_char-1]=0;// terminate for sure - ums->addItem( new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT,true, NULL, CRCInput::RC_nokey, "", true )); + ums->addItem(new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT,true, NULL, CRCInput::RC_nokey, "", true )); } int res = ums->exec(NULL, ""); ums->hide(); - delete ums; + return res; } -//check item for details like empty string and show an user message -void CUserMenuSetup::checkItem() +//check items of current button menu and set prefered menue name +void CUserMenuSetup::checkButtonItems() { + //count of all items of widget + int count = ums->getItemsCount(); + + //count of configured items + int used_items = getUsedItemsCount(); + + //warn if no items defined and reset menu name, if empty + if (used_items == 0){ + if (!g_settings.usermenu_text[button].empty()){ + DisplayInfoMessage(g_Locale->getText(LOCALE_USERMENU_MSG_WARNING_NO_ITEMS)); + g_settings.usermenu_text[button] = ""; + } + return; + } + + //found configured items and set as prefered name + for(int i = 0; i < count ; i++) + { + if (ums->getItem(i)->isMenueOptionChooser()) //choosers only + { + CMenuOptionChooser * opt_c = NULL; + opt_c = static_cast (ums->getItem(i)); + neutrino_locale_t opt_locale = USERMENU_ITEM_OPTIONS[opt_c->getOptionValue()].value; + int set_key = USERMENU_ITEM_OPTIONS[opt_c->getOptionValue()].key; + opt_c = NULL; + + if (set_key != SNeutrinoSettings::ITEM_NONE) + pref_name = g_Locale->getText(opt_locale); + + //warn if we have more than 1 items and the name of usermenu ist the same like before, exit function and let user decide, what to do + if (used_items > 1 && g_settings.usermenu_text[button]==pref_name){ + DisplayInfoMessage(g_Locale->getText(LOCALE_USERMENU_MSG_WARNING_NAME)); + return; + } + } + } + + if (used_items == 1) + g_settings.usermenu_text[button] = pref_name; //if found only 1 configured item, ensure that the caption of usermenu is the same like this +} + +//check button name for details like empty string and show an user message on issue +void CUserMenuSetup::checkButtonName() +{ + checkButtonItems(); + + //exit function, if no items found + if (getUsedItemsCount() == 0) + return; + bool is_empty = g_settings.usermenu_text[button].empty(); if (is_empty) { std::string msg = g_Locale->getText(LOCALE_USERMENU_MSG_INFO_IS_EMPTY); msg += g_Locale->getText(usermenu[button].def_name); + DisplayInfoMessage(msg.c_str()); g_settings.usermenu_text[button] = is_empty ? g_Locale->getText(usermenu[button].def_name) : g_settings.usermenu_text[button].c_str(); } } +//get count of used items +int CUserMenuSetup::getUsedItemsCount() +{ + int def_items = 0; + for(int item = 0; item < SNeutrinoSettings::ITEM_MAX; item++) + if (g_settings.usermenu[button][item] != 0) + def_items++; + + return def_items; +} + diff --git a/src/gui/user_menue_setup.h b/src/gui/user_menue_setup.h index adfc3292d..eb80bd486 100644 --- a/src/gui/user_menue_setup.h +++ b/src/gui/user_menue_setup.h @@ -33,6 +33,7 @@ #define __user_menue_setup__ #include + #include #include @@ -63,14 +64,20 @@ const struct usermenu_props_t usermenu[USERMENU_ITEMS_COUNT] = int width; int max_char; int button; + std::string pref_name; neutrino_locale_t local; int showSetup(); - void checkItem(); - + void checkButtonItems(); + void checkButtonName(); + + CMenuWidget * ums; + CMenuForwarder *mf; + public: CUserMenuSetup(neutrino_locale_t menue_title, int menue_button); ~CUserMenuSetup(); + int getUsedItemsCount(); int exec(CMenuTarget* parent, const std::string & actionKey); }; diff --git a/src/system/locals.h b/src/system/locals.h index b53598dbe..9d089abfb 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1354,6 +1354,8 @@ typedef enum LOCALE_USERMENU_ITEM_NONE, LOCALE_USERMENU_ITEM_VTXT, LOCALE_USERMENU_MSG_INFO_IS_EMPTY, + LOCALE_USERMENU_MSG_WARNING_NAME, + LOCALE_USERMENU_MSG_WARNING_NO_ITEMS, LOCALE_USERMENU_NAME, LOCALE_VIDEO_MODE_OK, LOCALE_VIDEOMENU_43MODE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b3cfdc60d..7e73f89c1 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1354,6 +1354,8 @@ const char * locale_real_names[] = "usermenu.item_none", "usermenu.item_vtxt", "usermenu.msg_info_is_empty", + "usermenu.msg_warning_name", + "usermenu.msg_warning_no_items", "usermenu.name", "video_mode_ok", "videomenu.43mode",