2009-05-04 12:19:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#include "qmlprojectplugin.h"
|
|
|
|
#include "qmlprojectmanager.h"
|
2010-02-18 15:33:35 +01:00
|
|
|
#include "qmlprojectapplicationwizard.h"
|
2009-05-04 12:19:22 +02:00
|
|
|
#include "qmlprojectconstants.h"
|
2009-05-07 12:27:52 +02:00
|
|
|
#include "qmlproject.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include "qmlprojectrunconfigurationfactory.h"
|
|
|
|
#include "qmlprojectruncontrol.h"
|
2011-01-20 14:03:07 +01:00
|
|
|
#include "qmlprojecttarget.h"
|
2010-02-26 14:46:04 +01:00
|
|
|
#include "fileformat/qmlprojectfileformat.h"
|
2009-11-11 10:10:00 +01:00
|
|
|
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-04-01 17:21:18 +02:00
|
|
|
#include <coreplugin/fileiconprovider.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/mimedatabase.h>
|
|
|
|
|
|
|
|
#include <texteditor/texteditoractionhandler.h>
|
|
|
|
|
2010-07-06 12:11:15 +02:00
|
|
|
#include <projectexplorer/taskhub.h>
|
2011-09-15 19:20:50 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2009-11-11 10:10:00 +01:00
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <QtCore/QtPlugin>
|
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
#include <QtGui/QApplication>
|
|
|
|
#include <QtGui/QMessageBox>
|
|
|
|
#include <QtGui/QPushButton>
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace QmlProjectManager {
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-07-13 17:16:43 +02:00
|
|
|
QmlProjectPlugin::QmlProjectPlugin()
|
2009-05-04 12:19:22 +02:00
|
|
|
{ }
|
|
|
|
|
|
|
|
QmlProjectPlugin::~QmlProjectPlugin()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
|
|
|
{
|
|
|
|
using namespace Core;
|
|
|
|
|
|
|
|
ICore *core = ICore::instance();
|
|
|
|
Core::MimeDatabase *mimeDB = core->mimeDatabase();
|
|
|
|
|
2010-08-17 13:05:33 +02:00
|
|
|
const QLatin1String mimetypesXml(":/qmlproject/QmlProject.mimetypes.xml");
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
if (! mimeDB->addMimeTypes(mimetypesXml, errorMessage))
|
|
|
|
return false;
|
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
Internal::Manager *manager = new Internal::Manager;
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
addAutoReleasedObject(manager);
|
2010-02-16 13:39:13 +01:00
|
|
|
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
2011-05-02 16:29:13 +02:00
|
|
|
addAutoReleasedObject(new Internal::QmlProjectRunControlFactory);
|
2011-07-21 10:40:56 +02:00
|
|
|
addAutoReleasedObject(new Internal::QmlProjectApplicationWizard);
|
|
|
|
addAutoReleasedObject(new Internal::QmlProjectTargetFactory);
|
2010-02-26 14:46:04 +01:00
|
|
|
|
|
|
|
QmlProjectFileFormat::registerDeclarativeTypes();
|
|
|
|
|
2010-04-01 17:21:18 +02:00
|
|
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
2010-07-30 22:16:59 +02:00
|
|
|
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/qmlproject/images/qmlproject.png")), "qmlproject");
|
2009-05-04 12:19:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProjectPlugin::extensionsInitialized()
|
2009-11-11 10:10:00 +01:00
|
|
|
{
|
|
|
|
}
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
void QmlProjectPlugin::showQmlObserverToolWarning()
|
|
|
|
{
|
|
|
|
QMessageBox dialog(QApplication::activeWindow());
|
|
|
|
QPushButton *qtPref = dialog.addButton(tr("Open Qt4 Options"),
|
|
|
|
QMessageBox::ActionRole);
|
2011-07-21 16:51:05 +02:00
|
|
|
dialog.addButton(QMessageBox::Cancel);
|
2011-07-21 10:40:56 +02:00
|
|
|
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(
|
2011-09-15 19:20:50 +02:00
|
|
|
ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
2011-07-21 10:40:56 +02:00
|
|
|
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace QmlProjectManager
|
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
Q_EXPORT_PLUGIN(QmlProjectManager::QmlProjectPlugin)
|