From 75487d286f3f6462f61b5ea8f785ff96221ee398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 10 Jul 2012 15:38:12 +0000 Subject: [PATCH] paysages : Terrain canvas (WIP). git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@384 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/baseform.cpp | 6 ++++++ gui_qt/baseform.h | 2 ++ gui_qt/dialogrender.h | 2 +- gui_qt/formrender.h | 2 +- gui_qt/formsky.h | 2 +- gui_qt/formterrain.cpp | 1 + gui_qt/formwater.h | 2 +- gui_qt/inputcamera.h | 2 +- gui_qt/inputcolor.h | 2 +- gui_qt/inputcolorgradation.h | 2 +- gui_qt/inputlayers.cpp | 21 +++++++++++++++++++++ gui_qt/inputlayers.h | 22 ++++++++++++++++++++++ 12 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 gui_qt/inputlayers.cpp create mode 100644 gui_qt/inputlayers.h diff --git a/gui_qt/baseform.cpp b/gui_qt/baseform.cpp index 866a7c1..22e709d 100644 --- a/gui_qt/baseform.cpp +++ b/gui_qt/baseform.cpp @@ -9,6 +9,7 @@ #include "inputcurve.h" #include "inputmaterial.h" #include "inputenum.h" +#include "inputlayers.h" #include #include @@ -411,6 +412,11 @@ BaseInput* BaseForm::addInputEnum(QString label, int* value, const QStringList& return addInput(new InputEnum(_form, label, value, values)); } +BaseInput* BaseForm::addInputLayers(QString label, Layers* value) +{ + return addInput(new InputLayers(_form, label, value)); +} + void BaseForm::updatePreviews() { for (int i = 0; i < _previews_list.size(); i++) diff --git a/gui_qt/baseform.h b/gui_qt/baseform.h index d6b5d2e..ab1d558 100644 --- a/gui_qt/baseform.h +++ b/gui_qt/baseform.h @@ -11,6 +11,7 @@ #include "../lib_paysages/noise.h" #include "../lib_paysages/curve.h" #include "../lib_paysages/color.h" +#include "../lib_paysages/layers.h" #include "../lib_paysages/pack.h" class BaseForm:public QWidget @@ -55,6 +56,7 @@ protected: BaseInput* addInputCurve(QString label, Curve* value, double xmin, double xmax, double ymin, double ymax, QString xlabel, QString ylabel); BaseInput* addInputMaterial(QString label, SurfaceMaterial* material); BaseInput* addInputEnum(QString label, int* value, const QStringList& values); + BaseInput* addInputLayers(QString label, Layers* value); void updatePreviews(); void disablePreviewsUpdate(); diff --git a/gui_qt/dialogrender.h b/gui_qt/dialogrender.h index 11f3e36..0a5c7ee 100644 --- a/gui_qt/dialogrender.h +++ b/gui_qt/dialogrender.h @@ -42,4 +42,4 @@ private: time_t _started; }; -#endif // _PAYSAGES_QT_DIALOGRENDER_H_ +#endif diff --git a/gui_qt/formrender.h b/gui_qt/formrender.h index c5d7123..4e99947 100644 --- a/gui_qt/formrender.h +++ b/gui_qt/formrender.h @@ -38,4 +38,4 @@ private: BasePreview* _preview_landscape; }; -#endif // _PAYSAGES_QT_FORMRENDER_H_ +#endif diff --git a/gui_qt/formsky.h b/gui_qt/formsky.h index 29bfda4..e3142bf 100644 --- a/gui_qt/formsky.h +++ b/gui_qt/formsky.h @@ -24,4 +24,4 @@ private: BasePreview* previewWest; }; -#endif // _PAYSAGES_QT_FORMSKY_H_ +#endif diff --git a/gui_qt/formterrain.cpp b/gui_qt/formterrain.cpp index 57a7a26..7b196e9 100644 --- a/gui_qt/formterrain.cpp +++ b/gui_qt/formterrain.cpp @@ -154,6 +154,7 @@ FormTerrain::FormTerrain(QWidget *parent): addInputDouble(tr("Height"), &_definition.height_factor, 0.0, 20.0, 0.1, 1.0); addInputDouble(tr("Scaling"), &_definition.scaling, 1.0, 50.0, 0.1, 5.0); addInputDouble(tr("Shadow smoothing"), &_definition.shadow_smoothing, 0.0, 0.3, 0.003, 0.03); + addInputLayers(tr("Canvases"), _definition.canvases); revertConfig(); } diff --git a/gui_qt/formwater.h b/gui_qt/formwater.h index 1305779..3bfe281 100644 --- a/gui_qt/formwater.h +++ b/gui_qt/formwater.h @@ -21,4 +21,4 @@ private: BasePreview* previewColor; }; -#endif // _PAYSAGES_QT_FORMWATER_H_ +#endif diff --git a/gui_qt/inputcamera.h b/gui_qt/inputcamera.h index d616185..b72276c 100644 --- a/gui_qt/inputcamera.h +++ b/gui_qt/inputcamera.h @@ -25,4 +25,4 @@ private: CameraDefinition* _value; }; -#endif // _PAYSAGES_QT_INPUTNOISE_H_ +#endif diff --git a/gui_qt/inputcolor.h b/gui_qt/inputcolor.h index 40ff2cf..c5211fd 100644 --- a/gui_qt/inputcolor.h +++ b/gui_qt/inputcolor.h @@ -25,4 +25,4 @@ private: Color* _value; }; -#endif // _PAYSAGES_QT_INPUTCOLOR_H_ +#endif diff --git a/gui_qt/inputcolorgradation.h b/gui_qt/inputcolorgradation.h index 42bdbd7..28381f6 100644 --- a/gui_qt/inputcolorgradation.h +++ b/gui_qt/inputcolorgradation.h @@ -25,4 +25,4 @@ private: ColorGradation* _value; }; -#endif // _PAYSAGES_QT_INPUTCOLORGRADATION_H_ +#endif diff --git a/gui_qt/inputlayers.cpp b/gui_qt/inputlayers.cpp new file mode 100644 index 0000000..88fa930 --- /dev/null +++ b/gui_qt/inputlayers.cpp @@ -0,0 +1,21 @@ +#include "inputlayers.h" + +#include +#include + +InputLayers::InputLayers(QWidget* form, QString label, Layers* value): + BaseInput(form, label) +{ + _value = value; + + _preview = new QLabel(form); + ((QLabel*)_preview)->setAlignment(Qt::AlignCenter); + _control = new QPushButton(tr("Editer"), form); +} + +void InputLayers::updatePreview() +{ + ((QLabel*)_preview)->setText(tr("%1 layers").arg(layersCount(_value))); + + BaseInput::updatePreview(); +} diff --git a/gui_qt/inputlayers.h b/gui_qt/inputlayers.h new file mode 100644 index 0000000..ed55546 --- /dev/null +++ b/gui_qt/inputlayers.h @@ -0,0 +1,22 @@ +#ifndef _PAYSAGES_QT_INPUTLAYERS_H_ +#define _PAYSAGES_QT_INPUTLAYERS_H_ + +#include +#include "baseinput.h" +#include "../lib_paysages/layers.h" + +class InputLayers:public BaseInput +{ + Q_OBJECT + +public: + InputLayers(QWidget* form, QString label, Layers* value); + +public slots: + virtual void updatePreview(); + +private: + Layers* _value; +}; + +#endif