paysages : Noise dialog WIP.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@228 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-01-19 16:03:34 +00:00 committed by ThunderK
parent a88a0ddaac
commit 57e7341ce0
2 changed files with 69 additions and 7 deletions

View file

@ -5,7 +5,9 @@
#include <QLabel> #include <QLabel>
#include <QColor> #include <QColor>
#include <QPainter> #include <QPainter>
#include <QSlider>
#include <QScrollArea> #include <QScrollArea>
#include <QPushButton>
#include "../lib_paysages/shared/functions.h" #include "../lib_paysages/shared/functions.h"
@ -62,19 +64,72 @@ private:
DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value): DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
QDialog(parent) QDialog(parent)
{ {
QWidget* previews;
QWidget* form;
QWidget* buttons;
QSlider* slider;
QPushButton* button;
_base = value; _base = value;
_current = noiseCreateGenerator(); _current = noiseCreateGenerator();
noiseCopy(_base, _current); noiseCopy(_base, _current);
setLayout(new QVBoxLayout()); setLayout(new QHBoxLayout());
previewLevel = new PreviewLevel(this, _current); previews = new QWidget(this);
layout()->addWidget(new QLabel("Level preview")); previews->setLayout(new QVBoxLayout());
layout()->addWidget(previewLevel); layout()->addWidget(previews);
previewTotal = new PreviewTotal(this, _current);
layout()->addWidget(new QLabel("Total preview")); previewLevel = new PreviewLevel(previews, _current);
layout()->addWidget(previewTotal); previews->layout()->addWidget(new QLabel("Level preview"));
previews->layout()->addWidget(previewLevel);
previewTotal = new PreviewTotal(previews, _current);
previews->layout()->addWidget(new QLabel("Total preview"));
previews->layout()->addWidget(previewTotal);
form = new QWidget(this);
form->setLayout(new QVBoxLayout());
layout()->addWidget(form);
form->layout()->addWidget(new QLabel("Layers"));
levels = new QListWidget(form);
form->layout()->addWidget(levels);
form->layout()->addWidget(new QLabel("Layer height"));
slider = new QSlider(form);
slider->setOrientation(Qt::Horizontal);
slider->setMinimumWidth(150);
slider->setMaximumWidth(400);
slider->setMinimum(0);
slider->setMaximum(1000);
slider->setTickInterval(100);
slider->setTickPosition(QSlider::TicksBelow);
form->layout()->addWidget(slider);
form->layout()->addWidget(new QLabel("Layer scaling"));
slider = new QSlider(form);
slider->setOrientation(Qt::Horizontal);
slider->setMinimumWidth(150);
slider->setMaximumWidth(400);
slider->setMinimum(0);
slider->setMaximum(1000);
slider->setTickInterval(100);
slider->setTickPosition(QSlider::TicksBelow);
form->layout()->addWidget(slider);
buttons = new QWidget(form);
buttons->setLayout(new QHBoxLayout());
form->layout()->addWidget(buttons);
button = new QPushButton("Validate", buttons);
buttons->layout()->addWidget(button);
button = new QPushButton("Reset", buttons);
buttons->layout()->addWidget(button);
button = new QPushButton("Cancel", buttons);
buttons->layout()->addWidget(button);
setWindowTitle("Paysages 3D - Noise editor"); setWindowTitle("Paysages 3D - Noise editor");
} }

View file

@ -2,6 +2,7 @@
#define _PAYSAGES_QT_DIALOGNOISE_H_ #define _PAYSAGES_QT_DIALOGNOISE_H_
#include <QDialog> #include <QDialog>
#include <QListWidget>
#include "preview.h" #include "preview.h"
#include "../lib_paysages/shared/types.h" #include "../lib_paysages/shared/types.h"
@ -21,12 +22,18 @@ public slots:
protected: protected:
virtual void closeEvent(QCloseEvent* e); virtual void closeEvent(QCloseEvent* e);
private slots:
void cancelClicked();
void revertClicked();
void applyClicked();
private: private:
NoiseGenerator* _base; NoiseGenerator* _base;
NoiseGenerator* _current; NoiseGenerator* _current;
NoiseLevel _current_level; NoiseLevel _current_level;
Preview* previewLevel; Preview* previewLevel;
Preview* previewTotal; Preview* previewTotal;
QListWidget* levels;
}; };
#endif #endif