mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuSearchResults
This commit is contained in:
parent
5cc50e465d
commit
412a78a112
35
recmenus.c
35
recmenus.c
@ -991,7 +991,7 @@ cRecMenuSearchTimerCreateConfirm::cRecMenuSearchTimerCreateConfirm(bool success)
|
||||
|
||||
AddHeader(new cRecMenuItemInfo(*line1, i, *line2, "", "", width - 2 * border));
|
||||
AddFooter(new cRecMenuItemButton(tr("OK"), rmsClose, true));
|
||||
|
||||
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
@ -1200,32 +1200,32 @@ Epgsearch_searchresults_v1_0 cRecMenuSearch::GetEPGSearchStruct(void) {
|
||||
|
||||
|
||||
// --- cRecMenuSearchResults ---------------------------------------------------------
|
||||
cRecMenuSearchResults::cRecMenuSearchResults(std::string searchString, const cEvent **searchResults, int numResults) {
|
||||
this->searchResults = searchResults;
|
||||
cRecMenuSearchResults::cRecMenuSearchResults(std::string searchString, const cEvent **searchResults, int numResults) { // OK
|
||||
SetWidthPercent(70);
|
||||
|
||||
this->searchString = searchString;
|
||||
this->searchResults = searchResults;
|
||||
this->numResults = numResults;
|
||||
cString message1 = tr("search results for");
|
||||
cString message2 = tr("search result for");
|
||||
cString infoText = cString::sprintf("%d %s:\n\"%s\"", numResults, (numResults>1)?(*message1):(*message2), searchString.c_str());
|
||||
cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText, true);
|
||||
infoItem->CalculateHeight(width - 2 * border);
|
||||
SetHeader(infoItem);
|
||||
|
||||
cRecMenuItem *buttons = new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsSearch, rmsClose, false);
|
||||
SetFooter(buttons);
|
||||
|
||||
const cString line1 = cString::sprintf("%d %s:", numResults, (numResults > 1) ? tr("search results for") : tr("search result for"));
|
||||
const cString line2 = cString::sprintf("\"%s\"", searchString.c_str());
|
||||
|
||||
AddHeader(new cRecMenuItemInfo(*line1, 2, *line2, "", "", width - 2 * border, true));
|
||||
AddFooter(new cRecMenuItemButtonYesNo(tr("Adapt Search"), tr("Close"), rmsSearch, rmsClose, false));
|
||||
|
||||
if (searchResults && (numResults > 0)) {
|
||||
for (int i=0; i<numResults; i++) {
|
||||
if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, rmsSearchRecord, (i==0)?true:false)))
|
||||
for (int i = 0; i < numResults; i++) {
|
||||
if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, rmsSearchRecord, (i == 0) ? true : false)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
cRecMenuItem *cRecMenuSearchResults::GetMenuItem(int number) {
|
||||
cRecMenuItem *cRecMenuSearchResults::GetMenuItem(int number) {
|
||||
if ((number >= 0) && (number < numResults)) {
|
||||
cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsSearchRecord, false);
|
||||
return result;
|
||||
@ -1238,10 +1238,9 @@ int cRecMenuSearchResults::GetTotalNumMenuItems(void) {
|
||||
}
|
||||
|
||||
const cEvent *cRecMenuSearchResults::GetEvent(void) {
|
||||
const cEvent *ev = NULL;
|
||||
if (cRecMenuItemEvent *activeItem = dynamic_cast<cRecMenuItemEvent*>(GetActiveMenuItem()))
|
||||
ev = activeItem->GetEventValue();
|
||||
return ev;
|
||||
return activeItem->GetEventValue();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user