File indexing completed on 2024-05-12 04:45:58
0001 #pragma once 0002 0003 #include <QDebug> 0004 0005 #include <MauiKit3/Core/fmh.h> 0006 #include <MauiKit3/FileBrowsing/fmstatic.h> 0007 0008 class Clip : public QObject 0009 { 0010 Q_OBJECT 0011 Q_PROPERTY(QVariantList sourcesModel READ sourcesModel NOTIFY sourcesChanged FINAL) 0012 Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged FINAL) 0013 Q_PROPERTY(bool mpvAvailable READ mpvAvailable CONSTANT FINAL) 0014 0015 public: 0016 static Clip * instance() 0017 { 0018 static Clip clip; 0019 return &clip; 0020 } 0021 0022 Clip(const Clip &) = delete; 0023 Clip &operator=(const Clip &) = delete; 0024 Clip(Clip &&) = delete; 0025 Clip &operator=(Clip &&) = delete; 0026 0027 bool mpvAvailable() const; 0028 0029 public Q_SLOTS: 0030 QVariantList sourcesModel() const; 0031 QStringList sources() const; 0032 0033 void addSources(const QStringList &paths); 0034 void removeSources(const QString &path); 0035 0036 void openVideos(const QList<QUrl> &urls); 0037 void refreshCollection(); 0038 /*File actions*/ 0039 static void showInFolder(const QStringList &urls); 0040 0041 private: 0042 explicit Clip(QObject* parent = nullptr); 0043 0044 static const QStringList getSourcePaths(); 0045 0046 static void saveSourcePath(QStringList const& paths); 0047 0048 static void removeSourcePath(const QString &path); 0049 0050 Q_SIGNALS: 0051 void refreshViews(QVariantMap tables); 0052 void openUrls(QStringList urls); 0053 void sourcesChanged(); 0054 }; 0055