File indexing completed on 2024-03-24 04:51:52
0001 /* 0002 * SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #ifndef WORKER_H 0008 #define WORKER_H 0009 0010 #include <KFileMetaData/Properties> 0011 #include <QImage> 0012 #include <QObject> 0013 #include <kconfig_version.h> 0014 #include <memory> 0015 0016 class KConfig; 0017 class QQuickWindow; 0018 0019 class Worker : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 static Worker *instance(); 0024 0025 Q_SIGNALS: 0026 void metaDataReady(int index, KFileMetaData::PropertyMultiMap metadata); 0027 void thumbnailSuccess(const QString &path, const QImage &image); 0028 void thumbnailFail(); 0029 void mprisThumbnailSuccess(const QImage &image); 0030 0031 public Q_SLOTS: 0032 void getMetaData(int index, const QString &path); 0033 void makePlaylistThumbnail(const QString &path, int width); 0034 QImage frameToImage(const QString &path, int width); 0035 void syncConfigValue(QString path, QString group, QString key, QVariant value); 0036 void saveWindowGeometry(QQuickWindow *window) const; 0037 void mprisThumbnail(const QString &path, int width); 0038 0039 private: 0040 Worker() = default; 0041 ~Worker() = default; 0042 0043 Worker(const Worker &) = delete; 0044 Worker &operator=(const Worker &) = delete; 0045 Worker(Worker &&) = delete; 0046 Worker &operator=(Worker &&) = delete; 0047 0048 private: 0049 std::unique_ptr<KConfig> m_cachedConf; 0050 }; 0051 0052 #endif // WORKER_H