MythTV  master
Go to the documentation of this file.
1 #ifndef VIDEODLG_H_
2 #define VIDEODLG_H_
4 #include <QPointer>
5 #include <QStringList>
7 #include "mythscreentype.h"
8 #include "metadatacommon.h"
10 #include "parentalcontrols.h"
11 #include "quicksp.h"
13 class MythUIText;
14 class MythUIButtonList;
15 class MythUIButtonTree;
17 class MythUIBusyDialog;
18 class MythUIImage;
19 class MythUIStateType;
20 class MythDialogBox;
21 class MythGenericTree;
22 class MetadataFactory;
23 class VideoMetadata;
24 class VideoScanner;
25 class MythMenu;
27 class QUrl;
32 {
35  public:
36  enum DialogType { DLG_DEFAULT = 0, DLG_BROWSER = 0x1, DLG_GALLERY = 0x2,
37  DLG_TREE = 0x4, DLG_MANAGER = 0x8, dtLast };
39  enum BrowseType { BRS_FOLDER = 0, BRS_GENRE = 0x1, BRS_CATEGORY = 0x2,
40  BRS_YEAR = 0x4, BRS_DIRECTOR = 0x8, BRS_CAST = 0x10,
42  BRS_TVMOVIE = 0x80, BRS_STUDIO = 0x100, btLast };
46  typedef QPointer<class VideoListDeathDelay> VideoListDeathDelayPtr;
50  public:
51  VideoDialog(MythScreenStack *lparent, const QString& lname,
52  const VideoListPtr& video_list, DialogType type,
53  BrowseType browse);
54  ~VideoDialog();
56  bool Create() override; // MythScreenType
57  bool keyPressEvent(QKeyEvent *levent) override; // MythScreenType
59  private:
60  void searchStart();
62  public slots:
63  void searchComplete(const QString& string);
65  protected slots:
66  void Init() override;
67  void Load() override;
69  private slots:
70  void UpdatePosition();
75  void playVideo();
76  void playVideoAlt();
77  void playFolder();
78  void playVideoWithTrailers();
79  void playTrailer();
81  void SwitchTree();
82  void SwitchGallery();
83  void SwitchBrowse();
84  void SwitchManager();
86  void SwitchVideoGenreGroup();
88  void SwitchVideoYearGroup();
91  void SwitchVideoCastGroup();
96  void EditMetadata();
97  void VideoSearch(MythGenericTree *node = nullptr,
98  bool automode = false);
99  void VideoAutoSearch(MythGenericTree *node = nullptr);
100  void ResetMetadata();
101  void ToggleWatched();
102  void ToggleProcess();
103  void RemoveVideo();
104  void OnRemoveVideo(bool);
106  void VideoMenu();
110  void DisplayMenu();
115  void popupClosed(const QString& which, int result);
117  void PromptToScan();
119  void ChangeFilter();
121  void ToggleBrowseMode();
122  void ToggleFlatView();
124  void ViewPlot();
125  void ShowCastDialog();
126  void ShowHomepage();
127  bool DoItemDetailShow();
128  void ShowPlayerSettings();
129  void ShowExtensionSettings();
130  void ShowMetadataSettings();
132  void OnParentalChange(int amount);
134  // Called when the underlying data for an item changes
137  void doVideoScan();
139  protected slots:
140  void scanFinished(bool);
141  void reloadData();
142  void refreshData();
143  void UpdateItem(MythUIButtonListItem *item);
145  protected:
146  void customEvent(QEvent *levent) override; // MythUIType
151  virtual void loadData();
152  void fetchVideos();
153  QString RemoteImageCheck(const QString& host, const QString& filename);
154  QString GetCoverImage(MythGenericTree *node);
155  QString GetFirstImage(MythGenericTree *node, const QString& type,
156  const QString& gpnode = QString(), int levels = 0);
157  QString GetImageFromFolder(VideoMetadata *metadata);
158  QString GetScreenshot(MythGenericTree *node);
159  QString GetBanner(MythGenericTree *node);
160  QString GetFanart(MythGenericTree *node);
164  void handleDirSelect(MythGenericTree *node);
166  bool goBack();
167  void setParentalLevel(const ParentalLevel::Level &level);
168  void shiftParental(int amount);
169  bool createPopup();
170  void createBusyDialog(const QString &title);
171  void createFetchDialog(VideoMetadata *metadata);
172  void dismissFetchDialog(VideoMetadata *metadata, bool ok);
173  void createOkDialog(const QString& title);
175  void SwitchLayout(DialogType type, BrowseType browse);
177  void StartVideoImageSet(VideoMetadata *metadata);
179  void SavePosition(void);
181  private slots:
183  void OnVideoImageSetDone(VideoMetadata *metadata);
184  void OnVideoSearchDone(MetadataLookup *lookup);
186  private:
203  MythUIImage *m_banner {nullptr};
204  MythUIImage *m_fanart {nullptr};
215  class VideoDialogPrivate *m_d {nullptr};
216 };
218 class VideoListDeathDelay : public QObject
219 {
222  public:
223  explicit VideoListDeathDelay(const VideoDialog::VideoListPtr& toSave);
227  // When exiting MythVideo, we delay destroying the data for kDelayTimeMS
228  // milliseconds, and reuse the data (possibly avoiding a rescan) if the user
229  // restarts MythVideo within that time period.
230  static const int kDelayTimeMS = 3000;
232  private slots:
233  void OnTimeUp();
235  private:
236  class VideoListDeathDelayPrivate *m_d {nullptr};
237 };
239 #endif
void playVideoAlt()
Play the selected item in an alternate player.
Definition: videodlg.cpp:3082
This widget is used for grouping other widgets for display when a particular named state is called.
void StartVideoImageSet(VideoMetadata *metadata)
Definition: videodlg.cpp:3608
bool keyPressEvent(QKeyEvent *levent) override
Handle keypresses and keybindings.
Definition: videodlg.cpp:2006
bool DoItemDetailShow()
Display the Item Detail Popup.
Definition: videodlg.cpp:2993
void ShowMetadataSettings()
Pop up a MythUI Menu for MythVideo Metadata Settings.
Definition: videodlg.cpp:2607
void ToggleFlatView()
Toggle Flat View.
Definition: videodlg.cpp:2752
void UpdateItem(MythUIButtonListItem *item)
Update the visible representation of a MythUIButtonListItem.
Definition: videodlg.cpp:1219
MythUIText * m_novideoText
Definition: videodlg.h:196
unsigned int slots[4]
Definition: element.c:38
void SetCurrentNode(MythGenericTree *)
Switch to a given MythGenericTree node.
Definition: videodlg.cpp:2303
MythUIButtonList * m_videoButtonList
Definition: videodlg.h:192
bool createPopup()
VideoDialog::VideoListPtr GetSaved()
Definition: videodlg.cpp:831
void OnVideoImageSetDone(VideoMetadata *metadata)
Definition: videodlg.cpp:3373
static VideoListDeathDelayPtr & GetSavedVideoList()
Definition: videodlg.cpp:841
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
void SwitchVideoGenreGroup()
Switch to Genre browse mode.
Definition: videodlg.cpp:2868
MythUIStateType * m_studioState
Definition: videodlg.h:211
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythUIText * m_positionText
Definition: videodlg.h:198
MythUIBusyDialog * m_busyPopup
Definition: videodlg.h:188
void SwitchManager()
Switch to Video Manager View.
Definition: videodlg.cpp:2850
Basic menu dialog, message and a list of options.
MythMenu * CreateMetadataBrowseMenu()
Create a MythMenu for MythVideo Metadata Browse modes.
Definition: videodlg.cpp:2635
MythUIImage * m_banner
Definition: videodlg.h:203
void refreshData()
Reloads the tree without invalidating the data.
Definition: videodlg.cpp:1058
QString GetFanart(MythGenericTree *node)
Find the Fanart for a given node.
Definition: videodlg.cpp:1971
MythMenu * CreateViewMenu()
Create a MythMenu for MythVideo Views.
Definition: videodlg.cpp:2540
void dismissFetchDialog(VideoMetadata *metadata, bool ok)
Definition: videodlg.cpp:2141
void shiftParental(int amount)
Shift the parental level for the library by an integer amount.
Definition: videodlg.cpp:3239
void SwitchVideoInsertDateGroup()
Switch to Insert Date browse mode.
Definition: videodlg.cpp:2931
void UpdateText(MythUIButtonListItem *)
Update the visible text values for a given ButtonListItem.
Definition: videodlg.cpp:2332
void PromptToScan()
Definition: videodlg.cpp:3824
MythUIStateType * m_userRatingState
Definition: videodlg.h:209
void SwitchTree()
Switch to Tree (List) View.
Definition: videodlg.cpp:2823
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:1770
MythUIStateType * m_videoLevelState
Definition: videodlg.h:208
virtual MythUIButtonListItem * GetItemCurrent()
Definition: videodlg.cpp:3386
MythScreenStack * m_mainStack
Definition: videodlg.h:190
VideoListDeathDelay(const VideoDialog::VideoListPtr &toSave)
Definition: videodlg.cpp:819
MetadataFactory * m_metadataFactory
Definition: videodlg.h:213
bool goBack()
Move one level up in the tree.
Definition: videodlg.cpp:2279
MythScreenStack * m_popupStack
Definition: videodlg.h:189
void ShowHomepage()
Definition: videodlg.cpp:3027
void SwitchLayout(DialogType type, BrowseType browse)
Handle a layout or browse mode switch.
Definition: videodlg.cpp:2949
MythMenu * CreateManageMenu()
Create a MythMenu for metadata management.
Definition: videodlg.cpp:2705
MythUIStateType * m_trailerState
Definition: videodlg.h:206
void ToggleProcess()
Definition: videodlg.cpp:2724
virtual MythUIButtonListItem * GetItemByMetadata(VideoMetadata *metadata)
Definition: videodlg.cpp:3396
void VideoAutoSearch(MythGenericTree *node=nullptr)
Definition: videodlg.cpp:3451
void Load() override
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:1045
MythUIStateType * m_parentalLevelState
Definition: videodlg.h:207
void setParentalLevel(const ParentalLevel::Level &level)
Set the parental level for the library.
Definition: videodlg.cpp:3230
void SwitchVideoTVMovieGroup()
Switch to Television/Movie browse mode.
Definition: videodlg.cpp:2940
QString GetScreenshot(MythGenericTree *node)
Find the Screenshot for a given node.
Definition: videodlg.cpp:1896
void ShowExtensionSettings()
Pop up a MythUI Menu for MythVideo filte Type Settings.
Definition: videodlg.cpp:2621
void EditMetadata()
Definition: videodlg.cpp:3522
void SwitchVideoUserRatingGroup()
Switch to User Rating browse mode.
Definition: videodlg.cpp:2922
MythUIText * m_titleText
Definition: videodlg.h:195
MythUIImage * m_fanart
Definition: videodlg.h:204
QString RemoteImageCheck(const QString &host, const QString &filename)
Search for a given (image) filename in the Video SG.
Definition: videodlg.cpp:1351
class VideoListDeathDelayPrivate * m_d
Definition: videodlg.h:236
MythUIButtonTree * m_videoButtonTree
Definition: videodlg.h:193
void customEvent(QEvent *levent) override
Definition: videodlg.cpp:3285
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
Definition: videodlg.h:46
void SwitchVideoYearGroup()
Switch to Year browse mode.
Definition: videodlg.cpp:2886
void handleDynamicDirSelect(MythGenericTree *node)
Request the latest metadata for a folder.
Definition: videodlg.cpp:2777
void searchComplete(const QString &string)
After using incremental search, move to the selected item.
Definition: videodlg.cpp:2200
void ShowCastDialog()
Display the Cast if the selected item.
Definition: videodlg.cpp:3017
void playVideoWithTrailers()
Play the selected item w/ a User selectable # of trailers.
Definition: videodlg.cpp:3178
static const int kDelayTimeMS
Definition: videodlg.h:230
void SwitchBrowse()
Switch to Browser View.
Definition: videodlg.cpp:2841
void searchStart()
Create an incremental search dialog for the current tree level.
Definition: videodlg.cpp:2241
MythUIText * m_crumbText
Definition: videodlg.h:199
void SwitchVideoCategoryGroup()
Switch to Category browse mode.
Definition: videodlg.cpp:2877
void SwitchVideoDirectorGroup()
Switch to Director browse mode.
Definition: videodlg.cpp:2895
void ShowPlayerSettings()
Pop up a MythUI Menu for MythVideo Player Settings.
Definition: videodlg.cpp:2593
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
void SwitchVideoFolderGroup()
Switch to Folder (filesystem) browse mode.
Definition: videodlg.cpp:2859
void popupClosed(const QString &which, int result)
Definition: videodlg.cpp:2525
void OnVideoSearchDone(MetadataLookup *lookup)
Definition: videodlg.cpp:3686
void RemoveVideo()
Definition: videodlg.cpp:3540
void ToggleWatched()
Definition: videodlg.cpp:3480
MythMenu * CreateInfoMenu()
Create a MythMenu for Info pertaining to the selected item.
Definition: videodlg.cpp:2678
VideoMetadata * GetMetadata(MythUIButtonListItem *item)
Retrieve the Database Metadata for a given MythUIButtonListItem.
Definition: videodlg.cpp:3266
simple_ref_ptr< class VideoList > VideoListPtr
Definition: videodlg.h:44
void doVideoScan()
Definition: videodlg.cpp:3816
void handleDirSelect(MythGenericTree *node)
Descend into a selected folder.
Definition: videodlg.cpp:2767
void Init() override
Definition: videodlg.cpp:1039
bool Create() override
Definition: videodlg.cpp:898
void OnRemoveVideo(bool)
Definition: videodlg.cpp:3560
void handleSelect(MythUIButtonListItem *)
Handle SELECT action for a given MythUIButtonListItem.
Definition: videodlg.cpp:2789
MythMenu * CreatePlayMenu()
Create a "Play Menu" for MythVideo.
Definition: videodlg.cpp:2460
virtual void loadData()
load the data used to build the ButtonTree/List for MythVideo.
Definition: videodlg.cpp:1110
MythUIStateType * m_watchedState
Definition: videodlg.h:210
void playFolder()
Play all the items in the selected folder.
Definition: videodlg.cpp:3094
void ChangeFilter()
Change the filtering of the library.
Definition: videodlg.cpp:3249
void SwitchVideoCastGroup()
Switch to Cast browse mode.
Definition: videodlg.cpp:2913
void createBusyDialog(const QString &title)
Create a busy dialog, used during metadata search, etc.
Definition: videodlg.cpp:2101
void createOkDialog(const QString &title)
Create a MythUI "OK" Dialog.
Definition: videodlg.cpp:2185
VideoDialog(MythScreenStack *lparent, const QString &lname, const VideoListPtr &video_list, DialogType type, BrowseType browse)
Definition: videodlg.cpp:846
void ResetMetadata()
Definition: videodlg.cpp:3595
void OnVideoSearchListSelection(const RefCountHandler< MetadataLookup > &lookup)
Definition: videodlg.cpp:3496
Definition: videodlg.h:29
void reloadData()
Reloads the tree after having invalidated the data.
Definition: videodlg.cpp:1100
void VideoMenu()
Pop up a MythUI "Playback Menu" for MythVideo.
Definition: videodlg.cpp:2399
void SavePosition(void)
Definition: videodlg.cpp:874
void SwitchGallery()
Switch to Gallery View.
Definition: videodlg.cpp:2832
void UpdatePosition()
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:2315
void SwitchVideoStudioGroup()
Switch to Studio browse mode.
Definition: videodlg.cpp:2904
void OnParentalChange(int amount)
Definition: videodlg.cpp:3504
void createFetchDialog(VideoMetadata *metadata)
Create a fetch notification, used during metadata search.
Definition: videodlg.cpp:2119
void fetchVideos()
Build the buttonlist/tree.
Definition: videodlg.cpp:1312
void ToggleBrowseMode()
Toggle the browseable status for the selected item.
Definition: videodlg.cpp:2740
void VideoSearch(MythGenericTree *node=nullptr, bool automode=false)
Definition: videodlg.cpp:3429
Screen in which all other widgets are contained and rendered.
void playVideo()
Play the selected item.
Definition: videodlg.cpp:3071
void ViewPlot()
Display a MythUI Popup with the selected item's plot.
Definition: videodlg.cpp:2979
class VideoDialogPrivate * m_d
Definition: videodlg.h:215
QString GetImageFromFolder(VideoMetadata *metadata)
Attempt to find/fallback a cover image for a given metadata item.
Definition: videodlg.cpp:1408
MythUIImage * m_screenshot
Definition: videodlg.h:202
MythMenu * CreateSettingsMenu()
Create a MythMenu for MythVideo Settings.
Definition: videodlg.cpp:2576
void playTrailer()
Play the trailer associated with the selected item.
Definition: videodlg.cpp:3211
MythUIImage * m_coverImage
Definition: videodlg.h:201
MythDialogBox * m_menuPopup
Definition: videodlg.h:187
void scanFinished(bool)
Definition: videodlg.cpp:1073
A tree widget for displaying and navigating a MythGenericTree()
void DisplayMenu()
Pop up a MythUI Menu for MythVideo Global Functions.
Definition: videodlg.cpp:2498
QString GetBanner(MythGenericTree *node)
Find the Banner for a given node.
Definition: videodlg.cpp:1936
Definition: videodlg.h:29
QString GetCoverImage(MythGenericTree *node)
A "hunt" for cover art to apply for a folder item.
Definition: videodlg.cpp:1546