paysages: More sizable UI.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@295 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
3f539f5313
commit
adaa18c01f
8 changed files with 85 additions and 38 deletions
3
TODO
3
TODO
|
@ -1,12 +1,13 @@
|
||||||
Technology Preview 1 :
|
Technology Preview 1 :
|
||||||
- Make all UI more sizable.
|
|
||||||
- Implement scrolling on previews.
|
- Implement scrolling on previews.
|
||||||
- Find a licence and apply it.
|
- Find a licence and apply it.
|
||||||
|
|
||||||
Technology Preview 2 :
|
Technology Preview 2 :
|
||||||
|
- Add an OSD ability on previews and use it for camera location and user landmarks.
|
||||||
- Add a material editor dialog.
|
- Add a material editor dialog.
|
||||||
- Add a zone editor dialog for localized textures.
|
- Add a zone editor dialog for localized textures.
|
||||||
- Add a terrain modifier dialog with zones.
|
- Add a terrain modifier dialog with zones.
|
||||||
|
- Add a noise filler (and maybe noise intervals ?).
|
||||||
- Improve curve editor.
|
- Improve curve editor.
|
||||||
- Replace FILE* by a custom type for Save and Load.
|
- Replace FILE* by a custom type for Save and Load.
|
||||||
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
|
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
|
||||||
|
@ -23,9 +22,10 @@ BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget
|
||||||
|
|
||||||
setLayout(new QHBoxLayout());
|
setLayout(new QHBoxLayout());
|
||||||
setObjectName("_base_form_");
|
setObjectName("_base_form_");
|
||||||
|
|
||||||
control = new QWidget(this);
|
control = new QWidget(this);
|
||||||
control->setLayout(new QVBoxLayout());
|
control->setLayout(new QVBoxLayout());
|
||||||
|
control->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
layout()->addWidget(control);
|
layout()->addWidget(control);
|
||||||
|
|
||||||
if (with_layers)
|
if (with_layers)
|
||||||
|
@ -61,11 +61,22 @@ BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget
|
||||||
layout()->setAlignment(previews, Qt::AlignTop);
|
layout()->setAlignment(previews, Qt::AlignTop);
|
||||||
|
|
||||||
form = new QWidget(this);
|
form = new QWidget(this);
|
||||||
form->setLayout(new QGridLayout());
|
form->setLayout(new QHBoxLayout());
|
||||||
form->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
||||||
control->layout()->addWidget(form);
|
control->layout()->addWidget(form);
|
||||||
control->layout()->setAlignment(form, Qt::AlignTop | Qt::AlignLeft);
|
control->layout()->setAlignment(form, Qt::AlignTop);
|
||||||
|
|
||||||
|
form_labels = new QWidget(form);
|
||||||
|
form_labels->setLayout(new QVBoxLayout());
|
||||||
|
form->layout()->addWidget(form_labels);
|
||||||
|
|
||||||
|
form_previews = new QWidget(form);
|
||||||
|
form_previews->setLayout(new QVBoxLayout());
|
||||||
|
form->layout()->addWidget(form_previews);
|
||||||
|
|
||||||
|
form_controls = new QWidget(form);
|
||||||
|
form_controls->setLayout(new QVBoxLayout());
|
||||||
|
form->layout()->addWidget(form_controls);
|
||||||
|
|
||||||
buttons = new QWidget(this);
|
buttons = new QWidget(this);
|
||||||
buttons->setLayout(new QHBoxLayout());
|
buttons->setLayout(new QHBoxLayout());
|
||||||
control->layout()->addWidget(buttons);
|
control->layout()->addWidget(buttons);
|
||||||
|
@ -172,16 +183,23 @@ QPushButton* BaseForm::addButton(QString label)
|
||||||
|
|
||||||
void BaseForm::addInput(BaseInput* input)
|
void BaseForm::addInput(BaseInput* input)
|
||||||
{
|
{
|
||||||
QGridLayout* layout = (QGridLayout*)form->layout();
|
int row_height = 30;
|
||||||
int row = layout->rowCount();
|
|
||||||
|
form_labels->layout()->addWidget(input->label());
|
||||||
layout->addWidget(input->label(), row, 0);
|
form_previews->layout()->addWidget(input->preview());
|
||||||
layout->addWidget(input->preview(), row, 1);
|
form_controls->layout()->addWidget(input->control());
|
||||||
layout->addWidget(input->control(), row, 2);
|
|
||||||
|
input->label()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
input->label()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
input->label()->setMinimumSize(150, row_height);
|
||||||
|
input->label()->setMaximumSize(250, row_height);
|
||||||
|
|
||||||
input->preview()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
input->preview()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
input->preview()->setMinimumSize(100, row_height);
|
||||||
|
input->preview()->setMaximumSize(250, row_height);
|
||||||
|
|
||||||
input->control()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
input->control()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
input->control()->setMinimumSize(280, row_height);
|
||||||
|
input->control()->setMaximumSize(700, row_height);
|
||||||
|
|
||||||
connect(input, SIGNAL(valueChanged()), this, SLOT(configChangeEvent()));
|
connect(input, SIGNAL(valueChanged()), this, SLOT(configChangeEvent()));
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ private:
|
||||||
QPushButton* layer_del;
|
QPushButton* layer_del;
|
||||||
QWidget* previews;
|
QWidget* previews;
|
||||||
QWidget* form;
|
QWidget* form;
|
||||||
|
QWidget* form_labels;
|
||||||
|
QWidget* form_previews;
|
||||||
|
QWidget* form_controls;
|
||||||
QWidget* buttons;
|
QWidget* buttons;
|
||||||
QPushButton* button_apply;
|
QPushButton* button_apply;
|
||||||
QPushButton* button_revert;
|
QPushButton* button_revert;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#include "baseinput.h"
|
#include "baseinput.h"
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
BaseInput::BaseInput(QWidget* form, QString label):
|
BaseInput::BaseInput(QWidget* form, QString label):
|
||||||
QObject(form)
|
QObject(form)
|
||||||
{
|
{
|
||||||
_label = new QLabel(label);
|
_label = new QLabel(label);
|
||||||
|
|
||||||
|
_label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
_label->setWordWrap(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseInput::updatePreview()
|
void BaseInput::updatePreview()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define _PAYSAGES_QT_BASEINPUT_H_
|
#define _PAYSAGES_QT_BASEINPUT_H_
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSlider>
|
#include <QLabel>
|
||||||
|
|
||||||
class BaseInput:public QObject
|
class BaseInput:public QObject
|
||||||
{
|
{
|
||||||
|
@ -23,9 +23,9 @@ signals:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QWidget* _label;
|
QLabel* _label;
|
||||||
QWidget* _preview;
|
QWidget* _preview;
|
||||||
QWidget* _control;
|
QWidget* _control;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _PAYSAGES_QT_BASEINPUT_H_
|
#endif
|
||||||
|
|
|
@ -88,6 +88,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
|
||||||
QWidget* form;
|
QWidget* form;
|
||||||
QWidget* buttons;
|
QWidget* buttons;
|
||||||
QPushButton* button;
|
QPushButton* button;
|
||||||
|
QLabel* label;
|
||||||
|
|
||||||
_base = value;
|
_base = value;
|
||||||
_current = noiseCreateGenerator();
|
_current = noiseCreateGenerator();
|
||||||
|
@ -97,13 +98,19 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
|
||||||
previews = new QWidget(this);
|
previews = new QWidget(this);
|
||||||
previews->setLayout(new QVBoxLayout());
|
previews->setLayout(new QVBoxLayout());
|
||||||
layout()->addWidget(previews);
|
layout()->addWidget(previews);
|
||||||
|
layout()->setAlignment(previews, Qt::AlignTop);
|
||||||
|
|
||||||
previewLevel = new PreviewLevel(previews, _current);
|
previewLevel = new PreviewLevel(previews, _current);
|
||||||
previews->layout()->addWidget(new QLabel(tr("Level preview")));
|
label = new QLabel(tr("Level preview"));
|
||||||
|
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
previews->layout()->addWidget(label);
|
||||||
previews->layout()->addWidget(previewLevel);
|
previews->layout()->addWidget(previewLevel);
|
||||||
previewLevel->start();
|
previewLevel->start();
|
||||||
|
|
||||||
previewTotal = new PreviewTotal(previews, _current);
|
previewTotal = new PreviewTotal(previews, _current);
|
||||||
previews->layout()->addWidget(new QLabel(tr("Total preview")));
|
label = new QLabel(tr("Total preview"));
|
||||||
|
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
previews->layout()->addWidget(label);
|
||||||
previews->layout()->addWidget(previewTotal);
|
previews->layout()->addWidget(previewTotal);
|
||||||
previewTotal->start();
|
previewTotal->start();
|
||||||
|
|
||||||
|
@ -132,7 +139,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
|
||||||
slider_height = new QSlider(form);
|
slider_height = new QSlider(form);
|
||||||
slider_height->setOrientation(Qt::Horizontal);
|
slider_height->setOrientation(Qt::Horizontal);
|
||||||
slider_height->setMinimumWidth(150);
|
slider_height->setMinimumWidth(150);
|
||||||
slider_height->setMaximumWidth(400);
|
//slider_height->setMaximumWidth(400);
|
||||||
slider_height->setMinimum(0);
|
slider_height->setMinimum(0);
|
||||||
slider_height->setMaximum(1000);
|
slider_height->setMaximum(1000);
|
||||||
slider_height->setTickInterval(100);
|
slider_height->setTickInterval(100);
|
||||||
|
@ -144,7 +151,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
|
||||||
slider_scaling = new QSlider(form);
|
slider_scaling = new QSlider(form);
|
||||||
slider_scaling->setOrientation(Qt::Horizontal);
|
slider_scaling->setOrientation(Qt::Horizontal);
|
||||||
slider_scaling->setMinimumWidth(150);
|
slider_scaling->setMinimumWidth(150);
|
||||||
slider_scaling->setMaximumWidth(400);
|
//slider_scaling->setMaximumWidth(400);
|
||||||
slider_scaling->setMinimum(1);
|
slider_scaling->setMinimum(1);
|
||||||
slider_scaling->setMaximum(1000);
|
slider_scaling->setMaximum(1000);
|
||||||
slider_scaling->setTickInterval(100);
|
slider_scaling->setTickInterval(100);
|
||||||
|
@ -214,6 +221,9 @@ void DialogNoise::revert()
|
||||||
void DialogNoise::revertToCurrent()
|
void DialogNoise::revertToCurrent()
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
|
int selected;
|
||||||
|
|
||||||
|
selected = levels->currentRow();
|
||||||
|
|
||||||
levels->clear();
|
levels->clear();
|
||||||
n = noiseGetLevelCount(_current);
|
n = noiseGetLevelCount(_current);
|
||||||
|
@ -221,6 +231,19 @@ void DialogNoise::revertToCurrent()
|
||||||
{
|
{
|
||||||
levels->addItem(QString(tr("Component %1")).arg(i + 1));
|
levels->addItem(QString(tr("Component %1")).arg(i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n > 0)
|
||||||
|
{
|
||||||
|
if (selected < 0)
|
||||||
|
{
|
||||||
|
selected = 0;
|
||||||
|
}
|
||||||
|
if (selected >= n)
|
||||||
|
{
|
||||||
|
selected = n - 1;
|
||||||
|
}
|
||||||
|
levels->setCurrentRow(selected);
|
||||||
|
}
|
||||||
|
|
||||||
previewLevel->redraw();
|
previewLevel->redraw();
|
||||||
previewTotal->redraw();
|
previewTotal->redraw();
|
||||||
|
|
|
@ -161,6 +161,7 @@ int WidgetCurveEditor::getPointAt(int x, int y)
|
||||||
|
|
||||||
// Find nearest point
|
// Find nearest point
|
||||||
nearest = -1;
|
nearest = -1;
|
||||||
|
distance = 0.0;
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
curveGetPoint(_curve, i, &point);
|
curveGetPoint(_curve, i, &point);
|
||||||
|
|
|
@ -19,17 +19,17 @@
|
||||||
<translation>Supprimer un niveau</translation>
|
<translation>Supprimer un niveau</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="74"/>
|
<location filename="../gui_qt/baseform.cpp" line="85"/>
|
||||||
<source>Apply</source>
|
<source>Apply</source>
|
||||||
<translation>Appliquer</translation>
|
<translation>Appliquer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="77"/>
|
<location filename="../gui_qt/baseform.cpp" line="88"/>
|
||||||
<source>Revert</source>
|
<source>Revert</source>
|
||||||
<translation>Annuler les modifications</translation>
|
<translation>Annuler les modifications</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="245"/>
|
<location filename="../gui_qt/baseform.cpp" line="263"/>
|
||||||
<source>Layer %1</source>
|
<source>Layer %1</source>
|
||||||
<translation>Niveau %1</translation>
|
<translation>Niveau %1</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -93,62 +93,62 @@ Cliquez avec le bouton droit sur un point pour le supprimer.</translation>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogNoise</name>
|
<name>DialogNoise</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="102"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="104"/>
|
||||||
<source>Level preview</source>
|
<source>Level preview</source>
|
||||||
<translation>Aperçu du composant</translation>
|
<translation>Aperçu du composant</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="106"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="111"/>
|
||||||
<source>Total preview</source>
|
<source>Total preview</source>
|
||||||
<translation>Aperçu du total</translation>
|
<translation>Aperçu du total</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="114"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="121"/>
|
||||||
<source>Noise components</source>
|
<source>Noise components</source>
|
||||||
<translation>Composants du bruit</translation>
|
<translation>Composants du bruit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="123"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="130"/>
|
||||||
<source>Add component</source>
|
<source>Add component</source>
|
||||||
<translation>Ajouter un composant</translation>
|
<translation>Ajouter un composant</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="127"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="134"/>
|
||||||
<source>Remove component</source>
|
<source>Remove component</source>
|
||||||
<translation>Supprimer un composant</translation>
|
<translation>Supprimer un composant</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="131"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="138"/>
|
||||||
<source>Component height</source>
|
<source>Component height</source>
|
||||||
<translation>Hauteur du composant</translation>
|
<translation>Hauteur du composant</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="143"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="150"/>
|
||||||
<source>Component scaling</source>
|
<source>Component scaling</source>
|
||||||
<translation>Echelle du composant</translation>
|
<translation>Echelle du composant</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="159"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="166"/>
|
||||||
<source>Validate</source>
|
<source>Validate</source>
|
||||||
<translation>Valider</translation>
|
<translation>Valider</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="163"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="170"/>
|
||||||
<source>Reset</source>
|
<source>Reset</source>
|
||||||
<translation>Recommencer</translation>
|
<translation>Recommencer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="167"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="174"/>
|
||||||
<source>Cancel</source>
|
<source>Cancel</source>
|
||||||
<translation>Annuler</translation>
|
<translation>Annuler</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="171"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="178"/>
|
||||||
<source>Paysages 3D - Noise editor</source>
|
<source>Paysages 3D - Noise editor</source>
|
||||||
<translation>Paysages 3D - Editeur de bruit</translation>
|
<translation>Paysages 3D - Editeur de bruit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/dialognoise.cpp" line="222"/>
|
<location filename="../gui_qt/dialognoise.cpp" line="232"/>
|
||||||
<source>Component %1</source>
|
<source>Component %1</source>
|
||||||
<translation>Composant %1</translation>
|
<translation>Composant %1</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Loading…
Reference in a new issue