Commit ed5030f1 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlProjectManager: moved the no-observer warning dialog to qmlprojectplugin

Change-Id: I6ce724e0db17d22616adcdf058d1f05af7124b64
Reviewed-on: http://codereview.qt.nokia.com/1929


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent c9ffc770
......@@ -50,10 +50,15 @@
#include <projectexplorer/taskhub.h>
#include <qtsupport/qtsupportconstants.h>
#include <QtCore/QtPlugin>
#include <QtGui/QApplication>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
namespace QmlProjectManager {
namespace Internal {
QmlProjectPlugin::QmlProjectPlugin()
{ }
......@@ -74,13 +79,13 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
if (! mimeDB->addMimeTypes(mimetypesXml, errorMessage))
return false;
Manager *manager = new Manager;
Internal::Manager *manager = new Internal::Manager;
addAutoReleasedObject(manager);
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
addAutoReleasedObject(new Internal::QmlProjectRunControlFactory);
addAutoReleasedObject(new QmlProjectApplicationWizard);
addAutoReleasedObject(new QmlProjectTargetFactory);
addAutoReleasedObject(new Internal::QmlProjectApplicationWizard);
addAutoReleasedObject(new Internal::QmlProjectTargetFactory);
QmlProjectFileFormat::registerDeclarativeTypes();
......@@ -93,7 +98,29 @@ void QmlProjectPlugin::extensionsInitialized()
{
}
} // namespace Internal
void QmlProjectPlugin::showQmlObserverToolWarning()
{
QMessageBox dialog(QApplication::activeWindow());
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
QMessageBox::ActionRole);
dialog.addButton(tr("Cancel"), QMessageBox::ActionRole);
dialog.setDefaultButton(qtPref);
dialog.setWindowTitle(tr("QML Observer Missing"));
dialog.setText(tr("QML Observer could not be found."));
dialog.setInformativeText(tr(
"QML Observer is used to offer debugging features for "
"QML applications, such as interactive debugging and inspection tools. "
"It must be compiled for each used Qt version separately. "
"On the Qt4 options page, select the current Qt installation "
"and click Rebuild."));
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::instance()->showOptionsDialog(
QtSupport::Constants::QT_SETTINGS_CATEGORY,
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
}
}
} // namespace QmlProjectManager
Q_EXPORT_PLUGIN(QmlProjectManager::Internal::QmlProjectPlugin)
Q_EXPORT_PLUGIN(QmlProjectManager::QmlProjectPlugin)
......@@ -33,6 +33,8 @@
#ifndef QMLPROJECTPLUGIN_H
#define QMLPROJECTPLUGIN_H
#include "qmlprojectmanager_global.h"
#include <extensionsystem/iplugin.h>
#include <QtCore/QObject>
......@@ -42,7 +44,9 @@ namespace Internal {
class ProjectFilesFactory;
class QmlProjectPlugin: public ExtensionSystem::IPlugin
}
class QMLPROJECTMANAGER_EXPORT QmlProjectPlugin: public ExtensionSystem::IPlugin
{
Q_OBJECT
......@@ -52,9 +56,11 @@ public:
virtual bool initialize(const QStringList &arguments, QString *errorString);
virtual void extensionsInitialized();
static void showQmlObserverToolWarning();
};
} // namespace Internal
} // namespace QmlProject
#endif // QMLPROJECTPLUGIN_H
......@@ -50,20 +50,15 @@
#include <debugger/debuggerengine.h>
#include <debugger/debuggerstartparameters.h>
#include <qmljsinspector/qmljsinspectorconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/qmlobservertool.h>
#include <qtsupport/qtsupportconstants.h>
#include <QtGui/QApplication>
#include <QtGui/QLabel>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <qmlprojectmanager/qmlprojectplugin.h>
#include <QtCore/QDir>
using namespace ProjectExplorer;
namespace QmlProjectManager {
namespace Internal {
QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode)
......@@ -213,35 +208,12 @@ RunControl *QmlProjectRunControlFactory::createDebugRunControl(QmlProjectRunConf
params.projectSourceFiles = runConfig->target()->project()->files(Project::ExcludeGeneratedFiles);
if (params.executable.isEmpty()) {
showQmlObserverToolWarning();
QmlProjectPlugin::showQmlObserverToolWarning();
return 0;
}
return Debugger::DebuggerPlugin::createDebugger(params, runConfig);
}
void QmlProjectRunControlFactory::showQmlObserverToolWarning()
{
QMessageBox dialog(QApplication::activeWindow());
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
QMessageBox::ActionRole);
dialog.addButton(tr("Cancel"), QMessageBox::ActionRole);
dialog.setDefaultButton(qtPref);
dialog.setWindowTitle(tr("QML Observer Missing"));
dialog.setText(tr("QML Observer could not be found."));
dialog.setInformativeText(tr(
"QML Observer is used to offer debugging features for "
"QML applications, such as interactive debugging and inspection tools. "
"It must be compiled for each used Qt version separately. "
"On the Qt4 options page, select the current Qt installation "
"and click Rebuild."));
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::instance()->showOptionsDialog(
QtSupport::Constants::QT_SETTINGS_CATEGORY,
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
}
}
} // namespace Internal
} // namespace QmlProjectManager
......@@ -82,7 +82,6 @@ public:
private:
ProjectExplorer::RunControl *createDebugRunControl(QmlProjectRunConfiguration *runConfig);
static void showQmlObserverToolWarning();
};
} // namespace Internal
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment