feat: 增加RunCommandWithOptions接口
无 Log: 无 Influence: 无 Task: https://pms.uniontech.com/task-view-220801.html Change-Id: Ibeb61119d911e3274c7cd4d39fd0060beefdb518
This commit is contained in:
parent
18c0c308f4
commit
df598fb4b4
@ -38,6 +38,12 @@
|
|||||||
<arg name="exe" type="s" direction="in"></arg>
|
<arg name="exe" type="s" direction="in"></arg>
|
||||||
<arg name="args" type="as" direction="in"></arg>
|
<arg name="args" type="as" direction="in"></arg>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="RunCommandWithOptions">
|
||||||
|
<arg name="exe" type="s" direction="in"></arg>
|
||||||
|
<arg name="args" type="as" direction="in"></arg>
|
||||||
|
<arg name="options" type="a{sv}" direction="in"></arg>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
|
||||||
|
</method>
|
||||||
<signal name='AutostartChanged'>
|
<signal name='AutostartChanged'>
|
||||||
<arg type='s' name='status' />
|
<arg type='s' name='status' />
|
||||||
<arg type='s' name='filePath' />
|
<arg type='s' name='filePath' />
|
||||||
|
@ -160,10 +160,10 @@ bool StartManager::launchAppWithOptions(QString desktopFile, uint32_t timestamp,
|
|||||||
|
|
||||||
bool StartManager::runCommand(QString exe, QStringList args)
|
bool StartManager::runCommand(QString exe, QStringList args)
|
||||||
{
|
{
|
||||||
return doRunCommandWithOptions(exe, args, QMap<QString, QString>());
|
return doRunCommandWithOptions(exe, args, QVariantMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StartManager::runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
bool StartManager::runCommandWithOptions(QString exe, QStringList args, QVariantMap options)
|
||||||
{
|
{
|
||||||
return doRunCommandWithOptions(exe, args, options);
|
return doRunCommandWithOptions(exe, args, options);
|
||||||
}
|
}
|
||||||
@ -449,11 +449,11 @@ bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp
|
|||||||
return process.startDetached(exec, exeArgs);
|
return process.startDetached(exec, exeArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StartManager::doRunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
bool StartManager::doRunCommandWithOptions(QString exe, QStringList args, QVariantMap options)
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
if (options.find("dir") != options.end()) {
|
if (options.find("dir") != options.end()) {
|
||||||
process.setWorkingDirectory(options["dir"]);
|
process.setWorkingDirectory(options["dir"].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return process.startDetached(exe, args);
|
return process.startDetached(exe, args);
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
bool launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
|
bool launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
|
||||||
bool launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
|
bool launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
|
||||||
bool runCommand(QString exe, QStringList args);
|
bool runCommand(QString exe, QStringList args);
|
||||||
bool runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
bool runCommandWithOptions(QString exe, QStringList args, QVariantMap options);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void autostartChanged(const QString &status, const QString &fileName);
|
void autostartChanged(const QString &status, const QString &fileName);
|
||||||
@ -61,7 +61,7 @@ private:
|
|||||||
bool doLaunchAppWithOptions(const QString &desktopFile);
|
bool doLaunchAppWithOptions(const QString &desktopFile);
|
||||||
bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
|
bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
|
||||||
bool launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files);
|
bool launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files);
|
||||||
bool doRunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
bool doRunCommandWithOptions(QString exe, QStringList args, QVariantMap options);
|
||||||
void waitCmd(DesktopInfo *info, QProcess *process, QString cmdName);
|
void waitCmd(DesktopInfo *info, QProcess *process, QString cmdName);
|
||||||
bool shouldUseProxy(QString appId);
|
bool shouldUseProxy(QString appId);
|
||||||
bool shouldDisableScaling(QString appId);
|
bool shouldDisableScaling(QString appId);
|
||||||
|
@ -422,7 +422,7 @@ void ApplicationManager::RunCommand(const QString &exe, const QStringList &args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationManager::RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options)
|
void ApplicationManager::RunCommandWithOptions(const QString &exe, const QStringList &args, const QVariantMap &options)
|
||||||
{
|
{
|
||||||
Q_D(ApplicationManager);
|
Q_D(ApplicationManager);
|
||||||
if (!d->checkDMsgUid()) {
|
if (!d->checkDMsgUid()) {
|
||||||
|
@ -76,6 +76,7 @@ public Q_SLOTS:
|
|||||||
void LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck = true);
|
void LaunchAppAction(const QString &desktopFile, const QString &action, uint32_t timestamp, bool withMsgCheck = true);
|
||||||
void LaunchAppWithOptions(const QString &desktopFile, uint32_t timestamp, const QStringList &files, QVariantMap options);
|
void LaunchAppWithOptions(const QString &desktopFile, uint32_t timestamp, const QStringList &files, QVariantMap options);
|
||||||
void RunCommand(const QString &exe, const QStringList &args);
|
void RunCommand(const QString &exe, const QStringList &args);
|
||||||
|
void RunCommandWithOptions(const QString &exe, const QStringList &args, const QVariantMap &options);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ApplicationManager(QObject *parent = nullptr);
|
ApplicationManager(QObject *parent = nullptr);
|
||||||
@ -85,7 +86,6 @@ protected:
|
|||||||
QList<QDBusObjectPath> list() const;
|
QList<QDBusObjectPath> list() const;
|
||||||
QDBusObjectPath GetInformation(const QString &id);
|
QDBusObjectPath GetInformation(const QString &id);
|
||||||
QList<QDBusObjectPath> GetInstances(const QString &id);
|
QList<QDBusObjectPath> GetInstances(const QString &id);
|
||||||
void RunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
|
||||||
bool IsProcessExist(uint32_t pid);
|
bool IsProcessExist(uint32_t pid);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user