MythTV  master
gallerythumbview.h
Go to the documentation of this file.
1 
4 #ifndef GALLERYVIEW_H
5 #define GALLERYVIEW_H
6 
7 #include "galleryslideview.h"
8 #include "galleryviews.h"
9 
10 class DirectoryView;
11 class MythMenu;
12 
15  kNoCaption = 0,
19 };
20 
21 
24 {
25  Q_OBJECT
26 public:
27  GalleryThumbView(MythScreenStack *parent, const char *name);
28  ~GalleryThumbView() override;
29  bool Create() override; // MythScreenType
30 
31 public slots:
32  void Start();
33  void Close() override; // MythScreenType
35 
36 private:
37  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
38  void mediaEvent(MythMediaEvent *event) override // MythUIType
39  { m_mgr.DeviceEvent(event); }
40  void customEvent(QEvent *event) override; // MythUIType
41  void RemoveImages(const QStringList &ids, bool deleted = true);
42  void BuildImageList();
43  void ResetUiSelection();
47  void UpdateScanProgress(const QString &scanner, int current, int total);
49  void SelectZoomWidget(int change);
50  QString CheckThumbnail(MythUIButtonListItem *item, const ImagePtrK &im,
51  ImageIdList &request, int index);
52  static void UpdateThumbnail(MythUIButtonListItem *button, const ImagePtrK &im,
53  const QString &url, int index);
54  void MenuMain();
55  void MenuShow(MythMenu *mainMenu);
56  void MenuMarked(MythMenu *mainMenu);
57  void MenuPaste(MythMenu *mainMenu);
58  void MenuTransform(MythMenu *mainMenu);
59  void MenuAction(MythMenu *mainMenu);
60  void MenuSlideshow(MythMenu *mainMenu);
61  bool DirSelectUp();
62  void DirSelectDown();
63  void ShowDialog(const QString &msg, const QString &event = "");
64 
65 private slots:
66  void LoadData(int parent);
67  void SelectImage(int id);
72  void ShowDetails();
83  void DoMarkItem(bool mark);
84  void MarkItem() { DoMarkItem(true); }
85  void UnmarkItem() { DoMarkItem(false); }
86  void DoMarkAll(bool mark = true);
87  void MarkAll() { DoMarkAll(true); }
88  void UnmarkAll() { DoMarkAll(false); }
89  void MarkInvertAll();
90  void DoHideItem(bool hide = true);
91  void HideItem() { DoHideItem(true); }
92  void Unhide() { DoHideItem(false); }
93  void DoHideMarked(bool hide = true);
94  void HideMarked() { DoHideMarked(true); }
95  void UnhideMarked() { DoHideMarked(false); }
96  void ShowRenameInput();
97  void DoShowHidden(bool show = true);
98  void ShowHidden() { DoShowHidden(true); }
99  void HideHidden() { DoShowHidden(false); }
100  void DoSetCover(bool reset = false);
101  void SetCover() { DoSetCover(false); }
102  void ResetCover() { DoSetCover(true); }
103  void DoShowType(int type);
107  void ZoomIn();
108  void ZoomOut();
109  void ShowSettings();
110  void DoScanAction(bool start);
111  void StartScan() { DoScanAction(true); }
112  void StopScan() { DoScanAction(false); }
113  void DeleteItem();
114  void DeleteMarked();
115  void Import();
116  void MakeDir();
117  void Eject();
118  void Copy(bool deleteAfter);
119  void Copy() { Copy(false); }
120  void Move();
121  void ShowPassword();
122  static void DoRepeat(int on) { gCoreContext->SaveSetting("GalleryRepeat", on); }
123  static void RepeatOn() { DoRepeat(1); }
124  static void RepeatOff() { DoRepeat(0); }
125 
126 private:
127  using IntPair = QPair<int,int>;
128 
129  // Theme widgets
139 
141  QList<MythUIButtonList *> m_zoomWidgets;
142  int m_zoomLevel {0};
143 
146  DirectoryView *m_view {nullptr};
148 
150  QHash<QString, IntPair> m_scanProgress;
152  QSet<QString> m_scanActive;
153 
156 
157  using ThumbLocation = QPair<MythUIButtonListItem *, int>;
159  QMultiHash<int, ThumbLocation> m_pendingMap;
160 
161  QSet<int> m_thumbExists;
162  bool m_editsAllowed {false};
163 };
164 
165 
166 #endif // GALLERYVIEW_H
GalleryThumbView::FlipVerticalMarked
void FlipVerticalMarked()
Definition: gallerythumbview.h:81
GalleryThumbView::UpdateThumbnail
static void UpdateThumbnail(MythUIButtonListItem *button, const ImagePtrK &im, const QString &url, int index)
Update the buttonlist item with a thumbnail.
Definition: gallerythumbview.cpp:838
kPicAndVideo
@ kPicAndVideo
Show Pictures & Videos.
Definition: imagemanager.h:78
ImagePtrK
QSharedPointer< ImageItemK > ImagePtrK
Definition: imagetypes.h:165
GalleryThumbView::m_scanProgressBar
MythUIProgressBar * m_scanProgressBar
Definition: gallerythumbview.h:138
GalleryThumbView::m_thumbExists
QSet< int > m_thumbExists
Images where thumbnails are known to exist.
Definition: gallerythumbview.h:161
GalleryThumbView::IntPair
QPair< int, int > IntPair
Definition: gallerythumbview.h:127
GalleryThumbView::m_positionText
MythUIText * m_positionText
Definition: gallerythumbview.h:136
GalleryThumbView::StartScan
void StartScan()
Definition: gallerythumbview.h:111
GalleryThumbView::HideMarked
void HideMarked()
Definition: gallerythumbview.h:94
ImageSlideShowType
ImageSlideShowType
Type of slide show.
Definition: galleryslideview.h:15
GalleryThumbView::MenuPaste
void MenuPaste(MythMenu *mainMenu)
Add a Paste submenu.
Definition: gallerythumbview.cpp:1123
GalleryThumbView::m_imageList
MythUIButtonList * m_imageList
Definition: gallerythumbview.h:130
GalleryThumbView::MakeDir
void MakeDir()
Show dialog to input new directory name.
Definition: gallerythumbview.cpp:1868
GalleryThumbView::SelectZoomWidget
void SelectZoomWidget(int change)
Change buttonlist to use a different size.
Definition: gallerythumbview.cpp:1828
GalleryThumbView::m_scanProgress
QHash< QString, IntPair > m_scanProgress
Last scan updates received from scanners.
Definition: gallerythumbview.h:150
GalleryThumbView::customEvent
void customEvent(QEvent *event) override
Handle custom events.
Definition: gallerythumbview.cpp:364
GalleryThumbView::DirSelectDown
void DirSelectDown()
Goes one directory level down.
Definition: gallerythumbview.cpp:1477
GalleryThumbView::UnmarkAll
void UnmarkAll()
Definition: gallerythumbview.h:88
GalleryThumbView::m_infoList
InfoList m_infoList
Image details overlay.
Definition: gallerythumbview.h:147
GalleryThumbView::ShowPassword
void ShowPassword()
Displays dialog to accept password.
Definition: gallerythumbview.cpp:1756
ImageManagerFe::DeviceEvent
void DeviceEvent(MythMediaEvent *event)
Manage events for local devices.
Definition: imagemanager.cpp:2456
GalleryThumbView::FlipHorizontalMarked
void FlipHorizontalMarked()
Definition: gallerythumbview.h:80
GalleryThumbView::mediaEvent
void mediaEvent(MythMediaEvent *event) override
Media/Device status event handler, received from MythMediaMonitor.
Definition: gallerythumbview.h:38
GalleryThumbView::GalleryThumbView
GalleryThumbView(MythScreenStack *parent, const char *name)
Constructor.
Definition: gallerythumbview.cpp:162
MythScreenStack
Definition: mythscreenstack.h:16
GalleryThumbView::FlipVertical
void FlipVertical()
Definition: gallerythumbview.h:76
GalleryThumbView::LoadData
void LoadData(int parent)
Loads & displays images from database.
Definition: gallerythumbview.cpp:623
kDateCaption
@ kDateCaption
Dates.
Definition: gallerythumbview.h:17
GalleryThumbView::m_crumbsText
MythUIText * m_crumbsText
Definition: gallerythumbview.h:132
kNoCaption
@ kNoCaption
None.
Definition: gallerythumbview.h:15
GalleryThumbView::m_typeFilterText
MythUIText * m_typeFilterText
Definition: gallerythumbview.h:135
GalleryThumbView::MenuAction
void MenuAction(MythMenu *mainMenu)
Add a Action submenu.
Definition: gallerythumbview.cpp:1188
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
show
static void show(uint8_t *buf, int length)
Definition: ringbuffer.cpp:341
GalleryThumbView::m_hideFilterText
MythUIText * m_hideFilterText
Definition: gallerythumbview.h:134
GalleryThumbView::Import
void Import()
Executes user 'Import command'.
Definition: gallerythumbview.cpp:2134
GalleryThumbView::ZoomIn
void ZoomIn()
Use smaller buttonlist widgets.
Definition: gallerythumbview.cpp:1817
GalleryThumbView::HideHidden
void HideHidden()
Definition: gallerythumbview.h:99
GalleryThumbView::DoHideItem
void DoHideItem(bool hide=true)
Hide or unhide item.
Definition: gallerythumbview.cpp:1571
GalleryThumbView::m_menuState
MenuSubjects m_menuState
Current selection/marked files when menu is invoked.
Definition: gallerythumbview.h:155
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
GalleryThumbView::Create
bool Create() override
Initialises and shows the graphical elements.
Definition: gallerythumbview.cpp:210
GalleryThumbView::MenuMain
void MenuMain()
Shows the main menu when the MENU button was pressed.
Definition: gallerythumbview.cpp:1027
GalleryThumbView::HideItem
void HideItem()
Definition: gallerythumbview.h:91
GalleryThumbView::RepeatOff
static void RepeatOff()
Definition: gallerythumbview.h:124
GalleryThumbView::SetUiSelection
void SetUiSelection(MythUIButtonListItem *item)
Updates text widgets for selected item.
Definition: gallerythumbview.cpp:969
GalleryThumbView::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Handle keypresses.
Definition: gallerythumbview.cpp:274
GalleryThumbView::DoSetCover
void DoSetCover(bool reset=false)
Set or reset thumbnails to use for a directory cover.
Definition: gallerythumbview.cpp:1791
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ImageFileTransform
ImageFileTransform
Image transformations.
Definition: imagemetadata.h:46
GalleryThumbView::ResetUiSelection
void ResetUiSelection()
Clears all text widgets for selected item.
Definition: gallerythumbview.cpp:946
GalleryThumbView::RotateCCWMarked
void RotateCCWMarked()
Definition: gallerythumbview.h:79
GalleryThumbView::MenuShow
void MenuShow(MythMenu *mainMenu)
Add a Show submenu.
Definition: gallerythumbview.cpp:1305
kPicOnly
@ kPicOnly
Hide videos.
Definition: imagemanager.h:79
GalleryThumbView::ShowSettings
void ShowSettings()
Show configuration screen.
Definition: gallerythumbview.cpp:1636
GalleryThumbView::UpdateScanProgress
void UpdateScanProgress(const QString &scanner, int current, int total)
Update progressbar with scan status.
Definition: gallerythumbview.cpp:865
ImageManagerFe::ClearStorageGroup
static void ClearStorageGroup()
Clear database & thumbnails of Storage Group images.
Definition: imagemanager.cpp:2152
MythUIProgressBar
Progress bar widget.
Definition: mythuiprogressbar.h:12
GalleryThumbView::TransformMarked
void TransformMarked(ImageFileTransform tran=kRotateCW)
Apply transform to marked images.
Definition: gallerythumbview.cpp:1559
GalleryThumbView::SelectImage
void SelectImage(int id)
Select item if it is displayed.
Definition: gallerythumbview.cpp:1365
GalleryThumbView::ResetCover
void ResetCover()
Definition: gallerythumbview.h:102
GalleryThumbView::DoShowHidden
void DoShowHidden(bool show=true)
Show or hide hidden files.
Definition: gallerythumbview.cpp:1689
mark
Definition: lang.cpp:22
kNormalSlideShow
@ kNormalSlideShow
Definition: galleryslideview.h:17
GalleryThumbView::m_view
DirectoryView * m_view
List of images comprising the view.
Definition: gallerythumbview.h:146
MythMediaEvent
Definition: mythmedia.h:183
GalleryThumbView::MenuSlideshow
void MenuSlideshow(MythMenu *mainMenu)
Add a Slideshow submenu.
Definition: gallerythumbview.cpp:1254
GalleryThumbView::ClearSgDb
static void ClearSgDb()
Definition: gallerythumbview.h:34
GalleryThumbView::BuildImageList
void BuildImageList()
Displays all images in current view.
Definition: gallerythumbview.cpp:658
GalleryThumbView::StartSlideshow
void StartSlideshow(ImageSlideShowType mode)
Start slideshow screen.
Definition: gallerythumbview.cpp:1420
GalleryThumbView::ShowRenameInput
void ShowRenameInput()
Show dialog to allow input.
Definition: gallerythumbview.cpp:1725
GalleryThumbView::ShowDialog
void ShowDialog(const QString &msg, const QString &event="")
Show a confirmation dialog.
Definition: gallerythumbview.cpp:1708
MenuSubjects
A snapshot of current selection, markings & dir info when menu is invoked.
Definition: galleryviews.h:52
GalleryThumbView::DeleteMarked
void DeleteMarked()
Confirm user deletion of marked files.
Definition: gallerythumbview.cpp:1626
GalleryThumbView::Unhide
void Unhide()
Definition: gallerythumbview.h:92
GalleryThumbView::DoRepeat
static void DoRepeat(int on)
Definition: gallerythumbview.h:122
ImageCaptionType
ImageCaptionType
Type of captions to display.
Definition: gallerythumbview.h:14
GalleryThumbView::m_scanActive
QSet< QString > m_scanActive
Scanners currently scanning.
Definition: gallerythumbview.h:152
GalleryThumbView::RotateCCW
void RotateCCW()
Definition: gallerythumbview.h:74
GalleryThumbView::ZoomOut
void ZoomOut()
Use larger buttonlist widgets.
Definition: gallerythumbview.cpp:1807
GalleryThumbView::ResetExif
void ResetExif()
Definition: gallerythumbview.h:77
GalleryThumbView::ItemClicked
void ItemClicked(MythUIButtonListItem *item)
Action item click.
Definition: gallerythumbview.cpp:1377
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
GalleryThumbView::DoHideMarked
void DoHideMarked(bool hide=true)
Hide or unhide marked items.
Definition: gallerythumbview.cpp:1596
GalleryThumbView::DirSelectUp
bool DirSelectUp()
Goes up one directory level.
Definition: gallerythumbview.cpp:1456
GalleryThumbView::UpdateImageItem
void UpdateImageItem(MythUIButtonListItem *item)
Initialises a single buttonlist item.
Definition: gallerythumbview.cpp:704
GalleryThumbView::ShowDetails
void ShowDetails()
Shows exif info/details about an item.
Definition: gallerythumbview.cpp:1747
GalleryThumbView::CheckThumbnail
QString CheckThumbnail(MythUIButtonListItem *item, const ImagePtrK &im, ImageIdList &request, int index)
Verify thumbnail is known to exist.
Definition: gallerythumbview.cpp:811
GalleryThumbView::FlipHorizontal
void FlipHorizontal()
Definition: gallerythumbview.h:75
GalleryThumbView::m_popupStack
MythScreenStack & m_popupStack
Definition: gallerythumbview.h:144
GalleryThumbView::m_pendingMap
QMultiHash< int, ThumbLocation > m_pendingMap
Buttons waiting for thumbnails to be created.
Definition: gallerythumbview.h:159
GalleryThumbView::TransformItem
void TransformItem(ImageFileTransform tran=kRotateCW)
Apply transform to an image.
Definition: gallerythumbview.cpp:1541
GalleryThumbView::RotateCW
void RotateCW()
Definition: gallerythumbview.h:73
GalleryThumbView::RepeatOn
static void RepeatOn()
Definition: gallerythumbview.h:123
GalleryThumbView::m_scanProgressText
MythUIText * m_scanProgressText
Definition: gallerythumbview.h:137
GalleryThumbView::MarkInvertAll
void MarkInvertAll()
Invert all marked items.
Definition: gallerythumbview.cpp:1528
GalleryThumbView::RecursiveSlideshow
void RecursiveSlideshow()
Definition: gallerythumbview.h:71
GalleryThumbView::m_emptyText
MythUIText * m_emptyText
Definition: gallerythumbview.h:133
GalleryThumbView::Move
void Move()
Move marked images to selected dir. If no marked files, use previously marked files....
Definition: gallerythumbview.cpp:2031
MythMenu
Definition: mythdialogbox.h:99
GalleryThumbView::m_mgr
ImageManagerFe & m_mgr
Manages the images.
Definition: gallerythumbview.h:145
galleryviews.h
Provides view datastores for Gallery screens.
kUserCaption
@ kUserCaption
Exif comments.
Definition: gallerythumbview.h:18
GalleryThumbView::SetCover
void SetCover()
Definition: gallerythumbview.h:101
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
kFlipVertical
@ kFlipVertical
Reflect about horizontal axis.
Definition: imagemetadata.h:51
GalleryThumbView::m_editsAllowed
bool m_editsAllowed
Edit privileges.
Definition: gallerythumbview.h:162
GalleryThumbView::HidePictures
void HidePictures()
Definition: gallerythumbview.h:105
ImageManagerFe
The image manager for use by Frontends.
Definition: imagemanager.h:459
kRotateCW
@ kRotateCW
Rotate clockwise.
Definition: imagemetadata.h:48
InfoList
The image info/details buttonlist overlay that displays exif tags.
Definition: galleryinfo.h:22
GalleryThumbView::Copy
void Copy()
Definition: gallerythumbview.h:119
galleryslideview.h
Slideshow screen.
GalleryThumbView::DoMarkAll
void DoMarkAll(bool mark=true)
Mark or unmark all items.
Definition: gallerythumbview.cpp:1513
ImageIdList
QList< int > ImageIdList
Definition: imagetypes.h:60
GalleryThumbView::DeleteItem
void DeleteItem()
Confirm user deletion of an item.
Definition: gallerythumbview.cpp:1615
GalleryThumbView::ShowHidden
void ShowHidden()
Definition: gallerythumbview.h:98
GalleryThumbView::m_zoomWidgets
QList< MythUIButtonList * > m_zoomWidgets
Theme buttonlist widgets implementing zoom levels.
Definition: gallerythumbview.h:141
GalleryThumbView::UnhideMarked
void UnhideMarked()
Definition: gallerythumbview.h:95
GalleryThumbView::~GalleryThumbView
~GalleryThumbView() override
Destructor.
Definition: gallerythumbview.cpp:181
GalleryThumbView::m_zoomLevel
int m_zoomLevel
Definition: gallerythumbview.h:142
GalleryThumbView::RemoveImages
void RemoveImages(const QStringList &ids, bool deleted=true)
Cleanup UI & image caches when a device is removed.
Definition: gallerythumbview.cpp:575
GalleryThumbView::MarkAll
void MarkAll()
Definition: gallerythumbview.h:87
GalleryThumbView::UnmarkItem
void UnmarkItem()
Definition: gallerythumbview.h:85
GalleryThumbView::DoShowType
void DoShowType(int type)
Show/hide pictures or videos.
Definition: gallerythumbview.cpp:1773
GalleryThumbView::Slideshow
void Slideshow()
Definition: gallerythumbview.h:70
GalleryThumbView::DoMarkItem
void DoMarkItem(bool mark)
Mark or unmark a single item.
Definition: gallerythumbview.cpp:1495
GalleryThumbView::MenuTransform
void MenuTransform(MythMenu *mainMenu)
Add a Transform submenu.
Definition: gallerythumbview.cpp:1152
kFlipHorizontal
@ kFlipHorizontal
Reflect about vertical axis.
Definition: imagemetadata.h:50
GalleryThumbView::ThumbLocation
QPair< MythUIButtonListItem *, int > ThumbLocation
Definition: gallerythumbview.h:157
GalleryThumbView::m_captionText
MythUIText * m_captionText
Definition: gallerythumbview.h:131
GalleryThumbView::DoScanAction
void DoScanAction(bool start)
Action scan request.
Definition: gallerythumbview.cpp:1408
GalleryThumbView::ResetExifMarked
void ResetExifMarked()
Definition: gallerythumbview.h:82
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:881
GalleryThumbView::HideVideos
void HideVideos()
Definition: gallerythumbview.h:106
GalleryThumbView::MarkItem
void MarkItem()
Definition: gallerythumbview.h:84
DirectoryView
A datastore of images for display by a screen. Provides an ordered list of dirs & images from a singl...
Definition: galleryviews.h:170
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
kRecursiveSlideShow
@ kRecursiveSlideShow
Definition: galleryslideview.h:18
GalleryThumbView::MenuMarked
void MenuMarked(MythMenu *mainMenu)
Adds a Marking submenu.
Definition: gallerythumbview.cpp:1070
kNameCaption
@ kNameCaption
Filenames.
Definition: gallerythumbview.h:16
GalleryThumbView::Close
void Close() override
Exit Gallery.
Definition: gallerythumbview.cpp:191
GalleryThumbView::Eject
void Eject()
Remove local device (or Import) from Gallery.
Definition: gallerythumbview.cpp:1886
GalleryThumbView::RotateCWMarked
void RotateCWMarked()
Definition: gallerythumbview.h:78
GalleryThumbView
Thumbnail screen.
Definition: gallerythumbview.h:23
kResetToExif
@ kResetToExif
Reset to Exif value.
Definition: imagemetadata.h:47
kVideoOnly
@ kVideoOnly
Hide pictures.
Definition: imagemanager.h:80
GalleryThumbView::ShowType
void ShowType()
Definition: gallerythumbview.h:104
GalleryThumbView::StopScan
void StopScan()
Definition: gallerythumbview.h:112
GalleryThumbView::Start
void Start()
Start Thumbnail screen.
Definition: gallerythumbview.cpp:599
kRotateCCW
@ kRotateCCW
Rotate anti-clockwise.
Definition: imagemetadata.h:49