hemeraservicemodel.h
1 #ifndef HEMERA_SERVICEMODEL_H
2 #define HEMERA_SERVICEMODEL_H
3 
4 #include <QtCore/QAbstractListModel>
5 
6 namespace Hemera {
7 
8 class ServiceManager;
9 
28 class ServiceModel : public QAbstractListModel
29 {
30  Q_OBJECT
31  Q_DISABLE_COPY(ServiceModel)
32 
33 public:
42  enum Roles {
44  ServiceTypeRole = Qt::UserRole + 5, // Start with decent padding
72  };
73 
79  enum class ModelDisplayType {
90  Orbits,
95  };
96 
113  explicit ServiceModel(ServiceManager *manager, ModelDisplayType type, QObject *parent = nullptr);
114  virtual ~ServiceModel();
115 
116  virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
117  virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
118 
119  virtual bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const override;
120 
121  virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
122 
123  virtual QHash< int, QByteArray > roleNames() const override;
124 
125 private:
126  class Private;
127  Private * const d;
128 };
129 }
130 
131 #endif // HEMERA_SERVICEMODEL_H
Human-readable description of the service, if any.
Definition: hemeraservicemodel.h:52
ServiceModel(ServiceManager *manager, ModelDisplayType type, QObject *parent=nullptr)
Constructs a new ServiceModel.
Definition: hemeraservicemodel.cpp:20
Definition: hemeraqmlappliance.cpp:3
The version of the service, if any.
Definition: hemeraservicemodel.h:50
Definition: hemeraservicemodel.h:71
A list of mimetypes handled by this service, if any.
Definition: hemeraservicemodel.h:56
The type of the service, as in Hemera::ServiceInfo::ServiceType.
Definition: hemeraservicemodel.h:44
Convenience Model to access ServiceManager.
Definition: hemeraservicemodel.h:28
URL to the service's icon, if any.
Definition: hemeraservicemodel.h:54
Definition: hemeraservicemodel.h:64
The common name of the service.
Definition: hemeraservicemodel.h:48
Provides access to this system's installed services, such as Applications and more.
Definition: hemeraservicemanager.h:72
The ID of the service.
Definition: hemeraservicemodel.h:46
ModelDisplayType
Definition: hemeraservicemodel.h:79
Roles
Special roles exposed by this model.
Definition: hemeraservicemodel.h:42
Lists all applications on the system. Equivalent to ServiceManager::services(Application) ...