9#include "labeledgamma.h"
13#include <KLocalizedString>
14#include <KSaneCore/Option>
30 initGamma(option->
title(), max);
37LabeledGamma::~LabeledGamma()
41void LabeledGamma::initGamma(QString text,
int max)
43 m_brightSlider =
new LabeledSlider(
this,
i18n(
"Brightness"), -50, 50, 1);
44 m_brightSlider->setValue(0);
46 m_contrastSlider =
new LabeledSlider(
this,
i18n(
"Contrast"), -50, 50, 1);
47 m_contrastSlider->setValue(0);
49 m_gammaSlider =
new LabeledSlider(
this,
i18n(
"Gamma"), 30, 300, 1);
50 m_gammaSlider->setValue(100);
53 int labelMax = m_brightSlider->labelWidthHint();
54 labelMax = qMax(labelMax, m_contrastSlider->labelWidthHint());
55 labelMax = qMax(labelMax, m_gammaSlider->labelWidthHint());
57 m_brightSlider->setLabelWidth(labelMax);
58 m_contrastSlider->setLabelWidth(labelMax);
59 m_gammaSlider->setLabelWidth(labelMax);
63 m_gammaDisplay =
new GammaDisp(
this, &m_brightness, &m_contrast, &m_gamma, max);
65 QGroupBox *groupBox =
new QGroupBox(text,
this);
66 QGridLayout *gr_lay =
new QGridLayout(groupBox);
69 gr_lay->
addWidget(m_contrastSlider, 1, 0);
71 gr_lay->
addWidget(m_gammaDisplay, 0, 1, 3, 1);
74 m_layout->addWidget(groupBox, 1, 0, 1, 3);
83void LabeledGamma::setColor(
const QColor &color)
85 if (m_gammaDisplay !=
nullptr) {
86 m_gammaDisplay->setColor(color);
90void LabeledGamma::setValues(
const QVariant &values)
94 if (
copy.size() != 3) {
98 m_brightSlider->blockSignals(
true);
99 m_contrastSlider->blockSignals(
true);
100 m_gammaSlider->blockSignals(
true);
102 m_brightness =
copy.at(0).toInt();
103 m_contrast =
copy.at(1).toInt();
104 m_gamma =
copy.at(2).toInt();
106 m_brightSlider->setValue(m_brightness);
107 m_contrastSlider->setValue(m_contrast);
108 m_gammaSlider->setValue(m_gamma);
112 m_brightSlider->blockSignals(
false);
113 m_contrastSlider->blockSignals(
false);
114 m_gammaSlider->blockSignals(
false);
118void LabeledGamma::emitNewValues()
120 m_brightness = m_brightSlider->value();
121 m_contrast = m_contrastSlider->value();
122 m_gamma = m_gammaSlider->value();
123 QVariantList values = { m_brightness, m_contrast, m_gamma };
125 m_gammaDisplay->update();
129bool LabeledGamma::getValues(
int &brightness,
int &contrast,
int &gamma)
131 brightness = m_brightSlider->value();
132 contrast = m_contrastSlider->value();
133 gamma = m_gammaSlider->value();
137int LabeledGamma::maxValue()
144#include "moc_labeledgamma.cpp"
void valueChanged(const QVariant &value)
bool setValue(const QVariant &value)
QString description() const
QVariant maximumValue() const
LabeledGamma(QWidget *parent, const QString &text, int max)
Create the labeled gamma widget.
void valueChanged(const QVariant &val)
Emit the slider value changes.
QString i18n(const char *text, const TYPE &arg...)
QAction * copy(const QObject *recvr, const char *slot, QObject *parent)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
QVariant fromValue(T &&value)
QList< QVariant > toList() const const