MythTV  master
imagemanager.h
Go to the documentation of this file.
1 
9 /* Myth uses two Gallery instances;
10  *
11  * One runs on the BE to manage the 'Photographs' Storage Group. The (permanent)
12  * database table is synchronised to SG files, thumbnails are generated and stored
13  * in the Temp SG, and BE messages for these images are handled.
14  *
15  * A separate instance runs on each FE to manage local/removeable media. This uses
16  * a temporary, memory Db table that is synchronised to images on USB/CDs etc,
17  * as they are mounted. Thumbnails are generated/stored on the FE and operations on
18  * these images are handled locally. The Db table and all thumbnails are removed
19  * when the FE exits.
20  *
21  * The UI integrates images/functions from both instances seamlessly.
22  *
23  * Commonality is provided by using an adapter layer for database and filesystem access.
24  * Functionality is segregated into local classes, which are layered on an
25  * adapter to assemble singletons for a BE manager & FE manager - the only
26  * elements intended for external use.
27  *
28  * Device manager
29  * |
30  * Common Adapter
31  * / \
32  * BE adapter FE adapter
33  * | Common Db API |
34  * | / \ |
35  * BE Db functions FE Db functions
36  * | Common Handler |
37  * | / \ |
38  * BE manager UI Db API
39  * |
40  * FE manager
41  *
42  * Implemented using templates rather than polymorphism for speed/efficiency.
43  */
44 
45 #ifndef IMAGEMANAGER_H
46 #define IMAGEMANAGER_H
47 
48 #include <utility>
49 
50 // Qt headers
51 #include <QTemporaryDir>
52 
53 // MythTV headers
54 #include "mythcorecontext.h"
55 #include "storagegroup.h"
56 #include "mythdirs.h"
57 
58 #include "imagescanner.h"
59 #include "imagemetadata.h"
60 
61 
62 // Builtin storage groups as per storagegroup.cpp
63 #define IMAGE_STORAGE_GROUP "Photographs"
64 #define THUMBNAIL_STORAGE_GROUP "Temp"
65 
66 // Filesystem dir within config dir used by TEMP SG
67 #define TEMP_SUBDIR "tmp"
68 // Filesystem dir within tmp config dir where thumbnails reside
69 #define THUMBNAIL_SUBDIR "Images"
70 
71 #define DEVICE_INVALID (-1)
72 
73 class MythMediaDevice;
74 class MythMediaEvent;
75 
79  kPicOnly = 1,
80  kVideoOnly = 2
81 };
82 
83 class Device;
84 
95 {
96 public:
97  QStringList CloseDevices(int devId, const QString &action);
98  QString DeviceMount(int devId) const;
99  QString DeviceName(int devId) const;
100  int DeviceCount() const { return m_devices.size(); }
101  QString ThumbDir(int fs) const;
102 
103 protected:
104  int OpenDevice(const QString &name, const QString &mount,
105  MythMediaDevice *media = nullptr,
106  QTemporaryDir *dir = nullptr);
107 
108  int LocateMount(const QString &mount) const;
109  StringMap GetDeviceDirs() const;
110  QList<int> GetAbsentees();
111 
112  DeviceManager() = default;
113  ~DeviceManager();
114 
115 private:
116  using DeviceMap = QMap<int, Device*>;
117 
120 };
121 
122 
125 {
126 public:
127  static QStringList SupportedImages();
128 
129  static QStringList SupportedVideos();
130 
132  static QString ConstructPath(const QString &path, const QString &name)
133  { return path.isEmpty() ? name : path + "/" + name; }
134 
136  static QString BaseNameOf(const QString &path)
137  { QString result = path.section('/', -1); return result.isNull() ? "" : result; }
138 
140  static QString PathOf(const QString &path)
141  { QString result = path.section('/', 0, -2); return result.isNull() ? "" : result; }
142 
143  static QString FormatSize(int sizeKib)
144  { return (sizeKib < 10000) ? QString("%L1 KiB").arg(sizeKib)
145  : QString("%L1 MiB").arg(sizeKib / 1024.0, 0, 'f', 1); }
146 
148  static QString GetAbsThumbPath(const QString &devPath, const QString &path)
149  { return QString("%1/" TEMP_SUBDIR "/%2/%3").arg(GetConfDir(), devPath, path); }
150 
152  static QString ThumbPath(const ImageItem &im)
153  { return im.m_type != kVideoFile ? im.m_filePath : im.m_filePath + ".jpg"; }
154 
162  QDir GetImageFilters() const { return m_dirFilter; }
163 
165  ImageNodeType GetImageType(const QString &ext) const
166  { return m_imageFileExt.contains(ext)
167  ? kImageFile
168  : m_videoFileExt.contains(ext) ? kVideoFile : kUnknown; }
169 protected:
171  virtual ~ImageAdapterBase() = default;
172 
173 private:
177  QStringList m_imageFileExt;
179  QStringList m_videoFileExt;
180 };
181 
182 
190 {
191 public:
192  ImageAdapterLocal() = default;
193 
194  ImageItem *CreateItem(const QFileInfo &fi, int parentId, int devId,
195  const QString &base) const;
196 
198  StringMap GetScanDirs() const { return GetDeviceDirs(); }
199 
201  static QString GetAbsFilePath(const ImagePtrK &im)
202  { return im->m_filePath; }
203 
205  static QString MakeFileUrl(const QString &path) { return path; }
206 
208  static QString MakeThumbUrl(const QString &devPath, const QString &path = "")
209  { return GetAbsThumbPath(devPath, path); }
210 
211  static void Notify(const QString &mesg, const QStringList &extra) ;
212 
213 protected:
214  // Adapter functions used by Database for local images. Negate ids in & out
215  static int ImageId(int id) { return ImageItem::ToLocalId(id); }
216  static QString ImageId(const QString &id) { return ImageItem::ToLocalId(id); }
217  static int DbId(int id) { return ImageItem::ToDbId(id); }
218  static QString DbIds(const QString &ids) { return ImageItem::ToDbId(ids); }
219 };
220 
221 
228 {
229 public:
231  m_hostname(gCoreContext->GetMasterHostName()),
232  m_hostport(MythCoreContext::GetMasterServerPort()),
234 
235  ImageItem *CreateItem(const QFileInfo &fi, int parentId, int devId,
236  const QString &base) const;
237  StringMap GetScanDirs() const;
238  QString GetAbsFilePath(const ImagePtrK &im) const;
239 
241  QString MakeFileUrl(const QString &path) const
244 
246  QString MakeThumbUrl(const QString &devPath, const QString &path = "") const
248  devPath + "/" + path,
250 
251  static void Notify(const QString &mesg, const QStringList &extra) ;
252 
253 protected:
254  // Adapter functions used by Database for remote images. Do nothing
255  static int ImageId(int id) { return id; }
256  static QString ImageId(const QString &id) { return id; }
257  static int DbId(int id) { return id; }
258  static QString DbIds(const QString &ids) { return ids; }
259 
260 private:
262  QString m_hostname;
265  // Marked mutable as storagegroup.h does not enforce const-correctness
267 };
268 
269 
273 template <class FS>
274 class META_PUBLIC ImageDb : public FS
275 {
276 public:
277  // Handler support
278  int GetImages(const QString &ids, ImageList &files, ImageList &dirs,
279  const QString &refine = "") const;
280  bool GetDescendants(const QString &ids,
281  ImageList &files, ImageList &dirs) const;
282  int InsertDbImage(ImageItemK &im, bool checkForDuplicate = false) const;
283  bool UpdateDbImage(ImageItemK &im) const;
284  QStringList RemoveFromDB(const ImageList &imList) const;
285 
286  bool SetHidden(bool hide, QString ids) const;
287  bool SetCover(int dir, int id) const;
288  bool SetOrientation(int id, int orientation) const;
289 
290  // Scanner support
291  bool ReadAllImages(ImageHash &files, ImageHash &dirs) const;
292  void ClearDb(int devId, const QString &action);
293 
294  // ImageReader support
295  int GetChildren(QString ids, ImageList &files, ImageList &dirs,
296  const QString &refine = "") const;
297  bool GetImageTree(int id, ImageList &files, const QString &refine) const;
298  int GetDirectory(int id, ImagePtr &parent, ImageList &files, ImageList &dirs,
299  const QString &refine) const;
300  void GetDescendantCount(int id, bool all, int &dirs, int &pics,
301  int &videos, int &sizeKb) const;
302 
303 protected:
304  explicit ImageDb(QString table) : FS(), m_table(std::move(table)) {}
305 
306  ImageItem *CreateImage(const MSqlQuery &query) const;
307  int ReadImages(ImageList &dirs, ImageList &files,
308  const QString &selector) const;
310  QString m_table;
311 };
312 
313 
315 class META_PUBLIC ImageDbSg : public ImageDb<ImageAdapterSg>
316 {
317 public:
318  ImageDbSg();
319 };
320 
321 
323 class META_PUBLIC ImageDbLocal : public ImageDb<ImageAdapterLocal>
324 {
325 protected:
326  ImageDbLocal();
327  ~ImageDbLocal() override { DropTable(); }
328  bool CreateTable();
329  bool m_dbExists { false };
330 
331 private:
332  void DropTable();
333 };
334 
335 
337 template <class DBFS>
338 class META_PUBLIC ImageHandler : protected DBFS
339 {
340 public:
341  QStringList HandleRename(const QString &id, const QString &newBase) const;
342  QStringList HandleDelete(const QString &ids) const;
343  QStringList HandleDbCreate(QStringList defs) const;
344  QStringList HandleDbMove(const QString &ids, const QString &srcPath, QString destPath) const;
345  QStringList HandleHide(bool hide, const QString &ids) const;
346  QStringList HandleTransform(int transform, const QString &ids) const;
347  QStringList HandleDirs(const QString &destId, bool rescan,
348  const QStringList &relPaths) const;
349  QStringList HandleCover(int dir, int cover) const;
350  QStringList HandleIgnore(const QString &exclusions) const;
351  QStringList HandleScanRequest(const QString &command, int devId = DEVICE_INVALID) const;
352  QStringList HandleCreateThumbnails(const QStringList &message) const;
353  QStringList HandleGetMetadata(const QString &id) const;
354 
355 protected:
356  ImageHandler() : DBFS(),
357  m_thumbGen(new ImageThumb<DBFS>(this)),
358  m_scanner(new ImageScanThread<DBFS>(this, m_thumbGen)) {}
359 
360  ~ImageHandler() override
361  {
362  delete m_scanner;
363  delete m_thumbGen;
364  }
365 
366  void RemoveFiles(ImageList &images) const;
367 
368  ImageThumb<DBFS> *m_thumbGen {nullptr};
369  ImageScanThread<DBFS> *m_scanner {nullptr};
370 };
371 
372 
378 class META_PUBLIC ImageManagerBe : protected QObject, public ImageHandler<ImageDbSg>
379 {
380 public:
381  static ImageManagerBe* getInstance();
382 
383 protected:
385  {
386  // Cleanup & terminate child threads before application exits
387  connect(qApp, &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
388  }
389 
392 };
393 
394 
400 class META_PUBLIC ImageDbReader : protected ImageHandler<ImageDbLocal>
401 {
402 public:
403  ~ImageDbReader() override { delete m_remote; }
404 
405  int GetType() const { return m_showType; }
406  bool GetVisibility() const { return m_showHidden; }
407 
408  void SetType(int showType)
409  { m_showType = showType; SetRefinementClause(); }
410 
411  void SetSortOrder(int order, int dirOrder)
412  { m_dirOrder = dirOrder; m_fileOrder = order; SetRefinementClause(); }
413 
414  void SetVisibility(bool showHidden)
415  { m_showHidden = showHidden; SetRefinementClause(); }
416 
417  int GetImages(const ImageIdList& ids, ImageList &files, ImageList &dirs) const;
418  int GetChildren(int id, ImageList &files, ImageList &dirs) const;
419  int GetDirectory(int id, ImagePtr &parent,
420  ImageList &files, ImageList &dirs) const;
421  void GetDescendants(const ImageIdList &ids,
422  ImageList &files, ImageList &dirs) const;
423  void GetImageTree(int id, ImageList &files) const;
424  void GetDescendantCount(int id, int &dirs, int &pics, int &videos,
425  int &sizeKb) const;
426 protected:
427  ImageDbReader(int order, int dirOrder, bool showAll, int showType)
428  : m_remote(new ImageDbSg()),
429  m_dirOrder(dirOrder), m_fileOrder(order),
430  m_showHidden(showAll), m_showType(showType)
431  { SetRefinementClause(); }
432 
433  void SetRefinementClause();
434 
435  static QString TypeSelector(int type);
436  static QString OrderSelector(int order);
437 
439 
444  QString m_refineClause;
445 };
446 
447 
456 class META_PUBLIC ImageManagerFe : protected QObject, public ImageDbReader
457 {
459 public:
460  static ImageManagerFe &getInstance();
461 
462  // UI actions on all images
463  void CreateThumbnails(const ImageIdList &ids, bool forFolder);
464  QString ScanImagesAction(bool start, bool local = false);
465  static QStringList ScanQuery();
466  QString HideFiles(bool hidden, const ImageIdList &ids);
467  QString ChangeOrientation(ImageFileTransform transform, const ImageIdList &ids);
468  QString SetCover(int parent, int cover);
469  void RequestMetaData(int id);
470  static QString IgnoreDirs(const QString &excludes);
471  QString MakeDir(int parent, const QStringList &names, bool rescan = true);
472  QString RenameFile(const ImagePtrK& im, const QString &name);
473  QString CreateImages(int destId, const ImageListK &images);
474  QString MoveDbImages(const ImagePtrK& destDir, ImageListK &images, const QString &srcPath);
475  QString DeleteFiles(const ImageIdList &ids);
476  static void ClearStorageGroup();
477  void CloseDevices(int devId = DEVICE_INVALID, bool eject = false);
478 
480 
481  // Local Device management
482  bool DetectLocalDevices();
483  void DeviceEvent(MythMediaEvent *event);
484  QString CreateImport();
487 
488  // UI helper functions
489  void SetDateFormat(const QString &format) { m_dateFormat = format; }
490  static QString LongDateOf(const ImagePtrK &im) ;
491  QString ShortDateOf(const ImagePtrK &im) const;
492  QString DeviceCaption(ImageItemK &im) const;
493  QString CrumbName(ImageItemK &im, bool getPath = false) const;
494 
496  QString BuildTransferUrl(const QString &path, bool local) const
497  { return local ? ImageDbReader::MakeFileUrl(path)
498  : m_remote->MakeFileUrl(path); }
499 
500 protected:
501  ImageManagerFe(int order, int dirOrder, bool showAll, int showType,
502  QString dateFormat)
503  : ImageDbReader(order, dirOrder, showAll, showType),
504  m_dateFormat(std::move(dateFormat))
505  {
506  // Cleanup & terminate child threads before application exits
507  connect(qApp, &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
508  }
509 
512 
514  QString m_dateFormat;
515 };
516 
517 
518 #endif // IMAGEMANAGER_H
ImageManagerBe::s_instance
static ImageManagerBe * s_instance
BE Gallery instance.
Definition: imagemanager.h:391
kPicAndVideo
@ kPicAndVideo
Show Pictures & Videos.
Definition: imagemanager.h:78
ImageManagerFe::m_dateFormat
QString m_dateFormat
UI format for thumbnail date captions.
Definition: imagemanager.h:514
ImageAdapterLocal::DbIds
static QString DbIds(const QString &ids)
Definition: imagemanager.h:218
ImageManagerFe::ImageManagerFe
ImageManagerFe(int order, int dirOrder, bool showAll, int showType, QString dateFormat)
Definition: imagemanager.h:501
ImagePtrK
QSharedPointer< ImageItemK > ImagePtrK
Definition: imagetypes.h:164
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:126
ImageDbReader::m_showType
int m_showType
Type of images to display - pic only/video only/both.
Definition: imagemanager.h:443
ImageAdapterLocal::MakeFileUrl
static QString MakeFileUrl(const QString &path)
Construct URL of a local image, which is an absolute path.
Definition: imagemanager.h:205
ImageAdapterLocal::ImageAdapterLocal
ImageAdapterLocal()=default
DeviceManager::GetDeviceDirs
StringMap GetDeviceDirs() const
Get all known devices.
Definition: imagemanager.cpp:246
ImageAdapterBase::ConstructPath
static QString ConstructPath(const QString &path, const QString &name)
Assembles a canonical file path without corrupting its absolute/relative nature.
Definition: imagemanager.h:132
ImageAdapterBase::BaseNameOf
static QString BaseNameOf(const QString &path)
Extracts file name (incl extension) from a filepath.
Definition: imagemanager.h:136
ImageItem::m_type
int m_type
Type of node: dir, video etc.
Definition: imagetypes.h:96
ImageAdapterBase::~ImageAdapterBase
virtual ~ImageAdapterBase()=default
ImageNodeType
ImageNodeType
Type of image node.
Definition: imagetypes.h:33
kVideoFile
@ kVideoFile
A video.
Definition: imagetypes.h:39
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
ImageItem::ToLocalId
static int ToLocalId(int id)
Converts a DB id (positive) to an id of a local image (negative)
Definition: imagetypes.h:126
ImageManagerFe::BuildTransferUrl
QString BuildTransferUrl(const QString &path, bool local) const
Generate Myth URL for a local or remote path.
Definition: imagemanager.h:496
THUMBNAIL_STORAGE_GROUP
#define THUMBNAIL_STORAGE_GROUP
Definition: imagemanager.h:64
ImageManagerFe::s_instance
static ImageManagerFe * s_instance
FE Gallery instance.
Definition: imagemanager.h:511
ImageDbReader::m_showHidden
bool m_showHidden
Whether hidden images are displayed.
Definition: imagemanager.h:442
ImageAdapterLocal::DbId
static int DbId(int id)
Definition: imagemanager.h:217
ImageDb::ImageDb
ImageDb(QString table)
Definition: imagemanager.h:304
ImageAdapterSg::m_hostport
int m_hostport
Definition: imagemanager.h:263
ImageManagerFe::Q_DECLARE_TR_FUNCTIONS
Q_DECLARE_TR_FUNCTIONS(ImageManagerFe)
ImageAdapterSg::ImageId
static int ImageId(int id)
Definition: imagemanager.h:255
DeviceManager::DeviceCount
int DeviceCount() const
Definition: imagemanager.h:100
ImageAdapterBase::m_videoFileExt
QStringList m_videoFileExt
List of file extensions recognised as videos.
Definition: imagemanager.h:179
RemoveFromDB
bool RemoveFromDB(Bookmark *site)
Definition: browserdbutil.cpp:158
ImageAdapterSg::Notify
static void Notify(const QString &mesg, const QStringList &extra)
Send message to all clients about remote ids.
Definition: imagemanager.cpp:451
ImageHandler::~ImageHandler
~ImageHandler() override
Definition: imagemanager.h:360
DEVICE_INVALID
#define DEVICE_INVALID
Definition: imagemanager.h:71
IMAGE_STORAGE_GROUP
#define IMAGE_STORAGE_GROUP
Definition: imagemanager.h:63
ImageAdapterSg::m_sg
StorageGroup m_sg
Images storage group.
Definition: imagemanager.h:266
ImageManagerFe::SetDateFormat
void SetDateFormat(const QString &format)
Definition: imagemanager.h:489
ImageDbReader::ImageDbReader
ImageDbReader(int order, int dirOrder, bool showAll, int showType)
Definition: imagemanager.h:427
Device
A device containing images (ie. USB stick, CD, storage group etc)
Definition: imagemanager.cpp:34
mythdirs.h
ImageAdapterSg::m_hostname
QString m_hostname
Host of SG.
Definition: imagemanager.h:262
ImageManagerBe::ImageManagerBe
ImageManagerBe()
Definition: imagemanager.h:384
ImageDbReader::SetVisibility
void SetVisibility(bool showHidden)
Definition: imagemanager.h:414
ImageAdapterLocal::GetAbsFilePath
static QString GetAbsFilePath(const ImagePtrK &im)
Get absolute filepath for a local image.
Definition: imagemanager.h:201
ImageAdapterSg::DbIds
static QString DbIds(const QString &ids)
Definition: imagemanager.h:258
ImageAdapterLocal::CreateItem
ImageItem * CreateItem(const QFileInfo &fi, int parentId, int devId, const QString &base) const
Construct a local image from a file.
Definition: imagemanager.cpp:337
ImageAdapterLocal::MakeThumbUrl
static QString MakeThumbUrl(const QString &devPath, const QString &path="")
Construct URL of the thumbnail of a local image (An absolute path)
Definition: imagemanager.h:208
ImageThumb
Definition: imagethumbs.h:128
ImageDbReader::m_refineClause
QString m_refineClause
SQL clause for image filtering/ordering.
Definition: imagemanager.h:444
ImageFileTransform
ImageFileTransform
Image transformations.
Definition: imagemetadata.h:46
ImageAdapterSg::MakeFileUrl
QString MakeFileUrl(const QString &path) const
Construct URL of a remote image.
Definition: imagemanager.h:241
ImageHash
QHash< QString, ImagePtr > ImageHash
Definition: imagetypes.h:160
MythCoreContext::GenMythURL
static QString GenMythURL(const QString &host=QString(), int port=0, QString path=QString(), const QString &storageGroup=QString())
Definition: mythcorecontext.cpp:777
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:224
kPicOnly
@ kPicOnly
Hide videos.
Definition: imagemanager.h:79
ImageDbReader::SetSortOrder
void SetSortOrder(int order, int dirOrder)
Definition: imagemanager.h:411
ImageAdapterBase
Common filesystem facilities.
Definition: imagemanager.h:125
StringMap
QMap< int, QString > StringMap
Definition: imagetypes.h:62
ImageAdapterBase::GetImageFilters
QDir GetImageFilters() const
Get filters for detecting recognised images/videos.
Definition: imagemanager.h:162
ImageAdapterSg
Filesystem adapter for Backend, managing Photographs storage group.
Definition: imagemanager.h:228
ImageDbReader::GetType
int GetType() const
Definition: imagemanager.h:405
ImageHandler
A handler for image operations. Requires a database/filesystem adapter.
Definition: imagemanager.h:339
ImageAdapterBase::FormatSize
static QString FormatSize(int sizeKib)
Definition: imagemanager.h:143
MythMediaEvent
Definition: mythmedia.h:184
ImageDbReader::~ImageDbReader
~ImageDbReader() override
Definition: imagemanager.h:403
ImageAdapterLocal::ImageId
static int ImageId(int id)
Definition: imagemanager.h:215
ImageAdapterBase::PathOf
static QString PathOf(const QString &path)
Extracts path from a filepath.
Definition: imagemanager.h:140
imagescanner.h
Synchronises image database to filesystem.
ImageListK
QList< ImagePtrK > ImageListK
Definition: imagetypes.h:165
DeviceManager::DeviceManager
DeviceManager()=default
ImageDbLocal::~ImageDbLocal
~ImageDbLocal() override
Definition: imagemanager.h:327
ImageDbReader
Provides read access to local & remote images.
Definition: imagemanager.h:401
DeviceManager::DeviceMap
QMap< int, Device * > DeviceMap
Definition: imagemanager.h:116
storagegroup.h
ImageDbReader::GetVisibility
bool GetVisibility() const
Definition: imagemanager.h:406
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
ImageDisplayType
ImageDisplayType
Display filter.
Definition: imagemanager.h:77
ImageList
QVector< ImagePtr > ImageList
Definition: imagetypes.h:159
ImageAdapterLocal
Filesystem adapter for Frontend, managing local devices iaw MediaMonitor.
Definition: imagemanager.h:190
ImageAdapterBase::GetAbsThumbPath
static QString GetAbsThumbPath(const QString &devPath, const QString &path)
Get absolute filepath for thumbnail of an image.
Definition: imagemanager.h:148
ImageAdapterSg::ImageId
static QString ImageId(const QString &id)
Definition: imagemanager.h:256
ImageAdapterLocal::GetScanDirs
StringMap GetScanDirs() const
Returns local device dirs to scan.
Definition: imagemanager.h:198
kImageFile
@ kImageFile
A picture.
Definition: imagetypes.h:38
ImageAdapterBase::m_dirFilter
QDir m_dirFilter
A pre-configured dir for reading image/video files.
Definition: imagemanager.h:175
MythCoreContext
This class contains the runtime context for MythTV.
Definition: mythcorecontext.h:55
ImagePtr
QSharedPointer< ImageItem > ImagePtr
Definition: imagetypes.h:158
ImageDbReader::SetType
void SetType(int showType)
Definition: imagemanager.h:408
mythcorecontext.h
ImageManagerFe
The image manager for use by Frontends.
Definition: imagemanager.h:457
ImageScanThread
Image Scanner thread requires a database/filesystem adapter.
Definition: imagescanner.h:29
ImageAdapterSg::ImageAdapterSg
ImageAdapterSg()
Definition: imagemanager.h:230
dir
QDir dir
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1174
ImageDbReader::m_fileOrder
int m_fileOrder
Display ordering of pics/videos.
Definition: imagemanager.h:441
ImageDbReader::m_remote
ImageDbSg * m_remote
Remote database access.
Definition: imagemanager.h:438
ImageItem
Represents a picture, video or directory.
Definition: imagetypes.h:68
imagemetadata.h
Handles Exif/FFMpeg metadata tags for images.
ImageItem::ToDbId
static int ToDbId(int id)
Converts local image ids (negative) to Db ids (positive)
Definition: imagetypes.h:130
DeviceManager::OpenDevice
int OpenDevice(const QString &name, const QString &mount, MythMediaDevice *media=nullptr, QTemporaryDir *dir=nullptr)
Define a new device and assign it a unique id. If the device is already known, its existing id is ret...
Definition: imagemanager.cpp:157
ImageDb< ImageAdapterLocal >::SetCover
bool SetCover(int dir, int id) const
Set the thumbnail(s) to be used for a dir.
Definition: imagemanager.cpp:918
ImageIdList
QList< int > ImageIdList
Definition: imagetypes.h:59
ImageAdapterBase::ThumbPath
static QString ThumbPath(const ImageItem &im)
Thumbnails of videos are a JPEG snapshot with jpg suffix appended.
Definition: imagemanager.h:152
DeviceManager
Manages image sources, ie.
Definition: imagemanager.h:95
ImageAdapterLocal::ImageId
static QString ImageId(const QString &id)
Definition: imagemanager.h:216
ImageAdapterSg::GetAbsFilePath
QString GetAbsFilePath(const ImagePtrK &im) const
Get absolute filepath for a remote image.
Definition: imagemanager.cpp:479
StorageGroup
Definition: storagegroup.h:12
build_compdb.action
action
Definition: build_compdb.py:9
ImageDbReader::m_dirOrder
int m_dirOrder
Display ordering of dirs.
Definition: imagemanager.h:440
DeviceManager::CloseDevices
QStringList CloseDevices(int devId, const QString &action)
Remove a device (or all devices)
Definition: imagemanager.cpp:189
ImageAdapterLocal::Notify
static void Notify(const QString &mesg, const QStringList &extra)
Send local message to UI about local ids.
Definition: imagemanager.cpp:386
ImageDbSg
A Database API with SG adapter for remote images.
Definition: imagemanager.h:316
ImageAdapterSg::MakeThumbUrl
QString MakeThumbUrl(const QString &devPath, const QString &path="") const
Construct URL of the thumbnail of a remote image.
Definition: imagemanager.h:246
ImageAdapterSg::GetScanDirs
StringMap GetScanDirs() const
Returns SG dirs.
Definition: imagemanager.cpp:462
MythMediaDevice
Definition: mythmedia.h:49
ImageHandler::ImageHandler
ImageHandler()
Definition: imagemanager.h:356
ImageDb::m_table
QString m_table
Db table name.
Definition: imagemanager.h:310
ImageDb
Database API.
Definition: imagemanager.h:275
ImageAdapterSg::CreateItem
ImageItem * CreateItem(const QFileInfo &fi, int parentId, int devId, const QString &base) const
Construct a remote image from a file.
Definition: imagemanager.cpp:402
ImageManagerBe
The image manager to be used by the Backend.
Definition: imagemanager.h:379
DeviceManager::m_devices
DeviceMap m_devices
Device store.
Definition: imagemanager.h:119
ImageAdapterBase::GetImageType
ImageNodeType GetImageType(const QString &ext) const
Determine file type from its extension.
Definition: imagemanager.h:165
query
MSqlQuery query(MSqlQuery::InitCon())
kUnknown
@ kUnknown
Unprocessable file type.
Definition: imagetypes.h:34
ImageAdapterSg::DbId
static int DbId(int id)
Definition: imagemanager.h:257
META_PUBLIC
#define META_PUBLIC
Definition: mythmetaexp.h:9
ImageAdapterBase::m_imageFileExt
QStringList m_imageFileExt
List of file extensions recognised as pictures.
Definition: imagemanager.h:177
kVideoOnly
@ kVideoOnly
Hide pictures.
Definition: imagemanager.h:80
TEMP_SUBDIR
#define TEMP_SUBDIR
Definition: imagemanager.h:67
ImageItem::m_filePath
QString m_filePath
Absolute for local images. Usually SG-relative for remotes.
Definition: imagetypes.h:92
ImageDbLocal
A Database with device adapter for local images.
Definition: imagemanager.h:324