Changed: #1193 code cleanup.

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

View file

@ -25,20 +25,20 @@
#include "iplugin_manager.h"
namespace NLMISC
namespace NLMISC
{
class INelContext;
class INelContext;
}
namespace ExtensionSystem
{
/**
@interface IPlugin
@brief Base class for all plugins.
@details The IPlugin class is an abstract class that must be implemented
once for each plugin. The IPlugin implementation must be exported and
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
@interface IPlugin
@brief Base class for all plugins.
@details The IPlugin class is an abstract class that must be implemented
once for each plugin. The IPlugin implementation must be exported and
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
see the Qt documentation for details on that.
*/
class IPlugin
@ -50,7 +50,7 @@ public:
virtual void extensionsInitialized() = 0;
virtual void shutdown() { }
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
virtual QString name() const = 0;
virtual QString version() const = 0;

View file

@ -54,10 +54,10 @@ public:
virtual QStringList getPluginPaths() const = 0;
virtual void setPluginPaths(const QStringList &paths) = 0;
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
// Settings
virtual void setSettings(QSettings *settings) = 0;
virtual QSettings *settings() const = 0;
// Settings
virtual void setSettings(QSettings *settings) = 0;
virtual QSettings *settings() const = 0;
Q_SIGNALS:
void objectAdded(QObject *obj);

View file

@ -26,10 +26,10 @@ namespace ExtensionSystem
{
class IPlugin;
class IPluginManager;
/**
@struct State
@details The plugin goes through several steps while being loaded.
/**
@struct State
@details The plugin goes through several steps while being loaded.
The state gives a hint on what went wrong in case of an error.
*/
struct State
@ -47,11 +47,11 @@ struct State
};
/**
@interface IPluginSpec
@brief Interface for plugin spec contains the information of the plugins and
information about the plugin's current state.
@details The plugin spec is also filled with more information as the plugin
goes through its loading process (see State).
@interface IPluginSpec
@brief Interface for plugin spec contains the information of the plugins and
information about the plugin's current state.
@details The plugin spec is also filled with more information as the plugin
goes through its loading process (see State).
If an error occurs, the plugin spec is the place to look for the error details.
*/
class IPluginSpec

View file

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

View file

@ -50,12 +50,12 @@ public:
virtual QStringList getPluginPaths() const;
virtual void setPluginPaths(const QStringList &paths);
virtual QList<IPluginSpec *> plugins() const;
// Settings
virtual void setSettings(QSettings *settings);
virtual QSettings *settings() const;
void readSettings();
void writeSettings();
// Settings
virtual void setSettings(QSettings *settings);
virtual QSettings *settings() const;
void readSettings();
void writeSettings();
private:
void setPluginState(CPluginSpec *spec, int destState);

View file

@ -117,9 +117,9 @@ sint main(int argc, char **argv)
#endif
Modules::init();
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
Modules::plugMan().setSettings(settings);
// load and set remap extensions from config

View file

@ -36,7 +36,7 @@ namespace NLQT
/**
@class CWorkspacePage
@brief Page for QStackWidget, to particles workspace operation (new/load/save workspace,
@brief Page for QStackWidget, to particles workspace operation (new/load/save workspace,
create/insert/remove all particles system to workspace)
*/
class CWorkspacePage: public QWidget

View file

@ -49,7 +49,7 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr
void CorePlugin::extensionsInitialized()
{
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
// for old ovqt
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
if (wnd)
@ -63,7 +63,7 @@ void CorePlugin::extensionsInitialized()
QAction *newAction = toolsMenu->addAction(tr("New settings"));
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
oldOVQT = true;
@ -94,7 +94,7 @@ void CorePlugin::extensionsInitialized()
void CorePlugin::shutdown()
{
if (!oldOVQT)
{
{
delete _mainWindow;
delete _pluginView;
}

View file

@ -58,7 +58,10 @@ public:
QObject *objectByName(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>
QList<Type *> getObjects() const

View file

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

View file

@ -59,7 +59,7 @@ CSettingsDialog::CSettingsDialog(QWidget *parent)
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
@ -341,9 +341,9 @@ void CSettingsDialog::saveGraphicsSettings()
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
if (ui.paletteCheckBox->isChecked())
QApplication::setPalette(QApplication::style()->standardPalette());
else
if (ui.paletteCheckBox->isChecked())
QApplication::setPalette(QApplication::style()->standardPalette());
else
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
}
@ -384,7 +384,7 @@ void CSettingsDialog::saveVegetableSettings()
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
list.push_back(str);
}
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
}

View file

@ -126,15 +126,15 @@ void CTailParticleWidget::setRibbonOrientation(int index)
}
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
{
if( event->type() == QEvent::Paint )
{
{
if( event->type() == QEvent::Paint )
{
QPainter painter(_ui.graphicsWidget);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setBrush(QBrush(Qt::white));
painter.setPen(QPen(Qt::black, 2, Qt::SolidLine));
painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0);
painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0);
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
painter.scale(0.86, 0.86);
painter.translate(6, 6);
@ -167,9 +167,9 @@ bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[0].y)),
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
}
}
}
}
}
}
return QWidget::eventFilter(object, event);
}

View file

@ -24,7 +24,7 @@
#include <nel/3d/u_scene.h>
// Project includes
#include "modules.h"
#include "modules.h"
const int sliderStepSize = 5000;
@ -47,8 +47,8 @@ CTuneMRMDialog::~CTuneMRMDialog()
}
void CTuneMRMDialog::setMaxValue(int value)
{
int actualMaxValue = value * sliderStepSize;
{
int actualMaxValue = value * sliderStepSize;
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
_ui.currentValueSlider->setMaximum(actualMaxValue);

View file

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

View file

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

View file

@ -43,7 +43,7 @@ public:
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
Q_SIGNALS:
void noiseValueChanged(const NLMISC::CNoiseValue &value);