2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
#include "qmlprojectplugin.h"
|
|
|
|
#include "qmlprojectmanager.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"
|
2013-01-11 13:31:03 +01:00
|
|
|
#include "qmlapplicationwizard.h"
|
2010-02-26 14:46:04 +01:00
|
|
|
#include "fileformat/qmlprojectfileformat.h"
|
2009-11-11 10:10:00 +01: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>
|
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QtPlugin>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QPushButton>
|
2011-07-21 10:40:56 +02:00
|
|
|
|
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;
|
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
Core::MimeDatabase *mimeDB = Core::ICore::mimeDatabase();
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2013-05-28 20:53:12 +03:00
|
|
|
const QLatin1String mimetypesXml(":/qmlproject/QmlProjectManager.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);
|
2012-11-28 12:44:49 +01:00
|
|
|
|
2013-01-11 13:31:03 +01:00
|
|
|
|
|
|
|
Internal::QmlApplicationWizard::createInstances(this);
|
2010-02-26 14:46:04 +01:00
|
|
|
|
2010-04-01 17:21:18 +02:00
|
|
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
2012-11-26 21:24:16 +02:00
|
|
|
iconProvider->registerIconOverlayForSuffix(QIcon(QLatin1String(":/qmlproject/images/qmlproject.png")),
|
|
|
|
QLatin1String("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());
|
2012-03-15 14:05:06 +01:00
|
|
|
QPushButton *qtPref = dialog.addButton(tr("Open Qt Versions"),
|
2011-07-21 10:40:56 +02:00
|
|
|
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"));
|
2012-03-15 14:05:06 +01:00
|
|
|
dialog.setText(tr("QML Observer could not be found for this Qt version."));
|
2011-07-21 10:40:56 +02:00
|
|
|
dialog.setInformativeText(tr(
|
|
|
|
"QML Observer is used to offer debugging features for "
|
2012-03-15 14:05:06 +01:00
|
|
|
"Qt Quick UI projects in the Qt 4.7 series.\n\n"
|
|
|
|
"To compile QML Observer, go to the Qt Versions page, "
|
|
|
|
"select the current Qt version, "
|
|
|
|
"and click Build in the Helpers section."));
|
2011-07-21 10:40:56 +02:00
|
|
|
dialog.exec();
|
|
|
|
if (dialog.clickedButton() == qtPref) {
|
2012-01-24 15:36:40 +01:00
|
|
|
Core::ICore::showOptionsDialog(
|
2012-12-29 01:31:08 +01:00
|
|
|
ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
|
|
|
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
|
2011-07-21 10:40:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace QmlProjectManager
|
|
|
|
|
2011-07-21 10:40:56 +02:00
|
|
|
Q_EXPORT_PLUGIN(QmlProjectManager::QmlProjectPlugin)
|