Changed: #1193 code cleanup.
This commit is contained in:
parent
8b03a1d829
commit
d8d5269f98
16 changed files with 79 additions and 76 deletions
|
@ -25,20 +25,20 @@
|
||||||
|
|
||||||
#include "iplugin_manager.h"
|
#include "iplugin_manager.h"
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class INelContext;
|
class INelContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPlugin
|
@interface IPlugin
|
||||||
@brief Base class for all plugins.
|
@brief Base class for all plugins.
|
||||||
@details The IPlugin class is an abstract class that must be implemented
|
@details The IPlugin class is an abstract class that must be implemented
|
||||||
once for each plugin. The IPlugin implementation must be exported and
|
once for each plugin. The IPlugin implementation must be exported and
|
||||||
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
||||||
see the Qt documentation for details on that.
|
see the Qt documentation for details on that.
|
||||||
*/
|
*/
|
||||||
class IPlugin
|
class IPlugin
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
virtual void extensionsInitialized() = 0;
|
virtual void extensionsInitialized() = 0;
|
||||||
virtual void shutdown() { }
|
virtual void shutdown() { }
|
||||||
|
|
||||||
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
virtual QString version() const = 0;
|
virtual QString version() const = 0;
|
||||||
|
|
|
@ -54,10 +54,10 @@ public:
|
||||||
virtual QStringList getPluginPaths() const = 0;
|
virtual QStringList getPluginPaths() const = 0;
|
||||||
virtual void setPluginPaths(const QStringList &paths) = 0;
|
virtual void setPluginPaths(const QStringList &paths) = 0;
|
||||||
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);
|
||||||
|
|
|
@ -26,10 +26,10 @@ namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPlugin;
|
class IPlugin;
|
||||||
class IPluginManager;
|
class IPluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@struct State
|
@struct State
|
||||||
@details The plugin goes through several steps while being loaded.
|
@details The plugin goes through several steps while being loaded.
|
||||||
The state gives a hint on what went wrong in case of an error.
|
The state gives a hint on what went wrong in case of an error.
|
||||||
*/
|
*/
|
||||||
struct State
|
struct State
|
||||||
|
@ -47,11 +47,11 @@ struct State
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPluginSpec
|
@interface IPluginSpec
|
||||||
@brief Interface for plugin spec contains the information of the plugins and
|
@brief Interface for plugin spec contains the information of the plugins and
|
||||||
information about the plugin's current state.
|
information about the plugin's current state.
|
||||||
@details The plugin spec is also filled with more information as the plugin
|
@details The plugin spec is also filled with more information as the plugin
|
||||||
goes through its loading process (see State).
|
goes through its loading process (see State).
|
||||||
If an error occurs, the plugin spec is the place to look for the error details.
|
If an error occurs, the plugin spec is the place to look for the error details.
|
||||||
*/
|
*/
|
||||||
class IPluginSpec
|
class IPluginSpec
|
||||||
|
|
|
@ -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
|
|
@ -50,12 +50,12 @@ public:
|
||||||
virtual QStringList getPluginPaths() const;
|
virtual QStringList getPluginPaths() const;
|
||||||
virtual void setPluginPaths(const QStringList &paths);
|
virtual void setPluginPaths(const QStringList &paths);
|
||||||
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);
|
||||||
|
|
|
@ -117,9 +117,9 @@ sint main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Modules::init();
|
Modules::init();
|
||||||
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
|
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
|
||||||
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
|
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
|
||||||
|
|
||||||
Modules::plugMan().setSettings(settings);
|
Modules::plugMan().setSettings(settings);
|
||||||
|
|
||||||
// load and set remap extensions from config
|
// load and set remap extensions from config
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace NLQT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CWorkspacePage
|
@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)
|
create/insert/remove all particles system to workspace)
|
||||||
*/
|
*/
|
||||||
class CWorkspacePage: public QWidget
|
class CWorkspacePage: public QWidget
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr
|
||||||
void CorePlugin::extensionsInitialized()
|
void CorePlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||||
|
|
||||||
// for old ovqt
|
// for old ovqt
|
||||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||||
if (wnd)
|
if (wnd)
|
||||||
|
@ -63,7 +63,7 @@ void CorePlugin::extensionsInitialized()
|
||||||
QAction *newAction = toolsMenu->addAction(tr("New settings"));
|
QAction *newAction = toolsMenu->addAction(tr("New settings"));
|
||||||
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
||||||
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
||||||
|
|
||||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||||
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||||
oldOVQT = true;
|
oldOVQT = true;
|
||||||
|
@ -94,7 +94,7 @@ void CorePlugin::extensionsInitialized()
|
||||||
void CorePlugin::shutdown()
|
void CorePlugin::shutdown()
|
||||||
{
|
{
|
||||||
if (!oldOVQT)
|
if (!oldOVQT)
|
||||||
{
|
{
|
||||||
delete _mainWindow;
|
delete _mainWindow;
|
||||||
delete _pluginView;
|
delete _pluginView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ CSettingsDialog::CSettingsDialog(QWidget *parent)
|
||||||
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
||||||
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
||||||
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
||||||
|
|
||||||
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
||||||
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
||||||
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
||||||
|
@ -341,9 +341,9 @@ void CSettingsDialog::saveGraphicsSettings()
|
||||||
|
|
||||||
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
|
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
|
||||||
|
|
||||||
if (ui.paletteCheckBox->isChecked())
|
if (ui.paletteCheckBox->isChecked())
|
||||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||||
else
|
else
|
||||||
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
|
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ void CSettingsDialog::saveVegetableSettings()
|
||||||
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
|
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
|
||||||
list.push_back(str);
|
list.push_back(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
|
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
|
||||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
|
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,15 +126,15 @@ void CTailParticleWidget::setRibbonOrientation(int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
if( event->type() == QEvent::Paint )
|
if( event->type() == QEvent::Paint )
|
||||||
{
|
{
|
||||||
QPainter painter(_ui.graphicsWidget);
|
QPainter painter(_ui.graphicsWidget);
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setBrush(QBrush(Qt::white));
|
painter.setBrush(QBrush(Qt::white));
|
||||||
painter.setPen(QPen(Qt::black, 2, Qt::SolidLine));
|
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.setPen(QPen(Qt::red, 2, Qt::SolidLine));
|
||||||
painter.scale(0.86, 0.86);
|
painter.scale(0.86, 0.86);
|
||||||
painter.translate(6, 6);
|
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->height() / 2.0) * (1 - verts[0].y)),
|
||||||
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
|
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
|
||||||
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
|
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(object, event);
|
return QWidget::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <nel/3d/u_scene.h>
|
#include <nel/3d/u_scene.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
const int sliderStepSize = 5000;
|
const int sliderStepSize = 5000;
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ CTuneMRMDialog::~CTuneMRMDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTuneMRMDialog::setMaxValue(int value)
|
void CTuneMRMDialog::setMaxValue(int value)
|
||||||
{
|
{
|
||||||
int actualMaxValue = value * sliderStepSize;
|
int actualMaxValue = value * sliderStepSize;
|
||||||
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
|
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
|
||||||
|
|
||||||
_ui.currentValueSlider->setMaximum(actualMaxValue);
|
_ui.currentValueSlider->setMaximum(actualMaxValue);
|
||||||
|
|
|
@ -315,30 +315,30 @@ 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)
|
||||||
{
|
{
|
||||||
_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)
|
||||||
{
|
{
|
||||||
_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)
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
|
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
|
||||||
: QGroupBox(parent),
|
: QGroupBox(parent),
|
||||||
_emit(true)
|
_emit(true)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
|
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
|
||||||
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
|
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
|
||||||
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
|
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void noiseValueChanged(const NLMISC::CNoiseValue &value);
|
void noiseValueChanged(const NLMISC::CNoiseValue &value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue