MythTV
master
|
A datastore of images for display by a screen. Provides an ordered list of dirs & images from a single directory, as required by a Thumbnail view. Permits marking of items and populates dir thumbnails from their subtree. More...
#include <galleryviews.h>
Public Member Functions | |
DirectoryView (SlideOrderType order) | |
Constructs a view of images & directories that can be marked. More... | |
ImagePtrK | GetParent () const |
QString | GetPosition () const |
Get positional status. More... | |
bool | LoadFromDb (int parentId) override |
Populate view from database as images/subdirs of a directory. View is ordered: Parent dir, sub-dirs, images. Dir thumbnails are derived from their subtree. More... | |
void | Clear (bool resetParent=true) |
Resets view. More... | |
MenuSubjects | GetMenuSubjects () |
Determine current selection, markings & various info to support menu display. More... | |
QStringList | RemoveImage (int id, bool deleted=false) |
Clear file/dir and all its ancestors from UI cache so that ancestor thumbnails are recalculated. Optionally deletes file/dir from view. More... | |
void | ClearCache () |
Clears UI cache. More... | |
void | MarkAll () |
Mark all images/dirs. More... | |
void | Mark (int id, bool mark) |
Mark/unmark an image/dir. More... | |
void | InvertMarked () |
Mark all unmarked items, unmark all marked items. More... | |
void | ClearMarked () |
Unmark all items. More... | |
bool | IsMarked (int id) const |
![]() | |
FlatView (SlideOrderType order) | |
virtual | ~FlatView () |
int | GetParentId () const |
ImageListK | GetAllNodes () const |
Get all images/dirs in view. More... | |
ImagePtrK | GetSelected () const |
Get current selection. More... | |
ImagePtrK | HasNext (int inc) const |
Peeks at next image in view but does not advance iterator. More... | |
ImagePtrK | HasPrev (int inc) const |
Peeks at previous image in view but does not decrement iterator. More... | |
ImagePtrK | Next (int inc) |
Advance iterator and return next image, wrapping if necessary. Regenerates unordered views on wrap. More... | |
ImagePtrK | Prev (int inc) |
Decrements iterator and returns previous image. Wraps at start. More... | |
QString | GetPosition () const |
Get positional status. More... | |
bool | Select (int id, int fallback=0) |
Selects first occurrence of an image. More... | |
QStringList | ClearImage (int id, bool remove=false) |
Clear file from UI cache and optionally from view. More... | |
void | ClearCache () |
Clears UI cache. More... | |
bool | Update (int id) |
Updates view with images that have been updated. More... | |
void | Rotate (int id) |
Rotate view so that starting image is at front. More... | |
void | Clear (bool resetParent=true) |
Reset view. More... | |
QString | GetCachedThumbUrl (int id) const |
Protected Member Functions | |
void | SetDirectory (int newParent) |
Manage markings on tree navigation. More... | |
void | LoadDirThumbs (ImageItem &parent, int thumbsNeeded, int level=0) |
Populate thumbs for a dir. More... | |
void | PopulateThumbs (ImageItem &parent, int thumbsNeeded, const ImageList &files, const ImageList &dirs, int level=0) |
Populate directory stats & thumbnails recursively from database as follows: Use user cover, if assigned. Otherwise derive 4 thumbnails from: first 4 images, then 1st thumbnail from first 4 sub-dirs, then 2nd thumbnail from sub-dirs etc. More... | |
ImageIdList | GetChildren () const |
bool | PopulateFromCache (ImageItem &dir, int required) |
Retrieve cached dir, if available. More... | |
void | Cache (ImageItemK &dir, int thumbCount) |
Cache displayed dir. More... | |
![]() | |
void | Populate (ImageList &files) |
Fills view with Db images, re-ordering them as required. More... | |
void | Cache (int id, int parent, const QString &url, const QString &thumb) |
Cache image properties to optimize UI. More... | |
Protected Attributes | |
MarkedFiles | m_marked |
Marked items in current dir/view. More... | |
MarkedFiles | m_prevMarked |
Marked items in previous dir. More... | |
QHash< int, DirCacheEntry > | m_dirCache |
Caches displayed image dirs. More... | |
![]() | |
int | m_parentId {-1} |
SlideOrderType | m_order {kOrdered} |
ImageManagerFe & | m_mgr |
QHash< int, ImagePtrK > | m_images |
Image objects currently displayed. More... | |
ImageIdList | m_sequence |
The sequence in which to display images. More... | |
int | m_active {0} |
Sequence index of current selected image. More... | |
QHash< int, FileCacheEntry > | m_fileCache |
Caches displayed image files. More... | |
Additional Inherited Members | |
![]() | |
static WeightList | CalculateSeasonalWeights (ImageList &files) |
This method calculates a weight for the item based on how closely it was taken to the current time of year. This means that New Year's pictures will be displayed very frequently on every New Year's, and that anniversary pictures will be favored again every anniversary. The weights are chosen using a beta distribution with a tunable shape parameter. More... | |
A datastore of images for display by a screen. Provides an ordered list of dirs & images from a single directory, as required by a Thumbnail view. Permits marking of items and populates dir thumbnails from their subtree.
Definition at line 170 of file galleryviews.h.
|
explicit |
Constructs a view of images & directories that can be marked.
order | Ordering to use for view |
Definition at line 472 of file galleryviews.cpp.
|
inline |
Definition at line 175 of file galleryviews.h.
Referenced by GalleryThumbView::DirSelectUp(), GalleryThumbView::ItemClicked(), GalleryThumbView::keyPressEvent(), GalleryThumbView::MenuAction(), and GalleryThumbView::MenuMarked().
QString DirectoryView::GetPosition | ( | ) | const |
Get positional status.
Definition at line 484 of file galleryviews.cpp.
Referenced by GalleryThumbView::SetUiSelection().
|
overridevirtual |
Populate view from database as images/subdirs of a directory. View is ordered: Parent dir, sub-dirs, images. Dir thumbnails are derived from their subtree.
parentId | The dir id, if positive. Otherwise the view is refreshed using the existing parent dir |
Reimplemented from FlatView.
Definition at line 498 of file galleryviews.cpp.
Referenced by GalleryThumbView::LoadData().
Resets view.
resetParent | parent id is only reset to root when this is set |
Definition at line 712 of file galleryviews.cpp.
Referenced by GalleryThumbView::Close(), and GalleryThumbView::customEvent().
MenuSubjects DirectoryView::GetMenuSubjects | ( | ) |
Determine current selection, markings & various info to support menu display.
Definition at line 807 of file galleryviews.cpp.
Referenced by GalleryThumbView::MenuMain().
Clear file/dir and all its ancestors from UI cache so that ancestor thumbnails are recalculated. Optionally deletes file/dir from view.
id | Image id |
deleted | If true, file is also deleted from view |
Definition at line 902 of file galleryviews.cpp.
Referenced by GalleryThumbView::RemoveImages().
void DirectoryView::ClearCache | ( | ) |
Clears UI cache.
Definition at line 887 of file galleryviews.cpp.
Referenced by Clear(), GalleryThumbView::DoShowHidden(), GalleryThumbView::DoShowType(), and GalleryThumbView::ShowSettings().
void DirectoryView::MarkAll | ( | ) |
Mark all images/dirs.
Definition at line 723 of file galleryviews.cpp.
Referenced by GalleryThumbView::DoMarkAll().
void DirectoryView::Mark | ( | int | id, |
bool | mark | ||
) |
Mark/unmark an image/dir.
id | The image/dir |
mark | If true, mark item. Otherwise unmark |
Definition at line 736 of file galleryviews.cpp.
Referenced by GalleryThumbView::DoHideItem(), GalleryThumbView::DoHideMarked(), GalleryThumbView::DoMarkItem(), and GalleryThumbView::Move().
void DirectoryView::InvertMarked | ( | ) |
Mark all unmarked items, unmark all marked items.
Definition at line 755 of file galleryviews.cpp.
Referenced by GalleryThumbView::MarkInvertAll().
void DirectoryView::ClearMarked | ( | ) |
Unmark all items.
Definition at line 766 of file galleryviews.cpp.
Referenced by Clear(), and GalleryThumbView::DoMarkAll().
|
inline |
Definition at line 188 of file galleryviews.h.
Referenced by GalleryThumbView::keyPressEvent(), and GalleryThumbView::UpdateImageItem().
|
protected |
Manage markings on tree navigation.
newParent | Id of new parent dir |
Definition at line 777 of file galleryviews.cpp.
Referenced by LoadFromDb().
|
protected |
Populate thumbs for a dir.
parent | Parent dir |
thumbsNeeded | Number of thumbnails needed |
level | Recursion depth |
Definition at line 570 of file galleryviews.cpp.
Referenced by LoadFromDb(), and PopulateThumbs().
|
protected |
Populate directory stats & thumbnails recursively from database as follows: Use user cover, if assigned. Otherwise derive 4 thumbnails from: first 4 images, then 1st thumbnail from first 4 sub-dirs, then 2nd thumbnail from sub-dirs etc.
parent | The parent dir |
thumbsNeeded | Number of thumbnails required |
files | A list of files to process |
dirs | A list of directories to process |
level | Recursion level (to detect recursion deadlocks) |
Definition at line 595 of file galleryviews.cpp.
Referenced by LoadDirThumbs(), and LoadFromDb().
|
inlineprotected |
Definition at line 197 of file galleryviews.h.
Referenced by InvertMarked(), and MarkAll().
Retrieve cached dir, if available.
dir | Dir image |
required | Number of thumbnails required |
Definition at line 840 of file galleryviews.cpp.
Referenced by LoadDirThumbs(), and LoadFromDb().
|
protected |
Cache displayed dir.
dir | Dir image |
thumbCount | Number of populated thumbnails |
Definition at line 860 of file galleryviews.cpp.
Referenced by PopulateThumbs().
|
protected |
Marked items in current dir/view.
Definition at line 201 of file galleryviews.h.
Referenced by ClearMarked(), DirectoryView(), GetMenuSubjects(), InvertMarked(), IsMarked(), LoadFromDb(), Mark(), MarkAll(), RemoveImage(), and SetDirectory().
|
protected |
Marked items in previous dir.
Definition at line 202 of file galleryviews.h.
Referenced by ClearMarked(), DirectoryView(), GetMenuSubjects(), InvertMarked(), IsMarked(), Mark(), MarkAll(), RemoveImage(), and SetDirectory().
|
protected |
Caches displayed image dirs.
Definition at line 205 of file galleryviews.h.
Referenced by Cache(), ClearCache(), PopulateFromCache(), and RemoveImage().