forked from qt-creator/qt-creator
Use QtcProcess
Change-Id: Ie41a40534f231c68797205e4dd817f5e98963b07 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -29,9 +29,9 @@
|
||||
#include "hostmessages.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
|
||||
namespace Qdb {
|
||||
@@ -147,7 +147,7 @@ void QdbWatcher::forkHostServer()
|
||||
showMessage(message, true);
|
||||
return;
|
||||
}
|
||||
if (QProcess::startDetached(qdbFilePath.toString(), {"server"}))
|
||||
if (Utils::QtcProcess::startDetached({qdbFilePath, {"server"}}))
|
||||
showMessage(tr("QDB host server started."), false);
|
||||
else
|
||||
showMessage(tr("Could not start QDB host server in %1").arg(qdbFilePath.toString()), true);
|
||||
|
@@ -52,33 +52,34 @@
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Qdb {
|
||||
namespace Internal {
|
||||
|
||||
static Utils::FilePath flashWizardFilePath()
|
||||
static FilePath flashWizardFilePath()
|
||||
{
|
||||
return findTool(QdbTool::FlashingWizard);
|
||||
}
|
||||
|
||||
static void startFlashingWizard()
|
||||
{
|
||||
const QString filePath = flashWizardFilePath().toUserOutput();
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
if (QProcess::startDetached(QLatin1String("explorer.exe"), {filePath}))
|
||||
const FilePath filePath = flashWizardFilePath();
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
if (QtcProcess::startDetached({"explorer.exe", {filePath.toString()}}))
|
||||
return;
|
||||
} else if (QProcess::startDetached(filePath, {})) {
|
||||
} else if (QtcProcess::startDetached({filePath, {}})) {
|
||||
return;
|
||||
}
|
||||
const QString message =
|
||||
QCoreApplication::translate("Qdb", "Flash wizard \"%1\" failed to start.");
|
||||
showMessage(message.arg(filePath), true);
|
||||
showMessage(message.arg(filePath.toUserOutput()), true);
|
||||
}
|
||||
|
||||
static bool isFlashActionDisabled()
|
||||
@@ -94,7 +95,7 @@ void registerFlashAction(QObject *parentForAction)
|
||||
{
|
||||
if (isFlashActionDisabled())
|
||||
return;
|
||||
const Utils::FilePath fileName = flashWizardFilePath();
|
||||
const FilePath fileName = flashWizardFilePath();
|
||||
if (!fileName.exists()) {
|
||||
const QString message =
|
||||
QCoreApplication::translate("Qdb", "Flash wizard executable \"%1\" not found.");
|
||||
@@ -146,7 +147,7 @@ public:
|
||||
Runnable r = runControl->runnable();
|
||||
// FIXME: Spaces!
|
||||
r.command.setArguments(r.command.executable().toString() + ' ' + r.command.arguments());
|
||||
r.command.setExecutable(Utils::FilePath::fromString(Constants::AppcontrollerFilepath));
|
||||
r.command.setExecutable(FilePath::fromString(Constants::AppcontrollerFilepath));
|
||||
doStart(r, runControl->device());
|
||||
});
|
||||
}
|
||||
@@ -156,7 +157,7 @@ template <class Step>
|
||||
class QdbDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
explicit QdbDeployStepFactory(Utils::Id id)
|
||||
explicit QdbDeployStepFactory(Id id)
|
||||
{
|
||||
registerStep<Step>(id);
|
||||
setDisplayName(Step::displayName());
|
||||
@@ -184,7 +185,7 @@ public:
|
||||
QdbDeployStepFactory<RemoteLinux::MakeInstallStep>
|
||||
m_makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
|
||||
|
||||
const QList<Utils::Id> supportedRunConfigs {
|
||||
const QList<Id> supportedRunConfigs {
|
||||
m_runConfigFactory.runConfigurationId(),
|
||||
"QmlProjectManager.QmlRunConfiguration"
|
||||
};
|
||||
|
@@ -192,7 +192,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
|
||||
addAction(menu, tr("Show Dependencies of \"%1\"").arg(moduleName),
|
||||
tr("Show Dependencies"),
|
||||
moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(),
|
||||
[modulePath] { QProcess::startDetached("depends", {modulePath}); });
|
||||
[modulePath] { QtcProcess::startDetached({{"depends"}, {modulePath}}); });
|
||||
|
||||
addAction(menu, tr("Load Symbols for All Modules"),
|
||||
enabled && canLoadSymbols,
|
||||
|
@@ -170,7 +170,7 @@ bool ExternalQtEditor::getEditorLaunchData(const Utils::FilePath &filePath,
|
||||
data->workingDirectory.clear();
|
||||
QVector<QtSupport::BaseQtVersion *> qtVersionsToCheck; // deduplicated after being filled
|
||||
if (const Project *project = SessionManager::projectForFile(filePath)) {
|
||||
data->workingDirectory = project->projectDirectory().toString();
|
||||
data->workingDirectory = project->projectDirectory();
|
||||
// active kit
|
||||
if (const Target *target = project->activeTarget()) {
|
||||
qtVersionsToCheck << QtSupport::QtKitAspect::qtVersion(target->kit());
|
||||
@@ -214,7 +214,7 @@ bool ExternalQtEditor::startEditorProcess(const LaunchData &data, QString *error
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << '\n' << data.binary << data.arguments << data.workingDirectory;
|
||||
qint64 pid = 0;
|
||||
if (!QProcess::startDetached(data.binary, data.arguments, data.workingDirectory, &pid)) {
|
||||
if (!QtcProcess::startDetached({FilePath::fromString(data.binary), data.arguments}, data.workingDirectory, &pid)) {
|
||||
*errorMessage = msgStartFailed(data.binary, data.arguments);
|
||||
return false;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
@@ -68,7 +69,7 @@ public:
|
||||
struct LaunchData {
|
||||
QString binary;
|
||||
QStringList arguments;
|
||||
QString workingDirectory;
|
||||
Utils::FilePath workingDirectory;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@@ -378,7 +378,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
|
||||
action->setIcon(kCachegrindIcon.icon());
|
||||
action->setToolTip(CallgrindTool::tr("Open results in KCachegrind."));
|
||||
connect(action, &QAction::triggered, this, [this, settings] {
|
||||
QProcess::startDetached(settings->kcachegrindExecutable.value(), { m_lastFileName });
|
||||
QtcProcess::startDetached({FilePath::fromString(settings->kcachegrindExecutable.value()), { m_lastFileName }});
|
||||
});
|
||||
|
||||
// dump action
|
||||
|
Reference in New Issue
Block a user