feat: 增加RunCommandWithOptions接口

无

Log: 无
Influence: 无
Task: https://pms.uniontech.com/task-view-220801.html
Change-Id: Ibeb61119d911e3274c7cd4d39fd0060beefdb518
This commit is contained in:
范朋程
2022-12-22 17:58:45 +08:00
committed by fanpengcheng
parent 18c0c308f4
commit df598fb4b4
5 changed files with 14 additions and 8 deletions

View File

@ -160,10 +160,10 @@ bool StartManager::launchAppWithOptions(QString desktopFile, uint32_t timestamp,
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);
}
@ -449,11 +449,11 @@ bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp
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;
if (options.find("dir") != options.end()) {
process.setWorkingDirectory(options["dir"]);
process.setWorkingDirectory(options["dir"].toString());
}
return process.startDetached(exe, args);

View File

@ -48,7 +48,7 @@ public:
bool launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
bool launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
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:
void autostartChanged(const QString &status, const QString &fileName);
@ -61,7 +61,7 @@ private:
bool doLaunchAppWithOptions(const QString &desktopFile);
bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QVariantMap options);
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);
bool shouldUseProxy(QString appId);
bool shouldDisableScaling(QString appId);