1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
4
* Copyright 2011, Leo Franchi <lfranchi@kde.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 CHECKDIRTREE_H
21
#define CHECKDIRTREE_H
25
#include <QFileSystemModel>
28
class DLLEXPORT CheckDirModel : public QFileSystemModel
33
CheckDirModel( QWidget* parent = 0 );
34
virtual ~CheckDirModel();
36
virtual Qt::ItemFlags flags( const QModelIndex& index ) const;
37
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
38
virtual bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
40
void setCheck( const QModelIndex& index, const QVariant& value );
41
Qt::CheckState getCheck( const QModelIndex& index );
45
void dataChangedByUser( const QModelIndex & index );
48
void getFileInfoResult();
49
void volumeShowFinished();
50
void processErrorOutput();
52
QHash<QPersistentModelIndex, Qt::CheckState> m_checkTable;
55
QString m_setFilePath;
56
QString m_getFileInfoPath;
60
class DLLEXPORT CheckDirTree : public QTreeView
65
CheckDirTree( QWidget* parent );
67
void checkPath( const QString& path, Qt::CheckState state );
69
void setExclusions( const QStringList& list );
70
QStringList getExclusions();
71
QStringList getCheckedPaths();
78
void onCollapse( const QModelIndex& idx );
79
void onExpand( const QModelIndex& idx );
80
void updateNode( const QModelIndex& idx );
84
CheckDirModel m_dirModel;
85
QSet<qint64> m_expandedSet;
87
void fillDown( const QModelIndex& index );
88
void updateParent( const QModelIndex& index );
89
void getExclusionsForNode( const QModelIndex& index, QStringList& exclusions );
90
void getChecksForNode( const QModelIndex& index, QStringList& checks );
93
#endif // CHECKDIRTREE_H