]> git.sesse.net Git - kdenlive/blob - src/doubleparameterwidget.cpp
Fix label
[kdenlive] / src / doubleparameterwidget.cpp
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 #include "doubleparameterwidget.h"
22 #include "dragvalue.h"
23
24 #include <QGridLayout>
25 #include <QLabel>
26 #include <QSpinBox>
27 #include <QToolButton>
28
29 #include <KDebug>
30 #include <KIcon>
31 #include <KLocalizedString>
32
33
34 DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix, int decimals, QWidget *parent) :
35     QWidget(parent)
36 {
37     setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
38     QGridLayout *layout = new QGridLayout(this);
39     layout->setContentsMargins(0, 0, 0, 0);
40     layout->setSpacing(0);
41     
42     m_dragVal = new DragValue(name, defaultValue, decimals, min, max, id, suffix, this);
43     layout->addWidget(m_dragVal, 0, 1);
44
45     if (!comment.isEmpty()) {
46         setToolTip(comment);
47     }
48     m_dragVal->setValue(value, false);
49     connect(m_dragVal, SIGNAL(valueChanged(double,bool)), this, SLOT(slotSetValue(double,bool)));
50     connect(m_dragVal, SIGNAL(inTimeline(int)), this, SIGNAL(setInTimeline(int)));
51 }
52
53 DoubleParameterWidget::~DoubleParameterWidget()
54 {
55     delete m_dragVal;
56 }
57
58 int DoubleParameterWidget::spinSize()
59 {
60     return m_dragVal->spinSize();
61 }
62
63 void DoubleParameterWidget::setSpinSize(int width)
64 {
65     m_dragVal->setSpinSize(width);
66 }
67
68 void DoubleParameterWidget::setValue(double value)
69 {
70     m_dragVal->blockSignals(true);
71     m_dragVal->setValue(value);
72     m_dragVal->blockSignals(false);
73 }
74
75 void DoubleParameterWidget::slotSetValue(double value, bool final)
76 {
77     if (final) {
78         emit valueChanged(value);
79     }
80 }
81
82 double DoubleParameterWidget::getValue()
83 {
84     return m_dragVal->value();
85 }
86
87 void DoubleParameterWidget::slotReset()
88 {
89     m_dragVal->slotReset();
90 }
91
92 void DoubleParameterWidget::setInTimelineProperty(bool intimeline)
93 {
94     m_dragVal->setInTimelineProperty(intimeline);
95 }
96
97 void DoubleParameterWidget::slotShowComment( bool show)
98 {
99 }
100
101 #include "doubleparameterwidget.moc"