MythTV  master
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
DeviceManager Class Reference

Manages image sources, ie. More...

#include <libmythmetadata/imagemanager.h>

Inheritance diagram for DeviceManager:
[legend]

Public Member Functions

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
 

Protected Member Functions

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 ()
 

Private Types

using DeviceMap = QMap< int, Device * >
 

Private Attributes

DeviceMap m_devices
 Device store. More...
 

Detailed Description

Manages image sources, ie.

SG, local media (USBs, CDs etc), import directories. A single SG device is opened on first use & never closed (no cleanup) . Imports are created by user & deleted when 'ejected' or FE exits, which cleans up thumbnails and imported images. Gallery scans local devices (MediaMonitor) whenever the UI starts. A local device is opened when first detected, closed when Gallery UI exits (to allow unmounting) but persists for subsequent Gallery use. It and its thumbnails are deleted by FE exit, user 'eject', system unmount or if it is no longer present when Gallery re-starts

Definition at line 94 of file imagemanager.h.

Member Typedef Documentation

◆ DeviceMap

using DeviceManager::DeviceMap = QMap<int, Device*>
private

Definition at line 116 of file imagemanager.h.

Constructor & Destructor Documentation

◆ DeviceManager()

DeviceManager::DeviceManager ( )
protecteddefault

◆ ~DeviceManager()

DeviceManager::~DeviceManager ( )
protected

Definition at line 127 of file imagemanager.cpp.

Member Function Documentation

◆ CloseDevices()

QStringList DeviceManager::CloseDevices ( int  devId,
const QString &  action 
)

Remove a device (or all devices)

Parameters
devIdId of device to remove
actionWhat action to take.
Returns
bool True if device is recognized

Definition at line 198 of file imagemanager.cpp.

◆ DeviceMount()

QString DeviceManager::DeviceMount ( int  devId) const

Get path at which the device is mounted.

Definition at line 134 of file imagemanager.cpp.

Referenced by ImageManagerFe::CrumbName().

◆ DeviceName()

QString DeviceManager::DeviceName ( int  devId) const

Get model name of the device.

Definition at line 141 of file imagemanager.cpp.

Referenced by ImageManagerFe::CrumbName(), and ImageManagerFe::DeviceCaption().

◆ DeviceCount()

int DeviceManager::DeviceCount ( ) const
inline

Definition at line 100 of file imagemanager.h.

Referenced by ImageManagerFe::DetectLocalDevices().

◆ ThumbDir()

QString DeviceManager::ThumbDir ( int  fs) const

Definition at line 147 of file imagemanager.cpp.

Referenced by ImageAdapterLocal::CreateItem(), and ImageAdapterSg::CreateItem().

◆ OpenDevice()

int DeviceManager::OpenDevice ( const QString &  name,
const QString &  mount,
MythMediaDevice media = nullptr,
QTemporaryDir *  dir = nullptr 
)
protected

Define a new device and assign it a unique id. If the device is already known, its existing id is returned.

Parameters
nameDevice model/volume/id
mountDevice mountpoint
mediaSet for MediaMonitor devices only
dirDir path of images: import devices only
Returns
int A unique id for this device.

Definition at line 162 of file imagemanager.cpp.

Referenced by ImageManagerFe::CreateImport(), ImageManagerFe::DetectLocalDevices(), ImageManagerFe::DeviceEvent(), and ImageDbSg::ImageDbSg().

◆ LocateMount()

int DeviceManager::LocateMount ( const QString &  mount) const
protected

Find the id of a device.

Parameters
mountDevice mountpoint
Returns
int Id (positive) if found, 0 if unknown

Definition at line 241 of file imagemanager.cpp.

Referenced by ImageManagerFe::DeviceEvent(), and OpenDevice().

◆ GetDeviceDirs()

StringMap DeviceManager::GetDeviceDirs ( ) const
protected

Get all known devices.

Definition at line 255 of file imagemanager.cpp.

Referenced by ImageAdapterLocal::GetScanDirs().

◆ GetAbsentees()

QList< int > DeviceManager::GetAbsentees ( )
protected

Get list of mountpoints for non-import devices.

Definition at line 269 of file imagemanager.cpp.

Referenced by ImageManagerFe::DetectLocalDevices().

Member Data Documentation

◆ m_devices

DeviceMap DeviceManager::m_devices
private

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