summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-06-17 13:06:07 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-06-17 14:38:09 +0200
commit1c591b5408a12c63fc867d22e6f2c469ef36f9bc (patch)
tree1a79c555f11ae647765eb8402b0aba54c2d2236a
parent5b1e1743161b75da73cd987d67593fb89f43e50d (diff)
downloadvdr-plugin-tvguide-1c591b5408a12c63fc867d22e6f2c469ef36f9bc.tar.gz
vdr-plugin-tvguide-1c591b5408a12c63fc867d22e6f2c469ef36f9bc.tar.bz2
Eliminate InitMenuItems in cRecMenuSearchTimerEdit
-rw-r--r--recmenus.c46
-rw-r--r--recmenus.h2
2 files changed, 23 insertions, 25 deletions
diff --git a/recmenus.c b/recmenus.c
index 4bd9bf5..dc28825 100644
--- a/recmenus.c
+++ b/recmenus.c
@@ -723,6 +723,7 @@ int cRecMenuSearchTimers::GetTotalNumMenuItems(void) {
// --- cRecMenuSearchTimerEdit ---------------------------------------------------------
cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer, std::vector<std::string> channelGroups) {
+ init = true;
deleteMenuItems = false;
this->searchTimer = searchTimer;
this->channelGroups = channelGroups;
@@ -776,7 +777,6 @@ cRecMenuSearchTimerEdit::cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer
SetHeader(infoItem);
cRecMenuItemButtonYesNo *footerButton = new cRecMenuItemButtonYesNo(tr("Save Search Timer"), tr("Cancel"), rmsSearchTimerSave, rmsSearchTimers, false);
SetFooter(footerButton);
- InitMenuItems();
CreateMenuItems();
}
@@ -805,13 +805,19 @@ int cRecMenuSearchTimerEdit::SplitChannelGroups(std::vector<std::string> *channe
return j;
}
-void cRecMenuSearchTimerEdit::InitMenuItems(void) {
- dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
+void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
- useChannelPos = 6;
- useTimePos = 7;
- useDayOfWeekPos = 8;
- avoidRepeatsPos = 14;
+ int activeMenuItem = 0;
+
+ if (mainMenuItems.size() > 0) {
+ for (long unsigned int index = 0; index < mainMenuItems.size(); index++) {
+ if (mainMenuItems[index]->isActive()) {
+ activeMenuItem = index;
+ break;
+ }
+ }
+ mainMenuItems.clear();
+ }
mainMenuItems.push_back(new cRecMenuItemText(tr("Search String"), searchString, TEXTINPUTLENGTH, false, searchString));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Active"), timerActive, false, false, &timerActive, rmsSearchTimerSave));
@@ -856,36 +862,28 @@ void cRecMenuSearchTimerEdit::InitMenuItems(void) {
mainMenuItems.push_back(new cRecMenuItemBool(tr("Compare Title"), compareTitle, false, false, &compareTitle, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Compare Subtitle"), compareSubtitle, false, false, &compareSubtitle, rmsSearchTimerSave));
mainMenuItems.push_back(new cRecMenuItemBool(tr("Compare Description"), compareSummary, false, false, &compareSummary, rmsSearchTimerSave));
-}
-
-void cRecMenuSearchTimerEdit::CreateMenuItems(void) {
- dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
bool reDraw = false;
if (GetCurrentNumMenuItems() > 0) {
InitMenu(false);
- currentMenuItems.clear();
reDraw = true;
}
- int numMainMenuItems = mainMenuItems.size();
-
- for (int i = 0; i < numMainMenuItems; i++) {
- currentMenuItems.push_back(mainMenuItems[i]);
- }
+ numMenuItems = mainMenuItems.size();
- int numMenuItemsAll = currentMenuItems.size();
int start = GetStartIndex();
- for (int i = start; i < numMenuItemsAll; i++) {
- if ((i == start) && !reDraw) {
- currentMenuItems[i]->setActive();
- }
+ for (int i = start; i < numMenuItems; i++) {
if (!AddMenuItemInitial(currentMenuItems[i])) {
break;
}
}
- numMenuItems = currentMenuItems.size();
- CalculateHeight();
+ if (reDraw)
+ mainMenuItems[activeMenuItem]->setActive();
+
+ if (init) {
+ init = !init;
+ }
+ CalculateHeight(!reDraw);
CreatePixmap();
Arrange();
}
diff --git a/recmenus.h b/recmenus.h
index 17e5517..a99b817 100644
--- a/recmenus.h
+++ b/recmenus.h
@@ -218,6 +218,7 @@ private:
std::vector<std::string> channelgroups;
std::vector<cRecMenuItem*> mainMenuItems;
std::vector<cRecMenuItem*> currentMenuItems;
+ bool init;
int numMenuItems;
int useChannelPos;
int useTimePos;
@@ -252,7 +253,6 @@ private:
bool compareSubtitle;
bool compareSummary;
bool useInFavorites;
- void InitMenuItems(void);
int SplitChannelGroups(std::vector<std::string> *channelGroups, std::vector<std::string> *channelgroups);
public:
cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer, std::vector<std::string> channelGroups);