File indexing completed on 2022-09-27 12:24:09

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 #include "kalziumelementproperty.h"
0015 
0016 class QTimer;
0017 
0018 /**
0019  * @class GradientWidgetImpl
0020 
0021  * @short Provides a widget for setting the appearance of the pse table
0022  * @author Carsten Niehaus
0023  * @author Kashyap Puranik
0024  * @author Etienne Rebetez
0025  */
0026 class GradientWidgetImpl : public QWidget, public Ui_gradientWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     /**
0032      * @param elementProperty The elementProperty class
0033      * @param parent The parent of this widget
0034      */
0035     explicit GradientWidgetImpl(QWidget *parent = nullptr);
0036     ~GradientWidgetImpl() override;
0037 
0038 Q_SIGNALS:
0039     /**
0040      * Is emitted when the value of the gradient or the spinbox is changed.
0041      */
0042     void gradientValueChanged(double);
0043 
0044 public Q_SLOTS:
0045     /**
0046      * Sets the comboboxes to the current values.
0047      * the current values come form the elementProperty class.
0048      */
0049     void slotGradientChanged();
0050 
0051 private Q_SLOTS:
0052     void play();
0053     void stop();
0054     void tick();
0055     void doubleToSlider(double var);
0056     void intToSpinbox(int var);
0057     /**
0058      * is used to display custom text in the widget according to the current value of the gradient
0059      */
0060     void setNewValue(double newValue);
0061 
0062 private:
0063     bool m_play = false; // Indicates whether mode is play or stop
0064     QTimer *const m_timer;
0065 };
0066 #endif // GRADIENTWIDGET_IMPL_H