2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
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
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 17:14:20 +01:00
|
|
|
**
|
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
|
|
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Utils { class FileSystemWatcher; }
|
2010-11-10 15:07:53 +01:00
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
namespace QmlJS {
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
class PluginDumper : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2014-01-23 14:28:31 +01:00
|
|
|
explicit PluginDumper(ModelManagerInterface *modelManager);
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
2016-01-20 12:38:56 +01:00
|
|
|
void runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info, const QStringList &arguments, const QString &importPath);
|
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();
|
|
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
ModelManagerInterface *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
|
|
|
};
|
|
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
} // namespace QmlJS
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
#endif // QMLJSPLUGINDUMPER_H
|