// SPDX-FileCopyrightText: 2022 Devin Lin // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include #include #include #include #include #include #include #include #include #include #include "homescreen.h" class HomeScreen; /** * @short Object that represents an application. */ class FolioApplication : public QObject { Q_OBJECT Q_PROPERTY(bool running READ running NOTIFY windowChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(QString icon READ icon NOTIFY iconChanged) Q_PROPERTY(QString storageId READ storageId NOTIFY storageIdChanged) public: FolioApplication(HomeScreen *parent = nullptr, KService::Ptr service = QExplicitlySharedDataPointer{nullptr}); static FolioApplication *fromJson(QJsonObject &obj, HomeScreen *parent); // may return nullptr QJsonObject toJson() const; bool running() const; QString name() const; QString icon() const; QString storageId() const; KWayland::Client::PlasmaWindow *window() const; void setName(QString &name); void setIcon(QString &icon); void setStorageId(QString &storageId); void setWindow(KWayland::Client::PlasmaWindow *window); Q_INVOKABLE void setMinimizedDelegate(QQuickItem *delegate); Q_INVOKABLE void unsetMinimizedDelegate(QQuickItem *delegate); Q_SIGNALS: void nameChanged(); void iconChanged(); void storageIdChanged(); void windowChanged(); private: bool m_running; QString m_name; QString m_icon; QString m_storageId; KWayland::Client::PlasmaWindow *m_window{nullptr}; };