2012-02-20 21:17:13 +00:00
|
|
|
#include "dialogcolorgradation.h"
|
|
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QSlider>
|
|
|
|
#include <QScrollArea>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include "baseform.h"
|
2012-02-21 13:41:02 +00:00
|
|
|
#include "tools.h"
|
2012-03-08 15:10:25 +00:00
|
|
|
#include "widgetcurveeditor.h"
|
2012-02-20 21:17:13 +00:00
|
|
|
|
|
|
|
/**************** Dialog ****************/
|
|
|
|
DialogColorGradation::DialogColorGradation(QWidget *parent, ColorGradation* gradation):
|
|
|
|
QDialog(parent)
|
|
|
|
{
|
|
|
|
_base = gradation;
|
|
|
|
_current = colorGradationCreate();
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationCopy(_base, _current);
|
2012-02-20 21:17:13 +00:00
|
|
|
|
|
|
|
setLayout(new QHBoxLayout());
|
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
_curve_editor = new WidgetCurveEditor(this);
|
|
|
|
layout()->addWidget(_curve_editor);
|
2012-02-20 21:17:13 +00:00
|
|
|
|
|
|
|
/*QObject::connect(button, SIGNAL(clicked()), this, SLOT(accept()));
|
|
|
|
QObject::connect(button, SIGNAL(clicked()), this, SLOT(revert()));
|
|
|
|
QObject::connect(button, SIGNAL(clicked()), this, SLOT(reject()));*/
|
|
|
|
|
2012-02-28 13:45:11 +00:00
|
|
|
setWindowTitle(tr("Paysages 3D - Color gradation editor"));
|
2012-02-20 21:17:13 +00:00
|
|
|
|
|
|
|
revert();
|
|
|
|
}
|
|
|
|
|
|
|
|
DialogColorGradation::~DialogColorGradation()
|
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationDelete(_current);
|
2012-02-20 21:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DialogColorGradation::getGradation(QWidget* parent, ColorGradation* gradation)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
DialogColorGradation* dialog = new DialogColorGradation(parent, gradation);
|
|
|
|
result = dialog->exec();
|
|
|
|
|
|
|
|
delete dialog;
|
|
|
|
|
|
|
|
return (result != 0) ? true : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DialogColorGradation::closeEvent(QCloseEvent* e)
|
|
|
|
{
|
|
|
|
reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DialogColorGradation::accept()
|
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationCopy(_current, _base);
|
2012-02-20 21:17:13 +00:00
|
|
|
QDialog::accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DialogColorGradation::revert()
|
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationCopy(_base, _current);
|
2012-02-20 21:17:13 +00:00
|
|
|
revertToCurrent();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DialogColorGradation::revertToCurrent()
|
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
// TODO
|
2012-02-20 21:17:13 +00:00
|
|
|
}
|