File indexing completed on 2024-05-19 04:50:16
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Casey Link <unnamedrambler@gmail.com> * 0003 * Copyright (c) 2005-2007 Christian Muehlhaeuser, Last.fm Ltd <chris@last.fm> * 0004 * Copyright (c) 2005-2007 Max Howell, Last.fm Ltd <max@last.fm> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) any later * 0009 * version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0013 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License along with * 0016 * this program. If not, see <http://www.gnu.org/licenses/>. * 0017 ****************************************************************************************/ 0018 0019 #ifndef LASTFMTREEVIEW_H 0020 #define LASTFMTREEVIEW_H 0021 0022 #include "playlist/PlaylistController.h" 0023 #include "widgets/PrettyTreeView.h" 0024 0025 #include <QList> 0026 #include <QMutex> 0027 #include <QPointer> 0028 0029 class LastFmTreeModel; 0030 0031 class QAction; 0032 class QContextMenuEvent; 0033 class QMouseEvent; 0034 class PopupDropper; 0035 0036 typedef QList<QAction *> QActionList; 0037 0038 class LastFmTreeView : public Amarok::PrettyTreeView 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 explicit LastFmTreeView ( QWidget* parent = nullptr ); 0044 ~LastFmTreeView() override; 0045 0046 Q_SIGNALS: 0047 void statusMessage ( const QString& message ); 0048 void plsShowRestState(); 0049 void plsShowNowPlaying(); 0050 0051 private Q_SLOTS: 0052 void slotReplacePlaylistByChildTracks(); 0053 void slotAppendChildTracks(); 0054 0055 protected: 0056 void contextMenuEvent ( QContextMenuEvent* ) override; 0057 void mouseDoubleClickEvent( QMouseEvent *event ) override; 0058 void startDrag( Qt::DropActions supportedActions ) override; 0059 0060 private: 0061 enum ContextMenuActionType { ExecQMenu, DoQMenuDefaultAction }; 0062 void playChildTracks ( const QModelIndex &item, Playlist::AddOptions insertMode ); 0063 void playChildTracks ( const QModelIndexList &items, Playlist::AddOptions insertMode ); 0064 QActionList createBasicActions( const QModelIndexList &indices ); 0065 0066 QTimer* m_timer; 0067 LastFmTreeModel* m_model; 0068 PopupDropper* m_pd; 0069 QAction* m_appendAction; 0070 QAction* m_loadAction; 0071 QModelIndexList m_currentItems; 0072 QMutex m_dragMutex; 0073 bool m_ongoingDrag; 0074 }; 0075 0076 #endif