1 /* This file is part of the KDE project
2 Copyright (c) 2010 Jean-Baptiste Mardelle <jb@kdenlive.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef TIMECODEDISPLAY_H_
21 #define TIMECODEDISPLAY_H_
23 #include "ui_timecodedisplay_ui.h"
26 #include <KRestrictedLine>
30 * @short A widget for qreal values with a popup slider
32 * TimecodeDisplay combines a numerical input and a dropdown slider in a way that takes up as
33 * little screen space as possible.
35 * It allows the user to either enter a floating point value or quickly set the value using a slider
37 * One signal is emitted when the value changes. The signal is even emitted when the slider
38 * is moving. The second argument of the signal however tells you if the value is final or not. A
39 * final value is produced by entering a value numerically or by releasing the slider.
41 * The input of the numerical line edit is constrained to numbers and decimal signs.
43 class TimecodeDisplay : public QWidget, public Ui::TimecodeDisplay_UI
51 * Constructor for the widget, where value is set to 0
53 * @param parent parent QWidget
55 TimecodeDisplay(Timecode t, QWidget *parent = 0);
60 virtual ~TimecodeDisplay();
63 * The minimum value that can be entered.
69 * The maximum value that can be entered.
75 * Sets the minimum maximum value that can be entered.
76 * @param min the minimum value
77 * @param max the maximum value
79 void setRange(int min, int max);
86 Timecode timecode() const;
88 //virtual QSize minimumSizeHint() const; ///< reimplemented from QComboBox
89 //virtual QSize sizeHint() const; ///< reimplemented from QComboBox
92 /** timecode for widget */
94 /** Should we display the timecode in frames or in format hh:mm:ss:ff */
103 * The value actually set is forced to be within the legal range: minimum <= value <= maximum
104 * @param value the new value
106 void setValue(int value);
107 void setValue(const QString &value);
108 void slotPrepareTimeCodeFormat(Timecode t);
112 void slotValueDown();
117 * Emitted every time the value changes (by calling setValue() or
118 * by user interaction).
119 * @param value the new value
120 * @param final if the value is final ie not produced during sliding (on slider release it's final)
122 void valueChanged(int value, bool final);
123 void editingFinished();
126 virtual void keyPressEvent(QKeyEvent *e);
127 virtual void wheelEvent(QWheelEvent *e);