00001 #ifndef SCHEDULERECORDING_H_
00002 #define SCHEDULERECORDING_H_
00003
00004 #include "mythscreentype.h"
00005 #include "schedulecommon.h"
00006
00007
00008 #include "mythdb.h"
00009
00010
00011 #include "mythcontext.h"
00012
00013
00014 #include "recordingrule.h"
00015 #include "recordinginfo.h"
00016
00017
00018 #include "metadatafactory.h"
00019
00020 class ProgramInfo;
00021 class MythUIText;
00022 class MythUIButton;
00023 class MythUIButtonList;
00024 class MythUIButtonListItem;
00025 class MythUIStateType;
00026 class MythUISpinBox;
00027 class TV;
00028
00029 class ScheduleEditor;
00030 class SchedEditChild;
00031
00032 class SchedOptMixin
00033 {
00034 protected:
00035 SchedOptMixin(MythScreenType &screen, RecordingRule *rule,
00036 SchedOptMixin *other = NULL);
00037 void SetRule(RecordingRule *rule) { m_rule = rule; };
00038 void Create(bool *err);
00039 void Load(void);
00040 void Save(void);
00041 void RuleChanged(void);
00042 void DupMethodChanged(MythUIButtonListItem *item);
00043
00044 MythUISpinBox *m_prioritySpin;
00045 MythUISpinBox *m_startoffsetSpin;
00046 MythUISpinBox *m_endoffsetSpin;
00047 MythUIButtonList *m_dupmethodList;
00048 MythUIButtonList *m_dupscopeList;
00049 MythUIButtonList *m_inputList;
00050 MythUICheckBox *m_ruleactiveCheck;
00051 MythUIButtonList *m_newrepeatList;
00052
00053 private:
00054 MythScreenType *m_screen;
00055 RecordingRule *m_rule;
00056 SchedOptMixin *m_other;
00057 bool m_loaded;
00058 bool m_haveRepeats;
00059 };
00060
00061 class StoreOptMixin
00062 {
00063 protected:
00064 StoreOptMixin(MythScreenType &screen, RecordingRule *rule,
00065 StoreOptMixin *other = NULL);
00066 void SetRule(RecordingRule *rule) { m_rule = rule; };
00067 void Create(bool *err);
00068 void Load(void);
00069 void Save(void);
00070 void RuleChanged(void);
00071 void MaxEpisodesChanged(MythUIButtonListItem *);
00072 void PromptForRecGroup(void);
00073 void SetRecGroup(QString recgroup);
00074
00075 MythUIButtonList *m_recprofileList;
00076 MythUIButtonList *m_recgroupList;
00077 MythUIButtonList *m_storagegroupList;
00078 MythUIButtonList *m_playgroupList;
00079 MythUISpinBox *m_maxepSpin;
00080 MythUIButtonList *m_maxbehaviourList;
00081 MythUICheckBox *m_autoexpireCheck;
00082
00083 private:
00084 MythScreenType *m_screen;
00085 RecordingRule *m_rule;
00086 StoreOptMixin *m_other;
00087 bool m_loaded;
00088 };
00089
00090 class PostProcMixin
00091 {
00092 protected:
00093 PostProcMixin(MythScreenType &screen, RecordingRule *rule,
00094 PostProcMixin *other= NULL);
00095 void SetRule(RecordingRule *rule) { m_rule = rule; };
00096 void Create(bool *err);
00097 void Load(void);
00098 void Save(void);
00099 void RuleChanged(void);
00100 void TranscodeChanged(bool enable);
00101
00102 MythUICheckBox *m_commflagCheck;
00103 MythUICheckBox *m_transcodeCheck;
00104 MythUIButtonList *m_transcodeprofileList;
00105 MythUICheckBox *m_userjob1Check;
00106 MythUICheckBox *m_userjob2Check;
00107 MythUICheckBox *m_userjob3Check;
00108 MythUICheckBox *m_userjob4Check;
00109 MythUICheckBox *m_metadataLookupCheck;
00110
00111 private:
00112 MythScreenType *m_screen;
00113 RecordingRule *m_rule;
00114 PostProcMixin *m_other;
00115 bool m_loaded;
00116 };
00117
00118 class ScheduleEditor : public ScheduleCommon,
00119 public SchedOptMixin, public StoreOptMixin, public PostProcMixin
00120 {
00121 Q_OBJECT
00122 public:
00123 ScheduleEditor(MythScreenStack *parent, RecordingInfo* recinfo,
00124 TV *player = NULL);
00125 ScheduleEditor(MythScreenStack *parent, RecordingRule* recrule,
00126 TV *player = NULL);
00127 ~ScheduleEditor();
00128
00129 bool Create(void);
00130 bool keyPressEvent(QKeyEvent *event);
00131 void customEvent(QEvent *event);
00132
00133 void showMenu(void);
00134 void showPrevious(void);
00135 void showUpcomingByRule(void);
00136 void showUpcomingByTitle(void);
00137 void ShowDetails(ProgramInfo *pginfo) const
00138 { ScheduleCommon::ShowDetails(pginfo); };
00139
00141 static void *RunScheduleEditor(ProgramInfo *proginfo, void *player = NULL);
00142
00143 signals:
00144 void ruleSaved(int ruleId);
00145 void ruleDeleted(int ruleId);
00146 void templateLoaded(void);
00147
00148 public slots:
00149 void ShowSchedOpt(void);
00150 void ShowFilters(void);
00151 void ShowStoreOpt(void);
00152 void ShowPostProc(void);
00153 void ShowMetadataOptions(void);
00154 void ShowPreviousView(void);
00155 void ShowNextView(void);
00156 void ShowPreview(void);
00157 void Save(void);
00158
00159 protected slots:
00160 void RuleChanged(MythUIButtonListItem *item);
00161 void DupMethodChanged(MythUIButtonListItem *);
00162 void MaxEpisodesChanged(MythUIButtonListItem *);
00163 void PromptForRecGroup(void);
00164 void TranscodeChanged(bool enable);
00165 void ShowSchedInfo(void);
00166 void ChildClosing(void);
00167 void Close(void);
00168
00169 private:
00170 void Load(void);
00171 void LoadTemplate(QString name);
00172 void DeleteRule(void);
00173
00174 void showTemplateMenu(void);
00175
00176 RecordingInfo *m_recInfo;
00177 RecordingRule *m_recordingRule;
00178
00179 bool m_sendSig;
00180
00181 MythUIButton *m_saveButton;
00182 MythUIButton *m_cancelButton;
00183
00184 MythUIButtonList *m_rulesList;
00185
00186 MythUIButton *m_schedOptButton;
00187 MythUIButton *m_storeOptButton;
00188 MythUIButton *m_postProcButton;
00189 MythUIButton *m_schedInfoButton;
00190 MythUIButton *m_previewButton;
00191 MythUIButton *m_metadataButton;
00192 MythUIButton *m_filtersButton;
00193
00194 TV *m_player;
00195
00196 bool m_loaded;
00197
00198 enum View
00199 {
00200 kMainView,
00201 kSchedOptView,
00202 kFilterView,
00203 kStoreOptView,
00204 kPostProcView,
00205 kMetadataView
00206 };
00207
00208 int m_view;
00209 SchedEditChild *m_child;
00210 };
00211
00212 class SchedEditChild : public MythScreenType
00213 {
00214 Q_OBJECT
00215 protected:
00216 SchedEditChild(MythScreenStack *parent, const QString name,
00217 ScheduleEditor &editor, RecordingRule &rule,
00218 RecordingInfo *recinfo);
00219 ~SchedEditChild();
00220
00221 virtual bool keyPressEvent(QKeyEvent *event);
00222 virtual bool Create(const QString xmlfile, const QString winname,
00223 bool isTemplate);
00224
00225 signals:
00226 void Closing(void);
00227
00228 public slots:
00229 virtual void Close(void);
00230 virtual void Load(void) = 0;
00231 virtual void Save(void) = 0;
00232
00233 protected:
00234 void SetTextFromMaps(void);
00235
00236 ScheduleEditor *m_editor;
00237 RecordingRule *m_recordingRule;
00238 RecordingInfo *m_recInfo;
00239
00240 MythUIButton *m_backButton;
00241 MythUIButton *m_saveButton;
00242 MythUIButton *m_previewButton;
00243 };
00244
00245 class SchedOptEditor : public SchedEditChild, public SchedOptMixin
00246 {
00247 Q_OBJECT
00248 public:
00249 SchedOptEditor(MythScreenStack *parent, ScheduleEditor &editor,
00250 RecordingRule &rule, RecordingInfo *recinfo);
00251 ~SchedOptEditor();
00252
00253 bool Create(void);
00254
00255 protected slots:
00256 void DupMethodChanged(MythUIButtonListItem *);
00257
00258 private:
00259 void Load(void);
00260 void Save(void);
00261
00262 MythUIButton *m_filtersButton;
00263 };
00264
00265 class SchedFilterEditor : public SchedEditChild
00266 {
00267 Q_OBJECT
00268 public:
00269 SchedFilterEditor(MythScreenStack *parent, ScheduleEditor &editor,
00270 RecordingRule &rule, RecordingInfo *recinfo);
00271 ~SchedFilterEditor();
00272
00273 bool Create(void);
00274
00275 protected slots:
00276 void ToggleSelected(MythUIButtonListItem *item);
00277
00278 private:
00279 void Load(void);
00280 void Save(void);
00281
00282 MythUIButtonList *m_filtersList;
00283 bool m_loaded;
00284 };
00285
00286 class StoreOptEditor : public SchedEditChild, public StoreOptMixin
00287 {
00288 Q_OBJECT
00289 public:
00290 StoreOptEditor(MythScreenStack *parent, ScheduleEditor &editor,
00291 RecordingRule &rule, RecordingInfo *recinfo);
00292 ~StoreOptEditor();
00293
00294 bool Create(void);
00295 void customEvent(QEvent *event);
00296
00297 protected slots:
00298 void MaxEpisodesChanged(MythUIButtonListItem *);
00299 void PromptForRecGroup(void);
00300
00301 private:
00302 void Load(void);
00303 void Save(void);
00304 };
00305
00306 class PostProcEditor : public SchedEditChild, public PostProcMixin
00307 {
00308 Q_OBJECT
00309 public:
00310 PostProcEditor(MythScreenStack *parent, ScheduleEditor &editor,
00311 RecordingRule &rule, RecordingInfo *recinfo);
00312 ~PostProcEditor();
00313
00314 bool Create(void);
00315
00316 protected slots:
00317 void TranscodeChanged(bool enable);
00318
00319 private:
00320 void Load(void);
00321 void Save(void);
00322 };
00323
00324 class MetadataOptions : public SchedEditChild
00325 {
00326 Q_OBJECT
00327 public:
00328 MetadataOptions(MythScreenStack *parent, ScheduleEditor &editor,
00329 RecordingRule &rule, RecordingInfo *recinfo);
00330 ~MetadataOptions();
00331
00332 bool Create(void);
00333
00334 protected slots:
00335 void PerformQuery();
00336 void SelectLocalFanart();
00337 void SelectLocalCoverart();
00338 void SelectLocalBanner();
00339 void SelectOnlineFanart();
00340 void SelectOnlineCoverart();
00341 void SelectOnlineBanner();
00342 void QueryComplete(MetadataLookup *lookup);
00343 void OnSearchListSelection(MetadataLookup *lookup);
00344 void OnImageSearchListSelection(ArtworkInfo info,
00345 VideoArtworkType type);
00346 void OnArtworkSearchDone(MetadataLookup *lookup);
00347 void FindNetArt(VideoArtworkType type);
00348
00349 void ValuesChanged();
00350
00351 private:
00352 void Load(void);
00353 void Save(void);
00354
00355 void CreateBusyDialog(QString title);
00356 void FindImagePopup(const QString &prefix,
00357 const QString &prefixAlt,
00358 QObject &inst,
00359 const QString &returnEvent);
00360 QStringList GetSupportedImageExtensionFilter();
00361
00362 void HandleDownloadedImages(MetadataLookup *lookup);
00363
00364 bool CanSetArtwork(void);
00365
00366 void customEvent(QEvent *event);
00367
00368
00369 MetadataFactory *m_metadataFactory;
00370
00371
00372 MetadataDownload *m_imageLookup;
00373 MetadataImageDownload *m_imageDownload;
00374
00375 MetadataLookup *m_lookup;
00376
00377 MythScreenStack *m_popupStack;
00378 MythUIBusyDialog *m_busyPopup;
00379
00380 MythUIImage *m_fanart;
00381 MythUIImage *m_coverart;
00382 MythUIImage *m_banner;
00383
00384 MythUITextEdit *m_inetrefEdit;
00385
00386 MythUISpinBox *m_seasonSpin;
00387 MythUISpinBox *m_episodeSpin;
00388
00389 MythUIButton *m_queryButton;
00390 MythUIButton *m_localFanartButton;
00391 MythUIButton *m_localCoverartButton;
00392 MythUIButton *m_localBannerButton;
00393 MythUIButton *m_onlineFanartButton;
00394 MythUIButton *m_onlineCoverartButton;
00395 MythUIButton *m_onlineBannerButton;
00396
00397 ArtworkMap m_artworkMap;
00398 };
00399
00400 #endif