00001 #ifndef VIDEODLG_H_
00002 #define VIDEODLG_H_
00003
00004 #include <QPointer>
00005 #include <QStringList>
00006
00007 #include "mythscreentype.h"
00008
00009 #include "parentalcontrols.h"
00010 #include "quicksp.h"
00011
00012 class MythUIText;
00013 class MythUIButtonList;
00014 class MythUIButtonTree;
00015 class MythUIButtonListItem;
00016 class MythUIBusyDialog;
00017 class MythUIImage;
00018 class MythUIStateType;
00019 class MythDialogBox;
00020 class MythGenericTree;
00021 class MetadataLookup;
00022 class MetadataFactory;
00023 class VideoMetadata;
00024 class VideoScanner;
00025 class MythMenu;
00026
00027 class QUrl;
00028
00029 enum ImageDownloadErrorState { esOK, esError, esTimeout };
00030
00031 class VideoDialog : public MythScreenType
00032 {
00033 Q_OBJECT
00034
00035 public:
00036 enum DialogType { DLG_DEFAULT = 0, DLG_BROWSER = 0x1, DLG_GALLERY = 0x2,
00037 DLG_TREE = 0x4, DLG_MANAGER = 0x8, dtLast };
00038
00039 enum BrowseType { BRS_FOLDER = 0, BRS_GENRE = 0x1, BRS_CATEGORY = 0x2,
00040 BRS_YEAR = 0x4, BRS_DIRECTOR = 0x8, BRS_CAST = 0x10,
00041 BRS_USERRATING = 0x20, BRS_INSERTDATE = 0x40,
00042 BRS_TVMOVIE = 0x80, BRS_STUDIO = 0x100, btLast };
00043
00044 typedef simple_ref_ptr<class VideoList> VideoListPtr;
00045
00046 typedef QPointer<class VideoListDeathDelay> VideoListDeathDelayPtr;
00047
00048 static VideoListDeathDelayPtr &GetSavedVideoList();
00049
00050 public:
00051 VideoDialog(MythScreenStack *lparent, QString lname,
00052 VideoListPtr video_list, DialogType type,
00053 BrowseType browse);
00054 ~VideoDialog();
00055
00056 bool Create();
00057 bool keyPressEvent(QKeyEvent *levent);
00058
00059 private:
00060 void searchStart();
00061
00062 public slots:
00063 void searchComplete(QString string);
00064
00065 protected slots:
00066 void Init();
00067 void Load();
00068
00069 private slots:
00070 void UpdatePosition();
00071 void UpdateText(MythUIButtonListItem *);
00072 void handleSelect(MythUIButtonListItem *);
00073 void SetCurrentNode(MythGenericTree *);
00074
00075 void playVideo();
00076 void playVideoAlt();
00077 void playFolder();
00078 void playVideoWithTrailers();
00079 void playTrailer();
00080
00081 void SwitchTree();
00082 void SwitchGallery();
00083 void SwitchBrowse();
00084 void SwitchManager();
00085 void SwitchVideoFolderGroup();
00086 void SwitchVideoGenreGroup();
00087 void SwitchVideoCategoryGroup();
00088 void SwitchVideoYearGroup();
00089 void SwitchVideoDirectorGroup();
00090 void SwitchVideoStudioGroup();
00091 void SwitchVideoCastGroup();
00092 void SwitchVideoUserRatingGroup();
00093 void SwitchVideoInsertDateGroup();
00094 void SwitchVideoTVMovieGroup();
00095
00096 void EditMetadata();
00097 void VideoSearch(MythGenericTree *node = NULL,
00098 bool automode = false);
00099 void VideoAutoSearch(MythGenericTree *node = NULL);
00100 void ResetMetadata();
00101 void ToggleWatched();
00102 void ToggleProcess();
00103 void RemoveVideo();
00104 void OnRemoveVideo(bool);
00105
00106 void VideoMenu();
00107 MythMenu* CreateInfoMenu();
00108 MythMenu* CreateManageMenu();
00109 MythMenu* CreatePlayMenu();
00110 void DisplayMenu();
00111 MythMenu* CreateViewMenu();
00112 MythMenu* CreateSettingsMenu();
00113 MythMenu* CreateMetadataBrowseMenu();
00114
00115 void PromptToScan();
00116
00117 void ChangeFilter();
00118
00119 void ToggleBrowseMode();
00120 void ToggleFlatView();
00121
00122 void ViewPlot();
00123 void ShowCastDialog();
00124 void ShowHomepage();
00125 bool DoItemDetailShow();
00126 void ShowPlayerSettings();
00127 void ShowExtensionSettings();
00128 void ShowMetadataSettings();
00129
00130 void OnParentalChange(int amount);
00131
00132
00133 void OnVideoSearchListSelection(MetadataLookup *lookup);
00134
00135 void doVideoScan();
00136
00137 protected slots:
00138 void scanFinished(bool);
00139 void reloadData();
00140 void refreshData();
00141 void UpdateItem(MythUIButtonListItem *item);
00142
00143 protected:
00144 void customEvent(QEvent *levent);
00145
00146 virtual MythUIButtonListItem *GetItemCurrent();
00147 virtual MythUIButtonListItem *GetItemByMetadata(VideoMetadata *metadata);
00148
00149 virtual void loadData();
00150 void fetchVideos();
00151 QString RemoteImageCheck(QString host, QString filename);
00152 QString GetCoverImage(MythGenericTree *node);
00153 QString GetFirstImage(MythGenericTree *node, QString type,
00154 QString gpnode = QString(), int levels = 0);
00155 QString GetImageFromFolder(VideoMetadata *metadata);
00156 QString GetScreenshot(MythGenericTree *node);
00157 QString GetBanner(MythGenericTree *node);
00158 QString GetFanart(MythGenericTree *node);
00159
00160 VideoMetadata *GetMetadata(MythUIButtonListItem *item);
00161
00162 void handleDirSelect(MythGenericTree *node);
00163 void handleDynamicDirSelect(MythGenericTree *node);
00164 bool goBack();
00165 void setParentalLevel(const ParentalLevel::Level &level);
00166 void shiftParental(int amount);
00167 bool createPopup();
00168 void createBusyDialog(QString title);
00169 void createOkDialog(QString title);
00170
00171 void SwitchLayout(DialogType type, BrowseType browse);
00172
00173 void StartVideoImageSet(VideoMetadata *metadata);
00174
00175 void SavePosition(void);
00176
00177 private slots:
00178
00179 void OnVideoImageSetDone(VideoMetadata *metadata);
00180 void OnVideoSearchDone(MetadataLookup *lookup);
00181
00182 private:
00183 MythDialogBox *m_menuPopup;
00184 MythUIBusyDialog *m_busyPopup;
00185 MythScreenStack *m_popupStack;
00186 MythScreenStack *m_mainStack;
00187
00188 MythUIButtonList *m_videoButtonList;
00189 MythUIButtonTree *m_videoButtonTree;
00190
00191 MythUIText *m_titleText;
00192 MythUIText *m_novideoText;
00193
00194 MythUIText *m_positionText;
00195 MythUIText *m_crumbText;
00196
00197 MythUIImage *m_coverImage;
00198 MythUIImage *m_screenshot;
00199 MythUIImage *m_banner;
00200 MythUIImage *m_fanart;
00201
00202 MythUIStateType *m_trailerState;
00203 MythUIStateType *m_parentalLevelState;
00204 MythUIStateType *m_videoLevelState;
00205 MythUIStateType *m_userRatingState;
00206 MythUIStateType *m_watchedState;
00207 MythUIStateType *m_studioState;
00208
00209 MetadataFactory *m_metadataFactory;
00210
00211 class VideoDialogPrivate *m_d;
00212 };
00213
00214 class VideoListDeathDelay : public QObject
00215 {
00216 Q_OBJECT
00217
00218 public:
00219 VideoListDeathDelay(VideoDialog::VideoListPtr toSave);
00220 ~VideoListDeathDelay();
00221
00222 VideoDialog::VideoListPtr GetSaved();
00223
00224 private slots:
00225 void OnTimeUp();
00226
00227 private:
00228 class VideoListDeathDelayPrivate *m_d;
00229 };
00230
00231 #endif