/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. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef SIPMODEL_H
  16. #define SIPMODEL_H
  17. #include "dllmacro.h"
  18. #include <QModelIndex>
  19. #include <QStringList>
  20. class SipPluginFactory;
  21. class SipPlugin;
  22. class DLLEXPORT SipModel : public QAbstractItemModel
  23. {
  24. Q_OBJECT
  25. public:
  26. enum Roles {
  27. PluginName = Qt::UserRole + 15,
  28. ConnectionStateRole = Qt::UserRole + 17,
  29. HasConfig = Qt::UserRole + 18,
  30. FactoryRole = Qt::UserRole + 19,
  31. ErrorString = Qt::UserRole + 20,
  32. FactoryItemRole = Qt::UserRole + 21,
  33. FactoryItemIcon = Qt::UserRole + 22,
  34. SipPluginData = Qt::UserRole + 23,
  35. SipPluginFactoryData = Qt::UserRole + 24
  36. };
  37. explicit SipModel( QObject* parent = 0 );
  38. virtual ~SipModel();
  39. virtual QModelIndex index ( int row, int column, const QModelIndex& parent = QModelIndex() ) const;
  40. virtual QModelIndex parent ( const QModelIndex& child ) const;
  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. private slots:
  47. void pluginAdded( SipPlugin* p );
  48. void pluginRemoved( SipPlugin* p );
  49. void pluginStateChanged( SipPlugin* p );
  50. private:
  51. QList< SipPluginFactory* > m_factories;
  52. };
  53. #endif // SIPMODEL_H