mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuRecordingSearch
This commit is contained in:
parent
37a31d0768
commit
a7e0aacdf1
153
recmenus.c
153
recmenus.c
@ -1285,82 +1285,6 @@ cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRec
|
||||
Arrange();
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* Recording Search Menus
|
||||
******************************************************************************************/
|
||||
|
||||
// --- cRecMenuRecordingSearch ---------------------------------------------------------
|
||||
cRecMenuRecordingSearch::cRecMenuRecordingSearch(std::string search) {
|
||||
strncpy(searchString, search.c_str(), TEXTINPUTLENGTH);
|
||||
SetWidthPercent(60);
|
||||
cString infoText = tr("Search in Recordings");
|
||||
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*infoText, true);
|
||||
infoItem->CalculateHeight(width - 2 * border);
|
||||
SetHeader(infoItem);
|
||||
|
||||
AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), TEXTINPUTLENGTH, false, searchString));
|
||||
AddMenuItem(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsRecordingSearchResult, rmsClose, true));
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
// --- cRecMenuRecordingSearchResults ---------------------------------------------------------
|
||||
cRecMenuRecordingSearchResults::cRecMenuRecordingSearchResults(std::string searchString, const cRecording **searchResults, int numResults) {
|
||||
this->searchString = searchString;
|
||||
this->searchResults = searchResults;
|
||||
SetWidthPercent(80);
|
||||
cString message1 = tr("Found");
|
||||
cString message2 = tr("recording");
|
||||
cString message3 = tr("recordings");
|
||||
cString message4 = tr("for");
|
||||
this->numResults = numResults;
|
||||
cString infoText = cString::sprintf("%s %d %s %s:\n\"%s\"", *message1, numResults, (numResults>1)?(*message3):(*message2), *message4, 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"), rmsRecordingSearch, rmsClose, false);
|
||||
SetFooter(buttons);
|
||||
if (searchResults && (numResults > 0)) {
|
||||
for (int i = 0; i < numResults; i++) {
|
||||
if (!AddMenuItemInitial(new cRecMenuItemRecording(searchResults[i], (i == 0) ? true : false)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
cRecMenuItem *cRecMenuRecordingSearchResults::GetMenuItem(int number) {
|
||||
if ((number >= 0) && (number < numResults)) {
|
||||
cRecMenuItem *result = new cRecMenuItemRecording(searchResults[number], false);
|
||||
return result;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int cRecMenuRecordingSearchResults::GetTotalNumMenuItems(void) {
|
||||
return numResults;
|
||||
}
|
||||
|
||||
// --- cRecMenuRecordingSearchNotFound ---------------------------------------------------------
|
||||
cRecMenuRecordingSearchNotFound::cRecMenuRecordingSearchNotFound(std::string searchString) {
|
||||
SetWidthPercent(50);
|
||||
cString message = tr("No recordings found for");
|
||||
cString text = cString::sprintf("%s\n\"%s\"",
|
||||
*message,
|
||||
searchString.c_str());
|
||||
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text);
|
||||
infoItem->CalculateHeight(width - 2 * border);
|
||||
AddMenuItem(infoItem);
|
||||
AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true));
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* Timeline
|
||||
******************************************************************************************/
|
||||
@ -1498,6 +1422,83 @@ eRecMenuState cRecMenuTimeline::ProcessKey(eKeys Key) {
|
||||
return state;
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* Recording Search Menus
|
||||
******************************************************************************************/
|
||||
|
||||
// --- cRecMenuRecordingSearch --------------------------------------------------------- // OK
|
||||
cRecMenuRecordingSearch::cRecMenuRecordingSearch(std::string search) {
|
||||
SetWidthPercent(60);
|
||||
|
||||
const cString line1 = tr("Search in Recordings");
|
||||
|
||||
AddHeader(new cRecMenuItemInfo(*line1, 1, "", "", "", width - 2 * border, true));
|
||||
AddFooter(new cRecMenuItemButtonYesNo(tr("Perform Search"), tr("Cancel"), rmsRecordingSearchResult, rmsClose, true));
|
||||
|
||||
strncpy(searchString, search.c_str(), TEXTINPUTLENGTH);
|
||||
AddMenuItem(new cRecMenuItemText(tr("Search Expression:"), TEXTINPUTLENGTH, false, searchString));
|
||||
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
// --- cRecMenuRecordingSearchResults ---------------------------------------------------------
|
||||
cRecMenuRecordingSearchResults::cRecMenuRecordingSearchResults(std::string searchString, const cRecording **searchResults, int numResults) {
|
||||
this->searchString = searchString;
|
||||
this->searchResults = searchResults;
|
||||
SetWidthPercent(80);
|
||||
cString message1 = tr("Found");
|
||||
cString message2 = tr("recording");
|
||||
cString message3 = tr("recordings");
|
||||
cString message4 = tr("for");
|
||||
this->numResults = numResults;
|
||||
cString infoText = cString::sprintf("%s %d %s %s:\n\"%s\"", *message1, numResults, (numResults>1)?(*message3):(*message2), *message4, 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"), rmsRecordingSearch, rmsClose, false);
|
||||
SetFooter(buttons);
|
||||
if (searchResults && (numResults > 0)) {
|
||||
for (int i = 0; i < numResults; i++) {
|
||||
if (!AddMenuItemInitial(new cRecMenuItemRecording(searchResults[i], (i == 0) ? true : false)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
cRecMenuItem *cRecMenuRecordingSearchResults::GetMenuItem(int number) {
|
||||
if ((number >= 0) && (number < numResults)) {
|
||||
cRecMenuItem *result = new cRecMenuItemRecording(searchResults[number], false);
|
||||
return result;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int cRecMenuRecordingSearchResults::GetTotalNumMenuItems(void) {
|
||||
return numResults;
|
||||
}
|
||||
|
||||
// --- cRecMenuRecordingSearchNotFound ---------------------------------------------------------
|
||||
cRecMenuRecordingSearchNotFound::cRecMenuRecordingSearchNotFound(std::string searchString) {
|
||||
SetWidthPercent(50);
|
||||
cString message = tr("No recordings found for");
|
||||
cString text = cString::sprintf("%s\n\"%s\"",
|
||||
*message,
|
||||
searchString.c_str());
|
||||
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text);
|
||||
infoItem->CalculateHeight(width - 2 * border);
|
||||
AddMenuItem(infoItem);
|
||||
AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsClose, true, true));
|
||||
CalculateHeight();
|
||||
CreatePixmap();
|
||||
Arrange();
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* Favorites
|
||||
******************************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user