File indexing completed on 2024-04-28 04:45:41

0001 #pragma once
0002 
0003 #include <QObject>
0004 
0005 class Library : public QObject
0006 {
0007     Q_OBJECT
0008     Q_DISABLE_COPY_MOVE(Library)
0009     Q_PROPERTY(QVariantList sources READ sourcesModel NOTIFY sourcesChanged FINAL)
0010 
0011 public:
0012     static Library * instance();
0013     QVariantList sourcesModel() const;
0014     QStringList sources() const;
0015 
0016 public Q_SLOTS:
0017     void openFiles(QStringList files);
0018     void removeSource(const QString &url);
0019     void addSources(const QStringList &urls);
0020 
0021     bool isPDF(const QString &url);
0022     bool isPlainText(const QString &url);
0023     bool isEpub(const QString &url);
0024     bool isCommicBook(const QString &url);
0025 
0026 private:
0027     static Library *m_instance;
0028     explicit Library(QObject *parent = nullptr);
0029     QStringList m_sources;
0030 
0031 Q_SIGNALS:
0032     void requestedFiles(QList<QUrl> files);
0033     void sourcesChanged(QStringList sources);
0034 
0035 };