diff --git a/TODO b/TODO index 258cd7b..82f1258 100644 --- a/TODO +++ b/TODO @@ -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. diff --git a/gui_qt/baseform.cpp b/gui_qt/baseform.cpp index 3c220f9..030f12e 100644 --- a/gui_qt/baseform.cpp +++ b/gui_qt/baseform.cpp @@ -9,7 +9,6 @@ #include #include -#include #include 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())); diff --git a/gui_qt/baseform.h b/gui_qt/baseform.h index 8a476a6..5ab840f 100644 --- a/gui_qt/baseform.h +++ b/gui_qt/baseform.h @@ -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; diff --git a/gui_qt/baseinput.cpp b/gui_qt/baseinput.cpp index cb6be3c..85d7a19 100644 --- a/gui_qt/baseinput.cpp +++ b/gui_qt/baseinput.cpp @@ -1,11 +1,12 @@ #include "baseinput.h" -#include - BaseInput::BaseInput(QWidget* form, QString label): QObject(form) { _label = new QLabel(label); + + _label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + _label->setWordWrap(true); } void BaseInput::updatePreview() diff --git a/gui_qt/baseinput.h b/gui_qt/baseinput.h index 3d6e162..16f8eab 100644 --- a/gui_qt/baseinput.h +++ b/gui_qt/baseinput.h @@ -2,7 +2,7 @@ #define _PAYSAGES_QT_BASEINPUT_H_ #include -#include +#include 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 diff --git a/gui_qt/dialognoise.cpp b/gui_qt/dialognoise.cpp index 74a1156..d035ac1 100644 --- a/gui_qt/dialognoise.cpp +++ b/gui_qt/dialognoise.cpp @@ -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(); diff --git a/gui_qt/widgetcurveeditor.cpp b/gui_qt/widgetcurveeditor.cpp index 958ddf9..4a1d8de 100644 --- a/gui_qt/widgetcurveeditor.cpp +++ b/gui_qt/widgetcurveeditor.cpp @@ -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); diff --git a/i18n/paysages_fr.ts b/i18n/paysages_fr.ts index fb388e0..ecbdcba 100644 --- a/i18n/paysages_fr.ts +++ b/i18n/paysages_fr.ts @@ -19,17 +19,17 @@ Supprimer un niveau - + Apply Appliquer - + Revert Annuler les modifications - + Layer %1 Niveau %1 @@ -93,62 +93,62 @@ Cliquez avec le bouton droit sur un point pour le supprimer. DialogNoise - + Level preview Aperçu du composant - + Total preview Aperçu du total - + Noise components Composants du bruit - + Add component Ajouter un composant - + Remove component Supprimer un composant - + Component height Hauteur du composant - + Component scaling Echelle du composant - + Validate Valider - + Reset Recommencer - + Cancel Annuler - + Paysages 3D - Noise editor Paysages 3D - Editeur de bruit - + Component %1 Composant %1