Fix free form refreshing from global data update

This commit is contained in:
Michaël Lemaire 2013-06-20 23:18:15 +02:00
parent 3d7aefe79d
commit da27cc9b1e
5 changed files with 78 additions and 57 deletions

View file

@ -1429,7 +1429,7 @@ Maintenir Ctrl : Plus rapide</translation>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="14"/>
<source>Terrain editor</source>
<translation type="unfinished"></translation>
<translation>Editeur de terrain</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="122"/>
@ -1472,67 +1472,77 @@ Maintenir Ctrl : Plus rapide</translation>
<translation>Altitude relative de la couche d&apos;eau</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="284"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="296"/>
<source>Go to textures to add small height displacements (rocks...)</source>
<translation>Aller aux textures pour ajouter des détails (roches...)</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="334"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="346"/>
<source>Result preview</source>
<translation>Prévisualisation du résultat</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="365"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="377"/>
<source>Render preview</source>
<translation>Rendu rapide</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="376"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="388"/>
<source>Explore in 3D</source>
<translation>Explorer en 3D</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="403"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="415"/>
<source>Actions</source>
<translation>Actions</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="412"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="424"/>
<source>Revert modifications</source>
<translation>Annuler les modifications</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="423"/>
<location filename="../../src/editing/terrain/mainterrainform.ui" line="435"/>
<source>Apply modifications</source>
<translation>Valider les modifications</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="55"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="59"/>
<source>Memory used by sculpted data: %1</source>
<translation>Mémoire utilisée par les zones sculptées : %1</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="59"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="63"/>
<source>No manual scuplting done</source>
<translation>Aucune zone n&apos;a é sculptée</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="90"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="78"/>
<source>No displacement textures</source>
<translation>Aucune texture de détail</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="82"/>
<source>Maximal displacement : %1% of total height</source>
<translation>Déplacement maximal par textures : %1% du dénivelé total</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="106"/>
<source>Paysages 3D - Base noise edition</source>
<translation>Paysages 3D - Edition de la forme de base</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="90"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="106"/>
<source>You have manual modifications on this terrain, regenerating base noise may produce weird results.</source>
<translation>Vous avez des modifications manuelles sur le terrain, modifier la forme de base peut produire des discontinuités.</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="90"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="106"/>
<source>Keep my changes anyway</source>
<translation>Garder mes changements</translation>
</message>
<message>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="90"/>
<location filename="../../src/editing/terrain/mainterrainform.cpp" line="106"/>
<source>Erase my changes</source>
<translation>Effacer mes changements</translation>
</message>
@ -1766,87 +1776,87 @@ rapide (F5)</translation>
<translation>Caméra</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="173"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="178"/>
<source>Do you want to start a new scenery ? Any unsaved changes will be lost.</source>
<translation>Voulez-vous commencer un nouveau paysage ? Les modifications non sauvegardées seront perdues.</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="173"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="178"/>
<source>Paysages 3D - New scenery</source>
<translation>Paysages 3D - Nouvelle scène</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="182"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="187"/>
<source>Paysages 3D - Choose a file to save the scenery</source>
<translation>Paysages 3D - Choisissez un fichier pour enregistrer la scène</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="182"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="208"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="187"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="213"/>
<source>Paysages 3D Scenery (*.p3d)</source>
<translation>Scène Paysages 3D (*.p3d)</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="196"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="199"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="201"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="204"/>
<source>Paysages 3D - File saving error</source>
<translation>Paysages 3D - Erreur d&apos;enregistrement</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="196"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="201"/>
<source>Can&apos;t write specified file : %1</source>
<translation>Impossible d&apos;écrire dans le fichier : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="199"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="204"/>
<source>Unexpected error while saving file : %1</source>
<translation>Erreur inconnue durant l&apos;enregistrement : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="206"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="211"/>
<source>Do you want to load a scenery from file ? Any unsaved changes will be lost.</source>
<translation>Voulez-vous charger une scène ? Les modifications non sauvegardées seront perdues.</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="206"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="211"/>
<source>Paysages 3D - Load scenery</source>
<translation>Paysages 3D - Charger une scène</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="208"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="213"/>
<source>Paysages 3D - Choose a scenery file to load</source>
<translation>Paysages 3D - Choisissez un fichier de scène à charger</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="218"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="221"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="224"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="227"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="223"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="226"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="229"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="232"/>
<source>Paysages 3D - File loading error</source>
<translation>Paysages 3D - Erreur de chargement</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="218"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="223"/>
<source>Can&apos;t read specified file : %1</source>
<translation>Impossible de lire le fichier : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="221"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="226"/>
<source>This file doesn&apos;t look like a Paysages 3D file : %1</source>
<translation>Le fichier ne semble pas être au format Paysages 3D : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="224"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="229"/>
<source>This file was created with an incompatible Paysages 3D version : %1</source>
<translation>Le fichier a é créé avec une version incompatible de Paysages 3D : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="227"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="232"/>
<source>Unexpected error while loading file : %1</source>
<translation>Erreur inconnue lors du chargement : %1</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.cpp" line="235"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="240"/>
<source>A 3D landscape editing and rendering software.
Authors :
@ -1981,7 +1991,7 @@ GLib - http://www.gtk.org</translation>
</message>
<message>
<location filename="../../src/editing/common/mainwindow.ui" line="14"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="235"/>
<location filename="../../src/editing/common/mainwindow.cpp" line="240"/>
<source>Paysages 3D</source>
<translation>Paysages 3D</translation>
</message>

