Thread: [Commits] : Tuxbox-GIT: apps branch master updated. CVS-Final-331-g641a9f9
Tuxbox Sources
Brought to you by:
dbt1
|
From: Thilo G. <tux...@ne...> - 2014-01-10 07:02:25
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 641a9f9b2bee4618553f2673a22c65c424b56b74 (commit)
via 51bbe8f34d3714e34ddae1f667cf377f09486277 (commit)
via 4aa49571b8654bdc1851c7cbedcb09829ebabab9 (commit)
via aff034f605db74a1f5695ff8db2278cd7f997cb3 (commit)
via c63e62487973b02936f45b2b6fafee680d395cce (commit)
via f2a5e4bd811f12b333b3f3dca5e09f805af854bf (commit)
via 8fe1818840917f1eb5a7b8d88ed997f1f71e0c61 (commit)
via 43154e275f89d4fe3a17a82226ae2abef49faf2e (commit)
via 3786468a38aaf2950271e58a1928a0eb80d4af5d (commit)
via 8cb92833fd1e3446283196fda839df8e8a2a5421 (commit)
via a71d8db768f03531e132e8342f1243646b7bd028 (commit)
via 4a3f2ddd2c88f156543ae75e72a537f6b68e3af2 (commit)
via 3791d45ceaa5f101c08258b9b7d642d2b1aa396c (commit)
via 37824440c763bd96aa1101406b24f36fee1cd0c1 (commit)
via 5bb6629379bb0ae97e33b786c074aee27350cb85 (commit)
via 4308fdc765bcbfcc6aeb190cfc5fab80a565cdb4 (commit)
via fe7c2a1b4b42acf35fac25634458c871f75949ae (commit)
via 26f24d1388743994b089c81fa53d1245189fd326 (commit)
via 7ec31d62e750491f7661cdc5feb178589d6894ba (commit)
via 8b9fccfe3c4ef26e0fefb9399c2249eb50a1d34f (commit)
via 185a555fa9ef9d9a661fa64753422c5ff6b94c66 (commit)
via f9f973c55cbd2324295f601843e0928a6e501db4 (commit)
via 622e55a25919572124b9c8e2a2daeaa176c750d3 (commit)
via a7ec46890c5a4925d33afbd34412ee711bd029a4 (commit)
via afead8b91a72b593ce7486e0509850d1a4d95f27 (commit)
via 081e4d0d0e2bb0f6719660d7771b265398efe7ce (commit)
via b665ed56736b4796f196723a2088e4be167a60bb (commit)
via 3f784e0a557c1568de1df0f191d4c76d448ef9a0 (commit)
via 745102b1ea84e80f9891ffffaa56fac5e0e167bd (commit)
via 50122c54c2e3801433a30a8398052a5cd300dc26 (commit)
via dd3dc207bbe40d686f5609f49babc7df0a605c9c (commit)
via c44f7e3b0881734ca0ec154b4b2a1528be219ba3 (commit)
via 6640bf2a94c23fbbf3cbe7de69521942ec6b947b (commit)
via d274b93737898b5c841306027bc9f436dcee59c5 (commit)
via 8588e416be4b491e511606c547d65cd17c54ba6d (commit)
via ac8d8ea878c14d705d16bd11cd8593e8759c312f (commit)
via 7411ff6f87a9bce45a992092356cfd772b217d56 (commit)
via b9e8ee569c093cbb88992d15f2b483eb552548f3 (commit)
via 78fa4f888479b06ee927b9d35f0f5c732438446f (commit)
from c213938731574d429405adecb4c1d4881063d24c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 641a9f9b2bee4618553f2673a22c65c424b56b74
Author: Christian Schuett <Gau...@ho...>
Date: Thu Jan 9 22:42:12 2014 +0100
Neutrino moviebrowser: avoid segfault after deleting file with series name
neutrino crashes if you try to edit movie infos of a file after deleting
another one with series name
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 42a93eb..50b4ff8 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -2195,6 +2195,8 @@ void CMovieBrowser::onDeleteFile(MI_MOVIE_INFO& movieSelectionHandler)
hintBox.hide();
g_RCInput->clearRCMsg();
+ if (!movieSelectionHandler.serieName.empty())
+ m_seriename_stale = true;
m_vMovieInfo.erase( (std::vector<MI_MOVIE_INFO>::iterator)&movieSelectionHandler);
updateSerienames();
refreshBrowserList();
commit 51bbe8f34d3714e34ddae1f667cf377f09486277
Author: Christian Schuett <Gau...@ho...>
Date: Thu Jan 9 00:33:03 2014 +0100
Neutrino moviebrowser: update series list after changing series name
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale
index 7cc2492..d986b2b 100644
--- a/tuxbox/neutrino/data/locale/deutsch.locale
+++ b/tuxbox/neutrino/data/locale/deutsch.locale
@@ -903,7 +903,7 @@ moviebrowser.reload_at_start Filminfos neu laden bei Start
moviebrowser.remount_at_start Filmdepot verbinden bei Start
moviebrowser.scan_for_movies Suche Filme...
moviebrowser.serie_auto_create Serien automatisch zuordnen
-moviebrowser.serie_existingname Vorhandene Serie
+moviebrowser.serie_existingname Vorhandene Serien
moviebrowser.serie_head Serie
moviebrowser.serie_name Name ändern
moviebrowser.short_audio Audio
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 57b5355..42a93eb 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -1129,7 +1129,17 @@ int CMovieBrowser::exec(const char* path, const int playstate)
return (res);
}
+/************************************************************************
+************************************************************************/
+bool CMovieBrowser::changeNotify(const neutrino_locale_t OptionName, void *)
+{
+ if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MOVIEBROWSER_EDIT_SERIE))
+ {
+ m_seriename_stale = true;
+ }
+ return false;
+}
/************************************************************************
************************************************************************/
@@ -3012,15 +3022,21 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info)
/********************************************************************/
/** serie******************************************************/
- CStringInputSMS serieUserInput(LOCALE_MOVIEBROWSER_EDIT_SERIE, &movie_info->serieName, 20, true, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz\xE4\xF6\xFC\xDF""0123456789-_/()<>=.,:!?\\'\"& ");
+ CStringInputSMS serieUserInput(LOCALE_MOVIEBROWSER_EDIT_SERIE, &movie_info->serieName, 20, true, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz\xE4\xF6\xFC\xDF""0123456789-_/()<>=.,:!?\\'\"& ", this);
CMenuWidget serieMenu(LOCALE_MOVIEBROWSER_INFO_HEAD, NEUTRINO_ICON_STREAMING);
serieMenu.addIntroItems(LOCALE_MOVIEBROWSER_SERIE_HEAD);
serieMenu.addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_SERIE_NAME, true, movie_info->serieName,&serieUserInput));
if (!m_vHandleSerienames.empty())
- serieMenu.addItem(GenericMenuSeparatorLine);
+ {
+ m_serienames.clear();
+ serieMenu.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MOVIEBROWSER_SERIE_EXISTINGNAME));
+ }
for(unsigned int i=0; i < m_vHandleSerienames.size(); i++)
- serieMenu.addItem( new CMenuSelector(m_vHandleSerienames[i]->serieName.c_str(), true, movie_info->serieName));
+ {
+ m_serienames.push_back(m_vHandleSerienames[i]->serieName);
+ serieMenu.addItem( new CMenuSelector(m_serienames.back().c_str(), true, movie_info->serieName));
+ }
/********************************************************************/
/** update movie info ******************************************************/
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.h b/tuxbox/neutrino/src/gui/moviebrowser.h
index 029b8e1..a5be223 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.h
+++ b/tuxbox/neutrino/src/gui/moviebrowser.h
@@ -199,7 +199,7 @@ typedef struct
}MB_SETTINGS;
// Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see
-class CMovieBrowser : public CMenuTarget
+class CMovieBrowser : public CMenuTarget, CChangeObserver
{
public: // Variables /////////////////////////////////////////////////
int Multi_Select; // for FileBrowser compatibility, not used in MovieBrowser
@@ -233,7 +233,7 @@ class CMovieBrowser : public CMenuTarget
std::vector<MI_MOVIE_INFO*> m_vHandleRecordList;
std::vector<MI_MOVIE_INFO*> m_vHandlePlayList;
std::vector<std::string> m_dirNames;
-// std::vector<std::string> m_serienames;
+ std::vector<std::string> m_serienames;
std::vector<MI_MOVIE_INFO*> m_vHandleSerienames;
unsigned int m_currentBrowserSelection;
@@ -286,6 +286,7 @@ class CMovieBrowser : public CMenuTarget
~CMovieBrowser(); //P1
int exec(const char* path, const int playstate); //P1
int exec(CMenuTarget* parent, const std::string & actionKey);
+ bool changeNotify(const neutrino_locale_t OptionName, void *);
std::string getCurrentDir(void); //P1 for FileBrowser compatibility
CFile* getSelectedFile(void); //P1 for FileBrowser compatibility
MI_MOVIE_BOOKMARKS* getCurrentMovieBookmark(void){if(m_movieSelectionHandler == NULL) return NULL; return(&(m_movieSelectionHandler->bookmarks));};
commit 4aa49571b8654bdc1851c7cbedcb09829ebabab9
Author: Christian Schuett <Gau...@ho...>
Date: Wed Jan 8 21:42:10 2014 +0100
Neutrino moviebrowser: sort some filters alphabetically
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 0023ae3..57b5355 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -235,8 +235,6 @@ const int m_defaultRowWidth[MB_INFO_MAX_NUMBER+1] =
//------------------------------------------------------------------------
// sorting
//------------------------------------------------------------------------
-#define FILEBROWSER_NUMBER_OF_SORT_VARIANTS 5
-
bool sortDirection = 0;
bool compare_to_lower(const char a, const char b)
@@ -253,7 +251,15 @@ bool sortByTitle (const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b)
return false;
return a->file.Time < b->file.Time;
}
-bool sortByGenre (const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b)
+bool sortBySerie (const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b)
+{
+ if (std::lexicographical_compare(a->serieName.begin(), a->serieName.end(), b->serieName.begin(), b->serieName.end(), compare_to_lower))
+ return true;
+ if (std::lexicographical_compare(b->serieName.begin(), b->serieName.end(), a->serieName.begin(), a->serieName.end(), compare_to_lower))
+ return false;
+ return sortByTitle(a,b);
+}
+bool sortByInfo1 (const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b)
{
if (std::lexicographical_compare(a->epgInfo1.begin(), a->epgInfo1.end(), b->epgInfo1.begin(), b->epgInfo1.end(), compare_to_lower))
return true;
@@ -326,8 +332,8 @@ bool (* const sortBy[MB_INFO_MAX_NUMBER+1])(const MI_MOVIE_INFO* a, const MI_MOV
&sortByFileName , //MB_INFO_FILENAME = 0,
&sortByDir, //MB_INFO_FILEPATH = 1,
&sortByTitle, //MB_INFO_TITLE = 2,
- NULL, //MB_INFO_SERIE = 3,
- &sortByGenre, //MB_INFO_INFO1 = 4,
+ &sortBySerie, //MB_INFO_SERIE = 3,
+ &sortByInfo1, //MB_INFO_INFO1 = 4,
NULL, //MB_INFO_MAJOR_GENRE = 5,
NULL, //MB_INFO_MINOR_GENRE = 6,
NULL, //MB_INFO_INFO2 = 7,
@@ -1354,6 +1360,11 @@ void CMovieBrowser::refreshLCD(void)
/************************************************************************
************************************************************************/
+static bool sortByAlpha(const std::string & a, const std::string & b)
+{
+ return (strcasecmp(a.c_str(), b.c_str()) < 0);
+}
+
void CMovieBrowser::refreshFilterList(void)
{
TRACE("[mb]->refreshFilterList %d\r\n",m_settings.filter.item);
@@ -1386,9 +1397,9 @@ void CMovieBrowser::refreshFilterList(void)
}
else
{
- std::string tmp = g_Locale->getText(LOCALE_MENU_BACK);
- m_FilterLines.lineArray[0].push_back(tmp);
-
+ string_item = g_Locale->getText(LOCALE_MENU_BACK);
+ m_FilterLines.lineArray[0].push_back(string_item);
+
if(m_settings.filter.item == MB_INFO_FILEPATH)
{
for(unsigned int i =0 ; i < m_dirNames.size() ;i++)
@@ -1409,19 +1420,21 @@ void CMovieBrowser::refreshFilterList(void)
if(found == false)
m_FilterLines.lineArray[0].push_back(m_vMovieInfo[i].epgInfo1);
}
+ sort(m_FilterLines.lineArray[0].begin() + 1, m_FilterLines.lineArray[0].end(), sortByAlpha);
}
else if(m_settings.filter.item == MB_INFO_INFO2)
{
- std::string tmp2 = "->Eingabe";
- m_FilterLines.lineArray[0].push_back(tmp2);
+ string_item = "->Eingabe";
+ m_FilterLines.lineArray[0].push_back(string_item);
}
else if(m_settings.filter.item == MB_INFO_MAJOR_GENRE)
{
for(int i = 0; i < GENRE_ALL_COUNT; i++)
{
- std::string tmp2 = g_Locale->getText(GENRE_ALL[i].value);
- m_FilterLines.lineArray[0].push_back(tmp2);
+ string_item = g_Locale->getText(GENRE_ALL[i].value);
+ m_FilterLines.lineArray[0].push_back(string_item);
}
+ sort(m_FilterLines.lineArray[0].begin() + 1, m_FilterLines.lineArray[0].end(), sortByAlpha);
}
else if(m_settings.filter.item == MB_INFO_SERIE)
{
@@ -2811,8 +2824,15 @@ void CMovieBrowser::updateFilterSelection(void)
}
else if(m_settings.filter.item == MB_INFO_MAJOR_GENRE)
{
- m_settings.filter.optionString = g_Locale->getText(GENRE_ALL[selected_line].value);
- m_settings.filter.optionVar = GENRE_ALL[selected_line].key;
+ m_settings.filter.optionString = m_FilterLines.lineArray[0][selected_line+1];
+ for(int i = 0; i < GENRE_ALL_COUNT; i++)
+ {
+ if(strcmp(m_settings.filter.optionString.c_str(), g_Locale->getText(GENRE_ALL[i].value)) == 0)
+ {
+ m_settings.filter.optionVar = GENRE_ALL[i].key;
+ break;
+ }
+ }
}
else if(m_settings.filter.item == MB_INFO_SERIE)
{
@@ -3577,7 +3597,7 @@ void CMovieBrowser::updateSerienames(void)
}
}
TRACE("[mb]->updateSerienames: %d\r\n",m_vHandleSerienames.size());
- // TODO sort(m_serienames.begin(), m_serienames.end(), my_alphasort);
+ sort(m_vHandleSerienames.begin(), m_vHandleSerienames.end(), sortBySerie);
m_seriename_stale = false;
}
commit aff034f605db74a1f5695ff8db2278cd7f997cb3
Author: Christian Schuett <Gau...@ho...>
Date: Sun Jan 5 17:25:56 2014 +0100
Neutrino: sort some option choosers alphabetically
this affects
* genre selection in moviebrowser
* cable provider selection in scan setup
* user menu item selection in user menu setup
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 7047bfe..0023ae3 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -3052,7 +3052,7 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info)
movieInfoMenu.addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_INFO_TITLE, true, movie_info->epgTitle, &titelUserInput,NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1));
movieInfoMenu.addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_INFO_SERIE, true, movie_info->serieName, &serieMenu,NULL, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2));
movieInfoMenu.addItem( new CMenuForwarder(LOCALE_MOVIEBROWSER_INFO_INFO1, true, movie_info->epgInfo1, &epgUserInput,NULL, CRCInput::RC_3, NEUTRINO_ICON_BUTTON_3));
- movieInfoMenu.addItem( new CMenuOptionChooser(LOCALE_MOVIEBROWSER_INFO_GENRE_MAJOR, &movie_info->genreMajor, GENRE_ALL, GENRE_ALL_COUNT, true, NULL, CRCInput::RC_4, NEUTRINO_ICON_BUTTON_4, true));
+ movieInfoMenu.addItem( new CMenuOptionChooser(LOCALE_MOVIEBROWSER_INFO_GENRE_MAJOR, &movie_info->genreMajor, GENRE_ALL, GENRE_ALL_COUNT, true, NULL, CRCInput::RC_4, NEUTRINO_ICON_BUTTON_4, true, true));
movieInfoMenu.addItem(GenericMenuSeparatorLine);
movieInfoMenu.addItem( new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_INFO_QUALITY, &movie_info->quality, true, 0, 3, 0, 0, NONEXISTANT_LOCALE, NULL, NULL, CRCInput::RC_5, NEUTRINO_ICON_BUTTON_5));
movieInfoMenu.addItem( new CMenuOptionChooser(LOCALE_MOVIEBROWSER_INFO_PARENTAL_LOCKAGE, &movie_info->parentalLockAge, MESSAGEBOX_PARENTAL_LOCKAGE_OPTIONS, MESSAGEBOX_PARENTAL_LOCKAGE_OPTION_COUNT, true,NULL, CRCInput::RC_6, NEUTRINO_ICON_BUTTON_6 ));
diff --git a/tuxbox/neutrino/src/gui/scan_setup.cpp b/tuxbox/neutrino/src/gui/scan_setup.cpp
index eb7c6c7..4eccd7e 100644
--- a/tuxbox/neutrino/src/gui/scan_setup.cpp
+++ b/tuxbox/neutrino/src/gui/scan_setup.cpp
@@ -355,8 +355,8 @@ int CScanSetup::showScanService()
CZapitClient::SatelliteList providerList;
g_Zapit->getScanSatelliteList(providerList);
- // sat/provider selector
- CMenuOptionStringChooser * ojProv = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, (char*)&scanSettings.satNameNoDiseqc, true, NULL, CRCInput::RC_nokey, "", true);
+ //cable provider selector
+ CMenuOptionStringChooser * ojProv = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, (char*)&scanSettings.satNameNoDiseqc, true, NULL, CRCInput::RC_nokey, "", true, true);
bool sfound = false;
for (CZapitClient::SatelliteList::iterator it = providerList.begin(); it != providerList.end(); ++it) {
diff --git a/tuxbox/neutrino/src/gui/user_menue_setup.cpp b/tuxbox/neutrino/src/gui/user_menue_setup.cpp
index ce805f6..d772f9a 100644
--- a/tuxbox/neutrino/src/gui/user_menue_setup.cpp
+++ b/tuxbox/neutrino/src/gui/user_menue_setup.cpp
@@ -113,7 +113,7 @@ int CUserMenuSetup::showSetup()
{
snprintf(text,10,"%d:",item+1);
text[9]=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, true));
}
int res = ums->exec(NULL, "");
commit c63e62487973b02936f45b2b6fafee680d395cce
Author: Christian Schuett <Gau...@ho...>
Date: Sun Jan 5 16:58:21 2014 +0100
Neutrino: add possibility to sort option (string) choosers alphabetically
based on idea by M. Liebmann <tux...@gm...> in Coolstream Git
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/widget/menue.cpp b/tuxbox/neutrino/src/gui/widget/menue.cpp
index 4f246af..2e07e8d 100644
--- a/tuxbox/neutrino/src/gui/widget/menue.cpp
+++ b/tuxbox/neutrino/src/gui/widget/menue.cpp
@@ -844,11 +844,10 @@ int CMenuOptionNumberChooser::paint(bool selected)
-CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
+CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort)
{
optionNameString = g_Locale->getText(OptionName);
optionName = OptionName;
- options = Options;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
@@ -856,13 +855,15 @@ CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int *
directKey = DirectKey;
iconName = IconName;
pulldown = Pulldown;
+ optionsSort = OptionsSort;
+ for (unsigned int i = 0; i < number_of_options; i++)
+ options.push_back(&Options[i]);
}
-CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
+CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort)
{
optionNameString = OptionName;
optionName = NONEXISTANT_LOCALE;
- options = Options;
active = Active;
optionValue = OptionValue;
number_of_options = Number_Of_Options;
@@ -870,6 +871,9 @@ CMenuOptionChooser::CMenuOptionChooser(const char* OptionName, int * const Optio
directKey = DirectKey;
iconName = IconName;
pulldown = Pulldown;
+ optionsSort = OptionsSort;
+ for (unsigned int i = 0; i < number_of_options; i++)
+ options.push_back(&Options[i]);
}
int CMenuOptionChooser::getHeight(void) const
@@ -887,6 +891,10 @@ int CMenuOptionChooser::getOptionValue(void) const
return *optionValue;
}
+static bool sortByOptionValue(const CMenuOptionChooser::keyval * a, const CMenuOptionChooser::keyval * b)
+{
+ return (strcasecmp(g_Locale->getText(a->value), g_Locale->getText(b->value)) < 0);
+}
int CMenuOptionChooser::exec(CMenuTarget* parent)
{
@@ -894,6 +902,9 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
bool wantsRepaint = false;
int ret = menu_return::RETURN_NONE;
+ if (optionsSort)
+ sort(options.begin(), options.end(), sortByOptionValue);
+
if (pulldown)
{
int select = -1;
@@ -904,16 +915,16 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
for(unsigned int count = 0; count < number_of_options; count++)
{
bool selected = false;
- if (options[count].key == (*optionValue))
+ if (options[count]->key == (*optionValue))
selected = true;
sprintf(cnt, "%d", count);
- CMenuForwarder *mn_option = new CMenuForwarder(options[count].value, true, NULL, selector, cnt);
+ CMenuForwarder *mn_option = new CMenuForwarder(options[count]->value, true, NULL, selector, cnt);
mn_option->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true /*for selected item*/);
menu->addItem(mn_option, selected);
}
ret = menu->exec(parent, "");
if (select >= 0)
- *optionValue = options[select].key;
+ *optionValue = options[select]->key;
else
optionValueChanged = false;
delete menu;
@@ -925,15 +936,15 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
unsigned int count;
for(count = 0; count < number_of_options; count++)
{
- if (options[count].key == (*optionValue))
+ if (options[count]->key == (*optionValue))
{
- *optionValue = options[(count+1) % number_of_options].key;
+ *optionValue = options[(count+1) % number_of_options]->key;
break;
}
}
// if options are removed optionValue may not exist anymore -> use 1st available option
if ((count == number_of_options) && number_of_options)
- *optionValue = options[0].key;
+ *optionValue = options[0]->key;
paint(true);
}
@@ -953,9 +964,9 @@ int CMenuOptionChooser::paint( bool selected )
neutrino_locale_t option = NONEXISTANT_LOCALE;
for(unsigned int count = 0 ; count < number_of_options; count++)
{
- if (options[count].key == *optionValue)
+ if (options[count]->key == *optionValue)
{
- option = options[count].value;
+ option = options[count]->value;
break;
}
}
@@ -976,7 +987,7 @@ int CMenuOptionChooser::paint( bool selected )
//-------------------------------------------------------------------------------------------------------------------------------
-CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, char* OptionValue, bool Active, CChangeObserver* Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
+CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, char* OptionValue, bool Active, CChangeObserver* Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort)
{
optionName = OptionName;
active = Active;
@@ -985,6 +996,7 @@ CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t Optio
directKey = DirectKey;
iconName = IconName;
pulldown = Pulldown;
+ optionsSort = OptionsSort;
}
int CMenuOptionStringChooser::getHeight(void) const
@@ -1007,12 +1019,20 @@ void CMenuOptionStringChooser::addOption(const char * const value)
options.push_back(std::string(value));
}
+static bool sortByOptionStringValue(const std::string & a, const std::string & b)
+{
+ return (strcasecmp(a.c_str(), b.c_str()) < 0);
+}
+
int CMenuOptionStringChooser::exec(CMenuTarget* parent)
{
bool optionValueChanged = true;
bool wantsRepaint = false;
int ret = menu_return::RETURN_NONE;
+ if (optionsSort)
+ sort(options.begin(), options.end(), sortByOptionStringValue);
+
if (pulldown)
{
int select = -1;
diff --git a/tuxbox/neutrino/src/gui/widget/menue.h b/tuxbox/neutrino/src/gui/widget/menue.h
index ed1545f..9d0a5e3 100644
--- a/tuxbox/neutrino/src/gui/widget/menue.h
+++ b/tuxbox/neutrino/src/gui/widget/menue.h
@@ -250,14 +250,15 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
};
private:
- const struct keyval * options;
- unsigned number_of_options;
- std::string optionNameString;
- bool pulldown;
+ std::vector<const keyval *> options;
+ unsigned number_of_options;
+ std::string optionNameString;
+ bool pulldown;
+ bool optionsSort;
public:
- CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false);
- CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false);
+ CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false, bool OptionsSort = false);
+ CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false, bool OptionsSort = false);
void setOptionValue(const int newvalue);
int getOptionValue(void) const;
@@ -276,9 +277,10 @@ class CMenuOptionStringChooser : public CMenuItem
std::vector<std::string> options;
CChangeObserver * observ;
bool pulldown;
+ bool optionsSort;
public:
- CMenuOptionStringChooser(const neutrino_locale_t OptionName, char* OptionValue, bool Active = false, CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false);
+ CMenuOptionStringChooser(const neutrino_locale_t OptionName, char* OptionValue, bool Active = false, CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", bool Pulldown = false, bool OptionsSort = false);
~CMenuOptionStringChooser();
void addOption(const char * value);
commit f2a5e4bd811f12b333b3f3dca5e09f805af854bf
Author: Christian Schuett <Gau...@ho...>
Date: Sat Jan 4 18:27:55 2014 +0100
Neutrino: fix height calculation in extended input classes
also remove redundant code
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: Thilo Graf <db...@no...>
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 06bc523..3d3be9f 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -63,18 +63,7 @@ CExtendedInput::CExtendedInput(const neutrino_locale_t Name, char* Value, const
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
- width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true) + 20; // UTF-8
- height = hheight+ mheight+ 20;
-
- if (hint_1 != NONEXISTANT_LOCALE)
- {
- height += iheight;
- if (hint_2 != NONEXISTANT_LOCALE)
- height += iheight;
- }
-
- x = getScreenStartX(width);
- y = getScreenStartY(height);
+ calculateDialog();
}
CExtendedInput::~CExtendedInput()
@@ -96,6 +85,10 @@ void CExtendedInput::calculateDialog()
int maxX = 0;
int maxY = 0;
selectedChar = -1;
+
+ width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true) + 20; // UTF-8
+ height = hheight + mheight + 20;
+
for(unsigned int i=0; i<inputFields.size();i++)
{
inputFields[i]->init( ix, iy);
@@ -111,7 +104,7 @@ void CExtendedInput::calculateDialog()
width = (width > maxX+40) ? width : maxX+40;
height = (height > maxY+hheight+mheight) ? height : maxY+hheight+mheight;
- hintPosY = y + height -10;
+ hintPosY = height + iheight;
if (hint_1 != NONEXISTANT_LOCALE)
{
@@ -127,10 +120,14 @@ void CExtendedInput::calculateDialog()
width = maxX + 40;
height += iheight;
}
+
+ height += 10;
}
x = getScreenStartX(width);
y = getScreenStartY(height);
+
+ hintPosY += y;
}
@@ -411,7 +408,6 @@ CIPInput::CIPInput(const neutrino_locale_t Name, std::string & Value, const neut
: CExtendedInput(Name, IP, Hint_1, Hint_2, Observ)
{
ip = &Value;
- frameBuffer = CFrameBuffer::getInstance();
addInputField( new CExtendedInput_Item_Char("...
[truncated message content] |