2013-12-07 15:51:50 +01:00
# include "services/remotetimers.h"
2014-01-26 09:42:27 +01:00
# include "tools.h"
2019-07-10 17:35:55 +02:00
# include "recmenuview.h"
2013-12-07 15:51:50 +01:00
# include "recmenus.h"
2013-07-09 00:20:49 +02:00
// --- cRecMenuMain ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuMain : : cRecMenuMain ( bool epgSearchAvailable , bool timerActive , bool switchTimerActive ) {
2014-02-06 17:38:55 +01:00
eRecMenuState action = rmsInstantRecord ;
2013-12-07 15:51:50 +01:00
if ( ! timerActive ) {
2019-07-11 11:28:11 +02:00
if ( config . instRecFolderMode = = eFolderSelect )
2014-02-06 17:38:55 +01:00
action = rmsInstantRecordFolder ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Instant Record " ) , action , true , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
} else {
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Delete Timer " ) , rmsDeleteTimer , true , false , false , true ) ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " Edit Timer " ) , rmsEditTimer , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Timer Timeline " ) , rmsTimeline , false , false , false , true ) ) ;
if ( epgSearchAvailable ) {
AddMenuItem ( new cRecMenuItemButton ( tr ( " Create Search Timer " ) , rmsSearchTimer , false , false , false , true ) ) ;
2014-02-07 16:18:37 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Search Timers " ) , rmsSearchTimers , false , false , false , true ) ) ;
2014-01-10 12:44:01 +01:00
}
2019-07-11 11:28:11 +02:00
if ( config . instRecFolderMode = = eFolderSelect )
2014-02-06 17:38:55 +01:00
action = rmsSeriesTimerFolder ;
else
action = rmsSeriesTimer ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Create Series Timer " ) , action , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
if ( epgSearchAvailable ) {
if ( ! switchTimerActive ) {
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Create Switch Timer " ) , rmsSwitchTimer , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
} else {
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Delete Switch Timer " ) , rmsSwitchTimerDelete , false , false , false , true ) ) ;
2013-07-09 00:20:49 +02:00
}
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Search " ) , rmsSearch , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-02 11:25:58 +01:00
2013-12-07 15:51:50 +01:00
if ( epgSearchAvailable ) {
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Check for Timer Conflicts " ) , rmsTimerConflicts , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Search in Recordings " ) , rmsRecordingSearch , false , false , false , true ) ) ;
2013-12-07 15:51:50 +01:00
int menuWidth = CalculateOptimalWidth ( ) + 4 * border ;
SetWidthPixel ( menuWidth ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
2013-07-09 00:20:49 +02:00
} ;
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* Instant Timer Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-07-18 17:59:59 +02:00
// --- cRecMenuAskFolder ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuAskFolder : : cRecMenuAskFolder ( const cEvent * event , eRecMenuState nextAction ) {
SetWidthPercent ( 80 ) ;
NextAction = nextAction ;
cString message = tr ( " Set Folder for " ) ;
cString headerText = cString : : sprintf ( " %s \n \" %s \" " , * message , event - > Title ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * headerText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2014-01-10 12:44:01 +01:00
AddMenuItemInitial ( new cRecMenuItemButton ( tr ( " root video folder " ) , nextAction , true , false , true ) ) ;
2013-12-07 15:51:50 +01:00
2014-02-06 17:38:55 +01:00
ReadRecordingDirectories ( & folders , NULL , " " ) ;
2013-12-07 15:51:50 +01:00
int numFolders = folders . size ( ) ;
for ( int i = 0 ; i < numFolders ; i + + ) {
2014-02-06 17:38:55 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemButton ( folders [ i ] . c_str ( ) , nextAction , false , false , true ) ) )
2013-12-07 15:51:50 +01:00
break ;
2013-07-18 17:59:59 +02:00
}
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuItem * cRecMenuAskFolder : : GetMenuItem ( int number ) {
if ( number = = 0 ) {
cRecMenuItem * result = new cRecMenuItemButton ( tr ( " root video folder " ) , rmsInstantRecord , false , false , true ) ;
return result ;
2019-03-23 13:43:37 +01:00
} else if ( ( number > 0 ) & & ( number < ( int ) folders . size ( ) + 1 ) ) {
2014-02-06 17:38:55 +01:00
cRecMenuItem * result = new cRecMenuItemButton ( folders [ number - 1 ] . c_str ( ) , rmsInstantRecord , false , false , true ) ;
2013-12-07 15:51:50 +01:00
return result ;
}
return NULL ;
}
2013-07-18 17:59:59 +02:00
2013-12-07 15:51:50 +01:00
int cRecMenuAskFolder : : GetTotalNumMenuItems ( void ) {
return folders . size ( ) + 1 ;
}
2013-07-18 17:59:59 +02:00
2014-01-10 12:44:01 +01:00
std : : string cRecMenuAskFolder : : GetFolder ( void ) {
std : : string folder = " " ;
int folderActive = GetActive ( ) ;
2019-03-23 13:43:37 +01:00
if ( folderActive > 0 & & folderActive < ( int ) folders . size ( ) + 1 )
2014-02-06 17:38:55 +01:00
folder = folders [ folderActive - 1 ] ;
2014-01-10 12:44:01 +01:00
return folder ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuConfirmTimer ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuConfirmTimer : : cRecMenuConfirmTimer ( const cEvent * event ) {
SetWidthPercent ( 50 ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cString channelName = Channels - > GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
# else
2019-03-30 18:06:47 +01:00
const cString channelName = Channels . GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
cString message ;
bool eventHasTimer = false ;
2019-07-11 11:28:11 +02:00
if ( config . useRemoteTimers & & pRemoteTimers ) {
2013-12-07 15:51:50 +01:00
RemoteTimers_GetMatch_v1_0 rtMatch ;
rtMatch . event = event ;
pRemoteTimers - > Service ( " RemoteTimers::GetMatch-v1.0 " , & rtMatch ) ;
if ( rtMatch . timerMatch = = tmFull ) {
eventHasTimer = true ;
2013-07-09 00:20:49 +02:00
}
2013-12-07 15:51:50 +01:00
} else {
eventHasTimer = event - > HasTimer ( ) ;
}
if ( eventHasTimer ) {
message = tr ( " Timer created " ) ;
} else {
message = tr ( " Timer NOT created " ) ;
}
cString text = cString : : sprintf ( " %s \n %s \n %s %s - %s \n %s " ,
* message ,
* channelName ,
* event - > GetDateString ( ) ,
* event - > GetTimeString ( ) ,
* event - > GetEndTimeString ( ) ,
event - > Title ( )
) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuConfirmDeleteTimer ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuConfirmDeleteTimer : : cRecMenuConfirmDeleteTimer ( const cEvent * event ) {
SetWidthPercent ( 50 ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cString channelName = Channels - > GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
# else
2019-03-30 18:06:47 +01:00
const cString channelName = Channels . GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
cString text = cString : : sprintf ( " %s \n %s \n %s %s - %s \n %s " ,
tr ( " Timer deleted " ) ,
* channelName ,
* event - > GetDateString ( ) ,
* event - > GetTimeString ( ) ,
* event - > GetEndTimeString ( ) ,
event - > Title ( )
) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 4 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true , true ) ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuAskDeleteTimer ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuAskDeleteTimer : : cRecMenuAskDeleteTimer ( const cEvent * event ) {
SetWidthPercent ( 50 ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cString channelName = Channels - > GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
# else
2019-03-30 18:06:47 +01:00
const cString channelName = Channels . GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
cString text = cString : : sprintf ( " %s \" %s, %s \" %s " ,
tr ( " Timer " ) ,
* channelName ,
event - > Title ( ) ,
tr ( " still recording - really delete? " ) ) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 4 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButtonYesNo ( tr ( " Yes " ) , tr ( " No " ) , rmsDeleteTimerConfirmation , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuTimerConflicts ---------------------------------------------------------
2013-12-29 18:13:45 +01:00
cRecMenuTimerConflicts : : cRecMenuTimerConflicts ( cTVGuideTimerConflicts * conflicts ) {
int numConflicts = conflicts - > NumConflicts ( ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cString text ;
if ( numConflicts = = 1 ) {
text = cString : : sprintf ( " %s %s %s " , tr ( " One " ) , tr ( " Timer Conflict " ) , tr ( " detected " ) ) ;
} else {
2013-12-29 18:13:45 +01:00
text = cString : : sprintf ( " %d %s %s " , conflicts - > NumConflicts ( ) , tr ( " Timer Conflicts " ) , tr ( " detected " ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text , true ) ;
2013-12-07 15:51:50 +01:00
for ( int i = 0 ; i < numConflicts ; i + + ) {
2013-12-29 18:13:45 +01:00
cTVGuideTimerConflict * conflict = conflicts - > GetConflict ( i ) ;
if ( ! conflict )
continue ;
cString dateTime = DayDateTime ( conflict - > time ) ;
int numTimers = conflict - > timerIDs . size ( ) ;
2013-12-07 15:51:50 +01:00
cString textConflict = cString : : sprintf ( " %s: %s (%d %s) " , tr ( " Show conflict " ) , * dateTime , numTimers , tr ( " timers involved " ) ) ;
bool isActive = ( i = = 0 ) ? true : false ;
AddMenuItem ( new cRecMenuItemButton ( * textConflict , rmsTimerConflict , isActive ) ) ;
}
SetWidthPixel ( CalculateOptimalWidth ( ) + 4 * border ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Ignore Conflicts " ) , rmsClose , false ) ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
int cRecMenuTimerConflicts : : GetTimerConflict ( void ) {
return GetActive ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuTimerConflict ---------------------------------------------------------
2013-12-29 18:13:45 +01:00
cRecMenuTimerConflict : : cRecMenuTimerConflict ( cTVGuideTimerConflict * conflict ) {
SetWidthPercent ( 95 ) ;
2013-12-07 15:51:50 +01:00
this - > conflict = conflict ;
2013-12-29 18:13:45 +01:00
SetHeader ( new cRecMenuItemTimerConflictHeader ( conflict - > timeStart ,
conflict - > timeStop ,
conflict - > overlapStart ,
conflict - > overlapStop ) ) ;
2013-12-07 15:51:50 +01:00
SetFooter ( new cRecMenuItemButton ( tr ( " Ignore Conflict " ) , rmsIgnoreTimerConflict , false , true ) ) ;
int i = 0 ;
2013-12-29 18:13:45 +01:00
for ( std : : vector < int > : : iterator it = conflict - > timerIDs . begin ( ) ; it ! = conflict - > timerIDs . end ( ) ; it + + ) {
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_TIMERS_READ ;
const cTimer * timer = Timers - > Get ( * it ) ;
# else
2013-12-07 15:51:50 +01:00
const cTimer * timer = Timers . Get ( * it ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
if ( timer ) {
2014-01-10 12:44:01 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemTimer ( timer ,
2013-12-07 15:51:50 +01:00
rmsTimerConflictShowInfo ,
rmsDeleteTimerConflictMenu ,
2013-12-29 18:13:45 +01:00
rmsEditTimerConflictMenu ,
rmsSearchRerunsTimerConflictMenu ,
conflict - > timeStart ,
conflict - > timeStop ,
conflict - > overlapStart ,
conflict - > overlapStop ,
2013-12-07 15:51:50 +01:00
( ! i ) ? true : false )
2014-01-10 12:44:01 +01:00
) )
break ;
2013-12-07 15:51:50 +01:00
i + + ;
2013-07-09 00:20:49 +02:00
}
2013-12-07 15:51:50 +01:00
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cRecMenuItem * cRecMenuTimerConflict : : GetMenuItem ( int number ) {
2019-03-23 13:43:37 +01:00
if ( ( number > = 0 ) & & ( number < ( int ) conflict - > timerIDs . size ( ) ) ) {
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_TIMERS_READ ;
const cTimer * timer = Timers - > Get ( conflict - > timerIDs [ number ] ) ;
# else
2013-12-29 18:13:45 +01:00
const cTimer * timer = Timers . Get ( conflict - > timerIDs [ number ] ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
cRecMenuItem * result = new cRecMenuItemTimer ( timer ,
rmsTimerConflictShowInfo ,
rmsDeleteTimerConflictMenu ,
2013-12-29 18:13:45 +01:00
rmsEditTimerConflictMenu ,
rmsSearchRerunsTimerConflictMenu ,
conflict - > timeStart ,
conflict - > timeStop ,
conflict - > overlapStart ,
conflict - > overlapStop ,
2013-12-07 15:51:50 +01:00
false ) ;
return result ;
}
return NULL ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
int cRecMenuTimerConflict : : GetTotalNumMenuItems ( void ) {
2013-12-29 18:13:45 +01:00
return conflict - > timerIDs . size ( ) ;
2013-12-07 15:51:50 +01:00
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
int cRecMenuTimerConflict : : GetTimerConflictIndex ( void ) {
return GetActive ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuNoTimerConflict ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuNoTimerConflict : : cRecMenuNoTimerConflict ( void ) {
SetWidthPercent ( 50 ) ;
cString text = tr ( " No Timer Conflicts found " ) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 4 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " Close " ) , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2013-12-29 18:13:45 +01:00
// --- cRecMenuRerunResults ---------------------------------------------------------
cRecMenuRerunResults : : cRecMenuRerunResults ( const cEvent * original , const cEvent * * reruns , int numReruns ) {
this - > reruns = reruns ;
this - > numReruns = numReruns ;
SetWidthPercent ( 70 ) ;
this - > numReruns = numReruns ;
cString message1 = tr ( " reruns for " ) ;
cString message2 = tr ( " rerun for " ) ;
cString message3 = tr ( " found " ) ;
cString infoText = cString : : sprintf ( " %d %s: \n \" %s \" %s " , numReruns , ( numReruns > 1 ) ? ( * message1 ) : ( * message2 ) , original - > Title ( ) , * message3 ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItem * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-29 18:13:45 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
cRecMenuItem * button = new cRecMenuItemButton ( tr ( " Ignore reruns " ) , rmsTimerConflictIgnoreReruns , false ) ;
SetFooter ( button ) ;
if ( reruns & & ( numReruns > 0 ) ) {
for ( int i = 0 ; i < numReruns ; i + + ) {
2014-01-10 12:44:01 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemEvent ( reruns [ i ] , rmsSearchShowInfo , rmsTimerConflictRecordRerun , ( i = = 0 ) ? true : false ) ) )
2013-12-29 18:13:45 +01:00
break ;
}
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuItem * cRecMenuRerunResults : : GetMenuItem ( int number ) {
if ( ( number > = 0 ) & & ( number < numReruns ) ) {
cRecMenuItem * result = new cRecMenuItemEvent ( reruns [ number ] , rmsSearchShowInfo , rmsTimerConflictRecordRerun , false ) ;
return result ;
}
return NULL ;
}
int cRecMenuRerunResults : : GetTotalNumMenuItems ( void ) {
return numReruns ;
}
2014-01-10 12:44:01 +01:00
const cEvent * cRecMenuRerunResults : : GetRerunEvent ( void ) {
cRecMenuItemEvent * activeItem = dynamic_cast < cRecMenuItemEvent * > ( GetActiveMenuItem ( ) ) ;
return activeItem - > GetEventValue ( ) ;
}
2013-12-29 18:13:45 +01:00
// --- cRecMenuNoRerunsFound ---------------------------------------------------------
cRecMenuNoRerunsFound : : cRecMenuNoRerunsFound ( cString searchString ) {
SetWidthPercent ( 50 ) ;
cString message = tr ( " No reruns found for Event " ) ;
cString text = cString : : sprintf ( " %s \n \" %s \" " ,
* message ,
* searchString ) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsTimerConflictIgnoreReruns , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
// --- cRecMenuConfirmRerunUsed ---------------------------------------------------------
cRecMenuConfirmRerunUsed : : cRecMenuConfirmRerunUsed ( const cEvent * original , const cEvent * replace ) {
SetWidthPercent ( 70 ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cString channelOrig = Channels - > GetByChannelID ( original - > ChannelID ( ) ) - > Name ( ) ;
const cString channelReplace = Channels - > GetByChannelID ( replace - > ChannelID ( ) ) - > Name ( ) ;
# else
2019-03-30 18:06:47 +01:00
const cString channelOrig = Channels . GetByChannelID ( original - > ChannelID ( ) ) - > Name ( ) ;
const cString channelReplace = Channels . GetByChannelID ( replace - > ChannelID ( ) ) - > Name ( ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-29 18:13:45 +01:00
cString message1 = tr ( " Timer for " ) ;
cString message2 = tr ( " replaced by rerun " ) ;
cString text = cString : : sprintf ( " %s \n \" %s \" , %s %s, %s \n %s \n \" %s \" , %s %s, %s " ,
* message1 ,
original - > Title ( ) ,
* original - > GetDateString ( ) ,
* original - > GetTimeString ( ) ,
* channelOrig ,
* message2 ,
replace - > Title ( ) ,
* replace - > GetDateString ( ) ,
* replace - > GetTimeString ( ) ,
* channelReplace ) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsTimerConflicts , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuEditTimer ---------------------------------------------------------
2018-03-08 13:02:38 +01:00
cRecMenuEditTimer : : cRecMenuEditTimer ( const cTimer * timer , eRecMenuState nextState ) {
2014-01-26 09:42:27 +01:00
SetWidthPercent ( 70 ) ;
2014-01-10 12:44:01 +01:00
if ( ! timer )
return ;
originalTimer = timer ;
cString title ( " " ) ;
cString channelName ( " " ) ;
if ( timer - > Event ( ) )
title = timer - > Event ( ) - > Title ( ) ;
if ( timer - > Channel ( ) )
channelName = timer - > Channel ( ) - > Name ( ) ;
cString infoText = cString : : sprintf ( " %s: \n %s, %s " , tr ( " Edit Timer " ) , * title , * channelName ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2014-01-10 12:44:01 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
2014-02-06 17:38:55 +01:00
AddMenuItemInitial ( infoItem ) ;
2014-01-10 12:44:01 +01:00
timerActive = false ;
2019-07-11 11:28:11 +02:00
if ( config . useRemoteTimers & & pRemoteTimers ) {
2014-01-10 12:44:01 +01:00
RemoteTimers_GetMatch_v1_0 rtMatch ;
rtMatch . event = timer - > Event ( ) ;
pRemoteTimers - > Service ( " RemoteTimers::GetMatch-v1.0 " , & rtMatch ) ;
if ( rtMatch . timer ) {
if ( rtMatch . timerMatch = = tmFull )
timerActive = true ;
2014-01-03 11:56:45 +01:00
}
2014-01-10 12:44:01 +01:00
} else
timerActive = timer - > HasFlags ( tfActive ) ;
day = timer - > Day ( ) ;
start = timer - > Start ( ) ;
stop = timer - > Stop ( ) ;
prio = timer - > Priority ( ) ;
lifetime = timer - > Lifetime ( ) ;
2014-01-26 09:42:27 +01:00
strncpy ( folder , GetDirectoryFromTimer ( timer - > File ( ) ) . c_str ( ) , TEXTINPUTLENGTH ) ;
2014-01-10 12:44:01 +01:00
2014-02-06 17:38:55 +01:00
AddMenuItemInitial ( new cRecMenuItemBool ( tr ( " Timer Active " ) , timerActive , false , true , & timerActive ) ) ;
AddMenuItemInitial ( new cRecMenuItemInt ( tr ( " Priority " ) , prio , 0 , MAXPRIORITY , false , & prio ) ) ;
AddMenuItemInitial ( new cRecMenuItemInt ( tr ( " Lifetime " ) , lifetime , 0 , MAXLIFETIME , false , & lifetime ) ) ;
AddMenuItemInitial ( new cRecMenuItemDay ( tr ( " Day " ) , day , false , & day ) ) ;
AddMenuItemInitial ( new cRecMenuItemTime ( tr ( " Timer start time " ) , start , false , & start ) ) ;
AddMenuItemInitial ( new cRecMenuItemTime ( tr ( " Timer stop time " ) , stop , false , & stop ) ) ;
cString fileInfo = cString : : sprintf ( " %s: \n %s " , tr ( " Timer File " ) , timer - > File ( ) ) ;
cRecMenuItemInfo * fileInfoItem = new cRecMenuItemInfo ( * fileInfo , false ) ;
fileInfoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItemInitial ( fileInfoItem ) ;
AddMenuItemInitial ( new cRecMenuItemSelectDirectory ( tr ( " New Folder " ) , std : : string ( folder ) , false , folder ) ) ;
2014-01-10 12:44:01 +01:00
if ( nextState = = rmsTimelineTimerSave ) {
2014-02-06 17:38:55 +01:00
AddMenuItemInitial ( new cRecMenuItemButton ( tr ( " Delete Timer " ) , rmsTimelineTimerDelete , false , false ) ) ;
AddMenuItemInitial ( new cRecMenuItemButtonYesNo ( tr ( " Save " ) , tr ( " Cancel " ) , nextState , rmsTimeline , false ) ) ;
2014-01-10 12:44:01 +01:00
} else {
2014-02-06 17:38:55 +01:00
AddMenuItemInitial ( new cRecMenuItemButtonYesNo ( tr ( " Save " ) , tr ( " Cancel " ) , nextState , rmsClose , false ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-10 12:44:01 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2018-03-08 13:02:38 +01:00
const cTimer * cRecMenuEditTimer : : GetOriginalTimer ( void ) {
2014-01-10 12:44:01 +01:00
return originalTimer ;
}
cTimer cRecMenuEditTimer : : GetTimer ( void ) {
cTimer t ;
if ( timerActive )
t . SetFlags ( tfActive ) ;
else
t . SetFlags ( tfNone ) ;
t . SetDay ( day ) ;
t . SetStart ( start ) ;
t . SetStop ( stop ) ;
t . SetPriority ( prio ) ;
t . SetLifetime ( lifetime ) ;
2014-01-26 09:42:27 +01:00
std : : string newFolder ( folder ) ;
std : : string newFile = originalTimer - > File ( ) ;
2014-02-06 17:38:55 +01:00
size_t found = newFile . find_last_of ( ' ~ ' ) ;
if ( found ! = std : : string : : npos ) {
std : : string fileName = newFile . substr ( found + 1 ) ;
if ( newFolder . size ( ) > 0 )
newFile = * cString : : sprintf ( " %s~%s " , newFolder . c_str ( ) , fileName . c_str ( ) ) ;
else
newFile = fileName ;
} else {
if ( newFolder . size ( ) > 0 )
newFile = * cString : : sprintf ( " %s~%s " , newFolder . c_str ( ) , newFile . c_str ( ) ) ;
2014-01-26 09:42:27 +01:00
}
std : : replace ( newFile . begin ( ) , newFile . end ( ) , ' / ' , ' ~ ' ) ;
t . SetFile ( newFile . c_str ( ) ) ;
2014-01-10 12:44:01 +01:00
return t ;
2013-12-07 15:51:50 +01:00
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* Series Timer Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-12-07 15:51:50 +01:00
// --- cRecMenuSeriesTimer ---------------------------------------------------------
2018-03-08 13:02:38 +01:00
cRecMenuSeriesTimer : : cRecMenuSeriesTimer ( const cChannel * initialChannel , const cEvent * event , std : : string folder ) {
2014-01-10 12:44:01 +01:00
if ( ! initialChannel )
return ;
timerActive = true ;
channel = initialChannel - > Number ( ) ;
dayOfWeek = 127 ;
priority = MAXPRIORITY ;
lifetime = MAXLIFETIME ;
CalculateTimes ( event ) ;
this - > folder = folder ;
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 70 ) ;
2014-01-10 12:44:01 +01:00
cString title = tr ( " Create Series Timer based on " ) ;
cString infoText = cString : : sprintf ( " %s: \n %s " , * title , event - > Title ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2014-01-10 12:44:01 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2014-01-12 16:27:59 +01:00
AddMenuItem ( new cRecMenuItemBool ( tr ( " Timer Active " ) , timerActive , false , false , & timerActive ) ) ;
2019-03-30 18:06:47 +01:00
# if VDRVERSNUM >= 20301
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemChannelChooser ( tr ( " Channel " ) , initialChannel , false , & channel ) ) ;
2019-03-30 18:06:47 +01:00
# else
AddMenuItem ( new cRecMenuItemChannelChooser ( tr ( " Channel " ) , ( cChannel * ) initialChannel , false , & channel ) ) ;
# endif
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemTime ( tr ( " Series Timer start time " ) , start , false , & start ) ) ;
AddMenuItem ( new cRecMenuItemTime ( tr ( " Series Timer stop time " ) , stop , false , & stop ) ) ;
AddMenuItem ( new cRecMenuItemDayChooser ( tr ( " Days to record " ) , dayOfWeek , false , & dayOfWeek ) ) ;
AddMenuItem ( new cRecMenuItemDay ( tr ( " Day to start " ) , tstart , false , & tstart ) ) ;
AddMenuItem ( new cRecMenuItemInt ( tr ( " Priority " ) , priority , 0 , MAXPRIORITY , false , & priority ) ) ;
AddMenuItem ( new cRecMenuItemInt ( tr ( " Lifetime " ) , lifetime , 0 , MAXLIFETIME , false , & lifetime ) ) ;
2014-01-12 16:27:59 +01:00
AddMenuItem ( new cRecMenuItemButtonYesNo ( tr ( " Create Timer " ) , tr ( " Cancel " ) , rmsSeriesTimerCreate , rmsClose , true ) ) ;
2014-01-10 12:44:01 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cTimer * cRecMenuSeriesTimer : : GetTimer ( void ) {
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cChannel * chan = Channels - > GetByNumber ( channel ) ;
# else
2014-01-10 12:44:01 +01:00
cChannel * chan = Channels . GetByNumber ( channel ) ;
2018-03-08 13:02:38 +01:00
# endif
2014-01-10 12:44:01 +01:00
cTimer * seriesTimer = new cTimer ( NULL , NULL , chan ) ;
cString fileName = " TITLE EPISODE " ;
if ( folder . size ( ) > 0 ) {
std : : replace ( folder . begin ( ) , folder . end ( ) , ' / ' , ' ~ ' ) ;
fileName = cString : : sprintf ( " %s~%s " , folder . c_str ( ) , * fileName ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-10 12:44:01 +01:00
seriesTimer - > SetDay ( tstart ) ;
seriesTimer - > SetStart ( start ) ;
seriesTimer - > SetStop ( stop ) ;
seriesTimer - > SetPriority ( priority ) ;
seriesTimer - > SetLifetime ( lifetime ) ;
seriesTimer - > SetWeekDays ( dayOfWeek ) ;
seriesTimer - > SetFile ( * fileName ) ;
if ( timerActive )
seriesTimer - > SetFlags ( tfActive ) ;
else
seriesTimer - > SetFlags ( tfNone ) ;
return seriesTimer ;
}
void cRecMenuSeriesTimer : : CalculateTimes ( const cEvent * event ) {
tstart = event - > StartTime ( ) ;
tstart - = Setup . MarginStart * 60 ;
time_t tstop = tstart + event - > Duration ( ) ;
tstop + = Setup . MarginStop * 60 ;
struct tm tm_r ;
struct tm * time = localtime_r ( & tstart , & tm_r ) ;
start = time - > tm_hour * 100 + time - > tm_min ;
time = localtime_r ( & tstop , & tm_r ) ;
stop = time - > tm_hour * 100 + time - > tm_min ;
if ( stop > = 2400 )
stop - = 2400 ;
2013-12-07 15:51:50 +01:00
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
// --- cRecMenuConfirmSeriesTimer ---------------------------------------------------------
cRecMenuConfirmSeriesTimer : : cRecMenuConfirmSeriesTimer ( cTimer * seriesTimer ) {
SetWidthPercent ( 50 ) ;
cString message = tr ( " Series Timer created " ) ;
cString infoText = message ;
if ( seriesTimer ) {
cString days = cTimer : : PrintDay ( seriesTimer - > Day ( ) , seriesTimer - > WeekDays ( ) , true ) ;
infoText = cString : : sprintf ( " %s \n %s, %s: %s, %s: %s " , * message , * days , tr ( " Start " ) , * TimeString ( seriesTimer - > StartTime ( ) ) , tr ( " Stop " ) , * TimeString ( seriesTimer - > StopTime ( ) ) ) ;
}
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* SearchTimer Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-12-07 15:51:50 +01:00
// --- cRecMenuSearchTimer ---------------------------------------------------------
cRecMenuSearchTimer : : cRecMenuSearchTimer ( const cEvent * event ) {
SetWidthPercent ( 70 ) ;
cString message = tr ( " Configure Search Timer based on " ) ;
cString infoText = cString : : sprintf ( " %s: \n \" %s \" " , * message , event - > Title ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
2014-01-10 12:44:01 +01:00
SetHeader ( infoItem ) ;
strncpy ( searchString , event - > Title ( ) , TEXTINPUTLENGTH ) ;
AddMenuItemInitial ( new cRecMenuItemText ( tr ( " Search Expression: " ) , searchString , TEXTINPUTLENGTH , false ) ) ;
AddMenuItemInitial ( new cRecMenuItemButtonYesNo ( tr ( " Continue " ) , tr ( " Cancel " ) , rmsSearchTimerOptions , rmsClose , true ) ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
// --- cRecMenuSearchTimerTemplates ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuSearchTimerTemplates : : cRecMenuSearchTimerTemplates ( cTVGuideSearchTimer searchTimer , std : : vector < TVGuideEPGSearchTemplate > templates ) {
this - > searchTimer = searchTimer ;
2013-12-07 15:51:50 +01:00
this - > templates = templates ;
SetWidthPercent ( 70 ) ;
cString message = tr ( " Configure Search Timer for Search String " ) ;
2019-06-16 13:11:28 +02:00
cString infoText = cString : : sprintf ( " %s: \n %s " , * message , searchTimer . GetSearchString ( ) . c_str ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
AddMenuItemInitial ( new cRecMenuItemButton ( tr ( " Manually configure Options " ) , rmsSearchTimerEdit , true ) ) ;
2013-12-07 15:51:50 +01:00
numTemplates = templates . size ( ) ;
for ( int i = 0 ; i < numTemplates ; i + + ) {
cString buttonText = cString : : sprintf ( " %s \" %s \" " , tr ( " Use Template " ) , templates [ i ] . name . c_str ( ) ) ;
2014-01-10 12:44:01 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemButton ( * buttonText , rmsSearchTimerCreateWithTemplate , false ) ) )
2013-12-07 15:51:50 +01:00
break ;
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuItem * cRecMenuSearchTimerTemplates : : GetMenuItem ( int number ) {
if ( number = = 0 ) {
2014-01-10 12:44:01 +01:00
return new cRecMenuItemButton ( tr ( " Manually configure Options " ) , rmsSearchTimerEdit , false ) ;
2013-12-07 15:51:50 +01:00
} else if ( ( number > 0 ) & & ( number < numTemplates + 1 ) ) {
cString buttonText = cString : : sprintf ( " %s \" %s \" " , tr ( " Use Template " ) , templates [ number - 1 ] . name . c_str ( ) ) ;
2014-01-10 12:44:01 +01:00
cRecMenuItem * templ = new cRecMenuItemButton ( * buttonText , rmsSearchTimerCreateWithTemplate , false ) ;
2013-12-07 15:51:50 +01:00
return templ ;
}
return NULL ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
int cRecMenuSearchTimerTemplates : : GetTotalNumMenuItems ( void ) {
return numTemplates + 1 ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
TVGuideEPGSearchTemplate cRecMenuSearchTimerTemplates : : GetTemplate ( void ) {
TVGuideEPGSearchTemplate templ ;
int tmplActive = GetActive ( ) - 1 ;
2019-03-23 13:43:37 +01:00
if ( tmplActive > = 0 & & tmplActive < ( int ) templates . size ( ) )
2014-01-10 12:44:01 +01:00
templ = templates [ tmplActive ] ;
return templ ;
}
// --- cRecMenuSearchTimers ---------------------------------------------------------
cRecMenuSearchTimers : : cRecMenuSearchTimers ( std : : vector < cTVGuideSearchTimer > searchTimers ) {
this - > searchTimers = searchTimers ;
numSearchTimers = searchTimers . size ( ) ;
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 70 ) ;
2014-01-10 12:44:01 +01:00
cString headline ;
if ( numSearchTimers > 0 ) {
2014-02-07 16:18:37 +01:00
headline = tr ( " EPGSearch Search Timers " ) ;
2014-01-10 12:44:01 +01:00
} else {
headline = tr ( " No Search Timers Configured " ) ;
}
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * headline , true ) ;
2014-01-10 12:44:01 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
cRecMenuItem * button = new cRecMenuItemButton ( tr ( " Close " ) , rmsClose , ( ! numSearchTimers ) ? true : false ) ;
SetFooter ( button ) ;
2014-01-27 19:14:43 +01:00
if ( numSearchTimers > 0 )
SetMenuItems ( ) ;
2014-01-10 12:44:01 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuSearchTimers : : ~ cRecMenuSearchTimers ( void ) {
}
void cRecMenuSearchTimers : : SetMenuItems ( void ) {
for ( int i = 0 ; i < numSearchTimers ; i + + ) {
2014-02-07 16:18:37 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemSearchTimer ( searchTimers [ i ] , rmsSearchTimerTest , rmsSearchTimerEdit , rmsSearchTimerDeleteConfirm , ( i = = 0 ) ? true : false ) ) )
2014-01-27 19:14:43 +01:00
break ;
2014-01-10 12:44:01 +01:00
}
}
cTVGuideSearchTimer cRecMenuSearchTimers : : GetSearchTimer ( void ) {
cRecMenuItemSearchTimer * activeItem = dynamic_cast < cRecMenuItemSearchTimer * > ( GetActiveMenuItem ( ) ) ;
return activeItem - > GetTimer ( ) ;
}
cRecMenuItem * cRecMenuSearchTimers : : GetMenuItem ( int number ) {
if ( number < 0 | | number > = numSearchTimers )
return NULL ;
2014-02-07 16:18:37 +01:00
return new cRecMenuItemSearchTimer ( searchTimers [ number ] , rmsSearchTimerTest , rmsSearchTimerEdit , rmsSearchTimerDeleteConfirm , false ) ;
2014-01-10 12:44:01 +01:00
}
int cRecMenuSearchTimers : : GetTotalNumMenuItems ( void ) {
return numSearchTimers ;
}
// --- cRecMenuSearchTimerEdit ---------------------------------------------------------
2019-06-16 15:13:06 +02:00
cRecMenuSearchTimerEdit : : cRecMenuSearchTimerEdit ( cTVGuideSearchTimer searchTimer , std : : vector < std : : string > channelGroups ) {
2019-06-17 14:55:37 +02:00
init = true ;
2014-01-10 12:44:01 +01:00
deleteMenuItems = false ;
this - > searchTimer = searchTimer ;
2019-06-17 14:55:37 +02:00
this - > sT = searchTimer ;
2019-04-09 18:25:58 +02:00
this - > channelGroups = channelGroups ;
2019-06-17 14:55:37 +02:00
strncpy ( searchString , sT . searchString . c_str ( ) , TEXTINPUTLENGTH ) ;
2019-04-09 18:25:58 +02:00
channelgroupIndex = - 1 ;
2019-06-17 14:55:37 +02:00
std : : string dir = sT . directory ;
2014-01-26 09:42:27 +01:00
strncpy ( directory , dir . c_str ( ) , TEXTINPUTLENGTH ) ;
2019-07-04 14:17:08 +02:00
dayOfWeek = sT . DayOfWeek ( ) ;
2014-01-10 12:44:01 +01:00
2019-06-17 14:55:37 +02:00
sT . GetSearchModes ( & searchModes ) ;
sT . GetUseChannelModes ( & useChannelModes ) ;
sT . GetCompareDateModes ( & compareDateModes ) ;
sT . GetSearchTimerModes ( & searchTimerModes ) ;
sT . GetDelModes ( & delModes ) ;
2019-06-17 12:25:12 +02:00
channelgroupIndex = SplitChannelGroups ( & channelGroups , & channelgroups ) ;
2014-01-10 12:44:01 +01:00
SetWidthPercent ( 70 ) ;
cString infoText ;
2019-06-17 14:55:37 +02:00
if ( sT . GetID ( ) > - 1 ) {
2014-01-10 12:44:01 +01:00
infoText = tr ( " Configure Search Timer Options " ) ;
} else {
infoText = tr ( " Create Search Timer " ) ;
}
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
2014-01-10 12:44:01 +01:00
SetHeader ( infoItem ) ;
2019-06-16 15:13:06 +02:00
cRecMenuItemButtonYesNo * footerButton = new cRecMenuItemButtonYesNo ( tr ( " Save Search Timer " ) , tr ( " Cancel " ) , rmsSearchTimerSave , rmsSearchTimers , false ) ;
2014-01-10 12:44:01 +01:00
SetFooter ( footerButton ) ;
CreateMenuItems ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
cRecMenuSearchTimerEdit : : ~ cRecMenuSearchTimerEdit ( void ) {
for ( std : : vector < cRecMenuItem * > : : iterator it = mainMenuItems . begin ( ) ; it ! = mainMenuItems . end ( ) ; it + + ) {
delete * it ;
}
mainMenuItems . clear ( ) ;
}
2019-04-09 18:25:58 +02:00
int cRecMenuSearchTimerEdit : : SplitChannelGroups ( std : : vector < std : : string > * channelGroups , std : : vector < std : : string > * channelgroups ) {
int i = 0 ;
int j = 0 ;
for ( std : : vector < std : : string > : : iterator it = channelGroups - > begin ( ) ; it ! = channelGroups - > end ( ) ; it + + ) {
std : : string a = * it ;
splitstring s ( a . c_str ( ) ) ;
std : : vector < std : : string > value = s . split ( ' | ' , 0 ) ;
std : : vector < std : : string > : : iterator ito = value . begin ( ) ;
channelgroups - > push_back ( * ito ) ;
2019-06-16 15:26:23 +02:00
std : : string b = * ito ;
2019-06-17 14:55:37 +02:00
if ( b . compare ( sT . channelGroup ) = = 0 )
2019-04-09 18:25:58 +02:00
j = i ;
i + + ;
}
return j ;
}
2019-06-17 13:06:07 +02:00
void cRecMenuSearchTimerEdit : : CreateMenuItems ( void ) {
2014-01-10 12:44:01 +01:00
2019-06-17 13:06:07 +02:00
int activeMenuItem = 0 ;
if ( mainMenuItems . size ( ) > 0 ) {
for ( long unsigned int index = 0 ; index < mainMenuItems . size ( ) ; index + + ) {
if ( mainMenuItems [ index ] - > isActive ( ) ) {
activeMenuItem = index ;
break ;
}
}
mainMenuItems . clear ( ) ;
}
2014-01-10 12:44:01 +01:00
2019-06-17 14:55:37 +02:00
mainMenuItems . push_back ( new cRecMenuItemText ( tr ( " Search term " ) , searchString , TEXTINPUTLENGTH , init , searchString ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Active " ) , sT . useAsSearchTimer , true , false , & sT . useAsSearchTimer , rmsSearchTimerSave ) ) ;
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Search mode " ) , searchModes , sT . mode , false , & sT . mode , rmsSearchTimerSave , true ) ) ;
if ( sT . mode = = 5 ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Tolerance " ) , sT . fuzzyTolerance , 1 , 9 , false , & sT . fuzzyTolerance , rmsSearchTimerSave , 1 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Match case " ) , sT . useCase , false , false , & sT . useCase , rmsSearchTimerSave ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use title " ) , sT . useTitle , false , false , & sT . useTitle , rmsSearchTimerSave ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use subtitle " ) , sT . useSubtitle , false , false , & sT . useSubtitle , rmsSearchTimerSave ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use description " ) , sT . useDescription , false , false , & sT . useDescription , rmsSearchTimerSave ) ) ;
// mainMenuItems.push_back(new cRecMenuItemBool(tr("Use content descriptor"), sT.useContentDescriptors, false, false, &sT.useContentDescriptors, rmsSearchTimerSave));
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Use channel " ) , useChannelModes , sT . useChannel , false , & sT . useChannel , rmsSearchTimerSave , true ) ) ;
if ( sT . useChannel = = 1 ) {
startChannel = ( sT . channelMin ) ? sT . channelMin - > Number ( ) : 0 ;
stopChannel = ( sT . channelMax ) ? sT . channelMax - > Number ( ) : 0 ;
2019-06-17 14:19:13 +02:00
if ( startChannel = = 0 ) startChannel = 1 ;
if ( stopChannel = = 0 ) stopChannel = 1 ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2019-06-17 14:19:13 +02:00
{
LOCK_CHANNELS_READ ;
2019-06-17 14:55:37 +02:00
mainMenuItems . push_back ( new cRecMenuItemChannelChooser ( tr ( " from channel " ) , Channels - > GetByNumber ( startChannel ) , false , & startChannel , rmsSearchTimerSave , 1 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemChannelChooser ( tr ( " to channel " ) , Channels - > GetByNumber ( stopChannel ) , false , & stopChannel , rmsSearchTimerSave , 1 ) ) ;
2019-06-17 14:19:13 +02:00
}
2018-03-08 13:02:38 +01:00
# else
2019-06-17 14:55:37 +02:00
mainMenuItems . push_back ( new cRecMenuItemChannelChooser ( tr ( " from channel " ) , Channels . GetByNumber ( startChannel ) , false , & startChannel , rmsSearchTimerSave , 1 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemChannelChooser ( tr ( " to channel " ) , Channels . GetByNumber ( stopChannel ) , false , & stopChannel , rmsSearchTimerSave , 1 ) ) ;
2018-03-08 13:02:38 +01:00
# endif
2019-06-17 14:19:13 +02:00
}
2019-06-17 14:55:37 +02:00
else if ( ( sT . useChannel = = 2 ) & & ( channelgroups . size ( ) > 0 ) ) {
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Channel group " ) , channelgroups , channelgroupIndex , false , & channelgroupIndex , rmsSearchTimerSave , false , 1 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use time " ) , sT . useTime , true , false , & sT . useTime , rmsSearchTimerSave ) ) ;
if ( sT . useTime ) {
mainMenuItems . push_back ( new cRecMenuItemTime ( tr ( " Start after " ) , sT . startTime , false , & sT . startTime , rmsSearchTimerSave , 1 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemTime ( tr ( " Start before " ) , sT . stopTime , false , & sT . stopTime , rmsSearchTimerSave , 1 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use duration " ) , sT . useDuration , true , false , & sT . useDuration , rmsSearchTimerSave ) ) ;
if ( sT . useDuration ) {
mainMenuItems . push_back ( new cRecMenuItemTime ( tr ( " Min. duration " ) , sT . minDuration , false , & sT . minDuration , rmsSearchTimerSave , 1 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemTime ( tr ( " Max. duration " ) , sT . maxDuration , false , & sT . maxDuration , rmsSearchTimerSave , 1 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use day of week " ) , sT . useDayOfWeek , true , false , & sT . useDayOfWeek , rmsSearchTimerSave ) ) ;
if ( sT . useDayOfWeek )
2019-07-04 14:17:08 +02:00
mainMenuItems . push_back ( new cRecMenuItemDayChooser ( tr ( " Day of week " ) , dayOfWeek , false , & dayOfWeek , 1 ) ) ;
2019-06-17 14:55:37 +02:00
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use in Favorites " ) , sT . useInFavorites , false , false , & sT . useInFavorites , rmsSearchTimerSave ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use as search timer " ) , sT . useAsSearchTimer , true , false , & sT . useAsSearchTimer , rmsSearchTimerSave ) ) ;
if ( sT . useAsSearchTimer ) {
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Action " ) , searchTimerModes , sT . action , false , & sT . action , rmsSearchTimerSave , true , 1 ) ) ;
if ( sT . action = = searchTimerActionSwitchOnly ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Switch ... minutes before start " ) , sT . switchMinsBefore , 0 , 99 , false , & sT . switchMinsBefore , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Unmute sound " ) , sT . unmuteSoundOnSwitch , false , false , & sT . unmuteSoundOnSwitch , rmsSearchTimerSave , 2 ) ) ;
}
if ( sT . action = = searchTimerActionAnnounceAndSwitch ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Ask ... minutes before start " ) , sT . switchMinsBefore , 0 , 99 , false , & sT . switchMinsBefore , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Unmute sound " ) , sT . unmuteSoundOnSwitch , false , false , & sT . unmuteSoundOnSwitch , rmsSearchTimerSave , 2 ) ) ;
}
if ( ( sT . action = = searchTimerActionRecord ) | | ( sT . action = = searchTimerActionInactiveRecord ) ) {
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Series Recording " ) , sT . useEpisode , false , false , & sT . useEpisode , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemSelectDirectory ( tr ( " Directory " ) , std : : string ( directory ) , false , directory , rmsSearchTimerSave , true , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Delete recordings after ... days " ) , sT . delAfterDays , 0 , 999 , false , & sT . delAfterDays , rmsSearchTimerSave , 2 ) ) ;
if ( sT . delAfterDays > 0 ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Keep ... recordings " ) , sT . recordingsKeep , 0 , 999 , false , & sT . recordingsKeep , rmsSearchTimerSave , 3 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Pause when ... recordings exist " ) , sT . pauseOnNrRecordings , 0 , 999 , false , & sT . pauseOnNrRecordings , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Avoid Repeats " ) , sT . avoidRepeats , true , false , & sT . avoidRepeats , rmsSearchTimerSave , 2 ) ) ;
if ( sT . avoidRepeats ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Allowed repeats " ) , sT . allowedRepeats , 0 , 99 , false , & sT . allowedRepeats , rmsSearchTimerSave , 3 ) ) ;
if ( sT . allowedRepeats > 0 ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Only repeats within ... days " ) , sT . repeatsWithinDays , 0 , 999 , false , & sT . repeatsWithinDays , rmsSearchTimerSave , 4 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Compare Title " ) , sT . compareTitle , false , false , & sT . compareTitle , rmsSearchTimerSave , 3 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Compare Subtitle " ) , sT . compareSubtitle , false , false , & sT . compareSubtitle , rmsSearchTimerSave , 3 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Compare Description " ) , sT . compareSummary , true , false , & sT . compareSummary , rmsSearchTimerSave , 3 ) ) ;
if ( sT . compareSummary ) {
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Min. match in % " ) , sT . compareSummaryMatchInPercent , 1 , 100 , false , & sT . compareSummaryMatchInPercent , rmsSearchTimerSave , 4 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Compare date " ) , compareDateModes , sT . compareDate , false , & sT . compareDate , rmsSearchTimerSave , false , 3 ) ) ;
}
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Priority " ) , sT . priority , 0 , 99 , false , & sT . priority , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Lifetime " ) , sT . lifetime , 0 , 99 , false , & sT . lifetime , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Time margin for start in minutes " ) , sT . marginStart , 0 , 30 , false , & sT . marginStart , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " Time margin for stop in minutes " ) , sT . marginStop , 0 , 30 , false , & sT . marginStop , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemBool ( tr ( " Use VPS " ) , sT . useVPS , false , false , & sT . useVPS , rmsSearchTimerSave , 2 ) ) ;
mainMenuItems . push_back ( new cRecMenuItemSelect ( tr ( " Auto delete " ) , delModes , sT . delMode , false , & sT . delMode , rmsSearchTimerSave , true , 2 ) ) ;
if ( sT . delMode = = 1 )
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " after ... recordings " ) , sT . delAfterCountRecs , 0 , 999 , false , & sT . delAfterCountRecs , rmsSearchTimerSave , 3 ) ) ;
else if ( sT . delMode = = 2 )
mainMenuItems . push_back ( new cRecMenuItemInt ( tr ( " after ... days after first rec. " ) , sT . delAfterDaysOfFirstRec , 0 , 999 , false , & sT . delAfterDaysOfFirstRec , rmsSearchTimerSave , 3 ) ) ;
}
2019-06-17 14:19:13 +02:00
}
2019-06-17 14:55:37 +02:00
mainMenuItems . push_back ( new cRecMenuItemButton ( tr ( " Display Results for Search Timer " ) , rmsSearchTimerTest , false ) ) ;
2014-01-10 12:44:01 +01:00
bool reDraw = false ;
if ( GetCurrentNumMenuItems ( ) > 0 ) {
InitMenu ( false ) ;
reDraw = true ;
}
2019-06-17 13:06:07 +02:00
numMenuItems = mainMenuItems . size ( ) ;
2014-01-10 12:44:01 +01:00
int start = GetStartIndex ( ) ;
2019-06-17 13:06:07 +02:00
for ( int i = start ; i < numMenuItems ; i + + ) {
2019-06-17 14:29:42 +02:00
if ( ! AddMenuItemInitial ( mainMenuItems [ i ] ) ) {
2014-01-10 12:44:01 +01:00
break ;
}
}
2019-06-17 13:06:07 +02:00
if ( reDraw )
mainMenuItems [ activeMenuItem ] - > setActive ( ) ;
if ( init ) {
init = ! init ;
}
CalculateHeight ( ! reDraw ) ;
2013-12-07 15:51:50 +01:00
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
cTVGuideSearchTimer cRecMenuSearchTimerEdit : : GetSearchTimer ( void ) {
searchTimer . SetSearchString ( searchString ) ;
2019-06-17 14:55:37 +02:00
searchTimer . SetSearchMode ( sT . mode ) ;
searchTimer . SetFuzzyTolerance ( sT . fuzzyTolerance ) ;
searchTimer . SetUseCase ( sT . useCase ) ;
searchTimer . SetUseTitle ( sT . useTitle ) ;
searchTimer . SetUseSubtitle ( sT . useSubtitle ) ;
searchTimer . SetUseDesription ( sT . useDescription ) ;
if ( sT . useChannel = = 1 ) {
2019-07-04 13:14:14 +02:00
# if VDRVERSNUM >= 20301
{
LOCK_CHANNELS_READ ;
sT . channelMin = Channels - > GetByNumber ( startChannel ) ;
sT . channelMax = Channels - > GetByNumber ( stopChannel ) ;
}
# else
sT . channelMin = Channels . GetByNumber ( startChannel ) ;
sT . channelMax = Channels . GetByNumber ( stopChannel ) ;
# endif
searchTimer . SetStartChannel ( sT . channelMin ) ;
searchTimer . SetStopChannel ( sT . channelMax ) ;
2014-01-10 12:44:01 +01:00
}
2019-06-17 14:55:37 +02:00
if ( sT . useChannel = = 2 ) {
2019-04-09 18:25:58 +02:00
if ( channelgroups . size ( ) > 0 ) {
std : : string & channelGroup = channelgroups [ channelgroupIndex ] ;
searchTimer . SetChannelGroup ( channelGroup ) ;
} else {
2019-06-17 14:55:37 +02:00
sT . useChannel = 0 ;
2019-04-09 18:25:58 +02:00
}
}
2019-06-17 14:55:37 +02:00
searchTimer . SetUseChannel ( sT . useChannel ) ;
searchTimer . SetUseTime ( sT . useTime ) ;
if ( sT . useTime ) {
searchTimer . SetStartTime ( sT . startTime ) ;
searchTimer . SetStopTime ( sT . stopTime ) ;
}
searchTimer . SetUseDuration ( sT . useDuration ) ;
if ( sT . useDuration ) {
searchTimer . SetMinDuration ( sT . minDuration ) ;
searchTimer . SetMaxDuration ( sT . maxDuration ) ;
}
searchTimer . SetUseDayOfWeek ( sT . useDayOfWeek ) ;
if ( sT . useDayOfWeek ) {
2019-07-04 14:17:08 +02:00
searchTimer . SetDayOfWeek ( dayOfWeek ) ;
2019-06-17 14:55:37 +02:00
}
searchTimer . SetUseAsSearchTimer ( sT . useAsSearchTimer ) ;
searchTimer . SetAction ( sT . action ) ;
searchTimer . SetSwitchMinsBefore ( sT . switchMinsBefore ) ;
searchTimer . SetUnmuteSoundOnSwitch ( sT . unmuteSoundOnSwitch ) ;
searchTimer . SetPriority ( sT . priority ) ;
searchTimer . SetLifetime ( sT . lifetime ) ;
searchTimer . SetUseEpisode ( sT . useEpisode ) ;
2014-01-26 09:42:27 +01:00
std : : string dir ( directory ) ;
std : : replace ( dir . begin ( ) , dir . end ( ) , ' / ' , ' ~ ' ) ;
searchTimer . SetDirectory ( dir ) ;
2019-06-17 14:55:37 +02:00
searchTimer . SetDelAfterDays ( sT . delAfterDays ) ;
searchTimer . SetRecordingsKeep ( sT . recordingsKeep ) ;
searchTimer . SetPauseOnNrRecordings ( sT . pauseOnNrRecordings ) ;
searchTimer . SetMarginStart ( sT . marginStart ) ;
searchTimer . SetMarginStop ( sT . marginStop ) ;
searchTimer . SetUseVPS ( sT . useVPS ) ;
searchTimer . SetAvoidRepeats ( sT . avoidRepeats ) ;
if ( sT . avoidRepeats ) {
searchTimer . SetAllowedRepeats ( sT . allowedRepeats ) ;
if ( sT . repeatsWithinDays > 0 ) {
searchTimer . SetRepeatsWithinDays ( sT . repeatsWithinDays ) ;
}
searchTimer . SetCompareTitle ( sT . compareTitle ) ;
searchTimer . SetCompareSubtitle ( sT . compareSubtitle ) ;
searchTimer . SetCompareSummary ( sT . compareSummary ) ;
if ( sT . compareSummary ) {
searchTimer . SetCompareSummaryMatchInPercent ( sT . compareSummaryMatchInPercent ) ;
}
searchTimer . SetCompareDate ( sT . compareDate ) ;
}
searchTimer . SetUseInFavorites ( sT . useInFavorites ) ;
searchTimer . SetDelMode ( sT . delMode ) ;
searchTimer . SetDelAfterCountRecs ( sT . delAfterCountRecs ) ;
searchTimer . SetDelAfterDaysOfFirstRec ( sT . delAfterDaysOfFirstRec ) ;
2014-01-10 12:44:01 +01:00
return searchTimer ;
}
int cRecMenuSearchTimerEdit : : GetTotalNumMenuItems ( void ) {
return numMenuItems ;
}
cRecMenuItem * cRecMenuSearchTimerEdit : : GetMenuItem ( int number ) {
if ( ( number > - 1 ) & & ( number < numMenuItems ) ) {
2019-06-17 14:29:42 +02:00
return mainMenuItems [ number ] ;
2014-01-10 12:44:01 +01:00
}
return NULL ;
}
// --- cRecMenuSearchTimerDeleteConfirm ---------------------------------------------
cRecMenuSearchTimerDeleteConfirm : : cRecMenuSearchTimerDeleteConfirm ( cTVGuideSearchTimer searchTimer ) {
this - > searchTimer = searchTimer ;
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 70 ) ;
2014-01-10 12:44:01 +01:00
cString message = tr ( " Really delete Search Timer " ) ;
2019-06-16 13:11:28 +02:00
cString infoText = cString : : sprintf ( " %s \" %s \" ? " , * message , searchTimer . GetSearchString ( ) . c_str ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " Delete only Search Timer " ) , rmsSearchTimerDelete , true ) ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " Delete Search Timer and created Timers " ) , rmsSearchTimerDeleteWithTimers , false ) ) ;
SetFooter ( new cRecMenuItemButton ( tr ( " Cancel " ) , rmsClose , false ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuSearchTimerDeleteConfirm : : ~ cRecMenuSearchTimerDeleteConfirm ( void ) {
}
cTVGuideSearchTimer cRecMenuSearchTimerDeleteConfirm : : GetSearchTimer ( void ) {
return searchTimer ;
}
// --- cRecMenuSearchTimerCreateConfirm ---------------------------------------------------------
cRecMenuSearchTimerCreateConfirm : : cRecMenuSearchTimerCreateConfirm ( bool success ) {
SetWidthPercent ( 50 ) ;
2013-12-07 15:51:50 +01:00
2014-01-10 12:44:01 +01:00
cString message1a = tr ( " Search Timer sucessfully created. " ) ;
cString message1b = tr ( " Search Timer update initialised " ) ;
cString message1 = cString : : sprintf ( " %s \n %s " , * message1a , * message1b ) ;
cString message2 = tr ( " Search Timer NOT sucessfully created " ) ;
cString infoText = success ? message1 : message2 ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true ) ) ;
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
// --- cRecMenuSearchTimerTemplatesCreate ---------------------------------------------------------
cRecMenuSearchTimerTemplatesCreate : : cRecMenuSearchTimerTemplatesCreate ( TVGuideEPGSearchTemplate templ , cTVGuideSearchTimer searchTimer ) {
this - > templ = templ ;
this - > searchTimer = searchTimer ;
SetWidthPercent ( 70 ) ;
cString message1 = tr ( " Creating Search Timer " ) ;
cString message2 = tr ( " Search Term " ) ;
cString message3 = tr ( " Using Template " ) ;
2019-06-16 13:11:28 +02:00
cString infoText = cString : : sprintf ( " %s \n %s: \" %s \" \n %s \" %s \" " , * message1 , * message2 , searchTimer . GetSearchString ( ) . c_str ( ) , * message3 , templ . name . c_str ( ) ) ;
2014-01-10 12:44:01 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " Display Results for Search Timer " ) , rmsSearchTimerTest , true ) ) ;
AddMenuItem ( new cRecMenuItemButtonYesNo ( tr ( " Create Search Timer " ) , tr ( " Use other Template " ) , rmsSearchTimerSave , rmsSearchTimerOptions , false ) ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearchTimerResults ---------------------------------------------------------
2014-01-17 16:11:12 +01:00
cRecMenuSearchTimerResults : : cRecMenuSearchTimerResults ( std : : string searchString , const cEvent * * searchResults , int numResults , std : : string templateName , eRecMenuState action2 ) {
2013-12-07 15:51:50 +01:00
this - > searchResults = searchResults ;
2014-01-17 16:11:12 +01:00
this - > action2 = action2 ;
2013-12-07 15:51:50 +01:00
this - > numResults = numResults ;
2014-01-19 13:52:05 +01:00
SetWidthPercent ( 70 ) ;
cString message1 = " " , message2 = " " , message3 = " " , infoText = " " ;
2014-02-07 18:15:13 +01:00
if ( action2 = = rmsFavoritesRecord ) {
message1 = tr ( " search results for Favorite " ) ;
message2 = tr ( " search result for Favorite " ) ;
} else {
2014-01-19 13:52:05 +01:00
message1 = tr ( " search results for Search Timer " ) ;
message2 = tr ( " search result for Search Timer " ) ;
message3 = tr ( " Using Template " ) ;
}
2013-12-07 15:51:50 +01:00
if ( templateName . size ( ) > 0 ) {
2014-01-10 12:44:01 +01:00
infoText = cString : : sprintf ( " %d %s: \n \" %s \" \n %s \" %s \" " , numResults , ( numResults > 1 ) ? ( * message1 ) : ( * message2 ) , searchString . c_str ( ) , * message3 , templateName . c_str ( ) ) ;
2013-12-07 15:51:50 +01:00
} else {
2014-01-10 12:44:01 +01:00
infoText = cString : : sprintf ( " %d %s: \n \" %s \" " , numResults , ( numResults > 1 ) ? ( * message1 ) : ( * message2 ) , searchString . c_str ( ) ) ;
2013-12-07 15:51:50 +01:00
}
2014-01-12 16:27:59 +01:00
cRecMenuItem * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cRecMenuItem * buttons = new cRecMenuItemButton ( tr ( " Close " ) , rmsClose , false ) ;
SetFooter ( buttons ) ;
if ( searchResults & & ( numResults > 0 ) ) {
for ( int i = 0 ; i < numResults ; i + + ) {
2014-01-17 16:11:12 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemEvent ( searchResults [ i ] , rmsSearchShowInfo , action2 , ( i = = 0 ) ? true : false ) ) )
2013-12-07 15:51:50 +01:00
break ;
2013-07-09 00:20:49 +02:00
}
2013-12-07 15:51:50 +01:00
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cRecMenuItem * cRecMenuSearchTimerResults : : GetMenuItem ( int number ) {
if ( ( number > = 0 ) & & ( number < numResults ) ) {
2014-01-17 16:11:12 +01:00
cRecMenuItem * result = new cRecMenuItemEvent ( searchResults [ number ] , rmsSearchShowInfo , action2 , false ) ;
2013-12-07 15:51:50 +01:00
return result ;
}
return NULL ;
}
int cRecMenuSearchTimerResults : : GetTotalNumMenuItems ( void ) {
return numResults ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
const cEvent * cRecMenuSearchTimerResults : : GetEvent ( void ) {
const cEvent * ev = NULL ;
if ( cRecMenuItemEvent * activeItem = dynamic_cast < cRecMenuItemEvent * > ( GetActiveMenuItem ( ) ) )
ev = activeItem - > GetEventValue ( ) ;
return ev ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearchTimerNothingFound ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuSearchTimerNothingFound : : cRecMenuSearchTimerNothingFound ( std : : string searchString ) {
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 50 ) ;
cString message = tr ( " Nothing found for Search String " ) ;
cString text ;
2014-01-10 12:44:01 +01:00
text = cString : : sprintf ( " %s \n \" %s \" " ,
* message ,
searchString . c_str ( ) ) ;
2013-12-07 15:51:50 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true , true ) ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* SwitchTimer Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-07-09 00:20:49 +02:00
// --- cRecMenuSwitchTimer ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuSwitchTimer : : cRecMenuSwitchTimer ( void ) {
2019-07-11 11:28:11 +02:00
switchMinsBefore = config . switchMinsBefore ;
switchMode = config . switchMode ;
2014-01-10 12:44:01 +01:00
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 60 ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cString infoText = tr ( " Configure Options for Switchtimer " ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
2014-01-10 12:44:01 +01:00
AddMenuItem ( new cRecMenuItemInt ( tr ( " Minutes before switching " ) , switchMinsBefore , 0 , 10 , false , & switchMinsBefore ) ) ;
2019-04-05 11:35:45 +02:00
std : : vector < std : : string > switchModeItems ;
switchModeItems . push_back ( tr ( " switch " ) ) ;
switchModeItems . push_back ( tr ( " announce only " ) ) ;
switchModeItems . push_back ( tr ( " ask for switch " ) ) ;
AddMenuItem ( new cRecMenuItemSelect ( tr ( " Switch Mode " ) , switchModeItems , switchMode , false , & switchMode ) ) ;
2013-12-07 15:51:50 +01:00
AddMenuItem ( new cRecMenuItemButtonYesNo ( tr ( " Create " ) , tr ( " Cancel " ) , rmsSwitchTimerCreate , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
cSwitchTimer cRecMenuSwitchTimer : : GetSwitchTimer ( void ) {
cSwitchTimer st ;
st . switchMinsBefore = switchMinsBefore ;
2019-04-05 11:35:45 +02:00
st . switchMode = switchMode ;
2014-01-10 12:44:01 +01:00
return st ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuSwitchTimerConfirm ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuSwitchTimerConfirm : : cRecMenuSwitchTimerConfirm ( bool success ) {
SetWidthPercent ( 50 ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cString message1 = tr ( " Switch Timer sucessfully created " ) ;
cString message2 = tr ( " Switch Timer NOT sucessfully created " ) ;
cString infoText = success ? message1 : message2 ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuSwitchTimerDelete ---------------------------------------------------------
2013-12-07 15:51:50 +01:00
cRecMenuSwitchTimerDelete : : cRecMenuSwitchTimerDelete ( void ) {
SetWidthPercent ( 50 ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cString infoText = tr ( " Switch Timer deleted " ) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* Search Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearch ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuSearch : : cRecMenuSearch ( std : : string searchString , bool withOptions ) {
strncpy ( this - > searchString , searchString . c_str ( ) , TEXTINPUTLENGTH ) ;
mode = 0 ;
channelNr = 0 ;
useTitle = true ;
useSubTitle = true ;
useDescription = false ;
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 60 ) ;
cString infoText = tr ( " Search " ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
2014-01-10 12:44:01 +01:00
SetHeader ( infoItem ) ;
AddMenuItem ( new cRecMenuItemText ( tr ( " Search Expression: " ) , this - > searchString , TEXTINPUTLENGTH , false , this - > searchString ) ) ;
if ( withOptions ) {
std : : vector < std : : string > searchModes ;
cTVGuideSearchTimer searchTimer ;
searchTimer . GetSearchModes ( & searchModes ) ;
AddMenuItemInitial ( new cRecMenuItemSelect ( tr ( " Search Mode " ) , searchModes , 0 , false , & mode ) ) ;
AddMenuItemInitial ( new cRecMenuItemChannelChooser ( tr ( " Channel to Search " ) , NULL , false , & channelNr ) ) ;
AddMenuItemInitial ( new cRecMenuItemBool ( tr ( " Search in title " ) , true , false , false , & useTitle ) ) ;
AddMenuItemInitial ( new cRecMenuItemBool ( tr ( " Search in Subtitle " ) , true , false , false , & useSubTitle ) ) ;
AddMenuItemInitial ( new cRecMenuItemBool ( tr ( " Search in Description " ) , false , false , false , & useDescription ) ) ;
} else {
AddMenuItemInitial ( new cRecMenuItemButton ( tr ( " Show Search Options " ) , rmsSearchWithOptions , false ) ) ;
}
cRecMenuItemButtonYesNo * button = new cRecMenuItemButtonYesNo ( tr ( " Perform Search " ) , tr ( " Cancel " ) , rmsSearchPerform , rmsClose , true ) ;
SetFooter ( button ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2014-01-10 12:44:01 +01:00
Epgsearch_searchresults_v1_0 cRecMenuSearch : : GetEPGSearchStruct ( void ) {
Epgsearch_searchresults_v1_0 data ;
data . query = searchString ;
data . mode = mode ;
data . channelNr = channelNr ;
data . useTitle = useTitle ;
data . useSubTitle = useSubTitle ;
data . useDescription = useDescription ;
return data ;
2013-12-07 15:51:50 +01:00
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearchResults ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuSearchResults : : cRecMenuSearchResults ( std : : string searchString , const cEvent * * searchResults , int numResults ) {
2013-12-07 15:51:50 +01:00
this - > searchResults = searchResults ;
SetWidthPercent ( 70 ) ;
2014-01-12 16:27:59 +01:00
this - > searchString = searchString ;
2013-12-07 15:51:50 +01:00
this - > numResults = numResults ;
cString message1 = tr ( " search results for " ) ;
cString message2 = tr ( " search result for " ) ;
2014-01-10 12:44:01 +01:00
cString infoText = cString : : sprintf ( " %d %s: \n \" %s \" " , numResults , ( numResults > 1 ) ? ( * message1 ) : ( * message2 ) , searchString . c_str ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItem * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cRecMenuItem * buttons = new cRecMenuItemButtonYesNo ( tr ( " Adapt Search " ) , tr ( " Close " ) , rmsSearch , rmsClose , false ) ;
SetFooter ( buttons ) ;
if ( searchResults & & ( numResults > 0 ) ) {
for ( int i = 0 ; i < numResults ; i + + ) {
2014-01-10 12:44:01 +01:00
if ( ! AddMenuItemInitial ( new cRecMenuItemEvent ( searchResults [ i ] , rmsSearchShowInfo , rmsSearchRecord , ( i = = 0 ) ? true : false ) ) )
2013-12-07 15:51:50 +01:00
break ;
2013-07-09 00:20:49 +02:00
}
2013-12-07 15:51:50 +01:00
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuItem * cRecMenuSearchResults : : GetMenuItem ( int number ) {
if ( ( number > = 0 ) & & ( number < numResults ) ) {
cRecMenuItem * result = new cRecMenuItemEvent ( searchResults [ number ] , rmsSearchShowInfo , rmsSearchRecord , false ) ;
return result ;
}
return NULL ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
int cRecMenuSearchResults : : GetTotalNumMenuItems ( void ) {
return numResults ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
const cEvent * cRecMenuSearchResults : : GetEvent ( void ) {
const cEvent * ev = NULL ;
if ( cRecMenuItemEvent * activeItem = dynamic_cast < cRecMenuItemEvent * > ( GetActiveMenuItem ( ) ) )
ev = activeItem - > GetEventValue ( ) ;
return ev ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearchConfirmTimer ---------------------------------------------------------
2014-01-17 16:11:12 +01:00
cRecMenuSearchConfirmTimer : : cRecMenuSearchConfirmTimer ( const cEvent * event , eRecMenuState nextAction ) {
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 50 ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_CHANNELS_READ ;
const cString channelName = Channels - > GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
# else
2019-03-30 18:06:47 +01:00
const cString channelName = Channels . GetByChannelID ( event - > ChannelID ( ) ) - > Name ( ) ;
2018-03-08 13:02:38 +01:00
# endif
2013-12-07 15:51:50 +01:00
cString message = tr ( " Timer created " ) ;
cString text = cString : : sprintf ( " %s \n %s \n %s %s - %s \n %s " ,
* message ,
* channelName ,
* event - > GetDateString ( ) ,
* event - > GetTimeString ( ) ,
* event - > GetEndTimeString ( ) ,
event - > Title ( )
) ;
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
2014-01-17 16:11:12 +01:00
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , nextAction , true , true ) ) ;
2013-12-07 15:51:50 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuSearchNothingFound ---------------------------------------------------------
2014-01-12 16:27:59 +01:00
cRecMenuSearchNothingFound : : cRecMenuSearchNothingFound ( std : : string searchString , bool tooShort ) {
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 50 ) ;
2014-01-12 16:27:59 +01:00
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 ( ) ) ;
}
2013-12-07 15:51:50 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsSearchNothingFoundConfirm , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* Recording Search Menus
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2013-07-09 00:20:49 +02:00
// --- cRecMenuRecordingSearch ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuRecordingSearch : : cRecMenuRecordingSearch ( std : : string search ) {
strncpy ( searchString , search . c_str ( ) , TEXTINPUTLENGTH ) ;
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 60 ) ;
cString infoText = tr ( " Search in Recordings " ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
2014-01-10 12:44:01 +01:00
SetHeader ( infoItem ) ;
AddMenuItem ( new cRecMenuItemText ( tr ( " Search Expression: " ) , searchString , TEXTINPUTLENGTH , false , searchString ) ) ;
2013-12-07 15:51:50 +01:00
AddMenuItem ( new cRecMenuItemButtonYesNo ( tr ( " Perform Search " ) , tr ( " Cancel " ) , rmsRecordingSearchResult , rmsClose , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuRecordingSearchResults ---------------------------------------------------------
2018-03-08 13:02:38 +01:00
cRecMenuRecordingSearchResults : : cRecMenuRecordingSearchResults ( std : : string searchString , const cRecording * * searchResults , int numResults ) {
2014-01-10 12:44:01 +01:00
this - > searchString = searchString ;
2013-12-07 15:51:50 +01:00
this - > searchResults = searchResults ;
SetWidthPercent ( 80 ) ;
cString message1 = tr ( " Found " ) ;
cString message2 = tr ( " recording " ) ;
cString message3 = tr ( " recordings " ) ;
cString message4 = tr ( " for " ) ;
this - > numResults = numResults ;
2014-01-10 12:44:01 +01:00
cString infoText = cString : : sprintf ( " %s %d %s %s: \n \" %s \" " , * message1 , numResults , ( numResults > 1 ) ? ( * message3 ) : ( * message2 ) , * message4 , searchString . c_str ( ) ) ;
2014-01-12 16:27:59 +01:00
cRecMenuItem * infoItem = new cRecMenuItemInfo ( * infoText , true ) ;
2013-12-07 15:51:50 +01:00
infoItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( infoItem ) ;
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
cRecMenuItem * buttons = new cRecMenuItemButtonYesNo ( tr ( " Adapt Search " ) , tr ( " Close " ) , rmsRecordingSearch , rmsClose , false ) ;
SetFooter ( buttons ) ;
if ( searchResults & & ( numResults > 0 ) ) {
2019-03-30 18:06:47 +01:00
for ( int i = 0 ; i < numResults ; i + + ) {
if ( ! AddMenuItemInitial ( new cRecMenuItemRecording ( searchResults [ i ] , ( i = = 0 ) ? true : false ) ) )
2013-12-07 15:51:50 +01:00
break ;
2013-07-09 00:20:49 +02:00
}
2013-12-07 15:51:50 +01:00
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuItem * cRecMenuRecordingSearchResults : : GetMenuItem ( int number ) {
if ( ( number > = 0 ) & & ( number < numResults ) ) {
cRecMenuItem * result = new cRecMenuItemRecording ( searchResults [ number ] , false ) ;
return result ;
}
return NULL ;
}
2013-07-09 00:20:49 +02:00
2013-12-07 15:51:50 +01:00
int cRecMenuRecordingSearchResults : : GetTotalNumMenuItems ( void ) {
return numResults ;
}
2013-07-09 00:20:49 +02:00
// --- cRecMenuRecordingSearchNotFound ---------------------------------------------------------
2014-01-10 12:44:01 +01:00
cRecMenuRecordingSearchNotFound : : cRecMenuRecordingSearchNotFound ( std : : string searchString ) {
2013-12-07 15:51:50 +01:00
SetWidthPercent ( 50 ) ;
cString message = tr ( " No recordings found for " ) ;
cString text = cString : : sprintf ( " %s \n \" %s \" " ,
* message ,
2014-01-10 12:44:01 +01:00
searchString . c_str ( ) ) ;
2013-12-07 15:51:50 +01:00
cRecMenuItemInfo * infoItem = new cRecMenuItemInfo ( * text ) ;
infoItem - > CalculateHeight ( width - 2 * border ) ;
AddMenuItem ( infoItem ) ;
AddMenuItem ( new cRecMenuItemButton ( tr ( " OK " ) , rmsClose , true , true ) ) ;
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
2014-01-02 11:25:58 +01:00
}
2014-01-10 12:44:01 +01:00
/******************************************************************************************
* Timeline
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2014-01-02 11:25:58 +01:00
// --- cRecMenuTimeline ---------------------------------------------------------
cRecMenuTimeline : : cRecMenuTimeline ( cTVGuideTimerConflicts * timerConflicts ) {
this - > timerConflicts = timerConflicts ;
SetStartStop ( ) ;
conflictsToday = timerConflicts - > GetConflictsBetween ( timeStart , timeStop ) ;
GetTimersForDay ( ) ;
SetWidthPercent ( 95 ) ;
header = new cRecMenuItemTimelineHeader ( timeStart , conflictsToday ) ;
SetHeader ( header ) ;
cRecMenuItem * footer = new cRecMenuItemButton ( tr ( " Close " ) , rmsClose , false , true ) ;
SetFooter ( footer ) ;
SetTimers ( ) ;
}
void cRecMenuTimeline : : SetStartStop ( void ) {
time_t now = time ( 0 ) ;
tm * timeStruct = localtime ( & now ) ;
timeStart = now - timeStruct - > tm_hour * 3600 - timeStruct - > tm_min * 60 - timeStruct - > tm_sec ;
today = timeStart ;
timeStop = timeStart + 24 * 3600 - 1 ;
}
void cRecMenuTimeline : : GetTimersForDay ( void ) {
timersToday . clear ( ) ;
2018-03-08 13:30:41 +01:00
# if VDRVERSNUM >= 20301
2018-03-08 13:02:38 +01:00
LOCK_TIMERS_READ ;
2018-03-08 14:20:23 +01:00
// const cTimers* timers = Timers;
2018-03-08 13:02:38 +01:00
for ( const cTimer * t = Timers - > First ( ) ; t ; t = Timers - > Next ( t ) ) {
# else
2019-03-30 18:06:47 +01:00
for ( const cTimer * t = Timers . First ( ) ; t ; t = Timers . Next ( t ) ) {
2018-03-08 13:02:38 +01:00
# endif
2014-01-02 11:25:58 +01:00
if ( ( ( t - > StartTime ( ) > timeStart ) & & ( t - > StartTime ( ) < = timeStop ) ) | | ( ( t - > StopTime ( ) > timeStart ) & & ( t - > StopTime ( ) < = timeStop ) ) ) {
timersToday . push_back ( t ) ;
}
}
numTimersToday = timersToday . size ( ) ;
}
void cRecMenuTimeline : : SetTimers ( void ) {
2014-01-10 12:44:01 +01:00
ClearMenu ( ) ;
2014-01-02 11:25:58 +01:00
if ( numTimersToday = = 0 ) {
AddMenuItem ( new cRecMenuItemTimelineTimer ( NULL , 0 , 0 , conflictsToday , header , false ) ) ;
header - > UnsetCurrentTimer ( ) ;
footer - > setActive ( ) ;
} else {
for ( int i = 0 ; i < numTimersToday ; i + + ) {
cRecMenuItemTimelineTimer * item = new cRecMenuItemTimelineTimer ( timersToday [ i ] , timeStart , timeStop , conflictsToday , header , false ) ;
if ( i = = 0 )
item - > setActive ( ) ;
2014-01-10 12:44:01 +01:00
if ( ! AddMenuItemInitial ( item ) )
2014-01-02 11:25:58 +01:00
break ;
}
footer - > setInactive ( ) ;
}
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
void cRecMenuTimeline : : PrevDay ( void ) {
if ( ( timeStart - 3600 * 24 ) < today )
return ;
timeStart - = 3600 * 24 ;
timeStop - = 3600 * 24 ;
conflictsToday = timerConflicts - > GetConflictsBetween ( timeStart , timeStop ) ;
SetWidthPercent ( 95 ) ;
header - > SetDay ( timeStart ) ;
header - > UnsetCurrentTimer ( ) ;
header - > RefreshTimerDisplay ( ) ;
GetTimersForDay ( ) ;
SetTimers ( ) ;
Display ( ) ;
}
void cRecMenuTimeline : : NextDay ( void ) {
timeStart + = 3600 * 24 ;
timeStop + = 3600 * 24 ;
conflictsToday = timerConflicts - > GetConflictsBetween ( timeStart , timeStop ) ;
SetWidthPercent ( 95 ) ;
header - > SetDay ( timeStart ) ;
header - > UnsetCurrentTimer ( ) ;
header - > RefreshTimerDisplay ( ) ;
GetTimersForDay ( ) ;
SetTimers ( ) ;
Display ( ) ;
}
cRecMenuItem * cRecMenuTimeline : : GetMenuItem ( int number ) {
if ( number < 0 )
return NULL ;
if ( number > = numTimersToday )
return NULL ;
return new cRecMenuItemTimelineTimer ( timersToday [ number ] , timeStart , timeStop , conflictsToday , header , false ) ;
}
int cRecMenuTimeline : : GetTotalNumMenuItems ( void ) {
return numTimersToday ;
}
2014-01-10 12:44:01 +01:00
void cRecMenuTimeline : : ClearMenu ( void ) {
InitMenu ( true ) ;
2014-01-02 11:25:58 +01:00
header - > UnsetCurrentTimer ( ) ;
}
2018-03-08 13:02:38 +01:00
const cTimer * cRecMenuTimeline : : GetTimer ( void ) {
2014-01-10 12:44:01 +01:00
if ( cRecMenuItemTimelineTimer * activeItem = dynamic_cast < cRecMenuItemTimelineTimer * > ( GetActiveMenuItem ( ) ) )
return activeItem - > GetTimerValue ( ) ;
return NULL ;
}
2014-01-02 11:25:58 +01:00
eRecMenuState cRecMenuTimeline : : ProcessKey ( eKeys Key ) {
eRecMenuState state = rmsContinue ;
switch ( Key & ~ k_Repeat ) {
case kLeft :
PrevDay ( ) ;
state = rmsConsumed ;
break ;
case kRight :
NextDay ( ) ;
state = rmsConsumed ;
break ;
default :
break ;
}
if ( state ! = rmsConsumed ) {
state = cRecMenu : : ProcessKey ( Key ) ;
}
return state ;
2014-01-14 18:00:32 +01:00
}
/******************************************************************************************
* Favorites
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// --- cRecMenuFavorites ---------------------------------------------------------
cRecMenuFavorites : : cRecMenuFavorites ( std : : vector < cTVGuideSearchTimer > favorites ) {
2014-01-19 13:52:05 +01:00
deleteMenuItems = false ;
2014-01-14 18:00:32 +01:00
this - > favorites = favorites ;
2014-01-19 13:52:05 +01:00
CreateFavoritesMenuItems ( ) ;
numFavorites = myMenuItems . size ( ) ;
2014-01-14 18:00:32 +01:00
SetWidthPercent ( 70 ) ;
cString header ;
if ( numFavorites > 0 ) {
header = tr ( " Favorites " ) ;
} else {
header = tr ( " No Favorites available " ) ;
}
cRecMenuItemInfo * headerItem = new cRecMenuItemInfo ( * header , true ) ;
headerItem - > CalculateHeight ( width - 2 * border ) ;
SetHeader ( headerItem ) ;
cRecMenuItem * button = new cRecMenuItemButton ( tr ( " Close " ) , rmsClose , ( numFavorites = = 0 ) ? true : false ) ;
SetFooter ( button ) ;
2014-01-19 13:52:05 +01:00
for ( int i = 0 ; i < numFavorites ; i + + ) {
if ( i = = 0 )
myMenuItems [ i ] - > setActive ( ) ;
if ( ! AddMenuItemInitial ( myMenuItems [ i ] ) )
break ;
}
2014-01-14 18:00:32 +01:00
CalculateHeight ( ) ;
CreatePixmap ( ) ;
Arrange ( ) ;
}
cRecMenuFavorites : : ~ cRecMenuFavorites ( void ) {
2014-01-19 13:52:05 +01:00
for ( std : : vector < cRecMenuItem * > : : iterator it = myMenuItems . begin ( ) ; it ! = myMenuItems . end ( ) ; it + + ) {
delete * it ;
}
myMenuItems . clear ( ) ;
}
void cRecMenuFavorites : : CreateFavoritesMenuItems ( void ) {
2019-07-11 11:28:11 +02:00
if ( config . favWhatsOnNow ) {
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( tr ( " What's on now " ) , rmsFavoritesNow , false ) ) ;
}
2019-07-11 11:28:11 +02:00
if ( config . favWhatsOnNext ) {
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( tr ( " What's on next " ) , rmsFavoritesNext , false ) ) ;
}
2019-07-11 11:28:11 +02:00
if ( config . favUseTime1 ) {
std : : string desc = * cString : : sprintf ( " %s (%s) " , config . descUser1 . c_str ( ) , NiceTime ( config . favTime1 ) . c_str ( ) ) ;
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( desc , rmsFavoritesUser1 , false ) ) ;
}
2019-07-11 11:28:11 +02:00
if ( config . favUseTime2 ) {
std : : string desc = * cString : : sprintf ( " %s (%s) " , config . descUser2 . c_str ( ) , NiceTime ( config . favTime2 ) . c_str ( ) ) ;
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( desc , rmsFavoritesUser2 , false ) ) ;
}
2019-07-11 11:28:11 +02:00
if ( config . favUseTime3 ) {
std : : string desc = * cString : : sprintf ( " %s (%s) " , config . descUser3 . c_str ( ) , NiceTime ( config . favTime3 ) . c_str ( ) ) ;
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( desc , rmsFavoritesUser3 , false ) ) ;
}
2019-07-11 11:28:11 +02:00
if ( config . favUseTime4 ) {
std : : string desc = * cString : : sprintf ( " %s (%s) " , config . descUser4 . c_str ( ) , NiceTime ( config . favTime4 ) . c_str ( ) ) ;
2014-01-19 13:52:05 +01:00
myMenuItems . push_back ( new cRecMenuItemFavoriteStatic ( desc , rmsFavoritesUser4 , false ) ) ;
}
int numAdditionalFavs = favorites . size ( ) ;
for ( int i = 0 ; i < numAdditionalFavs ; i + + ) {
myMenuItems . push_back ( new cRecMenuItemFavorite ( favorites [ i ] , rmsSearchTimerTest , false ) ) ;
}
}
std : : string cRecMenuFavorites : : NiceTime ( int favTime ) {
int hours = favTime / 100 ;
int mins = favTime - hours * 100 ;
return * cString : : sprintf ( " %02d:%02d " , hours , mins ) ;
2014-01-14 18:00:32 +01:00
}
cRecMenuItem * cRecMenuFavorites : : GetMenuItem ( int number ) {
if ( number > - 1 & & number < numFavorites )
2014-01-19 13:52:05 +01:00
return myMenuItems [ number ] ;
2014-01-14 18:00:32 +01:00
return NULL ;
}
int cRecMenuFavorites : : GetTotalNumMenuItems ( void ) {
return numFavorites ;
}
cTVGuideSearchTimer cRecMenuFavorites : : GetFavorite ( void ) {
cRecMenuItemFavorite * activeItem = dynamic_cast < cRecMenuItemFavorite * > ( GetActiveMenuItem ( ) ) ;
return activeItem - > GetFavorite ( ) ;
2018-03-08 14:20:23 +01:00
}