]> git.sesse.net Git - kdenlive/blob - src/widgets/doubleparameterwidget.h
Moving choosecolorwidget and colorpickerwidget in the widget folder.
[kdenlive] / src / widgets / doubleparameterwidget.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Till Theato (root@ttill.de)                     *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef DOUBLEPARAMETERWIDGET_H
22 #define DOUBLEPARAMETERWIDGET_H
23
24 #include <QWidget>
25
26
27 class QLabel;
28 class DragValue;
29
30 /**
31  * @class DoubleParameterWidget
32  * @brief Widget to choose a double parameter (for a effect) with the help of a slider and a spinbox.
33  * @author Till Theato
34  *
35  * The widget does only handle integers, so the parameter has to be converted into the proper double range afterwards.
36  */
37
38 class DoubleParameterWidget : public QWidget
39 {
40     Q_OBJECT
41 public:
42     /** @brief Sets up the parameter's GUI.
43     * @param name Name of the parameter
44     * @param value Value of the parameter
45     * @param min Minimum value
46     * @param max maximum value
47     * @param defaultValue Value used when using reset functionality
48     * @param comment A comment explaining the parameter. Will be shown for the tooltip.
49     * @param suffix (optional) Suffix to display in spinbox
50     * @param parent (optional) Parent Widget */
51     explicit DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix = QString(), int decimals = 0, QWidget* parent = 0);
52     ~DoubleParameterWidget();
53
54     /** @brief Gets the parameter's value. */
55     double getValue();
56     /** @brief Set the inTimeline property to paint widget with other colors. */
57     void setInTimelineProperty(bool intimeline);
58     /** @brief Returns minimum size for QSpinBox, used to set all spinboxes to the same width. */
59     int spinSize();
60     void setSpinSize(int width);
61     
62
63 public slots:
64     /** @brief Sets the value to @param value. */
65     void setValue(double value);
66
67     /** @brief Sets value to m_default. */
68     void slotReset();
69
70 private slots:
71     /** @brief Shows/Hides the comment label. */
72     void slotShowComment(bool show);
73
74     void slotSetValue(double value, bool final);
75
76 private:
77     DragValue *m_dragVal;
78     QLabel *m_commentLabel;
79     
80 signals:
81     void valueChanged(double);
82     /** @brief User wants to see this parameter in timeline. */
83     void setInTimeline(int);
84 };
85
86 #endif