paysages : Terrain canvas (WIP).

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@384 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-07-10 15:38:12 +00:00 committed by ThunderK
parent daf3002297
commit 75487d286f
12 changed files with 59 additions and 7 deletions

View file

@ -9,6 +9,7 @@
#include "inputcurve.h"
#include "inputmaterial.h"
#include "inputenum.h"
#include "inputlayers.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
@ -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++)

View file

@ -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();

View file

@ -42,4 +42,4 @@ private:
time_t _started;
};
#endif // _PAYSAGES_QT_DIALOGRENDER_H_
#endif

View file

@ -38,4 +38,4 @@ private:
BasePreview* _preview_landscape;
};
#endif // _PAYSAGES_QT_FORMRENDER_H_
#endif

View file

@ -24,4 +24,4 @@ private:
BasePreview* previewWest;
};
#endif // _PAYSAGES_QT_FORMSKY_H_
#endif

View file

@ -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();
}

View file

@ -21,4 +21,4 @@ private:
BasePreview* previewColor;
};
#endif // _PAYSAGES_QT_FORMWATER_H_
#endif

View file

@ -25,4 +25,4 @@ private:
CameraDefinition* _value;
};
#endif // _PAYSAGES_QT_INPUTNOISE_H_
#endif

View file

@ -25,4 +25,4 @@ private:
Color* _value;
};
#endif // _PAYSAGES_QT_INPUTCOLOR_H_
#endif

View file

@ -25,4 +25,4 @@ private:
ColorGradation* _value;
};
#endif // _PAYSAGES_QT_INPUTCOLORGRADATION_H_
#endif

21
gui_qt/inputlayers.cpp Normal file
View file

@ -0,0 +1,21 @@
#include "inputlayers.h"
#include <QLabel>
#include <QPushButton>
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();
}

22
gui_qt/inputlayers.h Normal file
View file

@ -0,0 +1,22 @@
#ifndef _PAYSAGES_QT_INPUTLAYERS_H_
#define _PAYSAGES_QT_INPUTLAYERS_H_
#include <QWidget>
#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