2023-07-10 10:18:33 +08:00
|
|
|
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
#ifndef APPLICATIONSERVICE_H
|
|
|
|
#define APPLICATIONSERVICE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QDBusObjectPath>
|
2023-07-17 14:49:35 +08:00
|
|
|
#include <QMap>
|
|
|
|
#include <QString>
|
|
|
|
#include <QDBusUnixFileDescriptor>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include "instanceservice.h"
|
|
|
|
#include "global.h"
|
2023-07-10 10:18:33 +08:00
|
|
|
|
|
|
|
class ApplicationService : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2023-07-17 14:49:35 +08:00
|
|
|
~ApplicationService() override;
|
|
|
|
ApplicationService(const ApplicationService&) = delete;
|
|
|
|
ApplicationService(ApplicationService &&) = delete;
|
|
|
|
ApplicationService& operator=(const ApplicationService&) = delete;
|
|
|
|
ApplicationService &operator=(ApplicationService &&) = delete;
|
|
|
|
|
|
|
|
Q_PROPERTY(QStringList Actions READ actions CONSTANT)
|
|
|
|
QStringList actions() const noexcept;
|
|
|
|
QStringList& actionsRef() noexcept;
|
|
|
|
|
|
|
|
Q_PROPERTY(QString ID READ iD CONSTANT)
|
|
|
|
QString iD() const noexcept;
|
|
|
|
|
|
|
|
Q_PROPERTY(IconMap Icons READ icons)
|
|
|
|
IconMap icons() const;
|
|
|
|
IconMap& iconsRef();
|
|
|
|
|
|
|
|
Q_PROPERTY(bool AutoStart READ isAutoStart WRITE setAutoStart)
|
|
|
|
bool isAutoStart() const noexcept;
|
|
|
|
void setAutoStart(bool autostart) noexcept;
|
|
|
|
|
|
|
|
Q_PROPERTY(QList<QDBusObjectPath> Instances READ instances)
|
|
|
|
QList<QDBusObjectPath> instances() const noexcept;
|
|
|
|
|
|
|
|
void recoverInstances(const QList<QDBusObjectPath>) noexcept;
|
|
|
|
bool removeOneInstance(const QDBusObjectPath &instance);
|
|
|
|
void removeAllInstance();
|
2023-07-10 10:18:33 +08:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
2023-07-17 14:49:35 +08:00
|
|
|
QString GetActionName(const QString &identifier, const QStringList &env);
|
2023-07-10 10:18:33 +08:00
|
|
|
QDBusObjectPath Launch(const QString &action, const QStringList &fields, const QVariantMap &options);
|
2023-07-17 14:49:35 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class ApplicationManager1Service;
|
|
|
|
explicit ApplicationService(QString ID);
|
|
|
|
bool m_AutoStart;
|
|
|
|
QString m_ID;
|
|
|
|
QDBusObjectPath m_applicationPath;
|
|
|
|
QStringList m_actions;
|
|
|
|
QMap<QDBusObjectPath,QSharedPointer<InstanceService>> m_Instances;
|
|
|
|
IconMap m_Icons;
|
2023-07-10 10:18:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|