mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-11 03:42:27 -05:00
Add fallback using QDesktopServices::openUrl() for "run" action
Users not familiar with launching processes with arguments might expect the run action to behave like clicking on icons on the desktop and be frustrated if the "file is not being opened". Thus introducing this fallback might help some users out.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopServices>
|
||||
|
||||
const std::string MacroActionRun::id = "run";
|
||||
|
||||
@@ -14,7 +15,13 @@ bool MacroActionRun::_registered = MacroActionFactory::Register(
|
||||
|
||||
bool MacroActionRun::PerformAction()
|
||||
{
|
||||
QProcess::startDetached(QString::fromStdString(_path), _args);
|
||||
if (!QProcess::startDetached(QString::fromStdString(_path), _args) &&
|
||||
_args.empty()) {
|
||||
vblog(LOG_INFO, "run \"%s\" using QDesktopServices",
|
||||
_path.c_str());
|
||||
QDesktopServices::openUrl(
|
||||
QUrl::fromLocalFile(QString::fromStdString(_path)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user