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 };
45  using VideoListDeathDelayPtr = QPointer<class VideoListDeathDelay>;
49  public:
50  VideoDialog(MythScreenStack *lparent, const QString& lname,
51  const VideoListPtr& video_list, DialogType type,
52  BrowseType browse);
53  ~VideoDialog() override;
55  bool Create() override; // MythScreenType
56  bool keyPressEvent(QKeyEvent *levent) override; // MythScreenType
58  private:
59  void searchStart();
61  public slots:
62  void searchComplete(const QString& string);
64  protected slots:
65  void Init() override;
66  void Load() override;
68  private slots:
69  void UpdatePosition();
70  void UpdateText(MythUIButtonListItem *item);
72  void SetCurrentNode(MythGenericTree *node);
74  void playVideo();
75  void playVideoAlt();
76  void playFolder();
77  void playVideoWithTrailers();
78  void playTrailer();
80  void SwitchTree();
81  void SwitchGallery();
82  void SwitchBrowse();
83  void SwitchManager();
85  void SwitchVideoGenreGroup();
87  void SwitchVideoYearGroup();
90  void SwitchVideoCastGroup();
95  void EditMetadata();
96  void VideoSearch(MythGenericTree *node = nullptr,
97  bool automode = false);
98  void VideoAutoSearch(MythGenericTree *node = nullptr);
99  void ResetMetadata();
100  void ToggleWatched();
101  void ToggleProcess();
102  void RemoveVideo();
103  void OnRemoveVideo(bool dodelete);
105  void VideoMenu();
109  void DisplayMenu();
114  void popupClosed(const QString& which, int result);
116  void PromptToScan();
118  void ChangeFilter();
120  void ToggleBrowseMode();
121  void ToggleFlatView();
123  void ViewPlot();
124  void ShowCastDialog();
125  void ShowHomepage();
126  bool DoItemDetailShow();
127  void ShowPlayerSettings();
128  void ShowExtensionSettings();
129  void ShowMetadataSettings();
131  void OnParentalChange(int amount);
133  // Called when the underlying data for an item changes
136  void doVideoScan();
138  protected slots:
139  void scanFinished(bool dbChanged);
140  void reloadData();
141  void refreshData();
142  void UpdateItem(MythUIButtonListItem *item);
144  protected:
145  void customEvent(QEvent *levent) override; // MythUIType
150  virtual void loadData();
151  void fetchVideos();
152  static QString RemoteImageCheck(const QString& host, const QString& filename);
153  static QString GetCoverImage(MythGenericTree *node);
154  QString GetFirstImage(MythGenericTree *node, const QString& type,
155  const QString& gpnode = QString(), int levels = 0);
156  static QString GetImageFromFolder(VideoMetadata *metadata);
157  static QString GetScreenshot(MythGenericTree *node);
158  static QString GetBanner(MythGenericTree *node);
159  static QString GetFanart(MythGenericTree *node);
163  void handleDirSelect(MythGenericTree *node);
165  bool goBack();
166  void setParentalLevel(const ParentalLevel::Level &level);
167  void shiftParental(int amount);
168  bool createPopup();
169  void createBusyDialog(const QString &title);
170  void createFetchDialog(VideoMetadata *metadata);
171  void dismissFetchDialog(VideoMetadata *metadata, bool ok);
172  void createOkDialog(const QString& title);
174  void SwitchLayout(DialogType type, BrowseType browse);
176  void StartVideoImageSet(VideoMetadata *metadata);
178  void SavePosition(void);
180  private slots:
182  void OnVideoImageSetDone(VideoMetadata *metadata);
183  void OnVideoSearchDone(MetadataLookup *lookup);
185  private:
202  MythUIImage *m_banner {nullptr};
203  MythUIImage *m_fanart {nullptr};
214  class VideoDialogPrivate *m_d {nullptr};
215 };
217 class VideoListDeathDelay : public QObject
218 {
221  public:
222  explicit VideoListDeathDelay(const VideoDialog::VideoListPtr& toSave);
223  ~VideoListDeathDelay() override;
226  // When exiting MythVideo, we delay destroying the data for kDelayTimeMS
227  // milliseconds, and reuse the data (possibly avoiding a rescan) if the user
228  // restarts MythVideo within that time period.
229  static const int kDelayTimeMS = 3000;
231  private slots:
232  void OnTimeUp();
234  private:
235  class VideoListDeathDelayPrivate *m_d {nullptr};
236 };
238 #endif
void playVideoAlt()
Play the selected item in an alternate player.
Definition: videodlg.cpp:3097
This widget is used for grouping other widgets for display when a particular named state is called.
void StartVideoImageSet(VideoMetadata *metadata)
Definition: videodlg.cpp:3620
bool keyPressEvent(QKeyEvent *levent) override
Handle keypresses and keybindings.
Definition: videodlg.cpp:2022
bool DoItemDetailShow()
Display the Item Detail Popup.
Definition: videodlg.cpp:3008
void OnRemoveVideo(bool dodelete)
Definition: videodlg.cpp:3572
void ShowMetadataSettings()
Pop up a MythUI Menu for MythVideo Metadata Settings.
Definition: videodlg.cpp:2622
void ToggleFlatView()
Toggle Flat View.
Definition: videodlg.cpp:2767
void UpdateItem(MythUIButtonListItem *item)
Update the visible representation of a MythUIButtonListItem.
Definition: videodlg.cpp:1221
MythUIText * m_novideoText
Definition: videodlg.h:195
unsigned int slots[4]
Definition: element.c:38
void handleSelect(MythUIButtonListItem *item)
Handle SELECT action for a given MythUIButtonListItem.
Definition: videodlg.cpp:2804
MythUIButtonList * m_videoButtonList
Definition: videodlg.h:191
bool createPopup()
VideoDialog::VideoListPtr GetSaved()
Definition: videodlg.cpp:834
void OnVideoImageSetDone(VideoMetadata *metadata)
Definition: videodlg.cpp:3389
static VideoListDeathDelayPtr & GetSavedVideoList()
Definition: videodlg.cpp:844
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
void SwitchVideoGenreGroup()
Switch to Genre browse mode.
Definition: videodlg.cpp:2883
MythUIStateType * m_studioState
Definition: videodlg.h:210
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythUIText * m_positionText
Definition: videodlg.h:197
MythUIBusyDialog * m_busyPopup
Definition: videodlg.h:187
void SwitchManager()
Switch to Video Manager View.
Definition: videodlg.cpp:2865
Basic menu dialog, message and a list of options.
MythMenu * CreateMetadataBrowseMenu()
Create a MythMenu for MythVideo Metadata Browse modes.
Definition: videodlg.cpp:2650
MythUIImage * m_banner
Definition: videodlg.h:202
void refreshData()
Reloads the tree without invalidating the data.
Definition: videodlg.cpp:1061
static QString GetFanart(MythGenericTree *node)
Find the Fanart for a given node.
Definition: videodlg.cpp:1987
MythMenu * CreateViewMenu()
Create a MythMenu for MythVideo Views.
Definition: videodlg.cpp:2555
void dismissFetchDialog(VideoMetadata *metadata, bool ok)
Definition: videodlg.cpp:2157
void shiftParental(int amount)
Shift the parental level for the library by an integer amount.
Definition: videodlg.cpp:3258
void SwitchVideoInsertDateGroup()
Switch to Insert Date browse mode.
Definition: videodlg.cpp:2946
void PromptToScan()
Definition: videodlg.cpp:3836
MythUIStateType * m_userRatingState
Definition: videodlg.h:208
void SwitchTree()
Switch to Tree (List) View.
Definition: videodlg.cpp:2838
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:1786
MythUIStateType * m_videoLevelState
Definition: videodlg.h:207
virtual MythUIButtonListItem * GetItemCurrent()
Definition: videodlg.cpp:3402
MythScreenStack * m_mainStack
Definition: videodlg.h:189
VideoListDeathDelay(const VideoDialog::VideoListPtr &toSave)
Definition: videodlg.cpp:822
MetadataFactory * m_metadataFactory
Definition: videodlg.h:212
bool goBack()
Move one level up in the tree.
Definition: videodlg.cpp:2290
MythScreenStack * m_popupStack
Definition: videodlg.h:188
void ShowHomepage()
Definition: videodlg.cpp:3042
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
Definition: videodlg.h:45
void SwitchLayout(DialogType type, BrowseType browse)
Handle a layout or browse mode switch.
Definition: videodlg.cpp:2964
MythMenu * CreateManageMenu()
Create a MythMenu for metadata management.
Definition: videodlg.cpp:2720
MythUIStateType * m_trailerState
Definition: videodlg.h:205
void ToggleProcess()
Definition: videodlg.cpp:2739
virtual MythUIButtonListItem * GetItemByMetadata(VideoMetadata *metadata)
Definition: videodlg.cpp:3412
void VideoAutoSearch(MythGenericTree *node=nullptr)
Definition: videodlg.cpp:3464
void Load() override
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:1048
MythUIStateType * m_parentalLevelState
Definition: videodlg.h:206
void setParentalLevel(const ParentalLevel::Level &level)
Set the parental level for the library.
Definition: videodlg.cpp:3249
void SwitchVideoTVMovieGroup()
Switch to Television/Movie browse mode.
Definition: videodlg.cpp:2955
static QString GetScreenshot(MythGenericTree *node)
Find the Screenshot for a given node.
Definition: videodlg.cpp:1912
void ShowExtensionSettings()
Pop up a MythUI Menu for MythVideo filte Type Settings.
Definition: videodlg.cpp:2636
void EditMetadata()
Definition: videodlg.cpp:3535
void SwitchVideoUserRatingGroup()
Switch to User Rating browse mode.
Definition: videodlg.cpp:2937
MythUIText * m_titleText
Definition: videodlg.h:194
MythUIImage * m_fanart
Definition: videodlg.h:203
static QString RemoteImageCheck(const QString &host, const QString &filename)
Search for a given (image) filename in the Video SG.
Definition: videodlg.cpp:1353
class VideoListDeathDelayPrivate * m_d
Definition: videodlg.h:235
MythUIButtonTree * m_videoButtonTree
Definition: videodlg.h:192
void customEvent(QEvent *levent) override
Definition: videodlg.cpp:3304
void SwitchVideoYearGroup()
Switch to Year browse mode.
Definition: videodlg.cpp:2901
void handleDynamicDirSelect(MythGenericTree *node)
Request the latest metadata for a folder.
Definition: videodlg.cpp:2792
void searchComplete(const QString &string)
After using incremental search, move to the selected item.
Definition: videodlg.cpp:2215
void ShowCastDialog()
Display the Cast if the selected item.
Definition: videodlg.cpp:3032
void playVideoWithTrailers()
Play the selected item w/ a User selectable # of trailers.
Definition: videodlg.cpp:3193
void scanFinished(bool dbChanged)
Definition: videodlg.cpp:1076
static const int kDelayTimeMS
Definition: videodlg.h:229
void SwitchBrowse()
Switch to Browser View.
Definition: videodlg.cpp:2856
void searchStart()
Create an incremental search dialog for the current tree level.
Definition: videodlg.cpp:2254
MythUIText * m_crumbText
Definition: videodlg.h:198
void SwitchVideoCategoryGroup()
Switch to Category browse mode.
Definition: videodlg.cpp:2892
void SwitchVideoDirectorGroup()
Switch to Director browse mode.
Definition: videodlg.cpp:2910
void SetCurrentNode(MythGenericTree *node)
Switch to a given MythGenericTree node.
Definition: videodlg.cpp:2314
void ShowPlayerSettings()
Pop up a MythUI Menu for MythVideo Player Settings.
Definition: videodlg.cpp:2608
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:2874
void popupClosed(const QString &which, int result)
Definition: videodlg.cpp:2540
void OnVideoSearchDone(MetadataLookup *lookup)
Definition: videodlg.cpp:3698
void RemoveVideo()
Definition: videodlg.cpp:3553
void ToggleWatched()
Definition: videodlg.cpp:3493
MythMenu * CreateInfoMenu()
Create a MythMenu for Info pertaining to the selected item.
Definition: videodlg.cpp:2693
static VideoMetadata * GetMetadata(MythUIButtonListItem *item)
Retrieve the Database Metadata for a given MythUIButtonListItem.
Definition: videodlg.cpp:3285
void doVideoScan()
Definition: videodlg.cpp:3828
void handleDirSelect(MythGenericTree *node)
Descend into a selected folder.
Definition: videodlg.cpp:2782
void Init() override
Definition: videodlg.cpp:1042
bool Create() override
Definition: videodlg.cpp:901
MythMenu * CreatePlayMenu()
Create a "Play Menu" for MythVideo.
Definition: videodlg.cpp:2475
virtual void loadData()
load the data used to build the ButtonTree/List for MythVideo.
Definition: videodlg.cpp:1113
MythUIStateType * m_watchedState
Definition: videodlg.h:209
~VideoDialog() override
Definition: videodlg.cpp:867
void playFolder()
Play all the items in the selected folder.
Definition: videodlg.cpp:3109
void ChangeFilter()
Change the filtering of the library.
Definition: videodlg.cpp:3268
void SwitchVideoCastGroup()
Switch to Cast browse mode.
Definition: videodlg.cpp:2928
void createBusyDialog(const QString &title)
Create a busy dialog, used during metadata search, etc.
Definition: videodlg.cpp:2117
void createOkDialog(const QString &title)
Create a MythUI "OK" Dialog.
Definition: videodlg.cpp:2201
VideoDialog(MythScreenStack *lparent, const QString &lname, const VideoListPtr &video_list, DialogType type, BrowseType browse)
Definition: videodlg.cpp:849
void ResetMetadata()
Definition: videodlg.cpp:3607
void OnVideoSearchListSelection(const RefCountHandler< MetadataLookup > &lookup)
Definition: videodlg.cpp:3509
Definition: videodlg.h:29
void reloadData()
Reloads the tree after having invalidated the data.
Definition: videodlg.cpp:1103
void VideoMenu()
Pop up a MythUI "Playback Menu" for MythVideo.
Definition: videodlg.cpp:2410
void SavePosition(void)
Definition: videodlg.cpp:877
void SwitchGallery()
Switch to Gallery View.
Definition: videodlg.cpp:2847
void UpdatePosition()
Called after the screen is created by MythScreenStack.
Definition: videodlg.cpp:2326
void SwitchVideoStudioGroup()
Switch to Studio browse mode.
Definition: videodlg.cpp:2919
void OnParentalChange(int amount)
Definition: videodlg.cpp:3517
void createFetchDialog(VideoMetadata *metadata)
Create a fetch notification, used during metadata search.
Definition: videodlg.cpp:2135
void fetchVideos()
Build the buttonlist/tree.
Definition: videodlg.cpp:1314
void ToggleBrowseMode()
Toggle the browseable status for the selected item.
Definition: videodlg.cpp:2755
void VideoSearch(MythGenericTree *node=nullptr, bool automode=false)
Definition: videodlg.cpp:3442
Screen in which all other widgets are contained and rendered.
void playVideo()
Play the selected item.
Definition: videodlg.cpp:3086
void ViewPlot()
Display a MythUI Popup with the selected item's plot.
Definition: videodlg.cpp:2994
class VideoDialogPrivate * m_d
Definition: videodlg.h:214
static QString GetImageFromFolder(VideoMetadata *metadata)
Attempt to find/fallback a cover image for a given metadata item.
Definition: videodlg.cpp:1410
MythUIImage * m_screenshot
Definition: videodlg.h:201
MythMenu * CreateSettingsMenu()
Create a MythMenu for MythVideo Settings.
Definition: videodlg.cpp:2591
void UpdateText(MythUIButtonListItem *item)
Update the visible text values for a given ButtonListItem.
Definition: videodlg.cpp:2343
void playTrailer()
Play the trailer associated with the selected item.
Definition: videodlg.cpp:3226
~VideoListDeathDelay() override
Definition: videodlg.cpp:829
MythUIImage * m_coverImage
Definition: videodlg.h:200
MythDialogBox * m_menuPopup
Definition: videodlg.h:186
A tree widget for displaying and navigating a MythGenericTree()
void DisplayMenu()
Pop up a MythUI Menu for MythVideo Global Functions.
Definition: videodlg.cpp:2513
static QString GetBanner(MythGenericTree *node)
Find the Banner for a given node.
Definition: videodlg.cpp:1952
Definition: videodlg.h:29
static QString GetCoverImage(MythGenericTree *node)
A "hunt" for cover art to apply for a folder item.
Definition: videodlg.cpp:1554