Refactor cRecMenuSearchTimers

This commit is contained in:
kamel5 2019-11-09 14:01:19 +01:00
parent a4cc2a4fa8
commit 54ce728fa5
2 changed files with 16 additions and 27 deletions

View File

@ -665,39 +665,29 @@ TVGuideEPGSearchTemplate cRecMenuSearchTimerTemplates::GetTemplate(void) {
}
// --- cRecMenuSearchTimers ---------------------------------------------------------
cRecMenuSearchTimers::cRecMenuSearchTimers(std::vector<cTVGuideSearchTimer> searchTimers) {
cRecMenuSearchTimers::cRecMenuSearchTimers(std::vector<cTVGuideSearchTimer> searchTimers) { // OK
SetWidthPercent(70);
this->searchTimers = searchTimers;
numSearchTimers = searchTimers.size();
SetWidthPercent(70);
cString headline;
const cString line1 = (numSearchTimers > 0) ? tr("EPGSearch Search Timers") : tr("No Search Timers Configured");
AddHeader(new cRecMenuItemInfo(*line1, 1, "", "", "", width - 2 * border, true));
AddFooter(new cRecMenuItemButton(tr("Close"), rmsClose, (!numSearchTimers) ? true : false));
if (numSearchTimers > 0) {
headline = tr("EPGSearch Search Timers");
} else {
headline = tr("No Search Timers Configured");
}
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headline, true);
infoItem->CalculateHeight(width - 2 * border);
SetHeader(infoItem);
cRecMenuItem *button = new cRecMenuItemButton(tr("Close"), rmsClose, (!numSearchTimers)?true:false);
SetFooter(button);
if (numSearchTimers > 0)
SetMenuItems();
CalculateHeight();
CreatePixmap();
Arrange();
}
cRecMenuSearchTimers::~cRecMenuSearchTimers(void) {
}
void cRecMenuSearchTimers::SetMenuItems(void) {
for (int i = 0; i < numSearchTimers; i++) {
if (!AddMenuItemInitial(new cRecMenuItemSearchTimer(searchTimers[i], rmsSearchTimerTest, rmsSearchTimerEdit, rmsSearchTimerDeleteConfirm, (i == 0) ? true : false)))
break;
}
}
CalculateHeight();
CreatePixmap();
Arrange();
}
cTVGuideSearchTimer cRecMenuSearchTimers::GetSearchTimer(void) {
cRecMenuItemSearchTimer *activeItem = dynamic_cast<cRecMenuItemSearchTimer*>(GetActiveMenuItem());
return activeItem->GetTimer();

View File

@ -205,13 +205,12 @@ class cRecMenuSearchTimers: public cRecMenu {
private:
int numSearchTimers;
std::vector<cTVGuideSearchTimer> searchTimers;
void SetMenuItems(void);
public:
cRecMenuSearchTimers(std::vector<cTVGuideSearchTimer> searchTimers);
virtual ~cRecMenuSearchTimers(void) {};
cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void);
cTVGuideSearchTimer GetSearchTimer(void);
virtual ~cRecMenuSearchTimers(void);
};
// --- cRecMenuSearchTimerEdit ---------------------------------------------------------