forked from qt-creator/qt-creator
QmlDesigner: Remove WidgetPluginManagerPrivate
Change-Id: Ibe3352dff9d620656ca4279d67e1e622a3e4dd41 Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
@@ -29,7 +29,6 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "widgetpluginmanager.h"
|
#include "widgetpluginmanager.h"
|
||||||
#include "widgetpluginpath.h"
|
|
||||||
#include <iwidgetplugin.h>
|
#include <iwidgetplugin.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -52,30 +51,17 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// ---- PluginManager[Private]
|
WidgetPluginManager::WidgetPluginManager()
|
||||||
class WidgetPluginManagerPrivate {
|
|
||||||
public:
|
|
||||||
typedef QList<WidgetPluginPath> PluginPathList;
|
|
||||||
PluginPathList m_paths;
|
|
||||||
};
|
|
||||||
|
|
||||||
WidgetPluginManager::WidgetPluginManager() :
|
|
||||||
d(new WidgetPluginManagerPrivate)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetPluginManager::~WidgetPluginManager()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetPluginManager::IWidgetPluginList WidgetPluginManager::instances()
|
WidgetPluginManager::IWidgetPluginList WidgetPluginManager::instances()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << '>' << Q_FUNC_INFO << QLibraryInfo::buildKey();
|
qDebug() << '>' << Q_FUNC_INFO << QLibraryInfo::buildKey();
|
||||||
IWidgetPluginList rc;
|
IWidgetPluginList rc;
|
||||||
const WidgetPluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
|
const PluginPathList::iterator end = m_paths.end();
|
||||||
for (WidgetPluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
|
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
|
||||||
it->getInstances(&rc);
|
it->getInstances(&rc);
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << '<' << Q_FUNC_INFO << rc.size();
|
qDebug() << '<' << Q_FUNC_INFO << rc.size();
|
||||||
@@ -87,15 +73,15 @@ bool WidgetPluginManager::addPath(const QString &path)
|
|||||||
const QDir dir(path);
|
const QDir dir(path);
|
||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
return false;
|
return false;
|
||||||
d->m_paths.push_back(WidgetPluginPath(dir));
|
m_paths.push_back(WidgetPluginPath(dir));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractItemModel *WidgetPluginManager::createModel(QObject *parent)
|
QAbstractItemModel *WidgetPluginManager::createModel(QObject *parent)
|
||||||
{
|
{
|
||||||
QStandardItemModel *model = new QStandardItemModel(parent);
|
QStandardItemModel *model = new QStandardItemModel(parent);
|
||||||
const WidgetPluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
|
const PluginPathList::iterator end = m_paths.end();
|
||||||
for (WidgetPluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
|
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
|
||||||
model->appendRow(it->createModelItem());
|
model->appendRow(it->createModelItem());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,9 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
|
#include "widgetpluginpath.h"
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QString;
|
class QString;
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
@@ -45,8 +48,6 @@ class IWidgetPlugin;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class WidgetPluginManagerPrivate;
|
|
||||||
|
|
||||||
// PluginManager: Loads the plugin libraries on demand "as lazy as
|
// PluginManager: Loads the plugin libraries on demand "as lazy as
|
||||||
// possible", that is, directories are scanned and
|
// possible", that is, directories are scanned and
|
||||||
// instances are created only when instances() is called.
|
// instances are created only when instances() is called.
|
||||||
@@ -54,11 +55,11 @@ class WidgetPluginManagerPrivate;
|
|||||||
class WidgetPluginManager
|
class WidgetPluginManager
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(WidgetPluginManager)
|
Q_DISABLE_COPY(WidgetPluginManager)
|
||||||
|
typedef QList<WidgetPluginPath> PluginPathList;
|
||||||
public:
|
public:
|
||||||
typedef QList<IWidgetPlugin *> IWidgetPluginList;
|
typedef QList<IWidgetPlugin *> IWidgetPluginList;
|
||||||
|
|
||||||
WidgetPluginManager();
|
WidgetPluginManager();
|
||||||
~WidgetPluginManager();
|
|
||||||
|
|
||||||
bool addPath(const QString &path);
|
bool addPath(const QString &path);
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ public:
|
|||||||
QAbstractItemModel *createModel(QObject *parent = 0);
|
QAbstractItemModel *createModel(QObject *parent = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WidgetPluginManagerPrivate *d;
|
PluginPathList m_paths;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -173,7 +173,7 @@ void WidgetPluginPath::ensureLoaded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetPluginPath::getInstances(WidgetPluginManager::IWidgetPluginList *list)
|
void WidgetPluginPath::getInstances(IWidgetPluginList *list)
|
||||||
{
|
{
|
||||||
ensureLoaded();
|
ensureLoaded();
|
||||||
// Compile list of instances
|
// Compile list of instances
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
#ifndef WIDGETPLUGINPATH_H
|
#ifndef WIDGETPLUGINPATH_H
|
||||||
#define WIDGETPLUGINPATH_H
|
#define WIDGETPLUGINPATH_H
|
||||||
|
|
||||||
#include "widgetpluginmanager.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -74,11 +72,12 @@ struct WidgetPluginData {
|
|||||||
// IPlugins.
|
// IPlugins.
|
||||||
|
|
||||||
class WidgetPluginPath {
|
class WidgetPluginPath {
|
||||||
|
typedef QList<IWidgetPlugin *> IWidgetPluginList;
|
||||||
public:
|
public:
|
||||||
explicit WidgetPluginPath(const QDir &path);
|
explicit WidgetPluginPath(const QDir &path);
|
||||||
|
|
||||||
|
|
||||||
void getInstances(WidgetPluginManager::IWidgetPluginList *list);
|
void getInstances(IWidgetPluginList *list);
|
||||||
|
|
||||||
QDir path() const { return m_path; }
|
QDir path() const { return m_path; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user