View file

@ -66,6 +66,7 @@ bool FreeFormHelper::eventFilter(QObject* object, QEvent* event)
void FreeFormHelper::startManaging()
{
_form_widget->installEventFilter(this);
connect(MainWindow::instance(), SIGNAL(refreshed()), this, SLOT(processGlobalRefresh()));
connect(this, SIGNAL(needLocalRefreshing()), _form_widget, SLOT(refreshFromLocalData()));
connect(this, SIGNAL(needGlobalRefreshing()), _form_widget, SLOT(refreshFromFellowData()));
@ -73,9 +74,7 @@ void FreeFormHelper::startManaging()
connect(this, SIGNAL(needCommitting()), _form_widget, SLOT(commitLocalDataToScenery()));
connect(this, SIGNAL(needAlterRenderer(Renderer*)), _form_widget, SLOT(alterRenderer(Renderer*)));
emit needLocalRefreshing();
emit needGlobalRefreshing();
emit needReverting();
processGlobalRefresh();
}
void FreeFormHelper::addPreview(BasePreview* preview, PreviewRenderer* renderer)
@ -197,11 +196,7 @@ void FreeFormHelper::openDialog(QDialog* dialog)
void FreeFormHelper::gotoMainTab(int position)
{
QWidget* window = _form_widget->window();
if (window->inherits("MainWindow"))
{
((MainWindow*)window)->openTab(position);
}
MainWindow::instance()->openTab(position);
}
void FreeFormHelper::processDataChange()
@ -224,6 +219,13 @@ void FreeFormHelper::processDataChange()
emit needLocalRefreshing();
}
void FreeFormHelper::processGlobalRefresh()
{
emit needGlobalRefreshing();
processRevertClicked();
}
void FreeFormHelper::processRevertClicked()
{
emit needReverting();
@ -261,15 +263,7 @@ void FreeFormHelper::processApplyClicked()
{
emit needCommitting();
_data_changed = false;
if (_button_apply)
{
_button_apply->setEnabled(false);
}
if (_button_revert)
{
_button_revert->setEnabled(false);
}
MainWindow::instance()->refreshAll();
}
void FreeFormHelper::processExploreClicked()

View file

@ -53,6 +53,7 @@ signals:
public slots:
void processDataChange();
void processGlobalRefresh();
void processRevertClicked();
void processApplyClicked();
void processExploreClicked();

View file

@ -28,6 +28,8 @@
#include "rendering/scenery.h"
#include "tools.h"
MainWindow* MainWindow::_instance = NULL;
int main(int argc, char** argv)
{
MainWindow* window;
@ -78,10 +80,11 @@ int main(int argc, char** argv)
return result;
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
MainWindow::MainWindow() :
QMainWindow(),
ui(new Ui::MainWindow)
{
_instance = this;
ui->setupUi(this);
BaseForm* form;
@ -155,7 +158,6 @@ void MainWindow::refreshAll()
{
_forms[i]->revertConfig();
}
// TODO Refresh free forms
// Refresh preview OSD
CameraDefinition* camera = cameraCreateDefinition();
@ -166,6 +168,8 @@ void MainWindow::refreshAll()
item->drawCamera(camera);
item->setToolTip(QString(tr("Camera")));
cameraDeleteDefinition(camera);
emit refreshed();
}
void MainWindow::openTab(int position)

View file

@ -12,19 +12,27 @@ namespace Ui {
class MainWindow;
}
class MainWindow;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
MainWindow();
~MainWindow();
virtual bool event(QEvent* event);
static inline MainWindow* instance()
{
return _instance;
}
static void guiSaveCallback(PackStream* stream, void* data);
static void guiLoadCallback(PackStream* stream, void* data);
protected:
public slots:
void refreshAll();
@ -42,7 +50,11 @@ public slots:
void explore3D();
signals:
void refreshed();
private:
static MainWindow* _instance;
Ui::MainWindow *ui;
void guiSave(PackStream* stream);