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:
@@ -536,3 +536,12 @@ bool AppOutputPane::canNavigate()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<RunControl *> AppOutputPane::runControls() const
|
||||||
|
{
|
||||||
|
QList<RunControl *> result;
|
||||||
|
foreach (const RunControlTab& tab, m_runControlTabs)
|
||||||
|
result << tab.runControl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ public:
|
|||||||
bool aboutToClose() const;
|
bool aboutToClose() const;
|
||||||
bool closeTabs(CloseTabMode mode);
|
bool closeTabs(CloseTabMode mode);
|
||||||
|
|
||||||
|
QList<RunControl *> runControls() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void allRunControlsFinished();
|
void allRunControlsFinished();
|
||||||
|
|
||||||
|
|||||||
@@ -1504,6 +1504,11 @@ void ProjectExplorerPlugin::startRunControl(RunControl *runControl, const QStrin
|
|||||||
emit updateRunActions();
|
emit updateRunActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<RunControl *> ProjectExplorerPlugin::runControls() const
|
||||||
|
{
|
||||||
|
return d->m_outputPane->runControls();
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::buildQueueFinished(bool success)
|
void ProjectExplorerPlugin::buildQueueFinished(bool success)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ public:
|
|||||||
|
|
||||||
void buildProject(ProjectExplorer::Project *p);
|
void buildProject(ProjectExplorer::Project *p);
|
||||||
|
|
||||||
|
QList<RunControl *> runControls() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aboutToShowContextMenu(ProjectExplorer::Project *project,
|
void aboutToShowContextMenu(ProjectExplorer::Project *project,
|
||||||
ProjectExplorer::Node *node);
|
ProjectExplorer::Node *node);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <debugger/debuggerrunner.h>
|
#include <debugger/debuggerrunner.h>
|
||||||
@@ -67,6 +68,7 @@ QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfig
|
|||||||
m_executable = runConfiguration->observerPath();
|
m_executable = runConfiguration->observerPath();
|
||||||
}
|
}
|
||||||
m_commandLineArguments = runConfiguration->viewerArguments();
|
m_commandLineArguments = runConfiguration->viewerArguments();
|
||||||
|
m_mainQmlFile = runConfiguration->mainScript();
|
||||||
|
|
||||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||||
this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
|
this, SLOT(slotAppendMessage(QString, Utils::OutputFormat)));
|
||||||
@@ -126,6 +128,11 @@ void QmlProjectRunControl::processExited(int exitCode)
|
|||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QmlProjectRunControl::mainQmlFile() const
|
||||||
|
{
|
||||||
|
return m_mainQmlFile;
|
||||||
|
}
|
||||||
|
|
||||||
QmlProjectRunControlFactory::QmlProjectRunControlFactory(QObject *parent)
|
QmlProjectRunControlFactory::QmlProjectRunControlFactory(QObject *parent)
|
||||||
: IRunControlFactory(parent)
|
: IRunControlFactory(parent)
|
||||||
{
|
{
|
||||||
@@ -163,8 +170,19 @@ RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfigurati
|
|||||||
const QString &mode)
|
const QString &mode)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||||
|
|
||||||
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration *>(runConfiguration);
|
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;
|
RunControl *runControl = 0;
|
||||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||||
runControl = new QmlProjectRunControl(config, mode);
|
runControl = new QmlProjectRunControl(config, mode);
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public:
|
|||||||
virtual bool isRunning() const;
|
virtual bool isRunning() const;
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
QString mainQmlFile() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void processExited(int exitCode);
|
void processExited(int exitCode);
|
||||||
void slotBringApplicationToForeground(qint64 pid);
|
void slotBringApplicationToForeground(qint64 pid);
|
||||||
@@ -65,6 +67,7 @@ private:
|
|||||||
|
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
QString m_commandLineArguments;
|
QString m_commandLineArguments;
|
||||||
|
QString m_mainQmlFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QmlProjectRunControlFactory : public ProjectExplorer::IRunControlFactory {
|
class QmlProjectRunControlFactory : public ProjectExplorer::IRunControlFactory {
|
||||||
|
|||||||
Reference in New Issue
Block a user