pluginsmodel.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef QSTARDICT_PLUGINSMODEL_H
  2. #define QSTARDICT_PLUGINSMODEL_H
  3. #include <QAbstractTableModel>
  4. #include <QStringList>
  5. #include <QIcon>
  6. namespace QStarDict {
  7. class PluginManager;
  8. class PluginsModel : public QAbstractTableModel
  9. {
  10. Q_OBJECT
  11. PluginManager *pmanager;
  12. QStringList pluginIds; // by priority
  13. QIcon settingIcon;
  14. public:
  15. enum class LoadType
  16. {
  17. All,
  18. JustDict,
  19. ExceptDict
  20. };
  21. enum Roles {
  22. IdRole = Qt::UserRole
  23. };
  24. PluginsModel(LoadType lt, PluginManager *pmanager);
  25. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  26. int columnCount(const QModelIndex &parent = QModelIndex()) const;
  27. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  28. bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
  29. Qt::ItemFlags flags(const QModelIndex &index) const;
  30. QStringList loadedPlugins();
  31. QString pluginId(int row) const;
  32. signals:
  33. void loadedListChanged();
  34. };
  35. } // namespace QStarDict
  36. #endif // QSTARDICT_PLUGINSMODEL_H