2012-01-07 16:53:23 +00:00
|
|
|
#include "inputcolorgradation.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QColorDialog>
|
2012-02-20 21:17:13 +00:00
|
|
|
#include "dialogcolorgradation.h"
|
2012-03-18 19:51:06 +00:00
|
|
|
#include "previewcolorgradation.h"
|
2012-01-08 10:31:01 +00:00
|
|
|
#include "tools.h"
|
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
InputColorGradation::InputColorGradation(QWidget* form, QString label, ColorGradation* value) : BaseInput(form, label)
|
2012-01-07 16:53:23 +00:00
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
_value = value;
|
|
|
|
|
2012-04-11 19:59:50 +00:00
|
|
|
_control = new PreviewColorGradation(form, value, COLORGRADATIONBAND_FINAL);
|
|
|
|
_control->setMinimumSize(200, 20);
|
2012-01-08 10:31:01 +00:00
|
|
|
|
2012-04-11 19:59:50 +00:00
|
|
|
_preview = new QPushButton(tr("Edit"), form);
|
|
|
|
_preview->setMaximumWidth(150);
|
2012-01-07 16:53:23 +00:00
|
|
|
|
2012-04-11 19:59:50 +00:00
|
|
|
connect((QPushButton*)_preview, SIGNAL(clicked()), this, SLOT(editGradation()));
|
2012-01-07 16:53:23 +00:00
|
|
|
}
|
|
|
|
|
2012-01-08 10:31:01 +00:00
|
|
|
void InputColorGradation::updatePreview()
|
|
|
|
{
|
2012-04-11 19:59:50 +00:00
|
|
|
_control->update();
|
2012-01-08 10:31:01 +00:00
|
|
|
BaseInput::updatePreview();
|
|
|
|
}
|
|
|
|
|
2012-01-07 16:53:23 +00:00
|
|
|
void InputColorGradation::applyValue()
|
|
|
|
{
|
|
|
|
BaseInput::applyValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputColorGradation::revert()
|
|
|
|
{
|
2012-01-08 10:31:01 +00:00
|
|
|
BaseInput::revert();
|
2012-01-07 16:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InputColorGradation::editGradation()
|
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
ColorGradation* gradation;
|
2012-02-20 21:17:13 +00:00
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
gradation = colorGradationCreate();
|
|
|
|
colorGradationCopy(_value, gradation);
|
2012-04-11 19:59:50 +00:00
|
|
|
if (DialogColorGradation::getGradation(_control, gradation))
|
2012-01-07 16:53:23 +00:00
|
|
|
{
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationCopy(gradation, _value);
|
2012-01-07 16:53:23 +00:00
|
|
|
applyValue();
|
2012-02-20 21:17:13 +00:00
|
|
|
}
|
2012-03-08 15:10:25 +00:00
|
|
|
colorGradationDelete(gradation);
|
2012-01-07 16:53:23 +00:00
|
|
|
}
|