MythTV  master
Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ImageDbLocal Class Reference

A Database with device adapter for local images. More...

#include <imagemanager.h>

Inheritance diagram for ImageDbLocal:
Inheritance graph
[legend]
Collaboration diagram for ImageDbLocal:
Collaboration graph
[legend]

Protected Member Functions

 ImageDbLocal ()
 Local database constructor. More...
 
 ~ImageDbLocal () override
 
bool CreateTable ()
 Create local database table, if it doesn't exist. More...
 
- Protected Member Functions inherited from ImageDb< ImageAdapterLocal >
 ImageDb (QString table)
 
ImageItemCreateImage (const MSqlQuery &query) const
 Create image from Db query data. More...
 
int ReadImages (ImageList &dirs, ImageList &files, const QString &selector) const
 Read selected database images/dirs. More...
 
- Protected Member Functions inherited from ImageAdapterBase
 ImageAdapterBase ()
 Constructor. More...
 
virtual ~ImageAdapterBase ()=default
 
- Protected Member Functions inherited from DeviceManager
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 returned. More...
 
int LocateMount (const QString &mount) const
 Find the id of a device. More...
 
StringMap GetDeviceDirs () const
 Get all known devices. More...
 
QList< int > GetAbsentees ()
 Get list of mountpoints for non-import devices. More...
 
 DeviceManager ()=default
 
 ~DeviceManager ()
 

Protected Attributes

bool m_dbExists { false }
 
- Protected Attributes inherited from ImageDb< ImageAdapterLocal >
QString m_table
 Db table name. More...
 

Private Member Functions

void DropTable ()
 Remove local image table. More...
 

Additional Inherited Members

- Public Member Functions inherited from ImageDb< ImageAdapterLocal >
int GetImages (const QString &ids, ImageList &files, ImageList &dirs, const QString &refine="") const
 Read database images/dirs by id. More...
 
bool GetDescendants (const QString &ids, ImageList &files, ImageList &dirs) const
 Return images and all of their descendants. More...
 
int InsertDbImage (ImageItemK &im, bool checkForDuplicate=false) const
 Adds new image to database, optionally checking for existing filepath. More...
 
bool UpdateDbImage (ImageItemK &im) const
 Updates or creates database image or dir. More...
 
QStringList RemoveFromDB (const ImageList &imList) const
 Remove images/dirs from database. More...
 
bool SetHidden (bool hide, const QString &ids) const
 Sets hidden status of an image/dir in database. More...
 
bool SetCover (int dir, int id) const
 Set the thumbnail(s) to be used for a dir. More...
 
bool SetOrientation (int id, int orientation) const
 Sets image orientation in Db. More...
 
bool ReadAllImages (ImageHash &files, ImageHash &dirs) const
 Read all database images and dirs as map. No filters or ordering applied. More...
 
void ClearDb (int devId, const QString &action)
 Clear Db for device & remove device. More...
 
int GetChildren (const QString &ids, ImageList &files, ImageList &dirs, const QString &refine="") const
 Read immediate children of a dir. More...
 
bool GetImageTree (int id, ImageList &files, const QString &refine) const
 Returns all files in the sub-tree of a dir. More...
 
int GetDirectory (int id, ImagePtr &parent, ImageList &files, ImageList &dirs, const QString &refine) const
 Read a dir and its immediate children from Db. More...
 
void GetDescendantCount (int id, bool all, int &dirs, int &pics, int &videos, int &sizeKb) const
 Return counts of dirs, pics, videos and size in the subtree of a dir. More...
 
- Public Member Functions inherited from ImageAdapterLocal
 ImageAdapterLocal ()=default
 
ImageItemCreateItem (const QFileInfo &fi, int parentId, int devId, const QString &base) const
 Construct a local image from a file. More...
 
StringMap GetScanDirs () const
 Returns local device dirs to scan. More...
 
- Public Member Functions inherited from ImageAdapterBase
QDir GetImageFilters () const
 Get filters for detecting recognised images/videos. More...
 
ImageNodeType GetImageType (const QString &ext) const
 Determine file type from its extension. More...
 
- Public Member Functions inherited from DeviceManager
QStringList CloseDevices (int devId, const QString &action)
 Remove a device (or all devices) More...
 
QString DeviceMount (int devId) const
 Get path at which the device is mounted. More...
 
QString DeviceName (int devId) const
 Get model name of the device. More...
 
int DeviceCount () const
 
QString ThumbDir (int fs) const
 
- Static Public Member Functions inherited from ImageAdapterLocal
static QString GetAbsFilePath (const ImagePtrK &im)
 Get absolute filepath for a local image. More...
 
static QString MakeFileUrl (const QString &path)
 Construct URL of a local image, which is an absolute path. More...
 
static QString MakeThumbUrl (const QString &devPath, const QString &path="")
 Construct URL of the thumbnail of a local image (An absolute path) More...
 
static void Notify (const QString &mesg, const QStringList &extra)
 Send local message to UI about local ids. More...
 
- Static Public Member Functions inherited from ImageAdapterBase
static QStringList SupportedImages ()
 Return recognised pictures. More...
 
static QStringList SupportedVideos ()
 Return recognised video extensions. More...
 
static QString ConstructPath (const QString &path, const QString &name)
 Assembles a canonical file path without corrupting its absolute/relative nature. More...
 
static QString BaseNameOf (const QString &path)
 Extracts file name (incl extension) from a filepath. More...
 
static QString PathOf (const QString &path)
 Extracts path from a filepath. More...
 
static QString FormatSize (int sizeKib)
 
static QString GetAbsThumbPath (const QString &devPath, const QString &path)
 Get absolute filepath for thumbnail of an image. More...
 
static QString ThumbPath (const ImageItem &im)
 Thumbnails of videos are a JPEG snapshot with jpg suffix appended. More...
 
- Static Protected Member Functions inherited from ImageAdapterLocal
static int ImageId (int id)
 
static QString ImageId (const QString &id)
 
static int DbId (int id)
 
static QString DbIds (const QString &ids)
 

Detailed Description

A Database with device adapter for local images.

Definition at line 326 of file imagemanager.h.

Constructor & Destructor Documentation

◆ ImageDbLocal()

ImageDbLocal::ImageDbLocal ( )
protected

Local database constructor.

Definition at line 1064 of file imagemanager.cpp.

◆ ~ImageDbLocal()

ImageDbLocal::~ImageDbLocal ( )
inlineoverrideprotected

Definition at line 330 of file imagemanager.h.

Member Function Documentation

◆ CreateTable()

bool ImageDbLocal::CreateTable ( )
protected

Create local database table, if it doesn't exist.

Definition at line 1089 of file imagemanager.cpp.

Referenced by ImageManagerFe::ScanImagesAction().

◆ DropTable()

void ImageDbLocal::DropTable ( )
private

Remove local image table.

Definition at line 1075 of file imagemanager.cpp.

Referenced by ImageDbLocal().

Member Data Documentation

◆ m_dbExists

bool ImageDbLocal::m_dbExists { false }
protected

The documentation for this class was generated from the following files: