forked from qt-creator/qt-creator
Qml run controls automatically stop all run controls for the same file
That's something which has been asked for multiple times. Also related to the task below. Change-Id: I1130a2a3527479f18bde2abfbff28fb556f437b9 Task-Nr: QTCREATORBUG-3508 Reviewed-on: http://codereview.qt.nokia.com/1844 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <debugger/debuggerrunner.h>
|
||||
@@ -67,6 +68,7 @@ QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfig
|
||||
m_executable = runConfiguration->observerPath();
|
||||
}
|
||||
m_commandLineArguments = runConfiguration->viewerArguments();
|
||||
m_mainQmlFile = runConfiguration->mainScript();
|
||||
|
||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||
this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
|
||||
@@ -126,6 +128,11 @@ void QmlProjectRunControl::processExited(int exitCode)
|
||||
emit finished();
|
||||
}
|
||||
|
||||
QString QmlProjectRunControl::mainQmlFile() const
|
||||
{
|
||||
return m_mainQmlFile;
|
||||
}
|
||||
|
||||
QmlProjectRunControlFactory::QmlProjectRunControlFactory(QObject *parent)
|
||||
: IRunControlFactory(parent)
|
||||
{
|
||||
@@ -163,8 +170,19 @@ RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfigurati
|
||||
const QString &mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
|
||||
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration *>(runConfiguration);
|
||||
|
||||
QList<ProjectExplorer::RunControl *> runcontrols =
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->runControls();
|
||||
foreach (ProjectExplorer::RunControl *rc, runcontrols) {
|
||||
if (QmlProjectRunControl *qrc = qobject_cast<QmlProjectRunControl *>(rc)) {
|
||||
if (qrc->mainQmlFile() == config->mainScript())
|
||||
// Asking the user defeats the purpose
|
||||
// Making it configureable might be worth it
|
||||
qrc->stop();
|
||||
}
|
||||
}
|
||||
|
||||
RunControl *runControl = 0;
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
runControl = new QmlProjectRunControl(config, mode);
|
||||
|
||||
Reference in New Issue
Block a user