Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ExtensionSlotModel.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3#pragma once
4
5#include "phosphorcontrol_export.h"
6
7#include <QAbstractListModel>
8#include <QList>
9#include <QPointer>
10#include <QString>
11#include <QVariantMap>
12#include <QtQml/qqmlregistration.h>
13
14namespace PhosphorControl {
15
17
18Q_MOC_INCLUDE("PhosphorControl/ApplicationController.h")
19
20
27class PHOSPHORCONTROL_EXPORT ExtensionSlotModel : public QAbstractListModel
28{
29 Q_OBJECT
32 Q_PROPERTY(QString pageId READ pageId WRITE setPageId NOTIFY pageIdChanged)
33 Q_PROPERTY(QString slot READ slotId WRITE setSlotId NOTIFY slotIdChanged)
34 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 QML_ELEMENT
36
37public:
51 Q_ENUM(Role)
52
53 explicit ExtensionSlotModel(QObject* parent = nullptr);
54
57 QString pageId() const;
58 void setPageId(const QString& pageId);
59 QString slotId() const;
60 void setSlotId(const QString& slot);
61 int count() const;
62
63 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
64 QVariant data(const QModelIndex& index, int role) const override;
65 QHash<int, QByteArray> roleNames() const override;
66
67Q_SIGNALS:
72
73private:
77 struct Row
78 {
79 QVariantMap entry;
80 QPointer<QObject> domain;
81 };
82
83 void refresh();
84 void applyList(const QList<QVariantMap>& next);
85
86 QPointer<ApplicationController> m_settingsApp;
87 QString m_pageId;
88 QString m_slot;
89 QList<Row> m_rows;
93 bool m_refreshing = false;
94 bool m_refreshPending = false;
95};
96
97} // namespace PhosphorControl
Top-level orchestrator for a phosphor-control application.
Definition ApplicationController.h:47
QHash< int, QByteArray > roleNames() const override
ExtensionSlotModel(QObject *parent=nullptr)
ApplicationController * settingsApp() const
Role
Definition ExtensionSlotModel.h:38
@ FailedRole
Definition ExtensionSlotModel.h:46
@ DomainRole
Definition ExtensionSlotModel.h:45
@ ExtensionIdRole
Definition ExtensionSlotModel.h:39
@ DisabledAfterCrashRole
Definition ExtensionSlotModel.h:48
@ ModulePageIdRole
Definition ExtensionSlotModel.h:43
@ ModuleFailedRole
Definition ExtensionSlotModel.h:47
@ NameRole
Definition ExtensionSlotModel.h:42
@ ErrorRole
Definition ExtensionSlotModel.h:49
@ ModuleNameRole
Definition ExtensionSlotModel.h:41
@ QmlSourceRole
Definition ExtensionSlotModel.h:44
@ ModuleIdRole
Definition ExtensionSlotModel.h:40
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void setSlotId(const QString &slot)
void setPageId(const QString &pageId)
void setSettingsApp(ApplicationController *settingsApp)
QVariant data(const QModelIndex &index, int role) const override
Definition ApplicationController.h:21