1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
4
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
6
* Tomahawk is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* Tomahawk is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef SOURCETREEVIEW_H
21
#define SOURCETREEVIEW_H
24
#include "SourcePlaylistInterface.h"
29
class SourceTreePopupDialog;
30
class CollectionModel;
33
class SourcesProxyModel;
41
class SourceTreeView : public QTreeView
46
explicit SourceTreeView( QWidget* parent = 0 );
50
void showOfflineSources( bool offlineSourcesShown );
52
void renamePlaylist();
54
void update( const QModelIndex &index );
57
void onOnline( const QModelIndex& index );
58
void onOffline( const QModelIndex& index );
60
void latchRequest( const Tomahawk::source_ptr& source );
61
void unlatchRequest( const Tomahawk::source_ptr& source );
62
void catchUpRequest();
63
void latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime );
66
void onItemExpanded( const QModelIndex& idx );
67
void onItemActivated( const QModelIndex& index );
68
void selectRequest( const QPersistentModelIndex& idx );
69
void expandRequest( const QPersistentModelIndex& idx );
70
void toggleExpandRequest( const QPersistentModelIndex& idx );
71
void onItemDoubleClicked( const QModelIndex& idx );
74
void deletePlaylist( const QModelIndex& = QModelIndex() );
75
void copyPlaylistLink();
76
void exportPlaylist();
79
void latchOnOrCatchUp();
81
void latchOnOrCatchUp( const Tomahawk::source_ptr& source );
82
void latchOff( const Tomahawk::source_ptr& source );
83
void latchModeToggled( bool checked );
85
void onCustomContextMenu( const QPoint& pos );
86
void onSelectionChanged();
88
void onDeletePlaylistResult( bool result );
91
void drawRow( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
92
void drawBranches( QPainter *painter, const QRect &rect, const QModelIndex &index ) const;
94
virtual void paintEvent( QPaintEvent* event );
96
virtual void dragEnterEvent( QDragEnterEvent* event );
97
virtual void dragLeaveEvent( QDragLeaveEvent* event );
98
virtual void dragMoveEvent( QDragMoveEvent* event );
99
virtual void dropEvent( QDropEvent* event );
100
virtual void keyPressEvent( QKeyEvent* event );
105
template< typename T >
106
T* itemFromIndex( const QModelIndex& index ) const;
108
SourcesModel* m_model;
109
SourcesProxyModel* m_proxyModel;
110
QModelIndex m_contextMenuIndex;
111
SourceDelegate* m_delegate;
112
Tomahawk::LatchManager* m_latchManager;
113
QWeakPointer<SourceTreePopupDialog> m_popupDialog;
115
QMenu m_playlistMenu;
116
QMenu m_roPlaylistMenu;
122
QPersistentModelIndex m_dropIndex;
124
QPersistentModelIndex m_selectedIndex;
127
#endif // SOURCETREEVIEW_H