File indexing completed on 2024-05-19 04:48:40
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Bart Cerneels <bart.cerneels@kde.org> * 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 #ifndef PLAYLISTSBYPROVIDERPROXY_H 0017 #define PLAYLISTSBYPROVIDERPROXY_H 0018 0019 #include "QtGroupingProxy.h" 0020 #include "PlaylistBrowserModel.h" 0021 0022 #include <QAction> 0023 0024 class PlaylistsByProviderProxy : public QtGroupingProxy 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit PlaylistsByProviderProxy( int playlistCategory, QObject *parent = nullptr ); 0029 PlaylistsByProviderProxy( QAbstractItemModel *model, int column, int playlistCategory ); 0030 ~PlaylistsByProviderProxy() override {} 0031 0032 /* QtGroupingProxy methods */ 0033 /* reimplement to handle tracks with multiple providers (synced) */ 0034 QVariant data( const QModelIndex &idx, int role ) const override; 0035 0036 /* reimplemented to prevent changing providers name */ 0037 Qt::ItemFlags flags( const QModelIndex &idx ) const override; 0038 0039 /* QAbstractModel methods */ 0040 bool removeRows( int row, int count, 0041 const QModelIndex &parent = QModelIndex() ) override; 0042 QStringList mimeTypes() const override; 0043 QMimeData *mimeData( const QModelIndexList &indexes ) const override; 0044 bool dropMimeData( const QMimeData *data, Qt::DropAction action, 0045 int row, int column, const QModelIndex &parent ) override; 0046 0047 Qt::DropActions supportedDropActions() const override; 0048 Qt::DropActions supportedDragActions() const override; 0049 0050 // re-implement to connect renameIndex signal 0051 void setSourceModel( QAbstractItemModel *sourceModel ) override; 0052 0053 protected Q_SLOTS: 0054 //re-implemented to add empty providers 0055 void buildTree() override; 0056 0057 private Q_SLOTS: 0058 void slotRenameIndex( const QModelIndex &index ); 0059 void slotProviderAdded( Playlists::PlaylistProvider *provider, int category ); 0060 void slotProviderRemoved( Playlists::PlaylistProvider *provider, int category ); 0061 0062 private: 0063 int m_playlistCategory; 0064 }; 0065 0066 #endif // PLAYLISTSBYPROVIDERPROXY_H