File indexing completed on 2024-05-12 04:33:22

0001 /*
0002  * SPDX-FileCopyrightText: 2007-2011 Kare Sars <kare.sars@iki .fi>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef LABELED_GAMMA_H
0008 #define LABELED_GAMMA_H
0009 
0010 // Local includes
0011 #include "labeledslider.h"
0012 #include "gammadisp.h"
0013 
0014 /**
0015   *@author Kåre Särs
0016   */
0017 
0018 namespace KSaneIface
0019 {
0020 
0021 /**
0022  * A wrapper for a checkbox
0023  */
0024 class LabeledGamma : public KSaneOptionWidget
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029 
0030     /**
0031      * Create the labeled gamma widget.
0032      *
0033      * \param parent parent widget
0034      * \param text is the text describing the checkbox.
0035      * \param max is the maximum gamma-table-value
0036      */
0037     LabeledGamma(QWidget *parent, const QString &text, int max);
0038 
0039     LabeledGamma(QWidget *parent, KSaneCore::Option *option, QColor color = Qt::black);
0040 
0041     ~LabeledGamma() override;
0042 
0043     void setColor(const QColor &color);
0044 
0045     int maxValue();
0046 
0047     bool getValues(int &brightness, int &contrast, int &gamma);
0048 
0049 public Q_SLOTS:
0050     void setValues(const QVariant &values);
0051 
0052 Q_SIGNALS:
0053     void valuesChanged(const QVariant &values);
0054 
0055 private Q_SLOTS:
0056     void emitNewValues();
0057 
0058 private:
0059     void initGamma(QString text, int max);
0060 
0061     LabeledSlider *m_brightSlider;
0062     LabeledSlider *m_contrastSlider;
0063     LabeledSlider *m_gammaSlider;
0064 
0065     int     m_brightness = 0;
0066     int     m_contrast = 0;
0067     int     m_gamma = 0;
0068     int     m_maxValue;
0069 
0070     GammaDisp  *m_gammaDisplay;
0071 };
0072 
0073 }  // NameSpace KSaneIface
0074 
0075 #endif // LABELED_GAMMA_H