feat: relay InstanceService PropertiesChanged signal

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2023-09-14 17:57:44 +08:00 committed by Comix
parent 6448481cfc
commit 51459ee33a
3 changed files with 10 additions and 5 deletions

View File

@ -513,7 +513,7 @@ void ApplicationService::detachAllInstance() noexcept
{ {
for (auto &instance : m_Instances.values()) { for (auto &instance : m_Instances.values()) {
orphanedInstances->append(instance); orphanedInstances->append(instance);
instance->m_orphaned = true; instance->setProperty("Orphaned", true);
} }
m_Instances.clear(); m_Instances.clear();

View File

@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-or-later // SPDX-License-Identifier: LGPL-3.0-or-later
#include "dbus/instanceservice.h" #include "dbus/instanceservice.h"
#include "propertiesForwarder.h"
#include <QCoreApplication> #include <QCoreApplication>
InstanceService::InstanceService(QString instanceId, QString application, QString systemdUnitPath, QString launcher) InstanceService::InstanceService(QString instanceId, QString application, QString systemdUnitPath, QString launcher)
@ -11,6 +12,7 @@ InstanceService::InstanceService(QString instanceId, QString application, QStrin
, m_Application(std::move(application)) , m_Application(std::move(application))
, m_SystemdUnitPath(std::move(systemdUnitPath)) , m_SystemdUnitPath(std::move(systemdUnitPath))
{ {
new PropertiesForwarder{application + "/" + instanceId, this};
} }
InstanceService::~InstanceService() = default; InstanceService::~InstanceService() = default;

View File

@ -18,13 +18,16 @@ public:
InstanceService &operator=(const InstanceService &) = delete; InstanceService &operator=(const InstanceService &) = delete;
InstanceService &operator=(InstanceService &&) = delete; InstanceService &operator=(InstanceService &&) = delete;
Q_PROPERTY(QDBusObjectPath Application MEMBER m_Application) Q_PROPERTY(QDBusObjectPath Application MEMBER m_Application CONSTANT)
Q_PROPERTY(QDBusObjectPath SystemdUnitPath MEMBER m_SystemdUnitPath) Q_PROPERTY(QDBusObjectPath SystemdUnitPath MEMBER m_SystemdUnitPath CONSTANT)
Q_PROPERTY(QString Launcher MEMBER m_Launcher) Q_PROPERTY(QString Launcher MEMBER m_Launcher CONSTANT)
Q_PROPERTY(bool Orphaned MEMBER m_orphaned) Q_PROPERTY(bool Orphaned MEMBER m_orphaned NOTIFY orphanedChanged)
[[nodiscard]] const QString &instanceId() const noexcept { return m_instanceId; } [[nodiscard]] const QString &instanceId() const noexcept { return m_instanceId; }
Q_SIGNALS:
void orphanedChanged();
private: private:
friend class ApplicationService; friend class ApplicationService;
InstanceService(QString instanceId, QString application, QString systemdUnitPath, QString launcher); InstanceService(QString instanceId, QString application, QString systemdUnitPath, QString launcher);