File indexing completed on 2024-05-19 04:48:26

0001 #pragma once
0002 
0003 #include <QObject>
0004 
0005 #include <MauiKit3/Core/mauilist.h>
0006 
0007 class TracksModel : public MauiList
0008 {
0009     Q_OBJECT
0010     Q_PROPERTY(QString query READ getQuery WRITE setQuery NOTIFY queryChanged)
0011     Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged)
0012 
0013 public:
0014     explicit TracksModel(QObject *parent = nullptr);
0015 
0016     void componentComplete() override final;
0017     const FMH::MODEL_LIST &items() const override final;
0018 
0019     void setQuery(const QString &query);
0020     QString getQuery() const;
0021 
0022     int limit() const;
0023     void setLimit(int limit);
0024 
0025 private:
0026     FMH::MODEL_LIST list;
0027     QString query;
0028     int m_limit = 99999;
0029     int m_newTracks;
0030 
0031     void setList();
0032 
0033 Q_SIGNALS:
0034     void queryChanged();
0035     void limitChanged(int limit);
0036 
0037 public Q_SLOTS:
0038     bool append(const QVariantMap &item);
0039     bool appendUrl(const QUrl &url);
0040 
0041     bool insertUrl(const QString &url, const int &index);
0042     bool insertUrls(const QStringList &urls, const int &index);
0043 
0044     bool appendUrls(const QStringList &urls);
0045     bool appendAt(const QVariantMap &item, const int &at);
0046     bool appendQuery(const QString &query);
0047 
0048     void copy(const TracksModel *list);
0049 
0050     void clear();
0051     bool fav(const int &index, const bool &value);
0052     bool countUp(const int &index);
0053     bool remove(const int &index);
0054     bool erase(const int &index);
0055     bool removeMissing(const int &index);
0056 
0057     void refresh();
0058     bool update(const QVariantMap &data, const int &index);
0059     
0060     void updateMetadata(const QVariantMap &data, const int &index);
0061 
0062     bool move(const int &index, const int &to);
0063 
0064     QStringList urls() const;
0065 };
0066