| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the Qt Designer of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | //
|
|---|
| 43 | // W A R N I N G
|
|---|
| 44 | // -------------
|
|---|
| 45 | //
|
|---|
| 46 | // This file is not part of the Qt API. It exists for the convenience
|
|---|
| 47 | // of Qt Designer. This header
|
|---|
| 48 | // file may change from version to version without notice, or even be removed.
|
|---|
| 49 | //
|
|---|
| 50 | // We mean it.
|
|---|
| 51 | //
|
|---|
| 52 |
|
|---|
| 53 | #ifndef PLUGINMANAGER_H
|
|---|
| 54 | #define PLUGINMANAGER_H
|
|---|
| 55 |
|
|---|
| 56 | #include "shared_global_p.h"
|
|---|
| 57 | #include "shared_enums_p.h"
|
|---|
| 58 |
|
|---|
| 59 | #include <QtCore/QSharedDataPointer>
|
|---|
| 60 | #include <QtCore/QMap>
|
|---|
| 61 | #include <QtCore/QPair>
|
|---|
| 62 | #include <QtCore/QStringList>
|
|---|
| 63 |
|
|---|
| 64 | QT_BEGIN_NAMESPACE
|
|---|
| 65 |
|
|---|
| 66 | class QDesignerFormEditorInterface;
|
|---|
| 67 | class QDesignerCustomWidgetInterface;
|
|---|
| 68 | class QDesignerPluginManagerPrivate;
|
|---|
| 69 |
|
|---|
| 70 | class QDesignerCustomWidgetSharedData;
|
|---|
| 71 |
|
|---|
| 72 | /* Information contained in the Dom XML of a custom widget. */
|
|---|
| 73 | class QDESIGNER_SHARED_EXPORT QDesignerCustomWidgetData {
|
|---|
| 74 | public:
|
|---|
| 75 | // StringPropertyType: validation mode and translatable flag.
|
|---|
| 76 | typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType;
|
|---|
| 77 |
|
|---|
| 78 | explicit QDesignerCustomWidgetData(const QString &pluginPath = QString());
|
|---|
| 79 |
|
|---|
| 80 | enum ParseResult { ParseOk, ParseWarning, ParseError };
|
|---|
| 81 | ParseResult parseXml(const QString &xml, const QString &name, QString *errorMessage);
|
|---|
| 82 |
|
|---|
| 83 | QDesignerCustomWidgetData(const QDesignerCustomWidgetData&);
|
|---|
| 84 | QDesignerCustomWidgetData& operator=(const QDesignerCustomWidgetData&);
|
|---|
| 85 | ~QDesignerCustomWidgetData();
|
|---|
| 86 |
|
|---|
| 87 | bool isNull() const;
|
|---|
| 88 |
|
|---|
| 89 | QString pluginPath() const;
|
|---|
| 90 |
|
|---|
| 91 | // Data as parsed from the widget's domXML().
|
|---|
| 92 | QString xmlClassName() const;
|
|---|
| 93 | // Optional. The language the plugin is supposed to be used with.
|
|---|
| 94 | QString xmlLanguage() const;
|
|---|
| 95 | // Optional. method used to add pages to a container with a container extension
|
|---|
| 96 | QString xmlAddPageMethod() const;
|
|---|
| 97 | // Optional. Base class
|
|---|
| 98 | QString xmlExtends() const;
|
|---|
| 99 | // Optional. The name to be used in the widget box.
|
|---|
| 100 | QString xmlDisplayName() const;
|
|---|
| 101 | // Type of a string property
|
|---|
| 102 | bool xmlStringPropertyType(const QString &name, StringPropertyType *type) const;
|
|---|
| 103 |
|
|---|
| 104 | private:
|
|---|
| 105 | QSharedDataPointer<QDesignerCustomWidgetSharedData> m_d;
|
|---|
| 106 | };
|
|---|
| 107 |
|
|---|
| 108 | class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject
|
|---|
| 109 | {
|
|---|
| 110 | Q_OBJECT
|
|---|
| 111 | public:
|
|---|
| 112 | typedef QList<QDesignerCustomWidgetInterface*> CustomWidgetList;
|
|---|
| 113 |
|
|---|
| 114 | explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
|
|---|
| 115 | virtual ~QDesignerPluginManager();
|
|---|
| 116 |
|
|---|
| 117 | QDesignerFormEditorInterface *core() const;
|
|---|
| 118 |
|
|---|
| 119 | QObject *instance(const QString &plugin) const;
|
|---|
| 120 |
|
|---|
| 121 | QStringList registeredPlugins() const;
|
|---|
| 122 |
|
|---|
| 123 | QStringList findPlugins(const QString &path);
|
|---|
| 124 |
|
|---|
| 125 | QStringList pluginPaths() const;
|
|---|
| 126 | void setPluginPaths(const QStringList &plugin_paths);
|
|---|
| 127 |
|
|---|
| 128 | QStringList disabledPlugins() const;
|
|---|
| 129 | void setDisabledPlugins(const QStringList &disabled_plugins);
|
|---|
| 130 |
|
|---|
| 131 | QStringList failedPlugins() const;
|
|---|
| 132 | QString failureReason(const QString &pluginName) const;
|
|---|
| 133 |
|
|---|
| 134 | QObjectList instances() const;
|
|---|
| 135 |
|
|---|
| 136 | CustomWidgetList registeredCustomWidgets() const;
|
|---|
| 137 | QDesignerCustomWidgetData customWidgetData(QDesignerCustomWidgetInterface *w) const;
|
|---|
| 138 | QDesignerCustomWidgetData customWidgetData(const QString &className) const;
|
|---|
| 139 |
|
|---|
| 140 | bool registerNewPlugins();
|
|---|
| 141 |
|
|---|
| 142 | public slots:
|
|---|
| 143 | bool syncSettings();
|
|---|
| 144 | void ensureInitialized();
|
|---|
| 145 |
|
|---|
| 146 | private:
|
|---|
| 147 | void updateRegisteredPlugins();
|
|---|
| 148 | void registerPath(const QString &path);
|
|---|
| 149 | void registerPlugin(const QString &plugin);
|
|---|
| 150 |
|
|---|
| 151 | private:
|
|---|
| 152 | static QStringList defaultPluginPaths();
|
|---|
| 153 |
|
|---|
| 154 | QDesignerPluginManagerPrivate *m_d;
|
|---|
| 155 | };
|
|---|
| 156 |
|
|---|
| 157 | QT_END_NAMESPACE
|
|---|
| 158 |
|
|---|
| 159 | #endif // PLUGINMANAGER_H
|
|---|