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, 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;
55 //QStyleOptionProgressBarV2 m_progressOptions;
56 void slotValueInc(int factor = 1);
57 void slotValueDec(int factor = 1);
58 void setNewValue(int, bool);
61 void valueChanged(int, bool);
66 * @brief A widget for modifing numbers by dragging, using the mouse wheel or entering them with the keyboard.
69 class DragValue : public QWidget
74 DragValue(const QString &label, int defaultValue, int id, const QString suffix, QWidget* parent = 0);
77 /** @brief Returns the precision = number of decimals */
78 int precision() const;
79 /** @brief Returns the maximum value */
80 qreal minimum() const;
81 /** @brief Returns the minimum value */
82 qreal maximum() const;
84 /** @brief Sets the precision (number of decimals) to @param precision. */
85 void setPrecision(int precision);
86 /** @brief Sets the minimum value. */
87 void setMinimum(qreal min);
88 /** @brief Sets the maximum value. */
89 void setMaximum(qreal max);
90 /** @brief Sets minimum and maximum value. */
91 void setRange(qreal min, qreal max);
92 /** @brief Sets the size of a step (when dragging or using the mouse wheel). */
93 void setStep(qreal step);
95 /** @brief Returns the current value */
97 /** @brief Change the "inTimeline" property to paint the intimeline widget differently. */
98 void setInTimelineProperty(bool intimeline);
99 /** @brief Returns minimum size for QSpinBox, used to set all spinboxes to the same width. */
101 /** @brief Sets the minimum size for QSpinBox, used to set all spinboxes to the same width. */
102 void setSpinSize(int width);
105 /** @brief Sets the value (forced to be in the valid range) and emits valueChanged. */
106 void setValue(int value, bool final = true);
107 /** @brief Resets to default value */
111 void valueChanged(int value, bool final = true);
112 void inTimeline(int);
121 /*virtual void mousePressEvent(QMouseEvent *e);
122 virtual void mouseMoveEvent(QMouseEvent *e);
123 virtual void mouseReleaseEvent(QMouseEvent *e);*/
124 /** @brief Forwards tab focus to lineedit since it is disabled. */
125 virtual void focusInEvent(QFocusEvent *e);
126 //virtual void keyPressEvent(QKeyEvent *e);
127 //virtual void wheelEvent(QWheelEvent *e);
128 //virtual void paintEvent( QPaintEvent * event );
132 void slotEditingFinished();
134 void slotSetScaleMode(int mode);
135 void slotSetDirectUpdate(bool directUpdate);
136 void slotShowContextMenu(const QPoint &pos);
137 void slotSetValue(int value);
138 void slotSetInTimeline();
148 KSelectAction *m_scale;
149 QAction *m_directUpdate;
150 CustomLabel *m_label;