/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. #ifndef RESOLVERSMODEL_H
  19. #define RESOLVERSMODEL_H
  20. #include <QModelIndex>
  21. #include <QStringList>
  22. #include <QSet>
  23. class ResolversModel : public QAbstractListModel
  24. {
  25. Q_OBJECT
  26. public:
  27. enum Roles {
  28. ResolverName = Qt::UserRole + 15,
  29. ResolverPath = Qt::UserRole + 16,
  30. HasConfig = Qt::UserRole + 17,
  31. ErrorState = Qt::UserRole + 18
  32. };
  33. explicit ResolversModel( QObject* parent = 0 );
  34. virtual ~ResolversModel();
  35. virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
  36. virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
  37. virtual int columnCount( const QModelIndex& parent ) const;
  38. virtual Qt::ItemFlags flags(const QModelIndex& index) const;
  39. virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
  40. void addResolver( const QString& resolver, bool enable = false );
  41. void atticaResolverInstalled ( const QString& resolverId );
  42. void removeResolver( const QString& resolver );
  43. void saveScriptResolvers();
  44. signals:
  45. void openConfig( const QString& filePath );
  46. private slots:
  47. void resolverChanged();
  48. private:
  49. void addInstalledResolvers();
  50. QSet<QString> m_waitingForLoad;
  51. };
  52. #endif // RESOLVERSMODEL_H