diff --git a/lib/timerdclient/timerdclient.cpp b/lib/timerdclient/timerdclient.cpp index 8f5827d74..44429ed6b 100644 --- a/lib/timerdclient/timerdclient.cpp +++ b/lib/timerdclient/timerdclient.cpp @@ -434,8 +434,10 @@ void CTimerdClient::getRecordingSafety(int &pre, int &post) //------------------------------------------------------------------------- //void CTimerdClient::getWeekdaysFromStr(int *rep, const char* str) -void CTimerdClient::getWeekdaysFromStr(CTimerd::CTimerEventRepeat *eventRepeat, const char* str) +void CTimerdClient::getWeekdaysFromStr(CTimerd::CTimerEventRepeat *eventRepeat, std::string &str) { + if (str.length() < 7) + str.append(7 - str.length(), '-'); int rep = (int) *eventRepeat; if(rep >= (int)CTimerd::TIMERREPEAT_WEEKDAYS) { @@ -454,21 +456,22 @@ void CTimerdClient::getWeekdaysFromStr(CTimerd::CTimerEventRepeat *eventRepeat, *eventRepeat = (CTimerd::CTimerEventRepeat) rep; } //------------------------------------------------------------------------- -void CTimerdClient::setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, char* str) +void CTimerdClient::setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, std::string &str) { + if (str.length() < 7) + str.append(7 - str.length(), '-'); if(rep >= CTimerd::TIMERREPEAT_WEEKDAYS) { for(int n=0;n<7;n++) { if(rep & (1 << (n+9))) - str[n]='X'; + str.at(n)='X'; else - str[n]='-'; + str.at(n)='-'; } - str[7]=0; } else - strcpy(str,"-------"); + str = "-------"; } //------------------------------------------------------------------------- void CTimerdClient::stopTimerEvent( int evId) diff --git a/lib/timerdclient/timerdclient.h b/lib/timerdclient/timerdclient.h index 89ef81d84..16bdcad77 100644 --- a/lib/timerdclient/timerdclient.h +++ b/lib/timerdclient/timerdclient.h @@ -170,8 +170,8 @@ class CTimerdClient:private CBasicClient // Convert String of O and X to repeat type and vice versa //void getWeekdaysFromStr(int *rep, const char* str); - void getWeekdaysFromStr(CTimerd::CTimerEventRepeat *rep, const char* str); - void setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, char* str); + void getWeekdaysFromStr(CTimerd::CTimerEventRepeat *rep, std::string &str); + void setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, std::string &str); }; #endif diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 1ba5b97c8..b1c3dd307 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1450,7 +1450,7 @@ bool CRecordManager::ShowMenu(void) { int select = -1, rec_count = recmap.size(); char cnt[5]; - CMenuForwarderNonLocalized * item; + CMenuForwarder * item; CMenuForwarder * iteml; t_channel_id channel_ids[RECORD_MAX_COUNT] = { 0 }; /* initialization avoids false "might */ int recording_ids[RECORD_MAX_COUNT] = { 0 }; /* be used uninitialized" warning */ @@ -1508,7 +1508,7 @@ bool CRecordManager::ShowMenu(void) rc_key = CRCInput::RC_stop; btn_icon = NEUTRINO_ICON_BUTTON_STOP; } - item = new CMenuForwarderNonLocalized(title.c_str(), true, durations[i].c_str(), selector, cnt, rc_key, NULL, mode_icon); + item = new CMenuForwarder(title.c_str(), true, durations[i].c_str(), selector, cnt, rc_key, NULL, mode_icon); item->setItemButton(btn_icon, true); //if only one recording is running, set the focus to this menu item diff --git a/src/gui/audio_select.cpp b/src/gui/audio_select.cpp index c2a5f4a3c..9b8c9433b 100644 --- a/src/gui/audio_select.cpp +++ b/src/gui/audio_select.cpp @@ -111,7 +111,7 @@ int CAudioSelectMenuHandler::doMenu () { char apid[5]; sprintf(apid, "%d", i); - CMenuForwarderNonLocalized *fw = new CMenuForwarderNonLocalized(g_RemoteControl->current_PIDs.APIDs[i].desc, + CMenuForwarder *fw = new CMenuForwarder(g_RemoteControl->current_PIDs.APIDs[i].desc, true, NULL, this, apid, CRCInput::convertDigitToKey(i + 1)); fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); AudioSelector.addItem(fw, (i == g_RemoteControl->current_PIDs.PIDs.selected_apid)); @@ -156,7 +156,7 @@ int CAudioSelectMenuHandler::doMenu () snprintf(spid,sizeof(spid), "DVB:%d", sd->pId); char item[64]; snprintf(item,sizeof(item), "DVB: %s (pid %x)", sd->ISO639_language_code.c_str(), sd->pId); - AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/, + AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/, sd->pId != dvbsub_getpid(), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num))); } if (s->thisSubType == CZapitAbsSub::TTX) @@ -174,7 +174,7 @@ int CAudioSelectMenuHandler::doMenu () snprintf(spid,sizeof(spid), "TTX:%d:%03X:%s", sd->pId, page, sd->ISO639_language_code.c_str()); char item[64]; snprintf(item,sizeof(item), "TTX: %s (pid %x page %03X)", sd->ISO639_language_code.c_str(), sd->pId, page); - AudioSelector.addItem(new CMenuForwarderNonLocalized(item /*sd->ISO639_language_code.c_str()*/, + AudioSelector.addItem(new CMenuForwarder(item /*sd->ISO639_language_code.c_str()*/, !tuxtx_subtitle_running(&pid, &page, NULL), NULL, &SubtitleChanger, spid, CRCInput::convertDigitToKey(++shortcut_num))); } } diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 50d4ca2f3..a07ea0209 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -128,14 +128,14 @@ int CCAMMenuHandler::doMainMenu() char tmp[32]; snprintf(tmp, sizeof(tmp), "ca_ci%d", i); - cammenu->addItem(new CMenuForwarderNonLocalized(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); + cammenu->addItem(new CMenuForwarder(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); snprintf(tmp, sizeof(tmp), "ca_ci_reset%d", i); cammenu->addItem(new CMenuForwarder(LOCALE_CI_RESET, true, NULL, this, tmp)); memset(name1,0,sizeof(name1)); } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_CI_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarder(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (CiSlots - 1)) @@ -157,7 +157,7 @@ int CCAMMenuHandler::doMainMenu() char tmp[32]; snprintf(tmp, sizeof(tmp), "ca_sc%d", i); - cammenu->addItem(new CMenuForwarderNonLocalized(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); + cammenu->addItem(new CMenuForwarder(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); #if 0 // FIXME not implemented yet snprintf(tmp, sizeof(tmp), "ca_sc_reset%d", i); cammenu->addItem(new CMenuForwarder(LOCALE_SC_RESET, true, NULL, this, tmp)); @@ -166,7 +166,7 @@ int CCAMMenuHandler::doMainMenu() } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_SC_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarder(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (ScNum - 1)) @@ -330,27 +330,27 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t bpos = 0; tptr[li] = 0; printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); + menu->addItem(new CMenuForwarder(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); sptr = &tptr[li+1]; } bpos++; } if(strlen(sptr)) { printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); + menu->addItem(new CMenuForwarder(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); } } for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) { snprintf(cnt, sizeof(cnt), "%d", i); if(sublevel) - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt)); + menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt)); else - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i+1))); + menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->choice_item[i], strlen(pMenu->choice_item[i]), 0).c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i+1))); } slen = strlen(pMenu->bottom); if(slen) { printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false)); + menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false)); } menu->exec(NULL, ""); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 863533b1b..ae9816c14 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -1288,7 +1288,7 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) m->addItem(GenericMenuSeparatorLine); std::list::iterator it = g_settings.epg_search_history.begin(); for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it) - m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); + m->addItem(new CMenuForwarder((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); m->exec(NULL, ""); m->hide(); delete m; @@ -1345,7 +1345,7 @@ int CEventFinderMenu::showMenu(void) CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); - m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "#2", CRCInput::convertDigitToKey(shortcut++)); + m_search_channelname_mf = new CMenuForwarder("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "#2", CRCInput::convertDigitToKey(shortcut++)); CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "#1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 7e83d8391..96f79265b 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -138,7 +138,7 @@ class CEventListHandler : public CMenuTarget class CEventFinderMenu : public CMenuTarget, CChangeObserver { private: - CMenuForwarderNonLocalized* m_search_channelname_mf; + CMenuForwarder* m_search_channelname_mf; int* m_event; int* m_search_epg_item; std::string* m_search_keyword; diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 5b2318398..5f8b7d6d6 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -242,7 +242,7 @@ int CHDDMenuHandler::doMenu () tempMenu[i]->addItem(mf); snprintf(sstr, sizeof(sstr), "%s (%s)", g_Locale->getText(LOCALE_HDD_REMOVABLE_DEVICE), namelist[i]->d_name); - mf = new CMenuForwarderNonLocalized((removable ? sstr : namelist[i]->d_name), enabled, tmp_str[i], tempMenu[i]); + mf = new CMenuForwarder((removable ? sstr : namelist[i]->d_name), enabled, tmp_str[i], tempMenu[i]); mf->setHint("", LOCALE_MENU_HINT_HDD_TOOLS); hddmenu->addItem(mf); diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index ebfba55df..ba38027e2 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -111,7 +111,7 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) // e.g. vtxt-plugins sprintf(id, "%d", count); enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); cnt++; } } @@ -265,7 +265,7 @@ int CMiscMenue::showMiscSettingsMenu() //CPU CMenuWidget misc_menue_cpu("CPU", NEUTRINO_ICON_SETTINGS, width); showMiscSettingsMenuCPUFreq(&misc_menue_cpu); - misc_menue.addItem( new CMenuForwarderNonLocalized("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::RC_4)); + misc_menue.addItem( new CMenuForwarder("CPU", true, NULL, &misc_menue_cpu, NULL, CRCInput::RC_4)); #endif /*CPU_FREQ*/ int res = misc_menue.exec(NULL, ""); @@ -357,7 +357,7 @@ int CMiscMenue::showMiscSettingsMenuEnergy() ms_energy->addItem(m1); ms_energy->addItem(m2); - m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, NULL, new CSleepTimerWidget, "permanent"); + m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, NULL, new CSleepTimerWidget(true)); m2->setHint("", LOCALE_MENU_HINT_INACT_TIMER); ms_energy->addItem(m2); diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 082ee51d4..70b5862ea 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2977,7 +2977,7 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info) pBookItemMenu[li]->addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_POSITION, true, pBookPosIntInput[li]->getValue(), pBookPosIntInput[li])); pBookItemMenu[li]->addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_BOOK_TYPE, true, pBookTypeIntInput[li]->getValue(),pBookTypeIntInput[li])); - bookmarkMenu.addItem( new CMenuForwarderNonLocalized (movie_info->bookmarks.user[li].name.c_str(), true, pBookPosIntInput[li]->getValue(),pBookItemMenu[li])); + bookmarkMenu.addItem( new CMenuForwarder (movie_info->bookmarks.user[li].name.c_str(), true, pBookPosIntInput[li]->getValue(),pBookItemMenu[li])); } /********************************************************************/ @@ -3277,7 +3277,7 @@ int CMovieBrowser::showStartPosSelectionMenu(void) // P2 position[menu_nr] = m_movieSelectionHandler->bookmarks.user[i].pos + m_movieSelectionHandler->bookmarks.user[i].length; snprintf(book[i], 19,"%5d min",position[menu_nr]/60); - startPosSelectionMenu.addItem(new CMenuForwarderNonLocalized (m_movieSelectionHandler->bookmarks.user[i].name.c_str(), true, book[i])); + startPosSelectionMenu.addItem(new CMenuForwarder (m_movieSelectionHandler->bookmarks.user[i].name.c_str(), true, book[i])); menu_nr++; } } @@ -3692,7 +3692,7 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) m->addItem(GenericMenuSeparatorLine); std::list::iterator it = settings->ytsearch_history.begin(); for (int i = 0; i < settings->ytsearch_history_size; i++, ++it) - m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); + m->addItem(new CMenuForwarder((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); m->exec(NULL, ""); m->hide(); delete m; @@ -4131,7 +4131,7 @@ int CDirMenu::show(void) { snprintf(tmp, sizeof(tmp),"%d",i); tmp[1]=0; - dirMenu.addItem( new CMenuForwarderNonLocalized ( (*dirList)[i].name.c_str(), (dirState[i] != DIR_STATE_UNKNOWN), dirOptionText[i], this,tmp)); + dirMenu.addItem( new CMenuForwarder ( (*dirList)[i].name.c_str(), (dirState[i] != DIR_STATE_UNKNOWN), dirOptionText[i], this,tmp)); } int ret = dirMenu.exec(NULL," "); return ret; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 84d050bdf..23af4dd12 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -994,7 +994,7 @@ void CMoviePlayerGui::selectAudioPid(bool file_player) char cnt[5]; sprintf(cnt, "%d", count); - CMenuForwarderNonLocalized * item = new CMenuForwarderNonLocalized(apidtitle.c_str(), enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(count + 1)); + CMenuForwarder * item = new CMenuForwarder(apidtitle.c_str(), enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(count + 1)); APIDSelector.addItem(item, defpid); } @@ -1326,7 +1326,7 @@ void CMoviePlayerGui::selectChapter() char cnt[5]; for (unsigned i = 0; i < positions.size(); i++) { sprintf(cnt, "%d", i); - CMenuForwarderNonLocalized * item = new CMenuForwarderNonLocalized(titles[i].c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1)); + CMenuForwarder * item = new CMenuForwarder(titles[i].c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1)); ChSelector.addItem(item, position > positions[i]); } ChSelector.exec(NULL, ""); @@ -1361,7 +1361,7 @@ void CMoviePlayerGui::selectSubtitle() title = pidnumber; } sprintf(cnt, "%d", count); - CMenuForwarderNonLocalized * item = new CMenuForwarderNonLocalized(title.c_str(), enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(count + 1)); + CMenuForwarder * item = new CMenuForwarder(title.c_str(), enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(count + 1)); item->setItemButton(NEUTRINO_ICON_BUTTON_STOP, false); APIDSelector.addItem(item, defpid); } diff --git a/src/gui/network_setup.cpp b/src/gui/network_setup.cpp index a74ac4106..67b44db8d 100644 --- a/src/gui/network_setup.cpp +++ b/src/gui/network_setup.cpp @@ -233,7 +233,7 @@ int CNetworkSetup::showNetworkSetup() m0->setHint("", LOCALE_MENU_HINT_NET_SETUPNOW); //eth id - CMenuForwarder *mac = new CMenuForwarderNonLocalized("MAC", false, mac_addr); + CMenuForwarder *mac = new CMenuForwarder("MAC", false, mac_addr); //prepare input entries CIPInput networkSettings_NetworkIP(LOCALE_NETWORKMENU_IPADDRESS , network_address , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, this); @@ -828,7 +828,7 @@ int CNetworkSetup::showWlanList() const char * icon = NULL; if (networks[i].encrypted) icon = NEUTRINO_ICON_LOCK; - CMenuForwarderNonLocalized * net = new CMenuForwarderNonLocalized(networks[i].ssid.c_str(), true, option[i], selector, cnt, CRCInput::RC_nokey, NULL, icon); + CMenuForwarder * net = new CMenuForwarder(networks[i].ssid.c_str(), true, option[i], selector, cnt, CRCInput::RC_nokey, NULL, icon); net->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); wlist.addItem(net, networks[i].ssid == network_ssid); } diff --git a/src/gui/nfs.cpp b/src/gui/nfs.cpp index 4cb28a441..5cb6bbe25 100644 --- a/src/gui/nfs.cpp +++ b/src/gui/nfs.cpp @@ -183,7 +183,7 @@ int CNFSMountGui::menu() { sprintf(s2,"mountentry%d",i); ISO_8859_1_entry[i] = ZapitTools::UTF8_to_Latin1(m_entry[i].c_str()); - mountMenuEntry[i] = new CMenuForwarderNonLocalized("", true, ISO_8859_1_entry[i], this, s2); + mountMenuEntry[i] = new CMenuForwarder("", true, ISO_8859_1_entry[i], this, s2); if (!i) menu_offset = mountMenuW.getItemsCount(); @@ -324,7 +324,7 @@ int CNFSUmountGui::menu() s1 += it->mountPoint; std::string s2 = "doumount "; s2 += it->mountPoint; - CMenuForwarder *forwarder = new CMenuForwarderNonLocalized(s1.c_str(), true, NULL, this, s2.c_str()); + CMenuForwarder *forwarder = new CMenuForwarder(s1.c_str(), true, NULL, this, s2.c_str()); forwarder->iconName = NEUTRINO_ICON_MOUNTED; umountMenu.addItem(forwarder); } diff --git a/src/gui/nfs.h b/src/gui/nfs.h index 17f33e08b..1c3be441f 100644 --- a/src/gui/nfs.h +++ b/src/gui/nfs.h @@ -53,7 +53,7 @@ class CNFSMountGui : public CMenuTarget CMenuWidget *mountMenuWPtr; int menu_offset; - CMenuForwarderNonLocalized* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES]; + CMenuForwarder* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES]; CFSMounter::FS_Support m_nfs_sup; CFSMounter::FS_Support m_cifs_sup; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 903e5a761..8516f87d1 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -710,36 +710,42 @@ private: CChangeObserver * observer; CConfigFile * configfile; int32_t defaultvalue; - char value[11]; + std::string value; protected: - virtual const char * getOption(void) - { - sprintf(value, "%u", configfile->getInt32(locale_real_names[text], defaultvalue)); - return value; - } + std::string getOption(fb_pixel_t * bgcol __attribute__((unused)) = NULL) { + return to_string(configfile->getInt32(locale_real_names[name], defaultvalue)); + } virtual bool changeNotify(const neutrino_locale_t OptionName, void * Data) - { - configfile->setInt32(locale_real_names[text], atoi(value)); - return observer->changeNotify(OptionName, Data); - } + { + configfile->setInt32(locale_real_names[name], atoi(value.c_str())); + return observer->changeNotify(OptionName, Data); + } public: CMenuNumberInput(const neutrino_locale_t Text, const int32_t DefaultValue, CChangeObserver * const Observer, CConfigFile * const Configfile) : CMenuForwarder(Text, true, NULL, this) - { - observer = Observer; - configfile = Configfile; - defaultvalue = DefaultValue; - } + { + observer = Observer; + configfile = Configfile; + defaultvalue = DefaultValue; + } int exec(CMenuTarget * parent, const std::string & action_Key) - { - CStringInput input(text, (char *)getOption(), 3, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 ", this); - return input.exec(parent, action_Key); - } + { + value = getOption(); + while (value.length() < 3) + value = " " + value; + CStringInput input(name, &value, 3, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, "0123456789 ", this); + return input.exec(parent, action_Key); + } + + std::string &getValue(void) { + value = getOption(); + return value; + } }; void COsdSetup::AddFontSettingItem(CMenuWidget &font_Settings, const SNeutrinoSettings::FONT_TYPES number_of_fontsize_entry) diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 7a2ed7331..7a50f8792 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -324,7 +324,7 @@ int CPersonalizeGui::ShowPersonalizationMenu() } //personalized menues - CMenuForwarderNonLocalized *p_mn[widget_count]; + CMenuForwarder *p_mn[widget_count]; for (int i = 0; i<(widget_count); i++) { ostringstream i_str; @@ -332,7 +332,7 @@ int CPersonalizeGui::ShowPersonalizationMenu() string s(i_str.str()); string action_key = s; string mn_name = v_widget[i]->getName(); - p_mn[i] = new CMenuForwarderNonLocalized(mn_name.c_str(), true, NULL, this, action_key.c_str(), CRCInput::convertDigitToKey(i+1)); + p_mn[i] = new CMenuForwarder(mn_name.c_str(), true, NULL, this, action_key.c_str(), CRCInput::convertDigitToKey(i+1)); pMenu->addItem(p_mn[i]); } @@ -467,7 +467,7 @@ void CPersonalizeGui::ShowPluginMenu(CMenuWidget* p_widget) { if( g_PluginList->getType(i)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(i)) //don't show hidden plugins an games { - p_widget->addItem(new CMenuForwarderNonLocalized(g_PluginList->getName(i), true, g_PluginList->getDescription(i), NULL, NULL, getShortcut(d_key))); + p_widget->addItem(new CMenuForwarder(g_PluginList->getName(i), true, g_PluginList->getDescription(i), NULL, NULL, getShortcut(d_key))); d_key++; } } diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 638956ef3..b0ecff917 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -412,7 +412,7 @@ int CScanSetup::showScanMenu() CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarder(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); @@ -458,7 +458,7 @@ int CScanSetup::showScanMenu() CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarder(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); @@ -558,7 +558,7 @@ int CScanSetup::showScanMenuFrontendSetup() modestr[i] = g_Locale->getText(getModeLocale(fe->getMode())); - mf = new CMenuForwarderNonLocalized(name, allow_start, modestr[i], this, tmp, key, icon); + mf = new CMenuForwarder(name, allow_start, modestr[i], this, tmp, key, icon); mf->setHint("", LOCALE_MENU_HINT_SCAN_SETUP_FE); setupMenu->addItem(mf); if(i != 0) @@ -849,7 +849,7 @@ int CScanSetup::showScanMenuLnbSetup() char opt[100]; sprintf(opt, "diseqc %2d / rotor %2d", sit->second.diseqc+1, sit->second.motor_position); satoptions.push_back(opt); - CMenuForwarder * mf = new CMenuForwarderNonLocalized(satname.c_str(), true, satoptions[count].c_str(), tempsat); + CMenuForwarder * mf = new CMenuForwarder(satname.c_str(), true, satoptions[count].c_str(), tempsat); mf->setHint("", LOCALE_MENU_HINT_SCAN_LNBCONFIG); sat_setup->addItem(mf); satmf.push_back(mf); @@ -1535,7 +1535,7 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &actionkey) old_selected = i; std::string tname = t.description(); - CMenuForwarderNonLocalized * ts_item = new CMenuForwarderNonLocalized(tname.c_str(), true, NULL, selector, cnt, CRCInput::RC_nokey, NULL)/*, false*/; + CMenuForwarder * ts_item = new CMenuForwarder(tname.c_str(), true, NULL, selector, cnt, CRCInput::RC_nokey, NULL)/*, false*/; ts_item->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); menu.addItem(ts_item, old_selected == i); diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index eeb5dd079..2f2b2e446 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -42,7 +42,7 @@ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ bool CSleepTimerWidget::is_running = false; -int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) +int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &/*actionKey*/) { int res = menu_return::RETURN_REPAINT; @@ -53,24 +53,21 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) } is_running = true; - shutdown_min = 0; - char value[16]; + int shutdown_min = 0; + std::string value; CStringInput *inbox; - bool permanent = (actionKey == "permanent"); if (parent) parent->hide(); if(permanent) { - sprintf(value,"%03d", g_settings.shutdown_min); + value = to_string(g_settings.shutdown_min); + if (value.length() < 3) + value.insert(0, 3 - value.length(), '0'); + inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE2, &value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT3, "0123456789 "); } else { shutdown_min = g_Timerd->getSleepTimerRemaining(); // remaining shutdown time? - sprintf(value,"%03d", shutdown_min); - } - - if(permanent) { - inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE2, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT3, "0123456789 "); - } else { + value = to_string(shutdown_min); if (g_settings.sleeptimer_min == 0) { CSectionsdClient::CurrentNextInfo info_CurrentNext; g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext); @@ -79,14 +76,16 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer+150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ; if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000) { - sprintf(value,"%03d", current_epg_zeit_dauer_rest); + value = to_string(current_epg_zeit_dauer_rest); } } + } else { + value = to_string(g_settings.sleeptimer_min); } - else - sprintf(value,"%03d", g_settings.sleeptimer_min); + if (value.length() < 3) + value.insert(0, 3 - value.length(), '0'); - inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 "); + inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, &value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 "); } int ret = inbox->exec (NULL, ""); @@ -99,7 +98,7 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - int new_val = atoi(value); + int new_val = atoi(value.c_str()); if(permanent) { g_settings.shutdown_min = new_val; printf("permanent sleeptimer min: %d\n", g_settings.shutdown_min); @@ -125,15 +124,13 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) return res; } -const char * CSleepTimerWidget::getTargetValue() +std::string &CSleepTimerWidget::getValue(void) { - shutdown_min = g_Timerd->getSleepTimerRemaining(); - if (shutdown_min > 0) - { - shutdown_min_string = to_string(shutdown_min); - shutdown_min_string += " "; - shutdown_min_string += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); - return shutdown_min_string.c_str(); + if (permanent) { + valueStringTmp = (g_settings.shutdown_min > 0) ? to_string(g_settings.shutdown_min) + " " + g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE) : ""; + } else { + int remaining = g_Timerd->getSleepTimerRemaining(); + valueStringTmp = (remaining > 0) ? to_string(remaining) + " " + g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE) : ""; } - return NULL; + return valueStringTmp; } diff --git a/src/gui/sleeptimer.h b/src/gui/sleeptimer.h index f52f9bebc..0d612966e 100644 --- a/src/gui/sleeptimer.h +++ b/src/gui/sleeptimer.h @@ -29,12 +29,12 @@ class CSleepTimerWidget: public CMenuTarget { private: static bool is_running; - int shutdown_min; - std::string shutdown_min_string; + bool permanent; public: + CSleepTimerWidget(bool _permanent = false) { permanent = _permanent; } int exec(CMenuTarget* parent, const std::string & actionKey); - const char * getTargetValue(); + std::string &getValue(void); }; diff --git a/src/gui/subchannel_select.cpp b/src/gui/subchannel_select.cpp index 86b0a6a1c..36867ce1c 100644 --- a/src/gui/subchannel_select.cpp +++ b/src/gui/subchannel_select.cpp @@ -100,11 +100,11 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu) nvod_time_x[0]= 0; sprintf(nvod_s, "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x); - menu->addItem(new CMenuForwarderNonLocalized(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel)); + menu->addItem(new CMenuForwarder(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel)); } else { - menu->addItem(new CMenuForwarderNonLocalized(e->subservice_name.c_str(), enabled, NULL, &NVODChanger, nvod_id, CRCInput::convertDigitToKey(count)), (count == g_RemoteControl->selected_subchannel)); + menu->addItem(new CMenuForwarder(e->subservice_name.c_str(), enabled, NULL, &NVODChanger, nvod_id, CRCInput::convertDigitToKey(count)), (count == g_RemoteControl->selected_subchannel)); } count++; diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index e9687e322..94fcf2b3e 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -665,15 +665,15 @@ int CTestMenu::showTestMenu() //hardware CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_HARDWARE); - w_test.addItem(new CMenuForwarderNonLocalized(w_hw->getName().c_str(), true, NULL, w_hw)); + w_test.addItem(new CMenuForwarder(w_hw->getName().c_str(), true, NULL, w_hw)); showHWTests(w_hw); //buttons - w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); + w_test.addItem(new CMenuForwarder("Buttons", true, NULL, this, "buttons")); //components CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_COMPONENTS); - w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc)); + w_test.addItem(new CMenuForwarder(w_cc->getName().c_str(), true, NULL, w_cc)); showCCTests(w_cc); //buildinfo @@ -688,31 +688,31 @@ int CTestMenu::showTestMenu() void CTestMenu::showCCTests(CMenuWidget *widget) { widget->addIntroItems(); - widget->addItem(new CMenuForwarderNonLocalized("Running Clock", true, NULL, this, "running_clock")); - widget->addItem(new CMenuForwarderNonLocalized("Clock", true, NULL, this, "clock")); - widget->addItem(new CMenuForwarderNonLocalized("Button", true, NULL, this, "button")); - widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); - widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); - widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); - widget->addItem(new CMenuForwarderNonLocalized("Channel-Logo", true, NULL, this, "channellogo")); - widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); - widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); - widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); - widget->addItem(new CMenuForwarderNonLocalized("Footer", true, NULL, this, "footer")); - widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform")); - widget->addItem(new CMenuForwarderNonLocalized("Window", true, NULL, this, "window")); - widget->addItem(new CMenuForwarderNonLocalized("Text-Extended", true, NULL, this, "text_ext")); + widget->addItem(new CMenuForwarder("Running Clock", true, NULL, this, "running_clock")); + widget->addItem(new CMenuForwarder("Clock", true, NULL, this, "clock")); + widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button")); + widget->addItem(new CMenuForwarder("Circle", true, NULL, this, "circle")); + widget->addItem(new CMenuForwarder("Square", true, NULL, this, "square")); + widget->addItem(new CMenuForwarder("Picture", true, NULL, this, "picture")); + widget->addItem(new CMenuForwarder("Channel-Logo", true, NULL, this, "channellogo")); + widget->addItem(new CMenuForwarder("Form", true, NULL, this, "form")); + widget->addItem(new CMenuForwarder("Text", true, NULL, this, "text")); + widget->addItem(new CMenuForwarder("Header", true, NULL, this, "header")); + widget->addItem(new CMenuForwarder("Footer", true, NULL, this, "footer")); + widget->addItem(new CMenuForwarder("Icon-Form", true, NULL, this, "iconform")); + widget->addItem(new CMenuForwarder("Window", true, NULL, this, "window")); + widget->addItem(new CMenuForwarder("Text-Extended", true, NULL, this, "text_ext")); } void CTestMenu::showHWTests(CMenuWidget *widget) { widget->addIntroItems(); - widget->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, this, "vfd")); - widget->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, this, "network")); - widget->addItem(new CMenuForwarderNonLocalized("Smartcard 1", true, NULL, this, "card0")); - widget->addItem(new CMenuForwarderNonLocalized("Smartcard 2", true, NULL, this, "card1")); - widget->addItem(new CMenuForwarderNonLocalized("HDD", true, NULL, this, "hdd")); - widget->addItem(new CMenuForwarderNonLocalized("SD/MMC", true, NULL, this, "mmc")); + widget->addItem(new CMenuForwarder("VFD", true, NULL, this, "vfd")); + widget->addItem(new CMenuForwarder("Network", true, NULL, this, "network")); + widget->addItem(new CMenuForwarder("Smartcard 1", true, NULL, this, "card0")); + widget->addItem(new CMenuForwarder("Smartcard 2", true, NULL, this, "card1")); + widget->addItem(new CMenuForwarder("HDD", true, NULL, this, "hdd")); + widget->addItem(new CMenuForwarder("SD/MMC", true, NULL, this, "mmc")); for (unsigned i = 0; i < sizeof(test_pos)/sizeof(int); i++) { CServiceManager::getInstance()->InitSatPosition(test_pos[i], NULL, true); @@ -732,7 +732,7 @@ void CTestMenu::showHWTests(CMenuWidget *widget) } else continue; - widget->addItem(new CMenuForwarderNonLocalized(title, true, NULL, this, scan)); + widget->addItem(new CMenuForwarder(title, true, NULL, this, scan)); if (frontend->getInfo()->type == FE_QPSK) { frontend->setMode(CFrontend::FE_MODE_INDEPENDENT); @@ -740,20 +740,20 @@ void CTestMenu::showHWTests(CMenuWidget *widget) satmap[test_pos[i]].configured = 1; frontend->setSatellites(satmap); if (i == 0) { - widget->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz ON", true, NULL, this, "22kon0")); - widget->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz OFF", true, NULL, this, "22koff0")); + widget->addItem(new CMenuForwarder("Tuner 1: 22 Khz ON", true, NULL, this, "22kon0")); + widget->addItem(new CMenuForwarder("Tuner 1: 22 Khz OFF", true, NULL, this, "22koff0")); } if (i == 1) { - widget->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz ON", true, NULL, this, "22kon1")); - widget->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz OFF", true, NULL, this, "22koff1")); + widget->addItem(new CMenuForwarder("Tuner 2: 22 Khz ON", true, NULL, this, "22kon1")); + widget->addItem(new CMenuForwarder("Tuner 2: 22 Khz OFF", true, NULL, this, "22koff1")); } if (i == 2) { - widget->addItem(new CMenuForwarderNonLocalized("Tuner 3: 22 Khz ON", true, NULL, this, "22kon2")); - widget->addItem(new CMenuForwarderNonLocalized("Tuner 3: 22 Khz OFF", true, NULL, this, "22koff2")); + widget->addItem(new CMenuForwarder("Tuner 3: 22 Khz ON", true, NULL, this, "22kon2")); + widget->addItem(new CMenuForwarder("Tuner 3: 22 Khz OFF", true, NULL, this, "22koff2")); } if (i == 3) { - widget->addItem(new CMenuForwarderNonLocalized("Tuner 4: 22 Khz ON", true, NULL, this, "22kon3")); - widget->addItem(new CMenuForwarderNonLocalized("Tuner 4: 22 Khz OFF", true, NULL, this, "22koff3")); + widget->addItem(new CMenuForwarder("Tuner 4: 22 Khz ON", true, NULL, this, "22kon3")); + widget->addItem(new CMenuForwarder("Tuner 4: 22 Khz OFF", true, NULL, this, "22koff3")); } } } diff --git a/src/gui/themes.cpp b/src/gui/themes.cpp index 5786a237d..64644e555 100644 --- a/src/gui/themes.cpp +++ b/src/gui/themes.cpp @@ -129,9 +129,9 @@ void CThemes::readThemes(CMenuWidget &themes) *pos = '\0'; if ( p == 1 ) { userThemeFile = "{U}" + (std::string)file; - oj = new CMenuForwarderNonLocalized((char*)file, true, "", this, userThemeFile.c_str()); + oj = new CMenuForwarder((char*)file, true, "", this, userThemeFile.c_str()); } else - oj = new CMenuForwarderNonLocalized((char*)file, true, "", this, file); + oj = new CMenuForwarder((char*)file, true, "", this, file); themes.addItem( oj ); } free(themelist[count]); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 35180e121..4f3ca671d 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -88,12 +88,12 @@ private: CMenuItem* m4; CMenuItem* m5; CMenuItem* m6; - char* display; + std::string * display; int* iType; time_t* stopTime; public: CTimerListNewNotifier( int* Type, time_t* time,CMenuItem* a1, CMenuItem* a2, - CMenuItem* a3, CMenuItem* a4, CMenuItem* a5, CMenuItem* a6,char* d) + CMenuItem* a3, CMenuItem* a4, CMenuItem* a5, CMenuItem* a6, std::string *d) { m1 = a1; m2 = a2; @@ -112,16 +112,18 @@ public: { *stopTime=(time(NULL)/60)*60; struct tm *tmTime2 = localtime(stopTime); - sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1, + char disp[40]; + snprintf(disp, sizeof(disp), "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1, tmTime2->tm_year+1900, tmTime2->tm_hour, tmTime2->tm_min); + *display = std::string(disp); m1->setActive(true); m6->setActive((g_settings.recording_type == RECORDING_FILE)); } else { *stopTime=0; - strcpy(display," "); + *display = " "; m1->setActive (false); m6->setActive(false); } @@ -158,9 +160,9 @@ private: CMenuForwarder* m2; int* iRepeat; - char * weekdays; + std::string * weekdays; public: - CTimerListRepeatNotifier( int* repeat, CMenuForwarder* a1, CMenuForwarder *a2, char * wstr) + CTimerListRepeatNotifier( int* repeat, CMenuForwarder* a1, CMenuForwarder *a2, std::string * wstr) { m1 = a1; m2 = a2; @@ -172,11 +174,11 @@ public: { if (*iRepeat >= (int)CTimerd::TIMERREPEAT_WEEKDAYS) { m1->setActive (true); - strcpy(weekdays, "XXXXX--"); + *weekdays = "XXXXX--"; } else { m1->setActive (false); - strcpy(weekdays, "-------"); + *weekdays = "-------"; } if (*iRepeat != (int)CTimerd::TIMERREPEAT_ONCE) m2->setActive(true); @@ -1081,13 +1083,13 @@ int CTimerList::modifyTimer() Timer->setWeekdaysToStr(timer->eventRepeat, m_weekdaysStr); timer->eventRepeat = (CTimerd::CTimerEventRepeat)(((int)timer->eventRepeat) & 0x1FF); - CStringInput timerSettings_weekdays(LOCALE_TIMERLIST_WEEKDAYS, m_weekdaysStr, 7, LOCALE_TIMERLIST_WEEKDAYS_HINT_1, LOCALE_TIMERLIST_WEEKDAYS_HINT_2, "-X"); + CStringInput timerSettings_weekdays(LOCALE_TIMERLIST_WEEKDAYS, &m_weekdaysStr, 7, LOCALE_TIMERLIST_WEEKDAYS_HINT_1, LOCALE_TIMERLIST_WEEKDAYS_HINT_2, "-X"); CMenuForwarder *m4 = new CMenuForwarder(LOCALE_TIMERLIST_WEEKDAYS, ((int)timer->eventRepeat) >= (int)CTimerd::TIMERREPEAT_WEEKDAYS, m_weekdaysStr, &timerSettings_weekdays ); CIntInput timerSettings_repeatCount(LOCALE_TIMERLIST_REPEATCOUNT, (int&)timer->repeatCount,3, LOCALE_TIMERLIST_REPEATCOUNT_HELP1, LOCALE_TIMERLIST_REPEATCOUNT_HELP2); CMenuForwarder *m5 = new CMenuForwarder(LOCALE_TIMERLIST_REPEATCOUNT, timer->eventRepeat != (int)CTimerd::TIMERREPEAT_ONCE ,timerSettings_repeatCount.getValue() , &timerSettings_repeatCount); - CTimerListRepeatNotifier notifier((int *)&timer->eventRepeat,m4,m5, m_weekdaysStr); + CTimerListRepeatNotifier notifier((int *)&timer->eventRepeat,m4,m5, &m_weekdaysStr); CMenuOptionChooser* m3 = new CMenuOptionChooser(LOCALE_TIMERLIST_REPEAT, (int *)&timer->eventRepeat, TIMERLIST_REPEAT_OPTIONS, TIMERLIST_REPEAT_OPTION_COUNT, true, ¬ifier); //printf("TIMER: rec dir %s len %s\n", timer->recordingDir, strlen(timer->recordingDir)); @@ -1162,14 +1164,14 @@ int CTimerList::newTimer() CDateInput timerSettings_stopTime(LOCALE_TIMERLIST_STOPTIME, &(timerNew.stopTime) , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2); CMenuForwarder *m2 = new CMenuForwarder(LOCALE_TIMERLIST_STOPTIME, true, timerSettings_stopTime.getValue (), &timerSettings_stopTime ); - CStringInput timerSettings_weekdays(LOCALE_TIMERLIST_WEEKDAYS, m_weekdaysStr, 7, LOCALE_TIMERLIST_WEEKDAYS_HINT_1, LOCALE_TIMERLIST_WEEKDAYS_HINT_2, "-X"); + CStringInput timerSettings_weekdays(LOCALE_TIMERLIST_WEEKDAYS, &m_weekdaysStr, 7, LOCALE_TIMERLIST_WEEKDAYS_HINT_1, LOCALE_TIMERLIST_WEEKDAYS_HINT_2, "-X"); CMenuForwarder *m4 = new CMenuForwarder(LOCALE_TIMERLIST_WEEKDAYS, false, m_weekdaysStr, &timerSettings_weekdays); CIntInput timerSettings_repeatCount(LOCALE_TIMERLIST_REPEATCOUNT, (int&)timerNew.repeatCount,3, LOCALE_TIMERLIST_REPEATCOUNT_HELP1, LOCALE_TIMERLIST_REPEATCOUNT_HELP2); CMenuForwarder *m5 = new CMenuForwarder(LOCALE_TIMERLIST_REPEATCOUNT, false,timerSettings_repeatCount.getValue() , &timerSettings_repeatCount); - CTimerListRepeatNotifier notifier((int *)&timerNew.eventRepeat,m4,m5, m_weekdaysStr); - strcpy(m_weekdaysStr,"XXXXX--"); + CTimerListRepeatNotifier notifier((int *)&timerNew.eventRepeat,m4,m5, &m_weekdaysStr); + m_weekdaysStr = "XXXXX--"; CMenuOptionChooser* m3 = new CMenuOptionChooser(LOCALE_TIMERLIST_REPEAT, (int *)&timerNew.eventRepeat, TIMERLIST_REPEAT_OPTIONS, TIMERLIST_REPEAT_OPTION_COUNT, true, ¬ifier); @@ -1188,20 +1190,20 @@ int CTimerList::newTimer() for (int j = 0; j < (int) channels.size(); j++) { char cChannelId[3+16+1+1]; sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->channel_id); - mwtv->addItem(new CMenuForwarderNonLocalized(channels[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : NULL)); + mwtv->addItem(new CMenuForwarder(channels[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : NULL)); } if (!channels.empty()) - mctv.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str() /*g_bouquetManager->Bouquets[i]->Name.c_str()*/, true, NULL, mwtv)); + mctv.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str() /*g_bouquetManager->Bouquets[i]->Name.c_str()*/, true, NULL, mwtv)); g_bouquetManager->Bouquets[i]->getRadioChannels(channels); for (int j = 0; j < (int) channels.size(); j++) { char cChannelId[3+16+1+1]; sprintf(cChannelId, "SC:" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ",", channels[j]->channel_id); - mwradio->addItem(new CMenuForwarderNonLocalized(channels[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : NULL)); + mwradio->addItem(new CMenuForwarder(channels[j]->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_SCRAMBLED : NULL)); } if (!channels.empty()) - mcradio.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwradio)); + mcradio.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwradio)); } } @@ -1225,7 +1227,7 @@ int CTimerList::newTimer() CTimerListNewNotifier notifier2((int *)&timerNew.eventType, &timerNew.stopTime,m2,m6,m8,m9,m10,m7, - timerSettings_stopTime.getValue()); + &timerSettings_stopTime.getValue()); CMenuOptionChooser* m0; if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) m0 = new CMenuOptionChooser(LOCALE_TIMERLIST_TYPE, (int *)&timerNew.eventType, TIMERLIST_TYPE_OPTIONS, TIMERLIST_TYPE_OPTION_COUNT, true, ¬ifier2); diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 4e752c4e6..067d942bb 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -64,7 +64,7 @@ class CTimerList : public CMenuTarget CTimerd::responseGetTimer timerNew; int timerNew_standby_on; char timerNew_channel_name[30]; - char m_weekdaysStr[8]; + std::string m_weekdaysStr; int timer_apids_dflt; int timer_apids_std; diff --git a/src/gui/update.cpp b/src/gui/update.cpp index c9a725678..48d65de19 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -162,7 +162,7 @@ bool CFlashUpdate::selectHttpImage(void) SelectionWidget.addItem(GenericMenuBack); SelectionWidget.addItem(new CMenuSeparator(CMenuSeparator::LINE)); - SelectionWidget.addItem(new CMenuForwarderNonLocalized(current, false)); + SelectionWidget.addItem(new CMenuForwarder(current, false)); std::ifstream urlFile(g_settings.softupdate_url_file); #ifdef DEBUG printf("[update] file %s\n", g_settings.softupdate_url_file); @@ -230,10 +230,10 @@ bool CFlashUpdate::selectHttpImage(void) descriptions.push_back(description); /* workaround since CMenuForwarder does not store the Option String itself */ - //SelectionWidget.addItem(new CMenuForwarderNonLocalized(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected))); + //SelectionWidget.addItem(new CMenuForwarder(names[i].c_str(), enabled, descriptions[i].c_str(), new CUpdateMenuTarget(i, &selected))); CUpdateMenuTarget * up = new CUpdateMenuTarget(i, &selected); update_t_list.push_back(up); - SelectionWidget.addItem(new CMenuForwarderNonLocalized(descriptions[i].c_str(), enabled, names[i].c_str(), up)); + SelectionWidget.addItem(new CMenuForwarder(descriptions[i].c_str(), enabled, names[i].c_str(), up)); i++; } } @@ -814,7 +814,7 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) enabled = false; // build jffs2 image from root0 if ((actionkey == "readmtd") && (lx == mtdInfo->findMTDNumberFromName("root0"))) { - CMenuForwarder *mf = new CMenuDForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); + CMenuForwarder *mf = new CMenuDForwarder("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); mtdselector->addItem(mf); continue; } @@ -824,11 +824,11 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) enabled = false; #endif sprintf(sActionKey, "%s%d", actionkey.c_str(), lx); - mtdselector->addItem(new CMenuForwarderNonLocalized(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++))); + mtdselector->addItem(new CMenuForwarder(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++))); } #ifndef BOXMODEL_APOLLO if (actionkey == "writemtd") - mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); + mtdselector->addItem(new CMenuForwarder("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); #endif int res = mtdselector->exec(NULL,""); delete mtdselector; @@ -855,7 +855,7 @@ int CFlashExpert::showFileSelector(const std::string & actionkey) int pos = filen.find(".img"); if(pos!=-1) { - fileselector->addItem(new CMenuForwarderNonLocalized(filen.c_str(), true, NULL, this, (actionkey + filen).c_str())); + fileselector->addItem(new CMenuForwarder(filen.c_str(), true, NULL, this, (actionkey + filen).c_str())); //TODO make sure filen is UTF-8 encoded } free(namelist[count]); diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 914b04ca7..d70d8ba5d 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -319,7 +319,7 @@ bool CUserMenu::showUserMenu(int button) //printf("[neutrino usermenu] plugin %d, set key %d...\n", count, g_PluginList->getKey(count)); StreamFeaturesChanger = new CStreamFeaturesChangeExec(); keyhelper.get(&key,&icon, d_key); - menu_item = new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); + menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); menu->addItem(menu_item, 0); cnt++; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 83838687f..6b8257306 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -39,6 +39,7 @@ #include #include +#include #include @@ -174,14 +175,12 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(name_start_x, y+ item_height, _dx- (name_start_x - x), left_text, item_color, 0, true); // UTF-8 //right text - if (right_text || right_bgcol) + if (right_text && (*right_text || right_bgcol)) { - int stringwidth = 0; - if (right_text) - stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(right_text, true); + int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(right_text, true); int stringstartposOption = std::max(name_start_x + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(left_text, true) + icon_frame_w, x + dx - stringwidth - icon_frame_w); //+ offx if (right_bgcol) { - if (!right_text) + if (!*right_text) stringstartposOption -= 60; fb_pixel_t right_frame_col, right_bg_col; if (active) { @@ -197,7 +196,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, col.setCorner(RADIUS_LARGE); col.paint(false); } - if (right_text) { + if (*right_text) { stringstartposOption -= (icon_w == 0 ? 0 : icon_w + icon_frame_w); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(stringstartposOption, y+item_height,dx- (stringstartposOption- x), right_text, item_color, 0, true); } @@ -1457,7 +1456,7 @@ int CMenuOptionChooser::exec(CMenuTarget*) else l_option = g_Locale->getText(options[count].value); sprintf(cnt, "%d", count); - CMenuForwarderNonLocalized *mn_option = new CMenuForwarderNonLocalized(l_option, true, NULL, selector, cnt); + CMenuForwarder *mn_option = new CMenuForwarder(l_option, true, NULL, selector, to_string(count).c_str()); mn_option->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true /*for selected item*/); menu->addItem(mn_option, selected); } @@ -1640,7 +1639,7 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent) if (strcmp(options[count].c_str(), optionValue) == 0) selected = true; sprintf(cnt, "%d", count); - CMenuForwarderNonLocalized *mn_option = new CMenuForwarderNonLocalized(options[count].c_str(), true, NULL, selector, cnt); + CMenuForwarder *mn_option = new CMenuForwarder(options[count], true, NULL, selector, to_string(count).c_str()); mn_option->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true /*for selected item*/); menu->addItem(mn_option, selected); } @@ -1757,25 +1756,11 @@ int CMenuOptionLanguageChooser::paint( bool selected ) } //------------------------------------------------------------------------------------------------------------------------------- -CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) -{ - option = Option; - option_string = NULL; - text=Text; - active = Active; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; - directKey = DirectKey; - iconName = IconName ? IconName : ""; - iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; - isStatic = IsStatic; -} - CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) { - option = NULL; - option_string = &Option; - text=Text; + option_string_ptr = &Option; + name = Text; + nameString = ""; active = Active; jumpTarget = Target; actionKey = ActionKey ? ActionKey : ""; @@ -1785,20 +1770,65 @@ CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, isStatic = IsStatic; } -void CMenuForwarder::setOption(const char * const Option) +CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) { - option = Option; - option_string = NULL; - if (used && x != -1) - paint(); + option_string_ptr = &Option; + name = NONEXISTANT_LOCALE; + nameString = Text; + active = Active; + jumpTarget = Target; + actionKey = ActionKey ? ActionKey : ""; + directKey = DirectKey; + iconName = IconName ? IconName : ""; + iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; + isStatic = IsStatic; +} + +CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) +{ + option_string = Option ? Option : ""; + option_string_ptr = &option_string; + name = Text; + nameString = ""; + active = Active; + jumpTarget = Target; + actionKey = ActionKey ? ActionKey : ""; + directKey = DirectKey; + iconName = IconName ? IconName : ""; + iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; + isStatic = IsStatic; +} + +CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) +{ + option_string = Option ? Option : ""; + option_string_ptr = &option_string; + name = NONEXISTANT_LOCALE; + nameString = Text; + active = Active; + jumpTarget = Target; + actionKey = ActionKey ? ActionKey : ""; + directKey = DirectKey; + iconName = IconName ? IconName : ""; + iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; + isStatic = IsStatic; +} + +void CMenuForwarder::setName(const std::string& t) +{ + name = NONEXISTANT_LOCALE; + nameString = t; +} + +void CMenuForwarder::setName(const neutrino_locale_t t) +{ + name = t; + nameString = ""; } void CMenuForwarder::setOption(const std::string &Option) { - option = NULL; - option_string = &Option; - if (used && x != -1) - paint(); + option_string = Option; } int CMenuForwarder::getHeight(void) const @@ -1806,32 +1836,18 @@ int CMenuForwarder::getHeight(void) const return g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); } -// used gets set by the addItem() function. This is for set to paint Text from locales by just not calling the addItem() function. -// Without this, the changeNotifiers would become machine-dependent. -void CMenuForwarder::setTextLocale(const neutrino_locale_t Text) -{ - text=Text; - - if (used && x != -1) - paint(); -} - int CMenuForwarder::getWidth(void) { - int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(text), true); - const char * option_text = NULL; - - if (option) - option_text = option; - else if (option_string) - option_text = option_string->c_str(); + const char *_name = (name == NONEXISTANT_LOCALE) ? nameString.c_str() : g_Locale->getText(name); + int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(_name, true); fb_pixel_t bgcol = 0; + std::string option_name = getOption(); if (jumpTarget) bgcol = jumpTarget->getColor(); - if (option_text != NULL) - tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_text, true); + if (!option_name.empty()) + tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_name.c_str(), true); else if (bgcol) tw += 10 + 60; @@ -1850,28 +1866,21 @@ int CMenuForwarder::exec(CMenuTarget* parent) } } -const char * CMenuForwarder::getOption(void) +std::string CMenuForwarder::getOption(void) { - if (option) - return option; - if (option_string) - return option_string->c_str(); + if (!option_string_ptr->empty()) + return *option_string_ptr; if (jumpTarget) - return jumpTarget->getTargetValue(); - return NULL; -} - -const char * CMenuForwarder::getName(void) -{ - return g_Locale->getText(text); + return jumpTarget->getValue(); + return ""; } int CMenuForwarder::paint(bool selected) { int height = getHeight(); - const char * l_text = getName(); + const char * l_name = getName(); - const char * option_text = getOption(); + std::string option_name = getOption(); fb_pixel_t bgcol = 0; if (jumpTarget) bgcol = jumpTarget->getColor(); @@ -1883,80 +1892,11 @@ int CMenuForwarder::paint(bool selected) paintItemButton(selected, height); //caption - paintItemCaption(selected, height, l_text, option_text, bgcol); + paintItemCaption(selected, height, l_name, option_name.c_str(), bgcol); return y+ height; } -CMenuDForwarder::CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) - : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ -} - -CMenuDForwarder::CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) - : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ -} - -CMenuDForwarder::~CMenuDForwarder() -{ - delete jumpTarget; -} - -//------------------------------------------------------------------------------------------------------------------------------- -const char * CMenuForwarderNonLocalized::getName(void) -{ - return the_text.c_str(); -} - -CMenuForwarderNonLocalized::CMenuForwarderNonLocalized(const char * const Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarder(NONEXISTANT_LOCALE, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ - the_text = Text; -} - -CMenuForwarderNonLocalized::CMenuForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarder(NONEXISTANT_LOCALE, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ - the_text = Text; -} - -// used gets set by the addItem() function. This is for set to paint non localized Text by just not calling the addItem() function. -// Without this, the changeNotifiers would become machine-dependent. -void CMenuForwarderNonLocalized::setText(const char * const Text) -{ - the_text = Text; - - if (used && x != -1) - paint(); -} - -int CMenuForwarderNonLocalized::getWidth(void) -{ - int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(the_text, true); - const char * option_text = NULL; - if (option) - option_text = option; - else if (option_string) - option_text = option_string->c_str(); - - if (option_text != NULL) - tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_text, true); - - return tw; -} - -CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ -} - -CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) -{ -} - -CMenuDForwarderNonLocalized::~CMenuDForwarderNonLocalized() -{ - delete jumpTarget; -} - //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, bool IsStatic) { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 5e0d826a2..56cfcc88e 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -79,13 +79,16 @@ class CChangeObserver class CMenuTarget { + protected: + std::string *valueString; + std::string valueStringTmp; public: - CMenuTarget(){} + CMenuTarget(){ valueString = &valueStringTmp; } virtual ~CMenuTarget(){} virtual void hide(){} virtual int exec(CMenuTarget* parent, const std::string & actionKey) = 0; + virtual std::string &getValue(void) { return *valueString; } virtual fb_pixel_t getColor(void) { return 0; } - virtual const char * getTargetValue() { return NULL; } }; class CMenuItem @@ -200,72 +203,67 @@ class CMenuSeparator : public CMenuItem class CMenuForwarder : public CMenuItem { - std::string actionKey; + std::string actionKey; protected: - const char * option; - const std::string * option_string; - CMenuTarget * jumpTarget; - neutrino_locale_t text; + std::string option_string; + const std::string * option_string_ptr; + CMenuTarget * jumpTarget; - virtual const char * getOption(void); - virtual const char * getName(void); + virtual std::string getOption(void); public: - CMenuForwarder(const neutrino_locale_t Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); - CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); + CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); + CMenuForwarder(const std::string & Text, const bool Active, const std::string &Option, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); + CMenuForwarder(const neutrino_locale_t Text, const bool Active = true, const char * const Option=NULL, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); + CMenuForwarder(const std::string & Text, const bool Active = true, const char * const Option=NULL, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); virtual ~CMenuForwarder(){} int paint(bool selected=false); int getHeight(void) const; int getWidth(void); - void setTextLocale(const neutrino_locale_t Text); - neutrino_locale_t getTextLocale() const {return text;}; - CMenuTarget* getTarget() const {return jumpTarget;}; - std::string getActionKey(){return actionKey;}; + neutrino_locale_t getTextLocale() const {return name;} + CMenuTarget* getTarget() const {return jumpTarget;} + std::string getActionKey(){return actionKey;} int exec(CMenuTarget* parent); - bool isSelectable(void) const - { - return active; - } - void setOption(const char * const Option); + bool isSelectable(void) const { return active; } void setOption(const std::string &Option); + void setName(const std::string& text); + void setName(const neutrino_locale_t text); }; class CMenuDForwarder : public CMenuForwarder { public: - CMenuDForwarder(const neutrino_locale_t Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); - CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); + CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; + CMenuDForwarder(const std::string & Text, const bool Active, const std::string &Option, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; + CMenuDForwarder(const neutrino_locale_t Text, const bool Active=true, const char * const Option=NULL, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; + CMenuDForwarder(const std::string & Text, const bool Active=true, const char * const Option=NULL, + CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; - ~CMenuDForwarder(); -}; - -class CMenuForwarderNonLocalized : public CMenuForwarder -{ - protected: - std::string the_text; - virtual const char * getName(void); - public: - // Text must be UTF-8 encoded: - CMenuForwarderNonLocalized(const char * const Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); - CMenuForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); - virtual ~CMenuForwarderNonLocalized(){} - - int getWidth(void); - - void setText(const char * const Text); -}; - -class CMenuDForwarderNonLocalized : public CMenuForwarderNonLocalized -{ - public: - CMenuDForwarderNonLocalized(const char * const Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); - CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); - ~CMenuDForwarderNonLocalized(); + ~CMenuDForwarder() { delete jumpTarget; } }; class CAbstractMenuOptionChooser : public CMenuItem diff --git a/src/gui/widget/mountchooser.cpp b/src/gui/widget/mountchooser.cpp index ff3f25ebe..fa56e462f 100644 --- a/src/gui/widget/mountchooser.cpp +++ b/src/gui/widget/mountchooser.cpp @@ -53,7 +53,7 @@ CMountChooser::CMountChooser(const neutrino_locale_t Name, const std::string & I { std::string s = g_settings.network_nfs[i].local_dir + " (" + g_settings.network_nfs[i].ip + ":" + g_settings.network_nfs[i].dir + ")"; snprintf(indexStr,sizeof(indexStr),"%d",i); - addItem(new CMenuForwarderNonLocalized(s.c_str(),true,NULL,this,(std::string("MID:") + std::string(indexStr)).c_str()), + addItem(new CMenuForwarder(s.c_str(),true,NULL,this,(std::string("MID:") + std::string(indexStr)).c_str()), selectedLocalDir == g_settings.network_nfs[i].local_dir); } } diff --git a/src/gui/widget/stringinput_ext.h b/src/gui/widget/stringinput_ext.h index 26e1c0d6f..cd1d9665f 100644 --- a/src/gui/widget/stringinput_ext.h +++ b/src/gui/widget/stringinput_ext.h @@ -180,7 +180,6 @@ class CDateInput : public CExtendedInput public: CDateInput(const neutrino_locale_t Name, time_t* Time, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ = NULL); ~CDateInput(); - char* getValue() {return value;} }; //---------------------------------------------------------------------------------------------------- @@ -230,9 +229,6 @@ class CIntInput : public CExtendedInput *@param Size how many digits can be entered */ CIntInput(const neutrino_locale_t Name, int& Value, const unsigned int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ = NULL); - char* getValue() { - return myValueStringOutput; - } void updateValue() { onBeforeExec(); } }; diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index c869c2d41..a9b2e8bc3 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -161,14 +161,14 @@ int CSelectChannelWidget::InitZapitChannelHelper(CZapitClient::channelsMode mode char cChannelId[60] = {0}; snprintf(cChannelId, sizeof(cChannelId), "ZC%c:%d|%" PRIx64 "#", (mode==CZapitClient::MODE_TV)?'T':'R', channel->number, channel->channel_id); - CMenuForwarderNonLocalized * chan_item = new CMenuForwarderNonLocalized(channel->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channel->getName()).c_str(), CRCInput::RC_nokey, NULL, channel->scrambled ?NEUTRINO_ICON_SCRAMBLED:NULL); + CMenuForwarder * chan_item = new CMenuForwarder(channel->getName().c_str(), true, NULL, this, (std::string(cChannelId) + channel->getName()).c_str(), CRCInput::RC_nokey, NULL, channel->scrambled ?NEUTRINO_ICON_SCRAMBLED:NULL); chan_item->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); mwtv->addItem(chan_item); } if(!channels.empty() && (!g_bouquetManager->Bouquets[i]->bHidden )) { - mctv.addItem(new CMenuForwarderNonLocalized(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwtv)); + mctv.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->Name.c_str(), true, NULL, mwtv)); } } int res = mctv.exec (NULL, ""); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 453f9f5a8..a180fa93a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3621,7 +3621,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) // zB vtxt-plugins sprintf(id, "%d", count); enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarderNonLocalized(g_PluginList->getName(count), true, NULL, MoviePluginChanger, id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, MoviePluginChanger, id, CRCInput::convertDigitToKey(count)), (cnt == 0)); cnt++; } } diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 72c476b93..3caad3e5c 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -288,7 +288,7 @@ void CNeutrinoApp::InitMenuMain() } #ifdef ENABLE_TEST_MENU - personalize.addItem(MENU_MAIN, new CMenuForwarderNonLocalized("Test menu", true, NULL, new CTestMenu()), NULL, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); + personalize.addItem(MENU_MAIN, new CMenuForwarder("Test menu", true, NULL, new CTestMenu()), NULL, false, CPersonalizeGui::PERSONALIZE_SHOW_NO); #endif } diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 48c500b05..61f01bd0e 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -2006,9 +2006,9 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh) hh->printf("\t\t\t\t%s\n",zRepCount.c_str()); hh->printf("\t\t\t\t%d\n",(int)timer->eventRepeat); hh->printf("\t\t\t\t%s\n",zRep.c_str()); - char weekdays[8]= {0}; + std::string weekdays; NeutrinoAPI->Timerd->setWeekdaysToStr(timer->eventRepeat, weekdays); - hh->printf("\t\t\t\t%s\n",weekdays); + hh->printf("\t\t\t\t%s\n", weekdays.c_str()); hh->WriteLn("\t\t\t\n"); // channel infos @@ -2354,7 +2354,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) else // default: no repeat rep = (CTimerd::CTimerEventRepeat)0; if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "") - NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"].c_str()); + NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"]); // apids bool changeApids=false; diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 9d557fbbb..593c74c51 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -981,7 +981,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin string_printf("\n",(int)CTimerd::TIMERREPEAT_WEEKDAYS, sel.c_str(), zRep.c_str()); // Weekdays - char weekdays[8]; + std::string weekdays; NeutrinoAPI->Timerd->setWeekdaysToStr(timer.eventRepeat, weekdays); hh->ParamList["weekdays"]= weekdays;