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

/src/libtomahawk/sip/SipModel.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 67 lines | 39 code | 11 blank | 17 comment | 0 complexity | 2df1e157beb175d62cae85b4bcf41039 MD5 | raw file
 1/*
 2    <one line to give the program's name and a brief idea of what it does.>
 3    Copyright (C) 2011  Leo Franchi <lfranchi@kde.org>
 4
 5    This program 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    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
17*/
18
19
20#ifndef SIPMODEL_H
21#define SIPMODEL_H
22
23#include "dllmacro.h"
24
25#include <QModelIndex>
26#include <QStringList>
27
28class SipPluginFactory;
29class SipPlugin;
30
31class DLLEXPORT SipModel : public QAbstractItemModel
32{
33    Q_OBJECT
34public:
35    enum Roles {
36        PluginName = Qt::UserRole + 15,
37        ConnectionStateRole = Qt::UserRole + 17,
38        HasConfig = Qt::UserRole + 18,
39        FactoryRole = Qt::UserRole + 19,
40        ErrorString = Qt::UserRole + 20,
41        FactoryItemRole = Qt::UserRole + 21,
42        FactoryItemIcon = Qt::UserRole + 22,
43        SipPluginData = Qt::UserRole + 23,
44        SipPluginFactoryData = Qt::UserRole + 24
45    };
46
47    explicit SipModel( QObject* parent = 0 );
48    virtual ~SipModel();
49
50    virtual QModelIndex index ( int row, int column, const QModelIndex& parent = QModelIndex() ) const;
51    virtual QModelIndex parent ( const QModelIndex& child ) const;
52    virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
53    virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
54    virtual int columnCount( const QModelIndex& parent ) const;
55    virtual Qt::ItemFlags flags(const QModelIndex& index) const;
56    virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
57
58private slots:
59    void pluginAdded( SipPlugin* p );
60    void pluginRemoved( SipPlugin* p );
61    void pluginStateChanged( SipPlugin* p );
62
63private:
64    QList< SipPluginFactory* > m_factories;
65};
66
67#endif // SIPMODEL_H