paysages: Icons and UI polishing.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@291 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-04-11 19:59:50 +00:00 committed by ThunderK
parent e9fd162907
commit 81cbbb9880
12 changed files with 125 additions and 93 deletions

2
TODO
View file

@ -1,3 +1,5 @@
- Make colorgradation dialog sizable (and reduce minimum size).
- Make all UI more sizable.
- Implement scaling and scrolling on previews. - Implement scaling and scrolling on previews.
- Add a material editor dialog. - Add a material editor dialog.
- Replace FILE* by a custom type for Save and Load. - Replace FILE* by a custom type for Save and Load.

View file

@ -14,61 +14,62 @@
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent) BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
{ {
QWidget* hwidget; QWidget* control;
QVBoxLayout* vlayout; QWidget* layers;
QHBoxLayout* hlayout; QLabel* label;
this->auto_apply = auto_apply; this->auto_apply = auto_apply;
this->with_layers = with_layers; this->with_layers = with_layers;
vlayout = new QVBoxLayout(); setLayout(new QHBoxLayout());
hlayout = new QHBoxLayout(); setObjectName("_base_form_");
control = new QWidget(this);
control->setLayout(new QVBoxLayout());
layout()->addWidget(control);
if (with_layers) if (with_layers)
{ {
hwidget = new QWidget(this); layers = new QWidget(this);
hwidget->setLayout(new QHBoxLayout()); layers->setLayout(new QHBoxLayout());
layers->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
hwidget->layout()->addWidget(new QLabel(tr("Layers : "), hwidget)); label = new QLabel(tr("Layers : "), layers);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
layers->layout()->addWidget(label);
layer_list = new QComboBox(hwidget); layer_list = new QComboBox(layers);
hwidget->layout()->addWidget(layer_list); layers->layout()->addWidget(layer_list);
QObject::connect(layer_list, SIGNAL(currentIndexChanged(int)), this, SLOT(layerListChanged())); QObject::connect(layer_list, SIGNAL(currentIndexChanged(int)), this, SLOT(layerListChanged()));
layer_new = new QPushButton(tr("Add layer"), hwidget); layer_new = new QPushButton(tr("Add layer"), layers);
hwidget->layout()->addWidget(layer_new); layers->layout()->addWidget(layer_new);
QObject::connect(layer_new, SIGNAL(clicked()), this, SLOT(layerAddClicked())); QObject::connect(layer_new, SIGNAL(clicked()), this, SLOT(layerAddClicked()));
layer_del = new QPushButton(tr("Delete layer"), hwidget); layer_del = new QPushButton(tr("Delete layer"), layers);
hwidget->layout()->addWidget(layer_del); layers->layout()->addWidget(layer_del);
QObject::connect(layer_del, SIGNAL(clicked()), this, SLOT(layerDelClicked())); QObject::connect(layer_del, SIGNAL(clicked()), this, SLOT(layerDelClicked()));
vlayout->addWidget(hwidget); control->layout()->addWidget(layers);
control->layout()->setAlignment(buttons, Qt::AlignTop);
} }
hwidget = new QWidget(this);
previews = new QWidget(this); previews = new QWidget(this);
previews->setLayout(new QVBoxLayout()); previews->setLayout(new QVBoxLayout());
previews->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); previews->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
layout()->addWidget(previews);
layout()->setAlignment(previews, Qt::AlignTop);
form = new QWidget(this); form = new QWidget(this);
form->setLayout(new QGridLayout()); form->setLayout(new QGridLayout());
form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); form->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
control->layout()->addWidget(form);
control->layout()->setAlignment(form, Qt::AlignTop | Qt::AlignLeft);
buttons = new QWidget(this); buttons = new QWidget(this);
buttons->setLayout(new QHBoxLayout()); buttons->setLayout(new QHBoxLayout());
control->layout()->addWidget(buttons);
hlayout->addWidget(previews); control->layout()->setAlignment(buttons, Qt::AlignBottom);
hlayout->addWidget(form);
hlayout->setAlignment(form, Qt::AlignTop);
vlayout->addWidget(hwidget);
vlayout->addWidget(buttons);
hwidget->setLayout(hlayout);
this->setLayout(vlayout);
this->setObjectName("_base_form_");
button_apply = addButton(tr("Apply")); button_apply = addButton(tr("Apply"));
button_apply->setEnabled(false); button_apply->setEnabled(false);

