paysages: Qt GUI (WIP)
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@215 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
1fcbb37f17
commit
08344579e5
8 changed files with 27 additions and 9 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include "baseform.h"
|
#include "baseform.h"
|
||||||
|
|
||||||
#include "inputdouble.h"
|
#include "inputdouble.h"
|
||||||
|
#include "inputcolor.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -79,3 +81,8 @@ void BaseForm::addInputDouble(QString label, double* value, double min, double m
|
||||||
{
|
{
|
||||||
addInput(new InputDouble(form, label, value, min, max, small_step, large_step));
|
addInput(new InputDouble(form, label, value, min, max, small_step, large_step));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseForm::addInputColor(QString label, Color* value)
|
||||||
|
{
|
||||||
|
addInput(new InputColor(form, label, value));
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "preview.h"
|
#include "preview.h"
|
||||||
#include "baseinput.h"
|
#include "baseinput.h"
|
||||||
|
#include "../lib_paysages/shared/types.h"
|
||||||
|
|
||||||
class BaseForm:public QWidget
|
class BaseForm:public QWidget
|
||||||
{
|
{
|
||||||
|
@ -20,6 +21,7 @@ protected:
|
||||||
void addPreview(Preview* preview, QString label);
|
void addPreview(Preview* preview, QString label);
|
||||||
void addInput(BaseInput* input);
|
void addInput(BaseInput* input);
|
||||||
void addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step);
|
void addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step);
|
||||||
|
void addInputColor(QString label, Color* value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* previews;
|
QWidget* previews;
|
||||||
|
|
|
@ -7,3 +7,8 @@ BaseInput::BaseInput(QWidget* form, QString label):
|
||||||
{
|
{
|
||||||
_label = new QLabel(label);
|
_label = new QLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseInput::applyValue()
|
||||||
|
{
|
||||||
|
emit(valueChanged());
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public slots:
|
||||||
virtual void revert() = 0;
|
virtual void revert() = 0;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void applyValue() = 0;
|
virtual void applyValue();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
|
@ -132,8 +132,10 @@ FormWater::FormWater(QWidget *parent) :
|
||||||
addPreview(previewColor, QString("Color preview"));
|
addPreview(previewColor, QString("Color preview"));
|
||||||
|
|
||||||
addInputDouble("Height", &_definition.height, -20.0, 20.0, 0.1, 1.0);
|
addInputDouble("Height", &_definition.height, -20.0, 20.0, 0.1, 1.0);
|
||||||
|
addInputColor("Surface color", &_definition.main_color);
|
||||||
addInputDouble("Transparency", &_definition.transparency, 0.0, 1.0, 0.001, 0.1);
|
addInputDouble("Transparency", &_definition.transparency, 0.0, 1.0, 0.001, 0.1);
|
||||||
addInputDouble("Reflection", &_definition.reflection, 0.0, 1.0, 0.001, 0.1);
|
addInputDouble("Reflection", &_definition.reflection, 0.0, 1.0, 0.001, 0.1);
|
||||||
|
addInputColor("Depth color", &_definition.depth_color);
|
||||||
addInputDouble("Depth filtering", &_definition.transparency_depth, 0.0, 100.0, 0.5, 5.0);
|
addInputDouble("Depth filtering", &_definition.transparency_depth, 0.0, 100.0, 0.5, 5.0);
|
||||||
|
|
||||||
revertConfig();
|
revertConfig();
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
#include "inputcolor.h"
|
#include "inputcolor.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
InputColor::InputColor(QWidget* form, QString label, Color color):
|
InputColor::InputColor(QWidget* form, QString label, Color* value):
|
||||||
BaseInput(form, label),
|
BaseInput(form, label),
|
||||||
_color(color)
|
_value(value)
|
||||||
{
|
{
|
||||||
setObjectName("_inputcolor_");
|
setObjectName("_inputcolor_");
|
||||||
|
|
||||||
_preview = new QLabel(form);
|
_preview = new QWidget(form);
|
||||||
_control = new QLabel(form);
|
_control = new QPushButton("Edit", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputColor::applyValue()
|
void InputColor::applyValue()
|
||||||
{
|
{
|
||||||
emit(valueChanged());
|
BaseInput::applyValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputColor::revert()
|
void InputColor::revert()
|
||||||
|
|
|
@ -11,7 +11,7 @@ class InputColor:public BaseInput
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputColor(QWidget* form, QString label, Color value);
|
InputColor(QWidget* form, QString label, Color* value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void revert();
|
virtual void revert();
|
||||||
|
@ -20,7 +20,7 @@ protected slots:
|
||||||
virtual void applyValue();
|
virtual void applyValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Color _color;
|
Color* _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GUI_QT_INPUTCOLOR_H_
|
#endif // _GUI_QT_INPUTCOLOR_H_
|
||||||
|
|
|
@ -31,7 +31,8 @@ void InputDouble::applyValue()
|
||||||
{
|
{
|
||||||
*value = ((double)slider->value()) * small_step;
|
*value = ((double)slider->value()) * small_step;
|
||||||
((QLabel*)_preview)->setText(QString("%1").arg(*value));
|
((QLabel*)_preview)->setText(QString("%1").arg(*value));
|
||||||
emit(valueChanged());
|
|
||||||
|
BaseInput::applyValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputDouble::revert()
|
void InputDouble::revert()
|
||||||
|
|
Loading…
Reference in a new issue