service/notifications: add notifications service

This commit is contained in:
outfoxxed 2024-07-10 12:27:10 -07:00
parent 79cbfba48a
commit d630cc7f76
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
15 changed files with 1249 additions and 0 deletions

View file

@ -72,3 +72,8 @@ bool UntypedObjectModel::removeObject(const QObject* object) {
}
qsizetype UntypedObjectModel::indexOf(QObject* object) { return this->valuesList.indexOf(object); }
UntypedObjectModel* UntypedObjectModel::emptyInstance() {
static auto* instance = new UntypedObjectModel(nullptr); // NOLINT
return instance;
}

View file

@ -55,6 +55,8 @@ public:
Q_INVOKABLE qsizetype indexOf(QObject* object);
static UntypedObjectModel* emptyInstance();
signals:
void valuesChanged();
/// Sent immediately before an object is inserted into the list.
@ -82,6 +84,10 @@ class ObjectModel: public UntypedObjectModel {
public:
explicit ObjectModel(QObject* parent): UntypedObjectModel(parent) {}
[[nodiscard]] QVector<T*>& valueList() {
return *reinterpret_cast<QVector<T*>*>(&this->valuesList); // NOLINT
}
[[nodiscard]] const QVector<T*>& valueList() const {
return *reinterpret_cast<const QVector<T*>*>(&this->valuesList); // NOLINT
}
@ -91,4 +97,8 @@ public:
}
void removeObject(const T* object) { this->UntypedObjectModel::removeObject(object); }
static ObjectModel<T>* emptyInstance() {
return static_cast<ObjectModel<T>*>(UntypedObjectModel::emptyInstance());
}
};