File indexing completed on 2024-05-19 04:48:42
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@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 0017 #ifndef USERPLAYLISTMODEL_H 0018 #define USERPLAYLISTMODEL_H 0019 0020 #include "amarok_export.h" 0021 #include "browsers/playlistbrowser/PlaylistBrowserModel.h" 0022 #include "core/meta/forward_declarations.h" 0023 #include "core/playlists/Playlist.h" 0024 0025 #include <QAction> 0026 #include <QAbstractItemModel> 0027 #include <QModelIndex> 0028 #include <QVariant> 0029 0030 #define PLAYLIST_DB_VERSION 1 0031 0032 namespace PlaylistBrowserNS { 0033 0034 /** 0035 @author Nikolaj Hald Nielsen <nhn@kde.org> 0036 */ 0037 class UserModel : public PlaylistBrowserModel 0038 { 0039 Q_OBJECT 0040 public: 0041 static UserModel * instance(); 0042 static void destroy(); 0043 0044 ~UserModel() override; 0045 0046 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override; 0047 bool removeRows( int row, int count, const QModelIndex & parent = QModelIndex() ) override; 0048 0049 Qt::DropActions supportedDropActions() const override { 0050 return Qt::CopyAction | Qt::MoveAction; 0051 } 0052 0053 Qt::DropActions supportedDragActions() const override { 0054 return Qt::MoveAction | Qt::CopyAction; 0055 } 0056 0057 bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) override; 0058 0059 private: 0060 UserModel(); 0061 static UserModel * s_instance; 0062 }; 0063 0064 } 0065 0066 namespace The { 0067 AMAROK_EXPORT PlaylistBrowserNS::UserModel* userPlaylistModel(); 0068 } 0069 #endif