1 #ifndef __apps__enigma__timer_h
2 #define __apps__enigma__timer_h
4 #include <lib/dvb/serviceplaylist.h>
5 #include <lib/gui/listbox.h>
6 #include <lib/gui/emessage.h>
10 class eTextInputField
;
16 class eTimerManager
: public Object
18 static eTimerManager
*instance
;
20 // eTimerManager actionHandler stuff
23 zap
, prepareEvent
, startCountdown
, setNextEvent
,
24 startEvent
, pauseEvent
, restartEvent
, stopEvent
,
25 startRecording
, stopRecording
, restartRecording
,
26 pauseRecording
, spinUpHarddiscs
, oldService
,
30 eTimer actionTimer
; // to start timer related actions
31 void actionHandler(); // the action Handler
32 ///////////////////////////
34 // for multiple use timer and connection objects..
36 Connection conn
, conn2
;
38 // the timerlist self...
40 eServiceReference timerlistref
;
41 eServiceReference playbackRef
;
43 // nextStarting event, or the current running Event
44 std::list
<ePlaylistEntry
>::iterator nextStartingEvent
;
46 bool setdeepstandbywakeup
;
48 // all methods are NOT always connected to the eDVB Signals
49 void switchedService( const eServiceReferenceDVB
&, int err
);
50 void leaveService( const eServiceReferenceDVB
& );
52 long getSecondsToBegin();
53 long getSecondsToEnd();
55 void writeToLogfile( const char *str
);
56 void writeToLogfile( eString str
);
58 enum { erase
, update
};
61 static eTimerManager
*getInstance() { return instance
; }
62 bool updateRunningEvent( int duration
, int after_event
);
63 bool removeEventFromTimerList( eWidget
*w
, const ePlaylistEntry
& entry
, int type
=erase
);
64 bool removeEventFromTimerList( eWidget
*w
, const eServiceReference
*ref
, const EITEvent
*evt
);
67 bool addEventToTimerList( eWidget
*w
, const eServiceReference
*ref
, const EITEvent
*evt
, int type
= ePlaylistEntry::RecTimerEntry
|ePlaylistEntry::recDVR
|ePlaylistEntry::stateWaiting
, const ePlaylistEntry
*exclude
=0 );
68 bool addEventToTimerList( eWidget
*w
, const ePlaylistEntry
& entry
, const ePlaylistEntry
*exclude
=0 );
69 int addEventToTimerList(const ePlaylistEntry
& entry
);
70 int deleteEventFromTimerList(const ePlaylistEntry
& entry
, bool force
=false);
71 int modifyEventInTimerList(const ePlaylistEntry
& old_entry
, const ePlaylistEntry
& new_entry
, bool force
=false);
72 bool eventAlreadyInList( eWidget
*w
, EITEvent
&e
, eServiceReference
&ref
);
73 void abortEvent(int err
);
77 int getTimerCount() { return timerlist
->getConstList().size(); }
78 ePlaylistEntry
* findEvent( eServiceReference
*service
, EITEvent
*evt
);
79 void disableDeepstandbyWakeup() { setdeepstandbywakeup
=false; }
81 void forEachEntry(Z ob
)
84 for (std::list
<ePlaylistEntry
>::iterator
i(timerlist
->getList().begin()); i
!= timerlist
->getList().end(); ++i
)
89 class eListBoxEntryTimer
: public eListBoxEntry
91 friend class eListBox
<eListBoxEntryTimer
>;
92 friend class eTimerListView
;
93 friend struct _selectEvent
;
94 static gFont TimeFont
, DescrFont
;
95 static gPixmap
*ok
, *failed
;
96 static int timeXSize
, dateXSize
;
97 int TimeYOffs
, DescrYOffs
;
98 eTextPara
*paraDate
, *paraTime
, *paraDescr
, *paraService
;
99 ePlaylistEntry
*entry
;
100 const eString
&redraw(gPainter
*rc
, const eRect
& rect
, gColor coActiveB
, gColor coActiveF
, gColor coNormalB
, gColor coNormalF
, int hilited
);
101 static int getEntryHeight();
104 bool operator < ( const eListBoxEntry
& ref
) const
106 return entry
->time_begin
< ((eListBoxEntryTimer
&)ref
).entry
->time_begin
;
108 eListBoxEntryTimer(eListBox
<eListBoxEntryTimer
> *listbox
, ePlaylistEntry
*entry
);
109 ~eListBoxEntryTimer();
112 class eTimerListView
:public eWindow
114 eListBox
<eListBoxEntryTimer
>* events
;
115 eButton
*add
, *erase
, *cleanup
;
118 void fillTimerList();
119 void entrySelected(eListBoxEntryTimer
*entry
);
122 void cleanupPressed();
125 class eTimerEditView
: public eWindow
127 eCheckbox
*multiple
, *cMo
, *cTue
, *cWed
, *cThu
, *cFr
, *cSa
, *cSu
;
128 eComboBox
*bday
, *bmonth
, *byear
, *eday
, *emonth
, *eyear
, *type
, *after_event
;
129 eTextInputField
*event_name
;
130 eLabel
*lBegin
, *lEnd
;
131 eNumber
*btime
, *etime
;
132 eButton
*bSelectService
, *bApply
, *bScanEPG
;
133 tm beginTime
, endTime
;
134 eServiceReference tmpService
;
135 ePlaylistEntry
*curEntry
;
138 void scanEPGPressed();
139 void multipleChanged( int );
140 void setMultipleCheckboxes( int type
);
141 void createWidgets();
142 void fillInData( time_t begTime
, int duration
, int type
, eServiceReference
& ref
);
144 void showServiceSelector();
145 void comboBoxClosed( eComboBox
*combo
, eListBoxEntryText
* );
146 void updateDateTime( const tm
& beginTime
, const tm
& endTime
, int what
);
147 void updateDay( eComboBox
* dayCombo
, int year
, int month
, int day
);
150 eWidget::focusNext(eWidget::focusDirNext
);
152 bool getData( time_t& beginTime
, int& duration
);
153 int eventHandler( const eWidgetEvent
&e
);
154 void changeTime( int dir
);
156 eTimerEditView(ePlaylistEntry
* e
=0);
157 eTimerEditView( const EITEvent
&e
, int type
, eServiceReference ref
);