Refactor cRecMenuSearchNothingFound

This commit is contained in:
kamel5 2019-11-09 15:04:52 +01:00
parent 412a78a112
commit 380e84afcd
1 changed files with 14 additions and 25 deletions

View File

@ -1243,6 +1243,20 @@ const cEvent *cRecMenuSearchResults::GetEvent(void) {
return NULL;
}
// --- cRecMenuSearchNothingFound ---------------------------------------------------------
cRecMenuSearchNothingFound::cRecMenuSearchNothingFound(std::string searchString, bool tooShort) { // OK
SetWidthPercent(50);
const cString line1 = cString::sprintf("%s", (!tooShort) ? tr("Nothing found for Search String") : tr("Search String has to have at least three letters"));
const cString line2 = cString::sprintf("\"%s\"", searchString.c_str());
AddHeader(new cRecMenuItemInfo(*line1, 2, *line2, "", "", width - 2 * border));
AddFooter(new cRecMenuItemButton(tr("OK"), rmsSearchNothingFoundConfirm, true, true));
CalculateHeight();
CreatePixmap();
Arrange();
}
// --- cRecMenuSearchConfirmTimer ---------------------------------------------------------
cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRecMenuState nextAction) {
@ -1271,31 +1285,6 @@ cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRec
Arrange();
}
// --- cRecMenuSearchNothingFound ---------------------------------------------------------
cRecMenuSearchNothingFound::cRecMenuSearchNothingFound(std::string searchString, bool tooShort) {
SetWidthPercent(50);
cString text;
if (!tooShort) {
cString message = tr("Nothing found for Search String");
text = cString::sprintf("%s\n\"%s\"",
*message,
searchString.c_str());
} else {
cString message = tr("Search String has to have at least three letters");
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"), rmsSearchNothingFoundConfirm, true, true));
CalculateHeight();
CreatePixmap();
Arrange();
}
/******************************************************************************************
* Recording Search Menus
******************************************************************************************/