File indexing completed on 2024-05-05 04:50:49
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 TRACKSMODEL_H 0008 #define TRACKSMODEL_H 0009 0010 #include <QAbstractListModel> 0011 #include <QObject> 0012 #include <QtQml/qqmlregistration.h> 0013 0014 class TracksModel : public QAbstractListModel 0015 { 0016 Q_OBJECT 0017 QML_NAMED_ELEMENT(TracksModel) 0018 0019 public: 0020 explicit TracksModel(QObject *parent = nullptr); 0021 enum { TextRole = Qt::UserRole, LanguageRole, TitleRole, IDRole, CodecRole }; 0022 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0023 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0024 virtual QHash<int, QByteArray> roleNames() const override; 0025 0026 public Q_SLOTS: 0027 void setTracks(QList<QVariant> tracks); 0028 0029 private: 0030 QList<QVariant> m_tracks; 0031 }; 0032 0033 #endif // TRACKSMODEL_H