Go to the documentation of this file.
22 #include <QWaitCondition>
54 : m_action(std::move(
action)), m_priority(priority), m_notify(notify)
55 { m_images.append(im); }
67 : m_images(std::move(list)),
68 m_action(std::move(
action)),
82 using TaskPtr = QSharedPointer<ThumbTask>;
126 template <
class DBFS>
133 void ClearThumbs(
int devId,
const QString &
action);
134 QString DeleteThumbs(
const ImageList &images);
135 void CreateThumbnail(
const ImagePtrK &im,
137 bool notify =
false);
139 void PauseBackground(
bool pause);
149 {
return (im.m_filePath.count(
'/') * 1000) + im.m_id; }
159 #endif // IMAGETHUMBS_H
QSharedPointer< ImageItemK > ImagePtrK
ThumbQueue m_requestQ
Synchronises completed tasks.
ImageThumbPriority
Priority of a thumbnail request.
QMutex m_mutex
Queue protection.
~ThumbThread() override
Destructor.
@ kPicRequestPriority
Client request to display an image thumbnail.
int m_priority
Request reason/priority.
static void RemoveTasks(ThumbQueue &queue, int devId)
ThumbQueue m_backgroundQ
Priority queue of background tasks.
QMultiMap< int, TaskPtr > ThumbQueue
A priority queue where 0 is highest priority.
@ kUrgentPriority
Scanner request needed to complete a scan.
void PauseBackground(bool pause)
Pauses or restarts processing of background tasks (scanner requests)
bool m_doBackground
Whether to process background tasks.
Common types used by Gallery.
ThumbTask(QString action, ImageListK list, int priority=kUrgentPriority, bool notify=false)
Construct request for a list of images/dirs.
QList< ImagePtrK > ImageListK
void cancel()
Clears all queues so that the thread will terminate.
A generator worker thread.
QVector< ImagePtr > ImageList
void AbortDevice(int devId, const QString &action)
Clears thumbnail request queue.
@ kDirRequestPriority
Client request to display a directory thumbnail.
A generator request that is queued.
ImageListK m_images
Images for thumbnail task.
ThumbTask(QString action, const ImagePtrK &im, int priority=kUrgentPriority, bool notify=false)
Construct request for a single image.
@ kBackgroundPriority
Scanner background request.
QSharedPointer< ThumbTask > TaskPtr
Represents a picture, video or directory.
ThumbThread< DBFS > * m_videoThread
Thread generating video previews.
ThumbThread(const QString &name, DBFS *const dbfs)
Constructor.
This is a wrapper around QThread that does several additional things.
bool m_notify
If true, a "THUMBNAIL_CREATED" event is broadcast.
void Enqueue(const TaskPtr &task)
Queues a Create request.
QString CreateThumbnail(const ImagePtrK &im, int thumbPriority)
Generate thumbnail for an image.
DBFS & m_dbfs
Database/filesystem adapter.
QWaitCondition m_taskDone
ThumbThread< DBFS > * m_imageThread
Thread generating picture thumbnails.
DBFS & m_dbfs
Db/filesystem adapter.
QString m_action
Request action: Create, delete etc.
void run() override
Handles thumbnail requests by priority.