File indexing completed on 2024-05-05 05:38:31

0001 /*
0002     SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "notificationmanager_export.h"
0010 
0011 #include <QObject>
0012 #include <QString>
0013 #include <memory>
0014 
0015 #include <qqmlregistration.h>
0016 
0017 namespace NotificationManager
0018 {
0019 /**
0020  * @short Information about the notification server
0021  *
0022  * Provides information such as vendor, name, version of the notification server.
0023  *
0024  * @author Kai Uwe Broulik <kde@privat.broulik.de>
0025  **/
0026 class NOTIFICATIONMANAGER_EXPORT ServerInfo : public QObject
0027 {
0028     Q_OBJECT
0029     QML_ELEMENT
0030     QML_UNCREATABLE("Can only access ServerInfo via Server")
0031 
0032     Q_PROPERTY(Status status READ status NOTIFY statusChanged)
0033 
0034     Q_PROPERTY(QString vendor READ vendor NOTIFY vendorChanged)
0035 
0036     Q_PROPERTY(QString name READ name NOTIFY nameChanged)
0037 
0038     Q_PROPERTY(QString version READ version NOTIFY versionChanged)
0039 
0040     Q_PROPERTY(QString specVersion READ specVersion NOTIFY specVersionChanged)
0041 
0042 public:
0043     explicit ServerInfo(QObject *parent = nullptr);
0044     ~ServerInfo() override;
0045 
0046     enum class Status {
0047         Unknown = -1,
0048         NotRunning,
0049         Running,
0050     };
0051     Q_ENUM(Status)
0052 
0053     Status status() const;
0054     QString vendor() const;
0055     QString name() const;
0056     QString version() const;
0057     QString specVersion() const;
0058 
0059 Q_SIGNALS:
0060     void statusChanged(Status status);
0061     void vendorChanged(const QString &vendor);
0062     void nameChanged(const QString &name);
0063     void versionChanged(const QString &version);
0064     void specVersionChanged(const QString &specVersion);
0065 
0066 private:
0067     class Private;
0068     std::unique_ptr<Private> d;
0069 };
0070 
0071 } // namespace NotificationManager