File indexing completed on 2024-04-14 03:40:20

0001 /*
0002     SPDX-FileCopyrightText: 2006 Carsten Niehaus <cniehaus@kde.org>
0003     SPDX-FileCopyrightText: 2010 Etienne Rebetez <etienne.rebetez@oberwallis.ch>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef GRADIENTWIDGET_IMPL_H
0009 #define GRADIENTWIDGET_IMPL_H
0010 
0011 #include "ui_gradientwidget.h"
0012 #include <QWidget>
0013 
0014 
0015 class QTimer;
0016 
0017 /**
0018  * @class GradientWidgetImpl
0019 
0020  * @short Provides a widget for setting the appearance of the pse table
0021  * @author Carsten Niehaus
0022  * @author Kashyap Puranik
0023  * @author Etienne Rebetez
0024  */
0025 class GradientWidgetImpl : public QWidget, public Ui_gradientWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     /**
0031      * @param elementProperty The elementProperty class
0032      * @param parent The parent of this widget
0033      */
0034     explicit GradientWidgetImpl(QWidget *parent = nullptr);
0035     ~GradientWidgetImpl() override;
0036 
0037 Q_SIGNALS:
0038     /**
0039      * Is emitted when the value of the gradient or the spinbox is changed.
0040      */
0041     void gradientValueChanged(double);
0042 
0043 public Q_SLOTS:
0044     /**
0045      * Sets the comboboxes to the current values.
0046      * the current values come form the elementProperty class.
0047      */
0048     void slotGradientChanged();
0049 
0050 private Q_SLOTS:
0051     void play();
0052     void stop();
0053     void tick();
0054     void doubleToSlider(double var);
0055     void intToSpinbox(int var);
0056     /**
0057      * is used to display custom text in the widget according to the current value of the gradient
0058      */
0059     void setNewValue(double newValue);
0060 
0061 private:
0062     bool m_play = false; // Indicates whether mode is play or stop
0063     QTimer *const m_timer;
0064 };
0065 #endif // GRADIENTWIDGET_IMPL_H