1 /***************************************************************************
2 * Copyright (C) 2011 by Till Theato (root@ttill.de) *
3 * This file is part of Kdenlive (www.kdenlive.org). *
5 * Kdenlive is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Kdenlive is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Kdenlive. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
23 #include <kselectaction.h>
24 #include <KIntSpinBox>
26 #include <QProgressBar>
36 class CustomLabel : public QProgressBar
40 CustomLabel(const QString &label, bool showSlider = true, QWidget *parent = 0);
43 //virtual void mouseDoubleClickEvent(QMouseEvent * event);
44 virtual void mousePressEvent(QMouseEvent * event);
45 virtual void mouseReleaseEvent(QMouseEvent *event);
46 virtual void mouseMoveEvent(QMouseEvent *event);
47 //virtual void paintEvent(QPaintEvent *event);
48 virtual void wheelEvent(QWheelEvent * event);
51 QPoint m_dragStartPosition;
52 QPoint m_dragLastPosition;
56 //QStyleOptionProgressBarV2 m_progressOptions;
57 void slotValueInc(int factor = 1);
58 void slotValueDec(int factor = 1);
59 void setNewValue(int, bool);
62 void valueChanged(int, bool);
68 * @brief A widget for modifing numbers by dragging, using the mouse wheel or entering them with the keyboard.
71 class DragValue : public QWidget
76 DragValue(const QString &label, int defaultValue, int id, const QString suffix, bool showSlider = true, QWidget* parent = 0);
79 /** @brief Returns the precision = number of decimals */
80 int precision() const;
81 /** @brief Returns the maximum value */
82 qreal minimum() const;
83 /** @brief Returns the minimum value */
84 qreal maximum() const;
86 /** @brief Sets the precision (number of decimals) to @param precision. */
87 void setPrecision(int precision);
88 /** @brief Sets the minimum value. */
89 void setMinimum(qreal min);
90 /** @brief Sets the maximum value. */
91 void setMaximum(qreal max);
92 /** @brief Sets minimum and maximum value. */
93 void setRange(qreal min, qreal max);
94 /** @brief Sets the size of a step (when dragging or using the mouse wheel). */
95 void setStep(qreal step);
97 /** @brief Returns the current value */
99 /** @brief Change the "inTimeline" property to paint the intimeline widget differently. */
100 void setInTimelineProperty(bool intimeline);
101 /** @brief Returns minimum size for QSpinBox, used to set all spinboxes to the same width. */
103 /** @brief Sets the minimum size for QSpinBox, used to set all spinboxes to the same width. */
104 void setSpinSize(int width);
107 /** @brief Sets the value (forced to be in the valid range) and emits valueChanged. */
108 void setValue(int value, bool final = true);
109 /** @brief Resets to default value */
113 void valueChanged(int value, bool final = true);
114 void inTimeline(int);
123 /*virtual void mousePressEvent(QMouseEvent *e);
124 virtual void mouseMoveEvent(QMouseEvent *e);
125 virtual void mouseReleaseEvent(QMouseEvent *e);*/
126 /** @brief Forwards tab focus to lineedit since it is disabled. */
127 virtual void focusInEvent(QFocusEvent *e);
128 //virtual void keyPressEvent(QKeyEvent *e);
129 //virtual void wheelEvent(QWheelEvent *e);
130 //virtual void paintEvent( QPaintEvent * event );
134 void slotEditingFinished();
136 void slotSetScaleMode(int mode);
137 void slotSetDirectUpdate(bool directUpdate);
138 void slotShowContextMenu(const QPoint &pos);
139 void slotSetValue(int value);
140 void slotSetInTimeline();
150 KSelectAction *m_scale;
151 QAction *m_directUpdate;
152 CustomLabel *m_label;