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:
Michaël Lemaire 2012-04-14 15:52:16 +00:00 committed by ThunderK
parent 3f539f5313
commit adaa18c01f
8 changed files with 85 additions and 38 deletions

3
TODO
View file

@ -1,12 +1,13 @@
Technology Preview 1 :
- Make all UI more sizable.
- Implement scrolling on previews.
- Find a licence and apply it.
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 zone editor dialog for localized textures.
- Add a terrain modifier dialog with zones.
- Add a noise filler (and maybe noise intervals ?).
- Improve curve editor.
- Replace FILE* by a custom type for Save and Load.
- Water and terrain LOD moves with the camera, fix it like in the wanderer.

View file

@ -9,7 +9,6 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLabel>
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());
setObjectName("_base_form_");
control = new QWidget(this);
control->setLayout(new QVBoxLayout());
control->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
layout()->addWidget(control);
if (with_layers)
@ -61,11 +61,22 @@ BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget
layout()->setAlignment(previews, Qt::AlignTop);
form = new QWidget(this);
form->setLayout(new QGridLayout());
form->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
form->setLayout(new QHBoxLayout());
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->setLayout(new QHBoxLayout());
control->layout()->addWidget(buttons);
@ -172,16 +183,23 @@ QPushButton* BaseForm::addButton(QString label)
void BaseForm::addInput(BaseInput* input)
{
QGridLayout* layout = (QGridLayout*)form->layout();
int row = layout->rowCount();
layout->addWidget(input->label(), row, 0);
layout->addWidget(input->preview(), row, 1);
layout->addWidget(input->control(), row, 2);
input->label()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
int row_height = 30;
form_labels->layout()->addWidget(input->label());
form_previews->layout()->addWidget(input->preview());
form_controls->layout()->addWidget(input->control());
input->label()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
input->label()->setMinimumSize(150, row_height);
input->label()->setMaximumSize(250, row_height);
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()->setMinimumSize(280, row_height);
input->control()->setMaximumSize(700, row_height);
connect(input, SIGNAL(valueChanged()), this, SLOT(configChangeEvent()));

View file

@ -58,6 +58,9 @@ private:
QPushButton* layer_del;
QWidget* previews;
QWidget* form;
QWidget* form_labels;
QWidget* form_previews;
QWidget* form_controls;
QWidget* buttons;
QPushButton* button_apply;
QPushButton* button_revert;

View file

@ -1,11 +1,12 @@
#include "baseinput.h"
#include <QLabel>
BaseInput::BaseInput(QWidget* form, QString label):
QObject(form)
{
_label = new QLabel(label);
_label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
_label->setWordWrap(true);
}
void BaseInput::updatePreview()

View file

@ -2,7 +2,7 @@
#define _PAYSAGES_QT_BASEINPUT_H_
#include <QWidget>
#include <QSlider>
#include <QLabel>
class BaseInput:public QObject
{
@ -23,9 +23,9 @@ signals:
void valueChanged();
protected:
QWidget* _label;
QLabel* _label;
QWidget* _preview;
QWidget* _control;
};
#endif // _PAYSAGES_QT_BASEINPUT_H_
#endif

View file

@ -88,6 +88,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
QWidget* form;
QWidget* buttons;
QPushButton* button;
QLabel* label;
_base = value;
_current = noiseCreateGenerator();
@ -97,13 +98,19 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
previews = new QWidget(this);
previews->setLayout(new QVBoxLayout());
layout()->addWidget(previews);
layout()->setAlignment(previews, Qt::AlignTop);
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);
previewLevel->start();
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);
previewTotal->start();
@ -132,7 +139,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
slider_height = new QSlider(form);
slider_height->setOrientation(Qt::Horizontal);
slider_height->setMinimumWidth(150);
slider_height->setMaximumWidth(400);
//slider_height->setMaximumWidth(400);
slider_height->setMinimum(0);
slider_height->setMaximum(1000);
slider_height->setTickInterval(100);
@ -144,7 +151,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
slider_scaling = new QSlider(form);
slider_scaling->setOrientation(Qt::Horizontal);
slider_scaling->setMinimumWidth(150);
slider_scaling->setMaximumWidth(400);
//slider_scaling->setMaximumWidth(400);
slider_scaling->setMinimum(1);
slider_scaling->setMaximum(1000);
slider_scaling->setTickInterval(100);
@ -214,6 +221,9 @@ void DialogNoise::revert()
void DialogNoise::revertToCurrent()
{
int i, n;
int selected;
selected = levels->currentRow();
levels->clear();
n = noiseGetLevelCount(_current);
@ -221,6 +231,19 @@ void DialogNoise::revertToCurrent()
{
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();
previewTotal->redraw();

View file

@ -161,6 +161,7 @@ int WidgetCurveEditor::getPointAt(int x, int y)
// Find nearest point
nearest = -1;
distance = 0.0;
for (int i = 0; i < n; i++)
{
curveGetPoint(_curve, i, &point);

View file

@ -19,17 +19,17 @@
<translation>Supprimer un niveau</translation>
</message>
<message>
<location filename="../gui_qt/baseform.cpp" line="74"/>
<location filename="../gui_qt/baseform.cpp" line="85"/>
<source>Apply</source>
<translation>Appliquer</translation>
</message>
<message>
<location filename="../gui_qt/baseform.cpp" line="77"/>
<location filename="../gui_qt/baseform.cpp" line="88"/>
<source>Revert</source>
<translation>Annuler les modifications</translation>
</message>
<message>
<location filename="../gui_qt/baseform.cpp" line="245"/>
<location filename="../gui_qt/baseform.cpp" line="263"/>
<source>Layer %1</source>
<translation>Niveau %1</translation>
</message>
@ -93,62 +93,62 @@ Cliquez avec le bouton droit sur un point pour le supprimer.</translation>
<context>
<name>DialogNoise</name>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="102"/>
<location filename="../gui_qt/dialognoise.cpp" line="104"/>
<source>Level preview</source>
<translation>Aperçu du composant</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="106"/>
<location filename="../gui_qt/dialognoise.cpp" line="111"/>
<source>Total preview</source>
<translation>Aperçu du total</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="114"/>
<location filename="../gui_qt/dialognoise.cpp" line="121"/>
<source>Noise components</source>
<translation>Composants du bruit</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="123"/>
<location filename="../gui_qt/dialognoise.cpp" line="130"/>
<source>Add component</source>
<translation>Ajouter un composant</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="127"/>
<location filename="../gui_qt/dialognoise.cpp" line="134"/>
<source>Remove component</source>
<translation>Supprimer un composant</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="131"/>
<location filename="../gui_qt/dialognoise.cpp" line="138"/>
<source>Component height</source>
<translation>Hauteur du composant</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="143"/>
<location filename="../gui_qt/dialognoise.cpp" line="150"/>
<source>Component scaling</source>
<translation>Echelle du composant</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="159"/>
<location filename="../gui_qt/dialognoise.cpp" line="166"/>
<source>Validate</source>
<translation>Valider</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="163"/>
<location filename="../gui_qt/dialognoise.cpp" line="170"/>
<source>Reset</source>
<translation>Recommencer</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="167"/>
<location filename="../gui_qt/dialognoise.cpp" line="174"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="171"/>
<location filename="../gui_qt/dialognoise.cpp" line="178"/>
<source>Paysages 3D - Noise editor</source>
<translation>Paysages 3D - Editeur de bruit</translation>
</message>
<message>
<location filename="../gui_qt/dialognoise.cpp" line="222"/>
<location filename="../gui_qt/dialognoise.cpp" line="232"/>
<source>Component %1</source>
<translation>Composant %1</translation>
</message>