FluentUI/example/InstallHelper.h

45 lines
1009 B
C
Raw Normal View History

2023-03-02 18:21:43 +08:00
#ifndef INSTALLHELPER_H
#define INSTALLHELPER_H
#include <QObject>
2023-03-03 18:19:48 +08:00
#include <QGuiApplication>
2023-03-02 18:21:43 +08:00
#include <QDebug>
2023-03-03 18:19:48 +08:00
2023-03-02 18:21:43 +08:00
#include "stdafx.h"
2023-03-03 18:19:48 +08:00
2023-03-02 18:21:43 +08:00
class InstallHelper : public QObject
{
2023-03-03 18:19:48 +08:00
2023-03-02 18:21:43 +08:00
Q_OBJECT
Q_PROPERTY_AUTO(bool,installing)
2023-03-05 23:39:13 +08:00
Q_PROPERTY_AUTO(bool,uninstallSuccess)
Q_PROPERTY_AUTO(QString,errorInfo)
2023-03-02 18:21:43 +08:00
public:
explicit InstallHelper(QObject *parent = nullptr);
Q_INVOKABLE void install(const QString& path,bool isHome,bool isStartMenu);
2023-03-03 18:19:48 +08:00
Q_INVOKABLE QString applicationFilePath(){
return QGuiApplication::arguments().join(" ");
}
Q_INVOKABLE bool isNavigateUninstall(){
2023-03-05 23:39:13 +08:00
return QGuiApplication::arguments().contains("--uninstall");
// return true;
2023-03-03 18:19:48 +08:00
}
2023-03-05 23:39:13 +08:00
Q_INVOKABLE bool isNavigateInstall();
Q_INVOKABLE QString pid(){
return QString::number(QCoreApplication::applicationPid());
}
2023-03-02 18:21:43 +08:00
2023-03-05 23:39:13 +08:00
Q_INVOKABLE void uninstall();
static InstallHelper *getInstance();
private:
static InstallHelper* m_instance;
2023-03-02 18:21:43 +08:00
};
#endif // INSTALLHELPER_H