From 10c5d5056691f0a03798c7e9439138126da30b8a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 22 Sep 2014 18:26:35 +0200 Subject: QtBiomeVisualiser: Moved the generator setup into a side-pane. --- Tools/QtBiomeVisualiser/GeneratorSetup.h | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Tools/QtBiomeVisualiser/GeneratorSetup.h (limited to 'Tools/QtBiomeVisualiser/GeneratorSetup.h') diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.h b/Tools/QtBiomeVisualiser/GeneratorSetup.h new file mode 100644 index 000000000..0594e1998 --- /dev/null +++ b/Tools/QtBiomeVisualiser/GeneratorSetup.h @@ -0,0 +1,57 @@ +#pragma once + +#include +#include +#include +#include +#include + + + + + +class cIniFile; +typedef std::shared_ptr cIniFilePtr; + + + + + +class GeneratorSetup : + public QWidget +{ + typedef QWidget super; + + Q_OBJECT + +public: + /** Creates the widget and loads the contents of the INI file, if not empty. */ + explicit GeneratorSetup(const std::string & a_IniFileName, QWidget * parent = nullptr); + + /** Returns the cIniFile instance that is being edited by this widget. */ + cIniFilePtr getIniFile() { return m_IniFile; } + +signals: + +public slots: + /** Called when the user selects a different generator from the top combobox. + Re-creates m_IniFile and updates the form layout. */ + void generatorChanged(const QString & a_NewName); + +protected: + QComboBox * m_cbGenerator; + QVBoxLayout * m_MainLayout; + QFormLayout * m_FormLayout; + + cIniFilePtr m_IniFile; + + int m_Seed; + + + /** Updates the form layout with the values from m_IniFile. */ + void updateFromIni(); +}; + + + + -- cgit v1.2.3 From 83588fb0aad5c8597df783792c946c27327f1a40 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 22 Sep 2014 21:51:59 +0200 Subject: QtBiomeVisualiser: Implemented live-update for the generator setup. --- Tools/QtBiomeVisualiser/GeneratorSetup.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Tools/QtBiomeVisualiser/GeneratorSetup.h') diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.h b/Tools/QtBiomeVisualiser/GeneratorSetup.h index 0594e1998..e72d3abbc 100644 --- a/Tools/QtBiomeVisualiser/GeneratorSetup.h +++ b/Tools/QtBiomeVisualiser/GeneratorSetup.h @@ -32,14 +32,21 @@ public: cIniFilePtr getIniFile() { return m_IniFile; } signals: + /** Emitted when the generator parameters have changed. */ + void generatorUpdated(); public slots: /** Called when the user selects a different generator from the top combobox. Re-creates m_IniFile and updates the form layout. */ void generatorChanged(const QString & a_NewName); +protected slots: + /** Called when any of the edit widgets are changed. */ + void editChanged(const QString & a_NewValue); + protected: QComboBox * m_cbGenerator; + QLineEdit * m_eSeed; QVBoxLayout * m_MainLayout; QFormLayout * m_FormLayout; -- cgit v1.2.3