forked from qt-creator/qt-creator
Dissolve RunControl::setRunnable
Change-Id: I52aea3bea0c4ea90a448f5a77bfa01414bc56702 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -129,15 +129,16 @@ void StartRemoteDialog::validate()
|
|||||||
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable StartRemoteDialog::runnable() const
|
CommandLine StartRemoteDialog::commandLine() const
|
||||||
{
|
{
|
||||||
const Kit *kit = d->kitChooser->currentKit();
|
const Kit *kit = d->kitChooser->currentKit();
|
||||||
const FilePath filePath = DeviceKitAspect::deviceFilePath(kit, d->executable->text());
|
const FilePath filePath = DeviceKitAspect::deviceFilePath(kit, d->executable->text());
|
||||||
|
return {filePath, d->arguments->text(), CommandLine::Raw};
|
||||||
|
}
|
||||||
|
|
||||||
Runnable r;
|
FilePath StartRemoteDialog::workingDirectory() const
|
||||||
r.command = {filePath, d->arguments->text(), CommandLine::Raw};
|
{
|
||||||
r.workingDirectory = FilePath::fromString(d->workingDirectory->text());
|
return FilePath::fromString(d->workingDirectory->text());
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -29,7 +29,10 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace ProjectExplorer { class Runnable; }
|
namespace Utils {
|
||||||
|
class CommandLine;
|
||||||
|
class FilePath;
|
||||||
|
} // Utils
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
@@ -43,7 +46,8 @@ public:
|
|||||||
explicit StartRemoteDialog(QWidget *parent = nullptr);
|
explicit StartRemoteDialog(QWidget *parent = nullptr);
|
||||||
~StartRemoteDialog() override;
|
~StartRemoteDialog() override;
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const;
|
Utils::CommandLine commandLine() const;
|
||||||
|
Utils::FilePath workingDirectory() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void validate();
|
void validate();
|
||||||
|
|||||||
@@ -904,31 +904,46 @@ const Runnable &RunControl::runnable() const
|
|||||||
return d->runnable;
|
return d->runnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunControl::setRunnable(const Runnable &runnable)
|
|
||||||
{
|
|
||||||
d->runnable = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CommandLine &RunControl::commandLine() const
|
const CommandLine &RunControl::commandLine() const
|
||||||
{
|
{
|
||||||
return d->runnable.command;
|
return d->runnable.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::setCommandLine(const CommandLine &command)
|
||||||
|
{
|
||||||
|
d->runnable.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
const FilePath &RunControl::workingDirectory() const
|
const FilePath &RunControl::workingDirectory() const
|
||||||
{
|
{
|
||||||
return d->runnable.workingDirectory;
|
return d->runnable.workingDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::setWorkingDirectory(const FilePath &workingDirectory)
|
||||||
|
{
|
||||||
|
d->runnable.workingDirectory = workingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
const Environment &RunControl::environment() const
|
const Environment &RunControl::environment() const
|
||||||
{
|
{
|
||||||
return d->runnable.environment;
|
return d->runnable.environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::setEnvironment(const Environment &environment)
|
||||||
|
{
|
||||||
|
d->runnable.environment = environment;
|
||||||
|
}
|
||||||
|
|
||||||
const QVariantHash &RunControl::extraData() const
|
const QVariantHash &RunControl::extraData() const
|
||||||
{
|
{
|
||||||
return d->runnable.extraData;
|
return d->runnable.extraData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::setExtraData(const QVariantHash &extraData)
|
||||||
|
{
|
||||||
|
d->runnable.extraData = extraData;
|
||||||
|
}
|
||||||
|
|
||||||
QString RunControl::displayName() const
|
QString RunControl::displayName() const
|
||||||
{
|
{
|
||||||
return d->displayName;
|
return d->displayName;
|
||||||
|
|||||||
@@ -243,12 +243,18 @@ public:
|
|||||||
Utils::Id runMode() const;
|
Utils::Id runMode() const;
|
||||||
|
|
||||||
const Runnable &runnable() const;
|
const Runnable &runnable() const;
|
||||||
void setRunnable(const Runnable &runnable);
|
|
||||||
|
|
||||||
const Utils::CommandLine &commandLine() const;
|
const Utils::CommandLine &commandLine() const;
|
||||||
|
void setCommandLine(const Utils::CommandLine &command);
|
||||||
|
|
||||||
const Utils::FilePath &workingDirectory() const;
|
const Utils::FilePath &workingDirectory() const;
|
||||||
|
void setWorkingDirectory(const Utils::FilePath &workingDirectory);
|
||||||
|
|
||||||
const Utils::Environment &environment() const;
|
const Utils::Environment &environment() const;
|
||||||
|
void setEnvironment(const Utils::Environment &environment);
|
||||||
|
|
||||||
const QVariantHash &extraData() const;
|
const QVariantHash &extraData() const;
|
||||||
|
void setExtraData(const QVariantHash &extraData);
|
||||||
|
|
||||||
static bool showPromptToStopDialog(const QString &title, const QString &text,
|
static bool showPromptToStopDialog(const QString &title, const QString &text,
|
||||||
const QString &stopButtonText = QString(),
|
const QString &stopButtonText = QString(),
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -45,9 +48,8 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
|
|||||||
|
|
||||||
void LocalQmlProfilerRunnerTest::testRunner()
|
void LocalQmlProfilerRunnerTest::testRunner()
|
||||||
{
|
{
|
||||||
QPointer<ProjectExplorer::RunControl> runControl;
|
QPointer<RunControl> runControl;
|
||||||
QPointer<LocalQmlProfilerSupport> profiler;
|
QPointer<LocalQmlProfilerSupport> profiler;
|
||||||
ProjectExplorer::Runnable debuggee;
|
|
||||||
QUrl serverUrl;
|
QUrl serverUrl;
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
@@ -56,37 +58,35 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
int runCount = 0;
|
int runCount = 0;
|
||||||
int stopCount = 0;
|
int stopCount = 0;
|
||||||
|
|
||||||
debuggee.command.setExecutable("\\-/|\\-/");
|
|
||||||
debuggee.environment = Utils::Environment::systemEnvironment();
|
|
||||||
|
|
||||||
// should not be used anywhere but cannot be empty
|
// should not be used anywhere but cannot be empty
|
||||||
serverUrl.setScheme(Utils::urlSocketScheme());
|
serverUrl.setScheme(Utils::urlSocketScheme());
|
||||||
serverUrl.setPath("invalid");
|
serverUrl.setPath("invalid");
|
||||||
|
|
||||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
runControl->setRunnable(debuggee);
|
runControl->setCommandLine({"\\-/|\\-/", {}});
|
||||||
|
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
|
|
||||||
auto connectRunner = [&]() {
|
auto connectRunner = [&]() {
|
||||||
connect(runControl, &ProjectExplorer::RunControl::aboutToStart, this, [&]() {
|
connect(runControl, &RunControl::aboutToStart, this, [&] {
|
||||||
QVERIFY(!started);
|
QVERIFY(!started);
|
||||||
QVERIFY(!running);
|
QVERIFY(!running);
|
||||||
++startCount;
|
++startCount;
|
||||||
started = true;
|
started = true;
|
||||||
});
|
});
|
||||||
connect(runControl, &ProjectExplorer::RunControl::started, this, [&]() {
|
connect(runControl, &RunControl::started, this, [&] {
|
||||||
QVERIFY(started);
|
QVERIFY(started);
|
||||||
QVERIFY(!running);
|
QVERIFY(!running);
|
||||||
++runCount;
|
++runCount;
|
||||||
running = true;
|
running = true;
|
||||||
});
|
});
|
||||||
connect(runControl, &ProjectExplorer::RunControl::stopped, this, [&]() {
|
connect(runControl, &RunControl::stopped, this, [&] {
|
||||||
QVERIFY(started);
|
QVERIFY(started);
|
||||||
++stopCount;
|
++stopCount;
|
||||||
running = false;
|
running = false;
|
||||||
started = false;
|
started = false;
|
||||||
});
|
});
|
||||||
connect(runControl, &ProjectExplorer::RunControl::finished, this, [&]() {
|
connect(runControl, &RunControl::finished, this, [&]{
|
||||||
running = false;
|
running = false;
|
||||||
started = false;
|
started = false;
|
||||||
});
|
});
|
||||||
@@ -110,10 +110,10 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
|
|
||||||
serverUrl = Utils::urlFromLocalSocket();
|
serverUrl = Utils::urlFromLocalSocket();
|
||||||
// comma is used to specify a test function. In this case, an invalid one.
|
// comma is used to specify a test function. In this case, an invalid one.
|
||||||
debuggee.command = Utils::CommandLine(Utils::FilePath::fromString(QCoreApplication::applicationFilePath()),
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
{"-test", "QmlProfiler,"});
|
|
||||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
const FilePath app = FilePath::fromString(QCoreApplication::applicationFilePath());
|
||||||
runControl->setRunnable(debuggee);
|
runControl->setCommandLine({app, {"-test", "QmlProfiler,"}});
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
runControl->initiateStart();
|
runControl->initiateStart();
|
||||||
@@ -128,11 +128,10 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
QTRY_VERIFY(runControl.isNull());
|
QTRY_VERIFY(runControl.isNull());
|
||||||
QVERIFY(profiler.isNull());
|
QVERIFY(profiler.isNull());
|
||||||
|
|
||||||
debuggee.command.setArguments({});
|
|
||||||
serverUrl.clear();
|
serverUrl.clear();
|
||||||
serverUrl = Utils::urlFromLocalHostAndFreePort();
|
serverUrl = Utils::urlFromLocalHostAndFreePort();
|
||||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
runControl->setRunnable(debuggee);
|
runControl->setCommandLine({app, {}});
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
runControl->initiateStart();
|
runControl->initiateStart();
|
||||||
@@ -148,7 +147,6 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
QTRY_VERIFY(runControl.isNull());
|
QTRY_VERIFY(runControl.isNull());
|
||||||
QVERIFY(profiler.isNull());
|
QVERIFY(profiler.isNull());
|
||||||
|
|
||||||
debuggee.command.setArguments("-test QmlProfiler,");
|
|
||||||
serverUrl.setScheme(Utils::urlSocketScheme());
|
serverUrl.setScheme(Utils::urlSocketScheme());
|
||||||
{
|
{
|
||||||
Utils::TemporaryFile file("file with spaces");
|
Utils::TemporaryFile file("file with spaces");
|
||||||
@@ -156,8 +154,8 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
serverUrl.setPath(file.fileName());
|
serverUrl.setPath(file.fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
runControl->setRunnable(debuggee);
|
runControl->setCommandLine({app, {"-test", "QmlProfiler,"}});
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
runControl->initiateStart();
|
runControl->initiateStart();
|
||||||
|
|||||||
@@ -282,12 +282,13 @@ CallgrindToolPrivate::CallgrindToolPrivate()
|
|||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
m_perspective.select();
|
m_perspective.select();
|
||||||
|
CommandLine command = dlg.commandLine();
|
||||||
auto runControl = new RunControl(CALLGRIND_RUN_MODE);
|
auto runControl = new RunControl(CALLGRIND_RUN_MODE);
|
||||||
runControl->copyDataFromRunConfiguration(runConfig);
|
runControl->copyDataFromRunConfiguration(runConfig);
|
||||||
runControl->createMainWorker();
|
runControl->createMainWorker();
|
||||||
const auto runnable = dlg.runnable();
|
runControl->setCommandLine(command);
|
||||||
runControl->setRunnable(runnable);
|
runControl->setWorkingDirectory(dlg.workingDirectory());
|
||||||
runControl->setDisplayName(runnable.command.executable().toUserOutput());
|
runControl->setDisplayName(command.executable().toUserOutput());
|
||||||
ProjectExplorerPlugin::startRunControl(runControl);
|
ProjectExplorerPlugin::startRunControl(runControl);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -704,12 +704,13 @@ MemcheckToolPrivate::MemcheckToolPrivate()
|
|||||||
return;
|
return;
|
||||||
TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID);
|
TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID);
|
||||||
m_perspective.select();
|
m_perspective.select();
|
||||||
|
const CommandLine cmd = dlg.commandLine();
|
||||||
RunControl *rc = new RunControl(MEMCHECK_RUN_MODE);
|
RunControl *rc = new RunControl(MEMCHECK_RUN_MODE);
|
||||||
rc->copyDataFromRunConfiguration(runConfig);
|
rc->copyDataFromRunConfiguration(runConfig);
|
||||||
rc->createMainWorker();
|
rc->createMainWorker();
|
||||||
const auto runnable = dlg.runnable();
|
rc->setCommandLine(cmd);
|
||||||
rc->setRunnable(runnable);
|
rc->setWorkingDirectory(dlg.workingDirectory());
|
||||||
rc->setDisplayName(runnable.command.executable().toUserOutput());
|
rc->setDisplayName(cmd.toUserOutput());
|
||||||
ProjectExplorerPlugin::startRunControl(rc);
|
ProjectExplorerPlugin::startRunControl(rc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user