2012-01-06 16:09:03 +00:00
|
|
|
#ifndef _PAYSAGES_QT_BASEFORM_H_
|
|
|
|
#define _PAYSAGES_QT_BASEFORM_H_
|
2012-01-05 16:32:41 +00:00
|
|
|
|
|
|
|
#include <QWidget>
|
2012-07-05 17:05:03 +00:00
|
|
|
#include <QStringList>
|
2012-02-21 13:41:02 +00:00
|
|
|
#include "basepreview.h"
|
2012-01-05 18:39:17 +00:00
|
|
|
#include "baseinput.h"
|
2012-07-10 19:39:12 +00:00
|
|
|
#include "dialoglayers.h"
|
2013-04-17 12:29:51 +00:00
|
|
|
#include "rendering/shared/types.h"
|
|
|
|
#include "rendering/tools/curve.h"
|
|
|
|
#include "rendering/tools/color.h"
|
|
|
|
#include "rendering/tools/pack.h"
|
2013-04-27 19:41:57 +00:00
|
|
|
#include "rendering/tools/lighting.h"
|
2013-04-17 12:29:51 +00:00
|
|
|
#include "rendering/noise.h"
|
|
|
|
#include "rendering/layers.h"
|
2012-01-05 16:32:41 +00:00
|
|
|
|
2013-08-23 22:50:56 +00:00
|
|
|
class QPushButton;
|
|
|
|
class QComboBox;
|
|
|
|
|
2013-04-27 19:41:57 +00:00
|
|
|
class BaseForm : public QWidget
|
2012-01-05 16:32:41 +00:00
|
|
|
{
|
2012-01-05 18:39:17 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-01-05 16:32:41 +00:00
|
|
|
public:
|
2013-04-27 19:41:57 +00:00
|
|
|
BaseForm(QWidget* parent, bool auto_apply = false, bool with_layers = false);
|
2012-06-02 09:46:24 +00:00
|
|
|
void hideButtons();
|
2012-06-27 10:30:00 +00:00
|
|
|
virtual void savePack(PackStream* stream);
|
|
|
|
virtual void loadPack(PackStream* stream);
|
2012-01-05 16:32:41 +00:00
|
|
|
|
2012-01-26 22:30:20 +00:00
|
|
|
signals:
|
|
|
|
void configApplied();
|
|
|
|
|
2012-01-05 16:32:41 +00:00
|
|
|
public slots:
|
|
|
|
virtual void revertConfig();
|
2012-01-06 16:09:03 +00:00
|
|
|
virtual void applyConfig();
|
2012-01-05 16:32:41 +00:00
|
|
|
|
2012-01-07 16:53:23 +00:00
|
|
|
protected slots:
|
2012-01-25 22:32:06 +00:00
|
|
|
virtual void configChangeEvent();
|
2012-11-19 20:40:57 +00:00
|
|
|
virtual void autoPresetSelected(int preset);
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-02-05 11:31:16 +00:00
|
|
|
private slots:
|
2012-07-05 11:37:50 +00:00
|
|
|
void rebuildLayerList();
|
2012-02-05 11:31:16 +00:00
|
|
|
void layerAddClicked();
|
|
|
|
void layerDelClicked();
|
2012-07-05 11:37:50 +00:00
|
|
|
void layerUpClicked();
|
|
|
|
void layerDownClicked();
|
2012-07-05 17:55:25 +00:00
|
|
|
void layerRenameClicked();
|
2012-02-05 11:31:16 +00:00
|
|
|
void layerListChanged();
|
2012-11-19 20:40:57 +00:00
|
|
|
void presetChoiceClicked();
|
2012-01-07 16:53:23 +00:00
|
|
|
|
2012-01-05 16:32:41 +00:00
|
|
|
protected:
|
2012-02-21 13:41:02 +00:00
|
|
|
void addPreview(BasePreview* preview, QString label);
|
2012-01-06 16:09:03 +00:00
|
|
|
QPushButton* addButton(QString label);
|
2012-11-19 20:40:57 +00:00
|
|
|
void addAutoPreset(QString label);
|
2012-06-23 22:11:25 +00:00
|
|
|
BaseInput* addInput(BaseInput* input);
|
|
|
|
BaseInput* addInputInt(QString label, int* value, int min, int max, int small_step, int large_step);
|
|
|
|
BaseInput* addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step);
|
|
|
|
BaseInput* addInputBoolean(QString label, int* value);
|
|
|
|
BaseInput* addInputColor(QString label, Color* value);
|
|
|
|
BaseInput* addInputColorGradation(QString label, ColorGradation* value);
|
|
|
|
BaseInput* addInputNoise(QString label, NoiseGenerator* value);
|
2012-06-27 12:49:51 +00:00
|
|
|
BaseInput* addInputCurve(QString label, Curve* value, double xmin, double xmax, double ymin, double ymax, QString xlabel, QString ylabel);
|
2012-06-23 22:11:25 +00:00
|
|
|
BaseInput* addInputMaterial(QString label, SurfaceMaterial* material);
|
|
|
|
BaseInput* addInputEnum(QString label, int* value, const QStringList& values);
|
2012-07-10 19:39:12 +00:00
|
|
|
BaseInput* addInputLayers(QString label, Layers* value, FormLayerBuilder form_builder);
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-06-27 13:28:12 +00:00
|
|
|
void updatePreviews();
|
|
|
|
void disablePreviewsUpdate();
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-02-05 11:31:16 +00:00
|
|
|
int currentLayer();
|
2012-07-05 17:05:03 +00:00
|
|
|
virtual QStringList getLayers();
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-02-05 11:31:16 +00:00
|
|
|
virtual void layerAddedEvent();
|
|
|
|
virtual void layerDeletedEvent(int layer);
|
2012-07-05 11:37:50 +00:00
|
|
|
virtual void layerMovedEvent(int layer, int new_position);
|
2012-07-05 17:55:25 +00:00
|
|
|
virtual void layerRenamedEvent(int layer, QString new_name);
|
2012-02-05 11:31:16 +00:00
|
|
|
virtual void layerSelectedEvent(int layer);
|
|
|
|
|
2012-01-05 16:32:41 +00:00
|
|
|
private:
|
2012-07-05 11:37:50 +00:00
|
|
|
bool _auto_apply;
|
|
|
|
QWidget* _form;
|
|
|
|
QWidget* _form_labels;
|
|
|
|
QWidget* _form_previews;
|
|
|
|
QWidget* _form_controls;
|
|
|
|
QWidget* _buttons;
|
|
|
|
QPushButton* _button_apply;
|
|
|
|
QPushButton* _button_revert;
|
2012-11-19 20:40:57 +00:00
|
|
|
QPushButton* _button_preset;
|
2012-07-05 18:14:51 +00:00
|
|
|
|
|
|
|
QWidget* _previews;
|
|
|
|
QVector<BasePreview*> _previews_list;
|
|
|
|
bool _auto_update_previews;
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-07-05 18:14:51 +00:00
|
|
|
QVector<BaseInput*> _inputs_list;
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-11-19 20:40:57 +00:00
|
|
|
QStringList _preset_list;
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-07-05 17:55:25 +00:00
|
|
|
bool _with_layers;
|
|
|
|
QComboBox* _layer_list;
|
|
|
|
int _layer_count;
|
|
|
|
QStringList _layer_names;
|
|
|
|
QPushButton* _layer_new;
|
|
|
|
QPushButton* _layer_del;
|
|
|
|
QPushButton* _layer_up;
|
|
|
|
QPushButton* _layer_down;
|
|
|
|
QPushButton* _layer_rename;
|
2012-01-05 16:32:41 +00:00
|
|
|
};
|
|
|
|
|
2012-07-05 11:37:50 +00:00
|
|
|
#endif
|