2010-11-10 15:07:53 +01: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).
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2010-11-10 15:07:53 +01: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.
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2010-12-17 17:14:20 +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 17:14:20 +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 17:14:20 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLJSPLUGINDUMPER_H
|
|
|
|
|
#define QMLJSPLUGINDUMPER_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QHash>
|
|
|
|
|
#include <QtCore/QProcess>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDir;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class FileWatcher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJSTools {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class ModelManager;
|
|
|
|
|
|
|
|
|
|
class PluginDumper : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit PluginDumper(ModelManager *modelManager);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
2011-02-08 13:29:21 +01:00
|
|
|
const QString &importUri, const QString &importVersion);
|
2010-11-24 09:30:46 +01:00
|
|
|
void scheduleCompleteRedump();
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath,
|
2011-02-08 13:29:21 +01:00
|
|
|
const QString &importUri, const QString &importVersion);
|
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;
|
2010-11-26 14:24:59 +01:00
|
|
|
|
2011-02-08 13:22:34 +01:00
|
|
|
bool hasPredumpedQmlTypesFile() const;
|
|
|
|
|
QString predumpedQmlTypesFilePath() const;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void dump(const Plugin &plugin);
|
|
|
|
|
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:
|
|
|
|
|
ModelManager *m_modelManager;
|
|
|
|
|
ProjectExplorer::FileWatcher *m_pluginWatcher;
|
|
|
|
|
QHash<QProcess *, QString> m_runningQmldumps;
|
|
|
|
|
QList<Plugin> m_plugins;
|
|
|
|
|
QHash<QString, int> m_libraryToPluginIndex;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlJSTools
|
|
|
|
|
|
|
|
|
|
#endif // QMLJSPLUGINDUMPER_H
|