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-03-18 19:51:06 +00:00
|
|
|
_preview = new PreviewColorGradation(form, value, COLORGRADATIONBAND_FINAL);
|
2012-01-07 16:53:23 +00:00
|
|
|
_preview->setMinimumSize(200, 20);
|
2012-01-08 10:31:01 +00:00
|
|
|
|
2012-02-28 13:45:11 +00:00
|
|
|
_control = new QPushButton(tr("Edit"), form);
|
2012-01-07 16:53:23 +00:00
|
|
|
_control->setMaximumWidth(150);
|
|
|
|
|
|
|
|
connect((QPushButton*)_control, SIGNAL(clicked()), this, SLOT(editGradation()));
|
|
|
|
}
|
|
|
|
|
2012-01-08 10:31:01 +00:00
|
|
|
void InputColorGradation::updatePreview()
|
|
|
|
{
|
|
|
|
_preview->update();
|
|
|
|
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);
|
|
|
|
if (DialogColorGradation::getGradation(_preview, 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
|
|
|
}
|