Changed: #1206 ovqt plugin system.

This commit is contained in:
dnk-88 2010-11-29 18:46:43 +02:00
parent 376bc221df
commit 181bff3a2d
5 changed files with 104 additions and 12 deletions

View file

@ -46,6 +46,8 @@ public:
virtual void setPluginPaths(const QStringList &paths) = 0; virtual void setPluginPaths(const QStringList &paths) = 0;
virtual QList<NLQT::CPluginSpec *> plugins() const = 0; virtual QList<NLQT::CPluginSpec *> plugins() const = 0;
virtual CPluginSpec *pluginByName(const QString &name) const = 0;
Q_SIGNALS: Q_SIGNALS:
void objectAdded(QObject *obj); void objectAdded(QObject *obj);
void aboutToRemoveObject(QObject *obj); void aboutToRemoveObject(QObject *obj);

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CPluginView</class>
<widget class="QDialog" name="CPluginView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>691</width>
<height>249</height>
</rect>
</property>
<property name="windowTitle">
<string>Plugins</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4">
<widget class="QTreeWidget" name="pluginTreeWidget">
<column>
<property name="text">
<string>State</string>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
</column>
<column>
<property name="text">
<string>Vendor</string>
</property>
</column>
<column>
<property name="text">
<string>Location</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="detailsPushButton">
<property name="text">
<string>Details</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="errorPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Error details</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>427</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="closePushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../object_viewer_qt.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -141,10 +141,9 @@ void CPluginManager::readPluginPaths()
Q_FOREACH (const QString &pluginFile, pluginsList) Q_FOREACH (const QString &pluginFile, pluginsList)
{ {
CPluginSpec *spec = new CPluginSpec; CPluginSpec *spec = new CPluginSpec;
if (spec->setFileName(pluginFile)) spec->setFileName(pluginFile);
_pluginSpecs.append(spec); spec->_pluginManager = this;
else _pluginSpecs.append(spec);
delete spec;
} }
Q_EMIT pluginsChanged(); Q_EMIT pluginsChanged();

View file

@ -50,7 +50,7 @@ public:
virtual void setPluginPaths(const QStringList &paths); virtual void setPluginPaths(const QStringList &paths);
virtual QList<CPluginSpec *> plugins() const; virtual QList<CPluginSpec *> plugins() const;
CPluginSpec *pluginByName(const QString &name) const; virtual CPluginSpec *pluginByName(const QString &name) const;
private: private:
void setPluginState(CPluginSpec *spec, int destState); void setPluginState(CPluginSpec *spec, int destState);

View file

@ -98,14 +98,13 @@ QString CPluginSpec::errorString() const
bool CPluginSpec::setFileName(const QString &fileName) bool CPluginSpec::setFileName(const QString &fileName)
{ {
_name _name = _version
= _version = _vendor
= _vendor
= _description = _description
= _location = _location
= _filePath = _filePath
= _fileName = _fileName
= ""; = "";
_state = State::Invalid; _state = State::Invalid;
_hasError = false; _hasError = false;
_errorString = ""; _errorString = "";