MythTV master
videodlg.h
Go to the documentation of this file.
1#ifndef VIDEODLG_H_
2#define VIDEODLG_H_
3
4// Qt
5#include <QPointer>
6#include <QStringList>
7
8// MythTV
13
14class MythUIText;
19class MythUIImage;
20class MythUIStateType;
21class MythDialogBox;
22class MythGenericTree;
23class MetadataFactory;
24class VideoMetadata;
25class VideoScanner;
26class MythMenu;
27
28class QUrl;
29
31
33{
34 Q_OBJECT
35
36 public:
37 enum DialogType : std::uint8_t
38 { DLG_DEFAULT = 0, DLG_BROWSER = 0x1, DLG_GALLERY = 0x2,
39 DLG_TREE = 0x4, DLG_MANAGER = 0x8, dtLast = 0x9 };
40
42 { BRS_FOLDER = 0, BRS_GENRE = 0x1, BRS_CATEGORY = 0x2,
43 BRS_YEAR = 0x4, BRS_DIRECTOR = 0x8, BRS_CAST = 0x10,
45 BRS_TVMOVIE = 0x80, BRS_STUDIO = 0x100, btLast = 0x101 };
46
48 using VideoListDeathDelayPtr = QPointer<class VideoListDeathDelay>;
49
51
52 public:
53 VideoDialog(MythScreenStack *lparent, const QString& lname,
54 const VideoListPtr& video_list, DialogType type,
55 BrowseType browse);
56 ~VideoDialog() override;
57
58 bool Create() override; // MythScreenType
59 bool keyPressEvent(QKeyEvent *levent) override; // MythScreenType
60
61 private:
62 void searchStart();
63
64 public slots:
65 void searchComplete(const QString& string);
66 void playbackStateChanged(const QString &filename);
67
68 protected slots:
69 void Init() override;
70 void Load() override;
71
72 private slots:
73 void UpdatePosition();
79
80 void playVideo();
81 void playVideoAlt();
82 void playFolder();
84 void playTrailer();
85
86 void SwitchTree();
87 void SwitchGallery();
88 void SwitchBrowse();
89 void SwitchManager();
100
101 void EditMetadata();
102 void VideoSearch(MythGenericTree *node,
103 bool automode = false);
104 void VideoSearch() { VideoSearch(nullptr, false); }
106 void VideoAutoSearch() { VideoAutoSearch(nullptr); }
107 void ResetMetadata();
108 void ToggleWatched();
109 void ToggleProcess();
110 void RemoveVideo();
111 void OnRemoveVideo(bool dodelete);
112
113 void VideoMenu();
117 void DisplayMenu();
121
122 void popupClosed(const QString& which, int result);
123
124 void PromptToScan();
125
126 void ChangeFilter();
127
128 void ToggleBrowseMode();
129 void ToggleFlatView();
130
131 void ViewPlot();
132 void ShowCastDialog();
133 void ShowHomepage();
134 bool DoItemDetailShow();
135 void DoItemDetailShow2() { static_cast<void>(DoItemDetailShow()); }
136 void ShowPlayerSettings();
139
140 void OnParentalChange(int amount);
141
142 // Called when the underlying data for an item changes
144
145 void doVideoScan();
146
147 protected slots:
148 void scanFinished(bool dbChanged);
149 void reloadData();
150 void refreshData();
152
153 protected:
154 void customEvent(QEvent *levent) override; // MythUIType
155
158
159 virtual void loadData();
160 void fetchVideos();
161 static QString RemoteImageCheck(const QString& host, const QString& filename);
162 static QString GetCoverImage(MythGenericTree *node);
163 QString GetFirstImage(MythGenericTree *node, const QString& type,
164 const QString& gpnode = QString(), int levels = 0);
165 static QString GetScreenshot(MythGenericTree *node);
166 static QString GetBanner(MythGenericTree *node);
167 static QString GetFanart(MythGenericTree *node);
168
170
173 bool goBack();
175 void shiftParental(int amount);
177 void createBusyDialog(const QString &title);
178 void createFetchDialog(VideoMetadata *metadata);
179 void dismissFetchDialog(VideoMetadata *metadata, bool ok);
180 void createOkDialog(const QString& title);
181
183
184 void StartVideoImageSet(VideoMetadata *metadata);
185
186 void SavePosition(void);
187
188 private slots:
189
190 void OnVideoImageSetDone(VideoMetadata *metadata);
191 void OnVideoSearchDone(MetadataLookup *lookup);
192 void OnPlaybackStopped();
193
194 private:
199
202
205
208
213
221
223
224 class VideoDialogPrivate *m_d {nullptr};
225};
226
227class VideoListDeathDelay : public QObject
228{
229 Q_OBJECT
230
231 public:
232 explicit VideoListDeathDelay(const VideoDialog::VideoListPtr& toSave);
233 ~VideoListDeathDelay() override;
234
236 // When exiting MythVideo, we delay destroying the data for kDelayTimeMS
237 // milliseconds, and reuse the data (possibly avoiding a rescan) if the user
238 // restarts MythVideo within that time period.
239 static constexpr std::chrono::milliseconds kDelayTimeMS { 3s };
240
241 private slots:
242 void OnTimeUp();
243
244 private:
246};
247
248#endif
Basic menu dialog, message and a list of options.
Screen in which all other widgets are contained and rendered.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A tree widget for displaying and navigating a MythGenericTree()
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
This widget is used for grouping other widgets for display when a particular named state is called.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
MythUIStateType * m_videoLevelState
Definition: videodlg.h:216
void SwitchManager()
Switch to Video Manager View.
Definition: videodlg.cpp:2873
void OnParentalChange(int amount)
Definition: videodlg.cpp:3549
void VideoMenu()
Pop up a MythUI "Playback Menu" for MythVideo.
Definition: videodlg.cpp:2412
void playFolder()
Play all the items in the selected folder.
Definition: videodlg.cpp:3116
void ShowMetadataSettings()
Pop up a MythUI Menu for MythVideo Metadata Settings.
Definition: videodlg.cpp:2630
void popupClosed(const QString &which, int result)
Definition: videodlg.cpp:2548
void SwitchVideoUserRatingGroup()
Switch to User Rating browse mode.
Definition: videodlg.cpp:2945
void ShowPlayerSettings()
Pop up a MythUI Menu for MythVideo Player Settings.
Definition: videodlg.cpp:2616
MythUIStateType * m_trailerState
Definition: videodlg.h:214
static VideoMetadata * GetMetadata(MythUIButtonListItem *item)
Retrieve the Database Metadata for a given MythUIButtonListItem.
Definition: videodlg.cpp:3288
void OnVideoImageSetDone(VideoMetadata *metadata)
Definition: videodlg.cpp:3401
bool goBack()
Move one level up in the tree.
Definition: videodlg.cpp:2247
MythUIImage * m_screenshot
Definition: videodlg.h:210
void ResetMetadata()
Definition: videodlg.cpp:3639
void setParentalLevel(ParentalLevel::Level level)
Set the parental level for the library.
Definition: videodlg.cpp:3252
void createBusyDialog(const QString &title)
Create a busy dialog, used during metadata search, etc.
Definition: videodlg.cpp:2071
void SwitchVideoYearGroup()
Switch to Year browse mode.
Definition: videodlg.cpp:2909
void SwitchVideoTVMovieGroup()
Switch to Television/Movie browse mode.
Definition: videodlg.cpp:2963
void handleDynamicDirSelect(MythGenericTree *node)
Request the latest metadata for a folder.
Definition: videodlg.cpp:2800
void fetchVideos()
Build the buttonlist/tree.
Definition: videodlg.cpp:1383
void StartVideoImageSet(VideoMetadata *metadata)
Definition: videodlg.cpp:3652
void SetCurrentNode(MythGenericTree *node)
Switch to a given MythGenericTree node.
Definition: videodlg.cpp:2271
MythMenu * CreateViewMenu()
Create a MythMenu for MythVideo Views.
Definition: videodlg.cpp:2563
void SwitchLayout(DialogType type, BrowseType browse)
Handle a layout or browse mode switch.
Definition: videodlg.cpp:2972
void createFetchDialog(VideoMetadata *metadata)
Create a fetch notification, used during metadata search.
Definition: videodlg.cpp:2089
MythUIText * m_titleText
Definition: videodlg.h:203
MythUIImage * m_banner
Definition: videodlg.h:211
void VideoAutoSearch()
Definition: videodlg.h:106
MythUIStateType * m_userRatingState
Definition: videodlg.h:217
void EditMetadata()
Definition: videodlg.cpp:3567
QString GetFirstImage(MythGenericTree *node, const QString &type, const QString &gpnode=QString(), int levels=0)
Find the first image of "type" within a folder structure.
Definition: videodlg.cpp:1717
void shiftParental(int amount)
Shift the parental level for the library by an integer amount.
Definition: videodlg.cpp:3261
static QString GetCoverImage(MythGenericTree *node)
A "hunt" for cover art to apply for a folder item.
Definition: videodlg.cpp:1485
void doVideoScan()
Definition: videodlg.cpp:3847
void createOkDialog(const QString &title)
Create a MythUI "OK" Dialog.
Definition: videodlg.cpp:2155
bool DoItemDetailShow()
Display the Item Detail Popup.
Definition: videodlg.cpp:3016
MythUIButtonList * m_videoButtonList
Definition: videodlg.h:200
MythUIStateType * m_studioState
Definition: videodlg.h:219
MythUIImage * m_coverImage
Definition: videodlg.h:209
void SwitchVideoGenreGroup()
Switch to Genre browse mode.
Definition: videodlg.cpp:2891
void refreshData()
Reloads the tree without invalidating the data.
Definition: videodlg.cpp:1130
void ToggleFlatView()
Toggle Flat View.
Definition: videodlg.cpp:2775
virtual void loadData()
load the data used to build the ButtonTree/List for MythVideo.
Definition: videodlg.cpp:1182
void RemoveVideo()
Definition: videodlg.cpp:3585
static QString GetBanner(MythGenericTree *node)
Find the Banner for a given node.
Definition: videodlg.cpp:1890
void SwitchVideoCategoryGroup()
Switch to Category browse mode.
Definition: videodlg.cpp:2900
MythDialogBox * m_menuPopup
Definition: videodlg.h:195
void handleDirSelect(MythGenericTree *node)
Descend into a selected folder.
Definition: videodlg.cpp:2790
void DisplayMenu()
Pop up a MythUI Menu for MythVideo Global Functions.
Definition: videodlg.cpp:2519
bool createPopup()
void searchComplete(const QString &string)
After using incremental search, move to the selected item.
Definition: videodlg.cpp:2169
void ShowCastDialog()
Display the Cast if the selected item.
Definition: videodlg.cpp:3040
void customEvent(QEvent *levent) override
Definition: videodlg.cpp:3307
void SwitchVideoStudioGroup()
Switch to Studio browse mode.
Definition: videodlg.cpp:2927
MythUIText * m_positionText
Definition: videodlg.h:206
void SavePosition(void)
Definition: videodlg.cpp:940
MythMenu * CreateMetadataBrowseMenu()
Create a MythMenu for MythVideo Metadata Browse modes.
Definition: videodlg.cpp:2658
@ DLG_DEFAULT
Definition: videodlg.h:38
@ DLG_MANAGER
Definition: videodlg.h:39
@ DLG_GALLERY
Definition: videodlg.h:38
@ DLG_BROWSER
Definition: videodlg.h:38
void SwitchTree()
Switch to Tree (List) View.
Definition: videodlg.cpp:2846
static QString GetScreenshot(MythGenericTree *node)
Find the Screenshot for a given node.
Definition: videodlg.cpp:1850
MythMenu * CreateSettingsMenu()
Create a MythMenu for MythVideo Settings.
Definition: videodlg.cpp:2599
static VideoListDeathDelayPtr & GetSavedVideoList()
Definition: videodlg.cpp:879
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
Definition: videodlg.h:48
static void UpdateWatchedState(MythUIButtonListItem *item)
Update the watched state for a given ButtonListItem from the database.
Definition: videodlg.cpp:2388
void reloadData()
Reloads the tree after having invalidated the data.
Definition: videodlg.cpp:1172
void SwitchVideoFolderGroup()
Switch to Folder (filesystem) browse mode.
Definition: videodlg.cpp:2882
virtual MythUIButtonListItem * GetItemCurrent()
Definition: videodlg.cpp:3414
MythMenu * CreateManageMenu()
Create a MythMenu for metadata management.
Definition: videodlg.cpp:2728
void ShowHomepage()
Definition: videodlg.cpp:3050
static QString GetFanart(MythGenericTree *node)
Find the Fanart for a given node.
Definition: videodlg.cpp:1925
void UpdateItem(MythUIButtonListItem *item)
Update the visible representation of a MythUIButtonListItem.
Definition: videodlg.cpp:1289
void PromptToScan()
Definition: videodlg.cpp:3855
void UpdateVisible(MythUIButtonListItem *item)
Update playback state for for a given visible ButtonListItem.
Definition: videodlg.cpp:2300
void playTrailer()
Play the trailer associated with the selected item.
Definition: videodlg.cpp:3229
MythUIStateType * m_parentalLevelState
Definition: videodlg.h:215
void SwitchVideoCastGroup()
Switch to Cast browse mode.
Definition: videodlg.cpp:2936
void OnPlaybackStopped()
Definition: videodlg.cpp:917
void playVideoWithTrailers()
Play the selected item w/ a User selectable # of trailers.
Definition: videodlg.cpp:3196
MythUIText * m_crumbText
Definition: videodlg.h:207
~VideoDialog() override
Definition: videodlg.cpp:930
void ViewPlot()
Display a MythUI Popup with the selected item's plot.
Definition: videodlg.cpp:3002
void OnVideoSearchDone(MetadataLookup *lookup)
Definition: videodlg.cpp:3730
void UpdatePosition()
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:2283
class VideoDialogPrivate * m_d
Definition: videodlg.h:224
void OnVideoSearchListSelection(RefCountHandler< MetadataLookup > lookup)
Definition: videodlg.cpp:3520
void SwitchGallery()
Switch to Gallery View.
Definition: videodlg.cpp:2855
void UpdateText(MythUIButtonListItem *item)
Update the visible text values for a given ButtonListItem.
Definition: videodlg.cpp:2316
void ChangeFilter()
Change the filtering of the library.
Definition: videodlg.cpp:3271
void handleSelect(MythUIButtonListItem *item)
Handle SELECT action for a given MythUIButtonListItem.
Definition: videodlg.cpp:2812
void Init() override
Definition: videodlg.cpp:1111
void playbackStateChanged(const QString &filename)
Definition: videodlg.cpp:906
MythUIImage * m_fanart
Definition: videodlg.h:212
static QString RemoteImageCheck(const QString &host, const QString &filename)
Search for a given (image) filename in the Video SG.
Definition: videodlg.cpp:1429
void SwitchBrowse()
Switch to Browser View.
Definition: videodlg.cpp:2864
void playVideoAlt()
Play the selected item in an alternate player.
Definition: videodlg.cpp:3105
void ToggleProcess()
Definition: videodlg.cpp:2747
void dismissFetchDialog(VideoMetadata *metadata, bool ok)
Definition: videodlg.cpp:2111
void playVideo()
Play the selected item.
Definition: videodlg.cpp:3094
void searchStart()
Create an incremental search dialog for the current tree level.
Definition: videodlg.cpp:2209
MythMenu * CreatePlayMenu()
Create a "Play Menu" for MythVideo.
Definition: videodlg.cpp:2481
void SwitchVideoInsertDateGroup()
Switch to Insert Date browse mode.
Definition: videodlg.cpp:2954
MetadataFactory * m_metadataFactory
Definition: videodlg.h:222
void VideoSearch()
Definition: videodlg.h:104
bool keyPressEvent(QKeyEvent *levent) override
Handle keypresses and keybindings.
Definition: videodlg.cpp:1960
void ToggleBrowseMode()
Toggle the browseable status for the selected item.
Definition: videodlg.cpp:2763
MythMenu * CreateInfoMenu()
Create a MythMenu for Info pertaining to the selected item.
Definition: videodlg.cpp:2701
VideoDialog(MythScreenStack *lparent, const QString &lname, const VideoListPtr &video_list, DialogType type, BrowseType browse)
Definition: videodlg.cpp:884
void OnRemoveVideo(bool dodelete)
Definition: videodlg.cpp:3604
MythScreenStack * m_mainStack
Definition: videodlg.h:198
MythUIStateType * m_watchedState
Definition: videodlg.h:218
void DoItemDetailShow2()
Definition: videodlg.h:135
MythUIStateType * m_bookmarkState
Definition: videodlg.h:220
void Load() override
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:1117
MythUIBusyDialog * m_busyPopup
Definition: videodlg.h:196
bool Create() override
Definition: videodlg.cpp:964
void ToggleWatched()
Definition: videodlg.cpp:3504
virtual MythUIButtonListItem * GetItemByMetadata(VideoMetadata *metadata)
Definition: videodlg.cpp:3424
void scanFinished(bool dbChanged)
Definition: videodlg.cpp:1145
@ BRS_USERRATING
Definition: videodlg.h:44
@ BRS_CATEGORY
Definition: videodlg.h:42
@ BRS_STUDIO
Definition: videodlg.h:45
@ BRS_FOLDER
Definition: videodlg.h:42
@ BRS_DIRECTOR
Definition: videodlg.h:43
@ BRS_TVMOVIE
Definition: videodlg.h:45
@ BRS_INSERTDATE
Definition: videodlg.h:44
MythScreenStack * m_popupStack
Definition: videodlg.h:197
MythUIButtonTree * m_videoButtonTree
Definition: videodlg.h:201
void ShowExtensionSettings()
Pop up a MythUI Menu for MythVideo filte Type Settings.
Definition: videodlg.cpp:2644
void SwitchVideoDirectorGroup()
Switch to Director browse mode.
Definition: videodlg.cpp:2918
MythUIText * m_novideoText
Definition: videodlg.h:204
~VideoListDeathDelay() override
Definition: videodlg.cpp:864
VideoDialog::VideoListPtr GetSaved()
Definition: videodlg.cpp:869
static constexpr std::chrono::milliseconds kDelayTimeMS
Definition: videodlg.h:239
VideoListDeathDelay(const VideoDialog::VideoListPtr &toSave)
Definition: videodlg.cpp:857
class VideoListDeathDelayPrivate * m_d
Definition: videodlg.h:245
unsigned short uint16_t
Definition: iso6937tables.h:3
ImageDownloadErrorState
Definition: videodlg.h:30
@ esError
Definition: videodlg.h:30
@ esOK
Definition: videodlg.h:30
@ esTimeout
Definition: videodlg.h:30