forked from qt-creator/qt-creator
		
	Fix QmlInspector to work properly now that QmlProjectManager
no longer uses LocalAppRunConfiguration. QmlInspector now uses the qmlviewer started by QmlProjectManager instead of starting its own, and clicking the Start Debug button within a QML project will switch to QML Inspect mode and start the inspector.
This commit is contained in:
		@@ -39,6 +39,7 @@
 | 
			
		||||
#include <coreplugin/icore.h>
 | 
			
		||||
#include <coreplugin/editormanager/editormanager.h>
 | 
			
		||||
#include <coreplugin/editormanager/ieditor.h>
 | 
			
		||||
#include <coreplugin/modemanager.h>
 | 
			
		||||
 | 
			
		||||
#include <qmleditor/qmlmodelmanagerinterface.h>
 | 
			
		||||
 | 
			
		||||
@@ -59,6 +60,7 @@
 | 
			
		||||
#include <QtGui/QLabel>
 | 
			
		||||
#include <QtGui/QSpinBox>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
using namespace QmlProjectManager;
 | 
			
		||||
using namespace QmlProjectManager::Internal;
 | 
			
		||||
using namespace ProjectExplorer;
 | 
			
		||||
@@ -508,7 +510,7 @@ ProjectExplorer::RunConfiguration *QmlRunConfigurationFactory::create(ProjectExp
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QmlRunControl::QmlRunControl(QmlRunConfiguration *runConfiguration, bool debugMode)
 | 
			
		||||
    : RunControl(runConfiguration)
 | 
			
		||||
    : RunControl(runConfiguration), m_debugMode(debugMode)
 | 
			
		||||
{
 | 
			
		||||
    Environment environment = ProjectExplorer::Environment::systemEnvironment();
 | 
			
		||||
    if (debugMode)
 | 
			
		||||
@@ -527,7 +529,7 @@ QmlRunControl::QmlRunControl(QmlRunConfiguration *runConfiguration, bool debugMo
 | 
			
		||||
    connect(&m_applicationLauncher, SIGNAL(processExited(int)),
 | 
			
		||||
            this, SLOT(processExited(int)));
 | 
			
		||||
    connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
 | 
			
		||||
            this, SLOT(bringApplicationToForeground(qint64)));
 | 
			
		||||
            this, SLOT(slotBringApplicationToForeground(qint64)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QmlRunControl::~QmlRunControl()
 | 
			
		||||
@@ -551,6 +553,16 @@ bool QmlRunControl::isRunning() const
 | 
			
		||||
    return m_applicationLauncher.isRunning();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
 | 
			
		||||
{
 | 
			
		||||
    if (m_debugMode) {
 | 
			
		||||
        Core::ICore *core = Core::ICore::instance();
 | 
			
		||||
        core->modeManager()->activateMode(QLatin1String("QML_INSPECT_MODE"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bringApplicationToForeground(pid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QmlRunControl::slotError(const QString &err)
 | 
			
		||||
{
 | 
			
		||||
    emit error(this, err);
 | 
			
		||||
 
 | 
			
		||||
@@ -209,6 +209,7 @@ public:
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void processExited(int exitCode);
 | 
			
		||||
    void slotBringApplicationToForeground(qint64 pid);
 | 
			
		||||
    void slotAddToOutputWindow(const QString &line);
 | 
			
		||||
    void slotError(const QString & error);
 | 
			
		||||
 | 
			
		||||
@@ -217,6 +218,7 @@ private:
 | 
			
		||||
 | 
			
		||||
    QString m_executable;
 | 
			
		||||
    QStringList m_commandLineArguments;
 | 
			
		||||
    bool m_debugMode;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class QmlRunControlFactory : public ProjectExplorer::IRunControlFactory {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user