File indexing completed on 2024-05-19 04:50:29
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef STATSYNCING_SINGLETRACKSMODEL_H 0018 #define STATSYNCING_SINGLETRACKSMODEL_H 0019 0020 #include "statsyncing/Track.h" 0021 #include "statsyncing/models/CommonModel.h" 0022 0023 #include <QAbstractTableModel> 0024 0025 namespace StatSyncing 0026 { 0027 /** 0028 * Model that provides data about single tracks that for some radon didn't end up 0029 * in synchronization. 0030 */ 0031 class SingleTracksModel : public QAbstractTableModel, protected CommonModel 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 /** 0037 * Construct model of single tracks. 0038 * 0039 * @param tracks list of tracks 0040 * @param columns list of Meta::val* fields that will form columns of the model 0041 * must include Meta::valTitle, may include: valRating, 0042 * valFirstPlayed, valLastPlayed, valPlaycount, valLabel. 0043 * @param options the options 0044 * @param parent the parent QObject 0045 */ 0046 SingleTracksModel( const TrackList &tracks, const QList<qint64> &columns, 0047 const Options &options, QObject *parent = nullptr ); 0048 0049 int rowCount( const QModelIndex &parent = QModelIndex() ) const override; 0050 int columnCount( const QModelIndex &parent = QModelIndex() ) const override; 0051 0052 QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; 0053 0054 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; 0055 Qt::ItemFlags flags( const QModelIndex &index ) const override; 0056 0057 QStringList mimeTypes() const override; 0058 QMimeData *mimeData( const QModelIndexList &indexes ) const override; 0059 0060 private: 0061 TrackList m_tracks; 0062 }; 0063 0064 } // namespace StatSyncing 0065 0066 #endif // STATSYNCING_SINGLETRACKSMODEL_H