From 3b4c322d59d0b6380759e1e7e6c94055bbad3fc4 Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@nokia.com> Date: Fri, 20 Aug 2010 11:34:02 +0200 Subject: [PATCH] QmlProject: Show effective qmlviewer call in separate row Don't misuse the input field for a custom qmlviewer path with displaying the effective qmlviewer used. Previously the effective qmlviewer was only calculated when the project pane is shown first, and then never updated. Reviewed-by: holmstedt --- .../qmlprojectrunconfiguration.cpp | 16 +++++++++++++++- .../qmlprojectrunconfiguration.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 1e47de5b1ff..25f395034bc 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -98,6 +98,8 @@ void QmlProjectRunConfiguration::ctor() Qt4ProjectManager::QtVersionManager *qtVersions = Qt4ProjectManager::QtVersionManager::instance(); connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>)), this, SLOT(updateEnabled())); + connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>)), this, SLOT(onViewerChanged())); + setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name.")); } @@ -174,16 +176,21 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget() Utils::PathChooser *qmlViewer = new Utils::PathChooser; qmlViewer->setExpectedKind(Utils::PathChooser::Command); - qmlViewer->setPath(viewerPath()); + qmlViewer->setPath(m_qmlViewerCustomPath); connect(qmlViewer, SIGNAL(changed(QString)), this, SLOT(onViewerChanged())); + m_qmlViewerExecutable = new QLabel; + m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs); + QLineEdit *qmlViewerArgs = new QLineEdit; qmlViewerArgs->setText(m_qmlViewerArgs); connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onViewerArgsChanged())); form->addRow(tr("QML Viewer"), qmlViewer); form->addRow(tr("QML Viewer arguments:"), qmlViewerArgs); + form->addRow(QString(), m_qmlViewerExecutable.data()); + form->addRow(tr("Main QML File:"), m_fileListCombo.data()); return config; @@ -258,12 +265,19 @@ void QmlProjectRunConfiguration::onViewerChanged() if (Utils::PathChooser *chooser = qobject_cast<Utils::PathChooser *>(sender())) { m_qmlViewerCustomPath = chooser->path(); } + if (!m_qmlViewerExecutable.isNull()) { + m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs); + } } void QmlProjectRunConfiguration::onViewerArgsChanged() { if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender())) m_qmlViewerArgs = lineEdit->text(); + + if (!m_qmlViewerExecutable.isNull()) { + m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs); + } } void QmlProjectRunConfiguration::onDebugServerPortChanged() diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h index 53adfb0cb6c..1c3f12cd6ed 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h @@ -34,6 +34,7 @@ #include <projectexplorer/runconfiguration.h> #include <QWeakPointer> #include <QComboBox> +#include <QLabel> QT_FORWARD_DECLARE_CLASS(QStringListModel); @@ -121,6 +122,7 @@ private: QStringListModel *m_fileListModel; // weakpointer is used to make sure we don't try to manipulate // widget which was deleted already, as can be the case here. + QWeakPointer<QLabel> m_qmlViewerExecutable; QWeakPointer<QComboBox> m_fileListCombo; Internal::QmlProjectTarget *m_projectTarget; -- GitLab