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
29
recmenus.c
29
recmenus.c
@ -1200,26 +1200,26 @@ Epgsearch_searchresults_v1_0 cRecMenuSearch::GetEPGSearchStruct(void) {
|
|||||||
|
|
||||||
|
|
||||||
// --- cRecMenuSearchResults ---------------------------------------------------------
|
// --- cRecMenuSearchResults ---------------------------------------------------------
|
||||||
cRecMenuSearchResults::cRecMenuSearchResults(std::string searchString, const cEvent **searchResults, int numResults) {
|
cRecMenuSearchResults::cRecMenuSearchResults(std::string searchString, const cEvent **searchResults, int numResults) { // OK
|
||||||
this->searchResults = searchResults;
|
|
||||||
SetWidthPercent(70);
|
SetWidthPercent(70);
|
||||||
this->searchString = searchString;
|
|
||||||
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);
|
this->searchString = searchString;
|
||||||
SetFooter(buttons);
|
this->searchResults = searchResults;
|
||||||
|
this->numResults = numResults;
|
||||||
|
|
||||||
|
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)) {
|
if (searchResults && (numResults > 0)) {
|
||||||
for (int i = 0; i < numResults; i++) {
|
for (int i = 0; i < numResults; i++) {
|
||||||
if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, rmsSearchRecord, (i == 0) ? true : false)))
|
if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, rmsSearchRecord, (i == 0) ? true : false)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateHeight();
|
CalculateHeight();
|
||||||
CreatePixmap();
|
CreatePixmap();
|
||||||
Arrange();
|
Arrange();
|
||||||
@ -1238,10 +1238,9 @@ int cRecMenuSearchResults::GetTotalNumMenuItems(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cEvent *cRecMenuSearchResults::GetEvent(void) {
|
const cEvent *cRecMenuSearchResults::GetEvent(void) {
|
||||||
const cEvent *ev = NULL;
|
|
||||||
if (cRecMenuItemEvent *activeItem = dynamic_cast<cRecMenuItemEvent*>(GetActiveMenuItem()))
|
if (cRecMenuItemEvent *activeItem = dynamic_cast<cRecMenuItemEvent*>(GetActiveMenuItem()))
|
||||||
ev = activeItem->GetEventValue();
|
return activeItem->GetEventValue();
|
||||||
return ev;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user