File indexing completed on 2024-05-12 04:47:03

0001 #pragma once
0002 
0003 #include <QObject>
0004 
0005 #include <MauiKit3/Core/fmh.h>
0006 #include <MauiKit3/Core/mauilist.h>
0007 
0008 namespace FMH
0009 {
0010 class FileLoader;
0011 }
0012 
0013 class LibraryModel : public MauiList
0014 {
0015     Q_OBJECT
0016     Q_PROPERTY(QStringList sources READ sources WRITE setSources NOTIFY sourcesChanged RESET resetSources)
0017 
0018 public:
0019     explicit LibraryModel(QObject *parent = nullptr);
0020     const FMH::MODEL_LIST &items() const override;
0021     void componentComplete() override final;
0022 
0023     QStringList sources() const;
0024     void resetSources();
0025 
0026 private:
0027     FMH::FileLoader *m_fileLoader;
0028     FMH::MODEL_LIST list;  
0029 
0030     void setList(const QStringList &sources);
0031 
0032     QStringList m_sources;
0033 
0034 public Q_SLOTS:
0035     bool remove(const int &index);
0036     bool deleteAt(const int &index);
0037     bool bookmark(const int &index, const int &value);
0038     void clear();
0039     void rescan();
0040     void setSources(QStringList sources);
0041 
0042 Q_SIGNALS:
0043     void sourcesChanged(QStringList sources);
0044 };