View file

@ -92,6 +92,9 @@ DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
progress->setValue(0); progress->setValue(0);
layout()->addWidget(progress); layout()->addWidget(progress);
progress_value = 0; progress_value = 0;
// TEMP
progress->hide();
} }
DialogRender::~DialogRender() DialogRender::~DialogRender()
@ -131,5 +134,5 @@ void DialogRender::applyRenderSize(int width, int height)
area->setMinimumSize(width, height); area->setMinimumSize(width, height);
area->setMaximumSize(width, height); area->setMaximumSize(width, height);
area->resize(width, height); area->resize(width, height);
scroll->setMinimumSize(width > 800 ? 850 : width + 50, height > 600 ? 650 : height + 50); scroll->setMinimumSize(width > 800 ? 820 : width + 20, height > 600 ? 620 : height + 20);
} }

View file

@ -12,18 +12,18 @@ InputColorGradation::InputColorGradation(QWidget* form, QString label, ColorGrad
{ {
_value = value; _value = value;
_preview = new PreviewColorGradation(form, value, COLORGRADATIONBAND_FINAL); _control = new PreviewColorGradation(form, value, COLORGRADATIONBAND_FINAL);
_preview->setMinimumSize(200, 20); _control->setMinimumSize(200, 20);
_control = new QPushButton(tr("Edit"), form); _preview = new QPushButton(tr("Edit"), form);
_control->setMaximumWidth(150); _preview->setMaximumWidth(150);
connect((QPushButton*)_control, SIGNAL(clicked()), this, SLOT(editGradation())); connect((QPushButton*)_preview, SIGNAL(clicked()), this, SLOT(editGradation()));
} }
void InputColorGradation::updatePreview() void InputColorGradation::updatePreview()
{ {
_preview->update(); _control->update();
BaseInput::updatePreview(); BaseInput::updatePreview();
} }
@ -43,7 +43,7 @@ void InputColorGradation::editGradation()
gradation = colorGradationCreate(); gradation = colorGradationCreate();
colorGradationCopy(_value, gradation); colorGradationCopy(_value, gradation);
if (DialogColorGradation::getGradation(_preview, gradation)) if (DialogColorGradation::getGradation(_control, gradation))
{ {
colorGradationCopy(gradation, _value); colorGradationCopy(gradation, _value);
applyValue(); applyValue();

View file

@ -4,6 +4,7 @@
#include <QMenuBar> #include <QMenuBar>
#include <QMenu> #include <QMenu>
#include <QIcon> #include <QIcon>
#include <QToolBar>
#include <QFileDialog> #include <QFileDialog>
#include <QTabWidget> #include <QTabWidget>
#include <QTranslator> #include <QTranslator>
@ -67,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
BaseForm* form; BaseForm* form;
QTabWidget* tabs; QTabWidget* tabs;
QMenu* menu; QToolBar* toolbar;
tabs = new QTabWidget(this); tabs = new QTabWidget(this);
@ -102,20 +103,22 @@ MainWindow::MainWindow(QWidget *parent) :
_form_render = new FormRender(tabs); _form_render = new FormRender(tabs);
tabs->addTab(_form_render, tr("Render")); tabs->addTab(_form_render, tr("Render"));
menu = menuBar()->addMenu(tr("&Scene")); toolbar = new QToolBar(this);
menu->addAction(tr("&New"), this, SLOT(fileNew()), QKeySequence(tr("Crtl+N"))); toolbar->setOrientation(Qt::Vertical);
menu->addSeparator(); toolbar->setAllowedAreas(Qt::LeftToolBarArea);
menu->addAction(tr("&Save"), this, SLOT(fileSave()), QKeySequence(tr("Crtl+S"))); toolbar->setMovable(false);
menu->addAction(tr("&Open"), this, SLOT(fileLoad()), QKeySequence(tr("Crtl+O"))); toolbar->setFloatable(false);
menu->addSeparator(); toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
menu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(tr("Crtl+Q"))); toolbar->toggleViewAction()->setEnabled(false);
toolbar->setIconSize(QSize(32, 32));
addToolBar(Qt::LeftToolBarArea, toolbar);
menu = menuBar()->addMenu(tr("&Actions")); toolbar->addAction(QIcon("images/new.png"), tr("&New"), this, SLOT(fileNew()))->setShortcut(QKeySequence(tr("Crtl+N")));
menu->addAction(tr("&Explore in 3D"), this, SLOT(explore3D()), QKeySequence("F2")); toolbar->addAction(QIcon("images/save.png"), tr("&Save"), this, SLOT(fileSave()))->setShortcut(QKeySequence(tr("Crtl+S")));
menu->addAction(tr("&Quick render"), this, SLOT(quickPreview()), QKeySequence("F5")); toolbar->addAction(QIcon("images/load.png"), tr("&Load"), this, SLOT(fileLoad()))->setShortcut(QKeySequence(tr("Crtl+L")));
toolbar->addAction(QIcon("images/explore.png"), tr("&Explore (F2)"), this, SLOT(explore3D()))->setShortcut(QKeySequence(tr("F2")));
menu = menuBar()->addMenu(tr("&Help")); toolbar->addAction(QIcon("images/render.png"), tr("&Quick\nrender (F5)"), this, SLOT(quickPreview()))->setShortcut(QKeySequence(tr("F5")));
menu->addAction(tr("&About"), this, SLOT(showAboutDialog())); toolbar->addAction(QIcon("images/about.png"), tr("&About"), this, SLOT(showAboutDialog()));
setCentralWidget(tabs); setCentralWidget(tabs);

View file

@ -4,32 +4,32 @@
<context> <context>
<name>BaseForm</name> <name>BaseForm</name>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="32"/> <location filename="../gui_qt/baseform.cpp" line="37"/>
<source>Layers : </source> <source>Layers : </source>
<translation>Niveaux :</translation> <translation>Niveaux :</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="38"/> <location filename="../gui_qt/baseform.cpp" line="45"/>
<source>Add layer</source> <source>Add layer</source>
<translation>Ajouter un niveau</translation> <translation>Ajouter un niveau</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="42"/> <location filename="../gui_qt/baseform.cpp" line="49"/>
<source>Delete layer</source> <source>Delete layer</source>
<translation>Supprimer un niveau</translation> <translation>Supprimer un niveau</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="73"/> <location filename="../gui_qt/baseform.cpp" line="74"/>
<source>Apply</source> <source>Apply</source>
<translation>Appliquer</translation> <translation>Appliquer</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="76"/> <location filename="../gui_qt/baseform.cpp" line="77"/>
<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="244"/> <location filename="../gui_qt/baseform.cpp" line="245"/>
<source>Layer %1</source> <source>Layer %1</source>
<translation>Niveau %1</translation> <translation>Niveau %1</translation>
</message> </message>
@ -682,32 +682,64 @@ Maintenir Ctrl : Plus rapide</translation>
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="75"/> <location filename="../gui_qt/mainwindow.cpp" line="76"/>
<source>Terrain</source> <source>Terrain</source>
<translation>Terrain</translation> <translation>Terrain</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="79"/> <location filename="../gui_qt/mainwindow.cpp" line="80"/>
<source>Textures</source> <source>Textures</source>
<translation>Textures</translation> <translation>Textures</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="83"/> <location filename="../gui_qt/mainwindow.cpp" line="84"/>
<source>Water</source> <source>Water</source>
<translation>Eau</translation> <translation>Eau</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="91"/> <location filename="../gui_qt/mainwindow.cpp" line="92"/>
<source>Atmosphere</source> <source>Atmosphere</source>
<translation>Atmosphère</translation> <translation>Atmosphère</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="87"/> <location filename="../gui_qt/mainwindow.cpp" line="118"/>
<source>&amp;Load</source>
<translation>&amp;Ouvrir</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="118"/>
<source>Crtl+L</source>
<translation>Ctrl+O</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="119"/>
<source>&amp;Explore (F2)</source>
<translation>&amp;Explorer (F2)</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="119"/>
<source>F2</source>
<translation>F2</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="120"/>
<source>&amp;Quick
render (F5)</source>
<translation>&amp;Rendu
rapide (F5)</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="120"/>
<source>F5</source>
<translation>F5</translation>
</message>
<message>
<location filename="../gui_qt/mainwindow.cpp" line="88"/>
<source>Sky</source> <source>Sky</source>
<translation>Ciel</translation> <translation>Ciel</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="95"/> <location filename="../gui_qt/mainwindow.cpp" line="96"/>
<source>Clouds</source> <source>Clouds</source>
<translation>Nuages</translation> <translation>Nuages</translation>
</message> </message>
@ -716,87 +748,78 @@ Maintenir Ctrl : Plus rapide</translation>
<translation type="obsolete">Eclairage</translation> <translation type="obsolete">Eclairage</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="103"/> <location filename="../gui_qt/mainwindow.cpp" line="104"/>
<source>Render</source> <source>Render</source>
<translation>Rendu</translation> <translation>Rendu</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="105"/>
<source>&amp;Scene</source> <source>&amp;Scene</source>
<translation>&amp;Scène</translation> <translation type="obsolete">&amp;Scène</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="106"/> <location filename="../gui_qt/mainwindow.cpp" line="116"/>
<source>&amp;New</source> <source>&amp;New</source>
<translation>&amp;Nouvelle</translation> <translation>&amp;Nouveau</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="106"/> <location filename="../gui_qt/mainwindow.cpp" line="116"/>
<source>Crtl+N</source> <source>Crtl+N</source>
<translation>Ctrl+N</translation> <translation>Ctrl+N</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="108"/> <location filename="../gui_qt/mainwindow.cpp" line="117"/>
<source>&amp;Save</source> <source>&amp;Save</source>
<translation>&amp;Sauvegarder</translation> <translation>&amp;Sauvegarder</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="108"/> <location filename="../gui_qt/mainwindow.cpp" line="117"/>
<source>Crtl+S</source> <source>Crtl+S</source>
<translation>Ctrl+S</translation> <translation>Ctrl+S</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="109"/>
<source>&amp;Open</source> <source>&amp;Open</source>
<translation>&amp;Ouvrir</translation> <translation type="obsolete">&amp;Ouvrir</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="109"/>
<source>Crtl+O</source> <source>Crtl+O</source>
<translation>Ctrl+O</translation> <translation type="obsolete">Ctrl+O</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="111"/>
<source>&amp;Quit</source> <source>&amp;Quit</source>
<translation>&amp;Quitter</translation> <translation type="obsolete">&amp;Quitter</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="111"/>
<source>Crtl+Q</source> <source>Crtl+Q</source>
<translation>Ctrl+Q</translation> <translation type="obsolete">Ctrl+Q</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="113"/>
<source>&amp;Actions</source> <source>&amp;Actions</source>
<translation>&amp;Actions</translation> <translation type="obsolete">&amp;Actions</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="114"/>
<source>&amp;Explore in 3D</source> <source>&amp;Explore in 3D</source>
<translation>&amp;Explorer en 3D</translation> <translation type="obsolete">&amp;Explorer en 3D</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="115"/>
<source>&amp;Quick render</source> <source>&amp;Quick render</source>
<translation>Rendu r&amp;apide</translation> <translation type="obsolete">Rendu r&amp;apide</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="117"/>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation>Ai&amp;de</translation> <translation type="obsolete">Ai&amp;de</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="118"/> <location filename="../gui_qt/mainwindow.cpp" line="121"/>
<source>&amp;About</source> <source>&amp;About</source>
<translation>&amp;A propos</translation> <translation>&amp;A propos</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="163"/> <location filename="../gui_qt/mainwindow.cpp" line="166"/>
<source>Paysages 3D</source> <source>Paysages 3D</source>
<translation>Paysages 3D</translation> <translation>Paysages 3D</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/mainwindow.cpp" line="163"/> <location filename="../gui_qt/mainwindow.cpp" line="166"/>
<source>A 3D landscape editing and rendering software. <source>A 3D landscape editing and rendering software.
Credits : Credits :

BIN
images/about.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
images/explore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/load.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

BIN
images/new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
images/render.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
images/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB