forked from qt-creator/qt-creator
Add option to specify qmlviewer command line arguments
This commit is contained in:
@@ -55,6 +55,7 @@
|
|||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QLineEdit>
|
||||||
|
|
||||||
using namespace QmlProjectManager;
|
using namespace QmlProjectManager;
|
||||||
using namespace QmlProjectManager::Internal;
|
using namespace QmlProjectManager::Internal;
|
||||||
@@ -365,6 +366,9 @@ QStringList QmlRunConfiguration::commandLineArguments() const
|
|||||||
{
|
{
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
|
||||||
|
if (!m_qmlViewerArgs.isEmpty())
|
||||||
|
args.append(m_qmlViewerArgs);
|
||||||
|
|
||||||
const QString s = mainScript();
|
const QString s = mainScript();
|
||||||
if (! s.isEmpty())
|
if (! s.isEmpty())
|
||||||
args.append(s);
|
args.append(s);
|
||||||
@@ -424,7 +428,12 @@ QWidget *QmlRunConfiguration::configurationWidget()
|
|||||||
qmlViewer->setPath(executable());
|
qmlViewer->setPath(executable());
|
||||||
connect(qmlViewer, SIGNAL(changed(QString)), this, SLOT(onQmlViewerChanged()));
|
connect(qmlViewer, SIGNAL(changed(QString)), this, SLOT(onQmlViewerChanged()));
|
||||||
|
|
||||||
|
QLineEdit *qmlViewerArgs = new QLineEdit;
|
||||||
|
qmlViewerArgs->setText(m_qmlViewerArgs);
|
||||||
|
connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onQmlViewerArgsChanged()));
|
||||||
|
|
||||||
form->addRow(tr("QML Viewer"), qmlViewer);
|
form->addRow(tr("QML Viewer"), qmlViewer);
|
||||||
|
form->addRow(tr("QML Viewer arguments:"), qmlViewerArgs);
|
||||||
form->addRow(tr("Main QML File:"), combo);
|
form->addRow(tr("Main QML File:"), combo);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
@@ -454,11 +463,18 @@ void QmlRunConfiguration::onQmlViewerChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlRunConfiguration::onQmlViewerArgsChanged()
|
||||||
|
{
|
||||||
|
if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
|
||||||
|
m_qmlViewerArgs = lineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
|
void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
|
||||||
{
|
{
|
||||||
ProjectExplorer::LocalApplicationRunConfiguration::save(writer);
|
ProjectExplorer::LocalApplicationRunConfiguration::save(writer);
|
||||||
|
|
||||||
writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewer);
|
writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewer);
|
||||||
|
writer.saveValue(QLatin1String("qmlviewerargs"), m_qmlViewerArgs);
|
||||||
writer.saveValue(QLatin1String("mainscript"), m_scriptFile);
|
writer.saveValue(QLatin1String("mainscript"), m_scriptFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,6 +483,7 @@ void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReade
|
|||||||
ProjectExplorer::LocalApplicationRunConfiguration::restore(reader);
|
ProjectExplorer::LocalApplicationRunConfiguration::restore(reader);
|
||||||
|
|
||||||
m_qmlViewer = reader.restoreValue(QLatin1String("qmlviewer")).toString();
|
m_qmlViewer = reader.restoreValue(QLatin1String("qmlviewer")).toString();
|
||||||
|
m_qmlViewerArgs = reader.restoreValue(QLatin1String("qmlviewerargs")).toString();
|
||||||
m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString();
|
m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString();
|
||||||
|
|
||||||
if (m_qmlViewer.isEmpty())
|
if (m_qmlViewer.isEmpty())
|
||||||
|
@@ -166,6 +166,7 @@ public:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setMainScript(const QString &scriptFile);
|
void setMainScript(const QString &scriptFile);
|
||||||
void onQmlViewerChanged();
|
void onQmlViewerChanged();
|
||||||
|
void onQmlViewerArgsChanged();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -175,6 +176,7 @@ private:
|
|||||||
QmlProject *m_project;
|
QmlProject *m_project;
|
||||||
QString m_scriptFile;
|
QString m_scriptFile;
|
||||||
QString m_qmlViewer;
|
QString m_qmlViewer;
|
||||||
|
QString m_qmlViewerArgs;
|
||||||
QLatin1String m_type;
|
QLatin1String m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user