Skip to content
Snippets Groups Projects
Commit ceca9d9d authored by Kai Koehne's avatar Kai Koehne
Browse files

Disable "Qt Quick->Preview" action if no qmlviewer in the PATH

An error dialog would be more explicit, but too late because of string
freeze.
parent e28e1f0c
No related branches found
No related tags found
No related merge requests found
...@@ -133,7 +133,9 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e ...@@ -133,7 +133,9 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
Core::Command *cmd = addToolAction(m_actionPreview, am, toolsMenuContext, Core::Command *cmd = addToolAction(m_actionPreview, am, toolsMenuContext,
QLatin1String("QtQuick.Preview"), menuQtQuick, tr("Ctrl+Alt+R")); QLatin1String("QtQuick.Preview"), menuQtQuick, tr("Ctrl+Alt+R"));
connect(cmd->action(), SIGNAL(triggered()), SLOT(openPreview())); connect(cmd->action(), SIGNAL(triggered()), SLOT(openPreview()));
m_previewRunner = new QmlJSPreviewRunner(this); m_previewRunner = new QmlJSPreviewRunner(this);
m_actionPreview->setEnabled(m_previewRunner->isReady());
QAction *followSymbolUnderCursorAction = new QAction(tr("Follow Symbol Under Cursor"), this); QAction *followSymbolUnderCursorAction = new QAction(tr("Follow Symbol Under Cursor"), this);
cmd = am->registerAction(followSymbolUnderCursorAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, context); cmd = am->registerAction(followSymbolUnderCursorAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, context);
......
...@@ -24,6 +24,10 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) : ...@@ -24,6 +24,10 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
m_applicationLauncher.setEnvironment(environment.toStringList()); m_applicationLauncher.setEnvironment(environment.toStringList());
} }
bool QmlJSPreviewRunner::isReady() const
{
return !m_qmlViewerDefaultPath.isEmpty();
}
void QmlJSPreviewRunner::run(const QString &filename) void QmlJSPreviewRunner::run(const QString &filename)
{ {
......
...@@ -13,6 +13,8 @@ class QmlJSPreviewRunner : public QObject ...@@ -13,6 +13,8 @@ class QmlJSPreviewRunner : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit QmlJSPreviewRunner(QObject *parent = 0); explicit QmlJSPreviewRunner(QObject *parent = 0);
bool isReady() const;
void run(const QString &filename); void run(const QString &filename);
signals: signals:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment