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 <imagemanager.h>

Inheritance diagram for DeviceManager:
Inheritance graph
[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 ()
 
 ~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 90 of file imagemanager.h.

Member Typedef Documentation

◆ DeviceMap

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

Definition at line 112 of file imagemanager.h.

Constructor & Destructor Documentation

◆ DeviceManager()

DeviceManager::DeviceManager ( )
inlineprotected

Definition at line 108 of file imagemanager.h.

◆ ~DeviceManager()

DeviceManager::~DeviceManager ( )
protected

Definition at line 122 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 189 of file imagemanager.cpp.

◆ DeviceMount()

QString DeviceManager::DeviceMount ( int  devId) const

Get path at which the device is mounted.

Definition at line 129 of file imagemanager.cpp.

Referenced by ImageManagerFe::CrumbName().

◆ DeviceName()

QString DeviceManager::DeviceName ( int  devId) const

Get model name of the device.

Definition at line 136 of file imagemanager.cpp.

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

◆ DeviceCount()

int DeviceManager::DeviceCount ( ) const
inline

Definition at line 96 of file imagemanager.h.

Referenced by ImageManagerFe::DetectLocalDevices().

◆ ThumbDir()

QString DeviceManager::ThumbDir ( int  fs) const

Definition at line 142 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 157 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 231 of file imagemanager.cpp.

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

◆ GetDeviceDirs()

StringMap DeviceManager::GetDeviceDirs ( ) const
protected

Get all known devices.

Definition at line 245 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 259 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: