mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuSearchTimers
This commit is contained in:
parent
a4cc2a4fa8
commit
54ce728fa5
38
recmenus.c
38
recmenus.c
@ -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");
|
||||
for (int i = 0; i < numSearchTimers; i++) {
|
||||
if (!AddMenuItemInitial(new cRecMenuItemSearchTimer(searchTimers[i], rmsSearchTimerTest, rmsSearchTimerEdit, rmsSearchTimerDeleteConfirm, (i == 0) ? true : false)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
cTVGuideSearchTimer cRecMenuSearchTimers::GetSearchTimer(void) {
|
||||
cRecMenuItemSearchTimer *activeItem = dynamic_cast<cRecMenuItemSearchTimer*>(GetActiveMenuItem());
|
||||
return activeItem->GetTimer();
|
||||
|
@ -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 ---------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user