PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 35ms app.codeStats 0ms

/src/resolversmodel.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 64 lines | 35 code | 12 blank | 17 comment | 0 complexity | b0f3b960af5b42b1d3943d2d79c94ca5 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 4 *
 5 *   Tomahawk is free software: you can redistribute it and/or modify
 6 *   it under the terms of the GNU General Public License as published by
 7 *   the Free Software Foundation, either version 3 of the License, or
 8 *   (at your option) any later version.
 9 *
10 *   Tomahawk is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20#ifndef RESOLVERSMODEL_H
21#define RESOLVERSMODEL_H
22
23#include <QModelIndex>
24#include <QStringList>
25#include <QSet>
26
27class ResolversModel : public QAbstractListModel
28{
29    Q_OBJECT
30public:
31    enum Roles {
32        ResolverName = Qt::UserRole + 15,
33        ResolverPath = Qt::UserRole + 16,
34        HasConfig = Qt::UserRole + 17,
35        ErrorState = Qt::UserRole + 18
36    };
37
38    explicit ResolversModel( QObject* parent = 0 );
39    virtual ~ResolversModel();
40
41    virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
42    virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
43    virtual int columnCount( const QModelIndex& parent ) const;
44    virtual Qt::ItemFlags flags(const QModelIndex& index) const;
45    virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
46
47    void addResolver( const QString& resolver, bool enable = false );
48    void atticaResolverInstalled ( const QString& resolverId );
49    void removeResolver( const QString& resolver );
50
51    void saveScriptResolvers();
52
53signals:
54    void openConfig( const QString& filePath );
55
56private slots:
57    void resolverChanged();
58
59private:
60    void addInstalledResolvers();
61    QSet<QString> m_waitingForLoad;
62};
63
64#endif // RESOLVERSMODEL_H