2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-11-10 15:07:53 +01: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
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-11-10 15:07:53 +01: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.
|
2010-11-10 15:07:53 +01: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 17:14:20 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
#ifndef QMLJSPLUGINDUMPER_H
|
|
|
|
|
#define QMLJSPLUGINDUMPER_H
|
|
|
|
|
|
2011-06-28 12:01:56 +02:00
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QProcess>
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDir;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2011-04-15 15:55:11 +02:00
|
|
|
namespace Utils {
|
|
|
|
|
class FileSystemWatcher;
|
2010-11-10 15:07:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJSTools {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class ModelManager;
|
|
|
|
|
|
|
|
|
|
class PluginDumper : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit PluginDumper(ModelManager *modelManager);
|
|
|
|
|
|
|
|
|
|
public:
|
2011-06-28 12:01:56 +02:00
|
|
|
void loadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
2010-11-10 15:07:53 +01:00
|
|
|
void loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
2011-02-08 13:29:21 +01:00
|
|
|
const QString &importUri, const QString &importVersion);
|
2011-06-28 12:01:56 +02:00
|
|
|
void scheduleRedumpPlugins();
|
|
|
|
|
void scheduleMaybeRedumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
private slots:
|
2011-06-28 12:01:56 +02:00
|
|
|
void onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info,
|
|
|
|
|
bool force = false);
|
2010-11-10 15:07:53 +01:00
|
|
|
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath,
|
2011-02-08 13:29:21 +01:00
|
|
|
const QString &importUri, const QString &importVersion);
|
2011-06-28 12:01:56 +02:00
|
|
|
void dumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
2010-11-24 09:30:46 +01:00
|
|
|
void dumpAllPlugins();
|
2010-11-10 15:07:53 +01:00
|
|
|
void qmlPluginTypeDumpDone(int exitCode);
|
|
|
|
|
void qmlPluginTypeDumpError(QProcess::ProcessError error);
|
|
|
|
|
void pluginChanged(const QString &pluginLibrary);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class Plugin {
|
|
|
|
|
public:
|
|
|
|
|
QString qmldirPath;
|
|
|
|
|
QString importPath;
|
|
|
|
|
QString importUri;
|
2011-02-08 13:29:21 +01:00
|
|
|
QString importVersion;
|
2011-09-02 13:25:08 +02:00
|
|
|
QStringList typeInfoPaths;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void dump(const Plugin &plugin);
|
2011-09-02 13:25:08 +02:00
|
|
|
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
2011-06-28 12:01:56 +02:00
|
|
|
const QString &libraryPath,
|
|
|
|
|
QmlJS::LibraryInfo libraryInfo);
|
2010-11-10 15:07:53 +01:00
|
|
|
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
|
|
|
|
const QString &baseName);
|
|
|
|
|
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
|
|
|
|
const QString &baseName, const QStringList &suffixes,
|
2010-11-11 14:21:04 +01:00
|
|
|
const QString &prefix = QString());
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
private:
|
2011-04-15 15:55:11 +02:00
|
|
|
Utils::FileSystemWatcher *pluginWatcher();
|
|
|
|
|
|
2010-11-10 15:07:53 +01:00
|
|
|
ModelManager *m_modelManager;
|
2011-04-15 15:55:11 +02:00
|
|
|
Utils::FileSystemWatcher *m_pluginWatcher;
|
2010-11-10 15:07:53 +01:00
|
|
|
QHash<QProcess *, QString> m_runningQmldumps;
|
|
|
|
|
QList<Plugin> m_plugins;
|
|
|
|
|
QHash<QString, int> m_libraryToPluginIndex;
|
2011-06-28 12:01:56 +02:00
|
|
|
QHash<QString, QmlJS::ModelManagerInterface::ProjectInfo> m_qtToInfo;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlJSTools
|
|
|
|
|
|
|
|
|
|
#endif // QMLJSPLUGINDUMPER_H
|