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