Changed: #1193 code cleanup.

This commit is contained in:
dnk-88 2011-02-12 18:11:23 +02:00
parent 8b03a1d829
commit d8d5269f98
16 changed files with 79 additions and 76 deletions

View file

@ -27,7 +27,7 @@
namespace NLMISC namespace NLMISC
{ {
class INelContext; class INelContext;
} }
namespace ExtensionSystem namespace ExtensionSystem

View file

@ -56,8 +56,8 @@ public:
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0; virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
// Settings // Settings
virtual void setSettings(QSettings *settings) = 0; virtual void setSettings(QSettings *settings) = 0;
virtual QSettings *settings() const = 0; virtual QSettings *settings() const = 0;
Q_SIGNALS: Q_SIGNALS:
void objectAdded(QObject *obj); void objectAdded(QObject *obj);

View file

@ -95,8 +95,8 @@ void CPluginManager::loadPlugins()
setPluginState(spec, State::Initialized); setPluginState(spec, State::Initialized);
QListIterator<CPluginSpec *> it(_pluginSpecs); QListIterator<CPluginSpec *> it(_pluginSpecs);
it.toBack(); it.toBack();
while (it.hasPrevious()) while (it.hasPrevious())
setPluginState(it.previous(), State::Running); setPluginState(it.previous(), State::Running);
Q_EMIT pluginsChanged(); Q_EMIT pluginsChanged();
@ -202,12 +202,12 @@ void CPluginManager::stopAll()
void CPluginManager::deleteAll() void CPluginManager::deleteAll()
{ {
QListIterator<CPluginSpec *> it(_pluginSpecs); QListIterator<CPluginSpec *> it(_pluginSpecs);
it.toBack(); it.toBack();
while (it.hasPrevious()) while (it.hasPrevious())
{ {
setPluginState(it.previous(), State::Deleted); setPluginState(it.previous(), State::Deleted);
} }
} }
}; // namespace NLQT }; // namespace NLQT

View file

@ -52,10 +52,10 @@ public:
virtual QList<IPluginSpec *> plugins() const; virtual QList<IPluginSpec *> plugins() const;
// Settings // Settings
virtual void setSettings(QSettings *settings); virtual void setSettings(QSettings *settings);
virtual QSettings *settings() const; virtual QSettings *settings() const;
void readSettings(); void readSettings();
void writeSettings(); void writeSettings();
private: private:
void setPluginState(CPluginSpec *spec, int destState); void setPluginState(CPluginSpec *spec, int destState);

View file

@ -58,7 +58,10 @@ public:
QObject *objectByName(const QString &name) const; QObject *objectByName(const QString &name) const;
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const; ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
ExtensionSystem::IPluginManager *pluginManager() const { return _plugMan; } ExtensionSystem::IPluginManager *pluginManager() const
{
return _plugMan;
}
template <typename Type> template <typename Type>
QList<Type *> getObjects() const QList<Type *> getObjects() const

View file

@ -71,16 +71,16 @@ QList<QString> MyPlugin::dependencies() const
QObject* MyPlugin::objectByName(const QString &name) const QObject* MyPlugin::objectByName(const QString &name) const
{ {
Q_FOREACH (QObject *qobj, _plugMan->allObjects()) Q_FOREACH (QObject *qobj, _plugMan->allObjects())
if (qobj->objectName() == name) if (qobj->objectName() == name)
return qobj; return qobj;
return 0; return 0;
} }
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
{ {
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins()) Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
if (spec->name() == name) if (spec->name() == name)
return spec; return spec;
return 0; return 0;
} }

View file

@ -316,9 +316,9 @@ void CVegetableEditor::setVegetableWindPower(float w)
_VegetableWindPower= w; _VegetableWindPower= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq, _VegetableWindFreq,
_VegetableWindPower, _VegetableWindPower,
_VegetableWindBendMin); _VegetableWindBendMin);
} }
void CVegetableEditor::setVegetableWindBendStart(float w) void CVegetableEditor::setVegetableWindBendStart(float w)
@ -326,9 +326,9 @@ void CVegetableEditor::setVegetableWindBendStart(float w)
_VegetableWindBendMin= w; _VegetableWindBendMin= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq, _VegetableWindFreq,
_VegetableWindPower, _VegetableWindPower,
_VegetableWindBendMin); _VegetableWindBendMin);
} }
void CVegetableEditor::setVegetableWindFrequency(float w) void CVegetableEditor::setVegetableWindFrequency(float w)
@ -336,9 +336,9 @@ void CVegetableEditor::setVegetableWindFrequency(float w)
_VegetableWindFreq= w; _VegetableWindFreq= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq, _VegetableWindFreq,
_VegetableWindPower, _VegetableWindPower,
_VegetableWindBendMin); _VegetableWindBendMin);
} }
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable) void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)

View file

@ -30,7 +30,7 @@ namespace NLQT
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent) CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
: QGroupBox(parent), : QGroupBox(parent),
_emit(true) _emit(true)
{ {
_ui.setupUi(this); _ui.setupUi(this);