]> git.sesse.net Git - kdenlive/commitdiff
Add widget for easier timecode display
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 23 May 2010 21:57:55 +0000 (21:57 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 23 May 2010 21:57:55 +0000 (21:57 +0000)
svn path=/trunk/kdenlive/; revision=4480

src/CMakeLists.txt
src/geometryval.cpp
src/geometryval.h
src/monitor.cpp
src/monitor.h
src/timecodedisplay.cpp [new file with mode: 0644]
src/timecodedisplay.h [new file with mode: 0644]
src/widgets/geometryval_ui.ui
src/widgets/timecodedisplay_ui.ui [new file with mode: 0644]

index a2c97a229acdb8accb61f4102445dc402633bdf3..36189bed31e32c1ea7d87e8ba89f9d0600eb4deb 100644 (file)
@@ -88,6 +88,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/geometryposition_ui.ui
   widgets/templateclip_ui.ui
   widgets/keyframeeditor_ui.ui
+  widgets/timecodedisplay_ui.ui
 )
 
 set(kdenlive_SRCS
@@ -187,6 +188,7 @@ set(kdenlive_SRCS
   KoSliderCombo.cpp
   kis_cubic_curve.cpp
   kis_curve_widget.cpp
+  timecodedisplay.cpp
 )
 
 add_definitions( ${KDE4_DEFINITIONS} )
index 037b4ebdb54f3164267219e21810f2883c19c4d7..b6c5e823ff7634ebff7e98698152a09c9d84197e 100644 (file)
@@ -37,9 +37,14 @@ Geometryval::Geometryval(const MltVideoProfile profile, Timecode t, QPoint frame
         m_path(NULL),
         m_fixedMode(false),
         m_frameSize(frame_size),
-        m_startPoint(startPoint)
+        m_startPoint(startPoint),
+        m_timePos(t)
 {
     setupUi(this);
+    m_timePos.setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
+    toolbarlayout->addWidget(&m_timePos);
+    toolbarlayout->insertStretch(-1);
+
     QVBoxLayout* vbox = new QVBoxLayout(widget);
     m_sceneview = new QGraphicsView(this);
     m_sceneview->setBackgroundBrush(QBrush(Qt::black));
@@ -107,8 +112,6 @@ Geometryval::Geometryval(const MltVideoProfile profile, Timecode t, QPoint frame
     connect(buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame()));
     connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties()));
     connect(m_scene, SIGNAL(doubleClickEvent()), this, SLOT(slotGeometry()));
-    connect(pos_up, SIGNAL(clicked()), this, SLOT(slotPosUp()));
-    connect(pos_down, SIGNAL(clicked()), this, SLOT(slotPosDown()));
 
     buttonhcenter->setIcon(KIcon("kdenlive-align-hor"));
     buttonhcenter->setToolTip(i18n("Align item horizontally"));
@@ -224,9 +227,7 @@ void Geometryval::slotResizeCustom()
 
 void Geometryval::slotTransparencyChanged(int transp)
 {
-    int pos;
-    if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-    else pos = m_timecode.getFrameCount(timePos->text());
+    int pos = m_timePos.value();
     Mlt::GeometryItem item;
     int error = m_geom->fetch(&item, pos);
     if (error || item.key() == false) {
@@ -246,57 +247,16 @@ void Geometryval::slotSyncCursor()
 
 void Geometryval::updateTimecodeFormat()
 {
-    timePos->setInputMask("");
-    if (KdenliveSettings::frametimecode()) {
-        int frames = m_timecode.getFrameCount(timePos->text());
-        QIntValidator *valid = new QIntValidator(this);
-        valid->setBottom(0);
-        timePos->setValidator(valid);
-        timePos->setText(QString::number(frames));
-    } else {
-        int pos = timePos->text().toInt();
-        timePos->setValidator(m_timecode.validator());
-        timePos->setText(m_timecode.getTimecodeFromFrames(pos));
-    }
-}
-
-void Geometryval::slotPosUp()
-{
-    int pos;
-    if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-    else pos = m_timecode.getFrameCount(timePos->text());
-    pos ++;
-    if (pos > m_helper->frameLength) pos = m_helper->frameLength;
-    if (KdenliveSettings::frametimecode()) {
-        timePos->setText(QString::number(pos));
-    } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
-    slotPositionChanged();
-}
-
-void Geometryval::slotPosDown()
-{
-    int pos;
-    if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-    else pos = m_timecode.getFrameCount(timePos->text());
-    pos --;
-    if (pos < 0) pos = 0;
-    if (KdenliveSettings::frametimecode()) {
-        timePos->setText(QString::number(pos));
-    } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
-    slotPositionChanged();
+    m_timePos.slotPrepareTimeCodeFormat(m_timecode);
 }
 
 void Geometryval::slotPositionChanged(int pos, bool seek)
 {
     if (pos == -1) {
-        if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-        else pos = m_timecode.getFrameCount(timePos->text());
+        pos = m_timePos.value();
     }
     if (seek && KdenliveSettings::transitionfollowcursor()) emit seekToPos(pos + m_startPoint);
-    if (KdenliveSettings::frametimecode()) {
-        timePos->setText(QString::number(pos));
-    } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
-
+    m_timePos.setValue(pos);
     //spinPos->setValue(pos);
     m_helper->setValue(pos);
     Mlt::GeometryItem item;
@@ -329,9 +289,7 @@ void Geometryval::slotDeleteFrame(int pos)
 {
     // check there is more than one keyframe
     Mlt::GeometryItem item;
-    int frame;
-    if (KdenliveSettings::frametimecode()) frame = timePos->text().toInt();
-    else frame = m_timecode.getFrameCount(timePos->text());
+    int frame = m_timePos.value();
 
     if (pos == -1) pos = frame;
     int error = m_geom->next_key(&item, pos + 1);
@@ -355,9 +313,7 @@ void Geometryval::slotDeleteFrame(int pos)
 
 void Geometryval::slotAddFrame(int pos)
 {
-    int frame;
-    if (KdenliveSettings::frametimecode()) frame = timePos->text().toInt();
-    else frame = m_timecode.getFrameCount(timePos->text());
+    int frame = m_timePos.value();
     if (pos == -1) pos = frame;
     Mlt::GeometryItem item;
     item.frame(pos);
@@ -389,10 +345,7 @@ void Geometryval::slotNextFrame()
         // Go to end
         pos = m_helper->frameLength;
     } else pos = item.frame();
-
-    if (KdenliveSettings::frametimecode()) {
-        timePos->setText(QString::number(pos));
-    } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
+    m_timePos.setValue(pos);
     slotPositionChanged();
 }
 
@@ -403,9 +356,7 @@ void Geometryval::slotPreviousFrame()
     kDebug() << "// SEEK TO NEXT KFR: " << error;
     if (error) return;
     int pos = item.frame();
-    if (KdenliveSettings::frametimecode()) {
-        timePos->setText(QString::number(pos));
-    } else timePos->setText(m_timecode.getTimecodeFromFrames(pos));
+    m_timePos.setValue(pos);
     slotPositionChanged();
 }
 
@@ -427,7 +378,7 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame)
         spinTransp->setMaximum(500);
         label_pos->setHidden(true);
         m_helper->setHidden(true);
-        timePos->setHidden(true);
+        m_timePos.setHidden(true);
     }
     if (par.attribute("opacity") == "false") {
         label_opacity->setHidden(true);
@@ -469,7 +420,8 @@ void Geometryval::setupParam(const QDomElement par, int minFrame, int maxFrame)
     slotPositionChanged(0, false);
     slotUpdateGeometry();
     if (!m_fixedMode) {
-        connect(timePos, SIGNAL(editingFinished()), this , SLOT(slotPositionChanged()));
+        m_timePos.setMaximum(maxFrame - minFrame - 1);
+        connect(&m_timePos, SIGNAL(editingFinished()), this , SLOT(slotPositionChanged()));
     }
     connect(spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int)));
 }
@@ -497,9 +449,7 @@ void Geometryval::updateTransitionPath()
 
 void Geometryval::slotUpdateTransitionProperties()
 {
-    int pos;
-    if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-    else pos = m_timecode.getFrameCount(timePos->text());
+    int pos = m_timePos.value();
     Mlt::GeometryItem item;
     int error = m_geom->next_key(&item, pos);
     if (error || item.frame() != pos) {
@@ -613,9 +563,7 @@ void Geometryval::slotUpdateGeometry()
 bool Geometryval::keyframeSelected()
 {
     Mlt::GeometryItem item;
-    int pos;
-    if (KdenliveSettings::frametimecode()) pos = timePos->text().toInt();
-    else pos = m_timecode.getFrameCount(timePos->text());
+    int pos = m_timePos.value();
     if (m_geom->fetch(&item, pos) || item.key() == false) return false;
     return true;
 }
index 4ba289e720739967700baf408bb4a1fc6a3ce3fc..654bcd917e1dc23d733517b6b5b3de3f40c56204 100644 (file)
@@ -29,6 +29,7 @@
 #include "ui_geometryval_ui.h"
 #include "definitions.h"
 #include "keyframehelper.h"
+#include "timecodedisplay.h"
 #include "ui_geometryposition_ui.h"
 
 //class QGraphicsScene;
@@ -69,6 +70,7 @@ private:
     double m_dar;
     int m_startPoint;
     QGraphicsView *m_sceneview;
+    TimecodeDisplay m_timePos;
     bool keyframeSelected();
 
 public slots:
@@ -99,8 +101,6 @@ private slots:
     void slotGeometryY(int value);
     void slotGeometryWidth(int value);
     void slotGeometryHeight(int value);
-    void slotPosUp();
-    void slotPosDown();
 
 signals:
     void parameterChanged();
index 5a88b826acad97c5c5001da66f02bacd876592b2..924e25d95906fd70bd8180f1548d898c463793b9 100644 (file)
@@ -112,19 +112,9 @@ Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget
     QWidget *spacer = new QWidget(this);
     spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     toolbar->addWidget(spacer);
-    m_timePos = new KRestrictedLine(this);
+    m_timePos = new TimecodeDisplay(m_monitorManager->timecode(), this);
     m_timePos->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
-    m_frametimecode = KdenliveSettings::frametimecode();
-    m_timePos->setInputMask("");
-    if (m_frametimecode) {
-        QIntValidator *valid = new QIntValidator(this);
-        valid->setBottom(0);
-        m_timePos->setValidator(valid);
-    } else
-        m_timePos->setValidator(m_monitorManager->timecode().validator());
-
     toolbar->addWidget(m_timePos);
-
     connect(m_timePos, SIGNAL(editingFinished()), this, SLOT(slotSeek()));
 
     layout2->addWidget(toolbar);
@@ -507,20 +497,13 @@ void Monitor::activateMonitor()
 
 void Monitor::setTimePos(const QString &pos)
 {
-    if (m_frametimecode) {
-        int frames = m_monitorManager->timecode().getFrameCount(pos);
-        m_timePos->setText(QString::number(frames));
-    } else m_timePos->setText(pos);
+    m_timePos->setValue(pos);
     slotSeek();
 }
 
 void Monitor::slotSeek()
 {
-    int frames;
-    if (m_frametimecode) frames = m_timePos->text().toInt();
-    else frames = m_monitorManager->timecode().getFrameCount(m_timePos->text());
-    //kDebug() << "// / / SEEK TO: " << frames;
-    slotSeek(frames);
+    slotSeek(m_timePos->value());
 }
 
 void Monitor::slotSeek(int pos)
@@ -624,8 +607,7 @@ void Monitor::seekCursor(int pos)
     activateMonitor();
     if (m_ruler->slotNewValue(pos)) {
         checkOverlay();
-        if (m_frametimecode) m_timePos->setText(QString::number(pos));
-        else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+        m_timePos->setValue(pos);
     }
 }
 
@@ -633,8 +615,7 @@ void Monitor::rendererStopped(int pos)
 {
     if (m_ruler->slotNewValue(pos)) {
         checkOverlay();
-        if (m_frametimecode) m_timePos->setText(QString::number(pos));
-        else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+        m_timePos->setValue(pos);
     }
     disconnect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
     m_playAction->setChecked(false);
@@ -825,19 +806,7 @@ void Monitor::slotSwitchMonitorInfo(bool show)
 
 void Monitor::updateTimecodeFormat()
 {
-    m_frametimecode = KdenliveSettings::frametimecode();
-    m_timePos->setInputMask("");
-    if (m_frametimecode) {
-        int frames = m_monitorManager->timecode().getFrameCount(m_timePos->text());
-        QIntValidator *valid = new QIntValidator(this);
-        valid->setBottom(0);
-        m_timePos->setValidator(valid);
-        m_timePos->setText(QString::number(frames));
-    } else {
-        int pos = m_timePos->text().toInt();
-        m_timePos->setValidator(m_monitorManager->timecode().validator());
-        m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
-    }
+    m_timePos->slotPrepareTimeCodeFormat(m_monitorManager->timecode());
 }
 
 QStringList Monitor::getZoneInfo() const
index 898754ee0acac5231c5d2e3fd79486180823bb27..2d1130811c3162b8fbf7d160fdbc67eb67652f3a 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "gentime.h"
 #include "ui_monitor_ui.h"
+#include "timecodedisplay.h"
 #ifdef Q_WS_MAC
 #include "videoglwidget.h"
 #endif
@@ -117,7 +118,7 @@ private:
     MonitorRefresh *m_monitorRefresh;
     KIcon m_playIcon;
     KIcon m_pauseIcon;
-    KRestrictedLine *m_timePos;
+    TimecodeDisplay *m_timePos;
     QAction *m_playAction;
     QMenu *m_contextMenu;
     QMenu *m_configMenu;
@@ -128,7 +129,6 @@ private:
     VideoGLWidget *m_glWidget;
 #endif
     GenTime getSnapForPos(bool previous);
-    bool m_frametimecode;
 
 private slots:
     void seekCursor(int pos);
diff --git a/src/timecodedisplay.cpp b/src/timecodedisplay.cpp
new file mode 100644 (file)
index 0000000..d0c6e22
--- /dev/null
@@ -0,0 +1,162 @@
+/* This file is part of the KDE project
+   Copyright (c) 2010 Jean-Baptiste Mardelle <jb@kdenlive.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "timecodedisplay.h"
+#include "kdenlivesettings.h"
+
+#include <QSize>
+#include <QStyle>
+#include <QStylePainter>
+#include <QStyleOptionSlider>
+#include <QLineEdit>
+#include <QValidator>
+#include <QHBoxLayout>
+#include <QFrame>
+#include <QMouseEvent>
+#include <QToolButton>
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+
+TimecodeDisplay::TimecodeDisplay(Timecode t, QWidget *parent)
+        : QWidget(parent),
+        m_minimum(0),
+        m_maximum(-1)
+{
+    setupUi(this);
+    lineedit->setFont(KGlobalSettings::toolBarFont());
+    QFontMetrics fm = lineedit->fontMetrics();
+    lineedit->setMaximumWidth(fm.width("88:88:88:888"));
+    slotPrepareTimeCodeFormat(t);
+    connect(uparrow, SIGNAL(clicked()), this, SLOT(slotValueUp()));
+    connect(downarrow, SIGNAL(clicked()), this, SLOT(slotValueDown()));
+    connect(lineedit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
+}
+
+TimecodeDisplay::~TimecodeDisplay()
+{
+}
+
+void TimecodeDisplay::slotValueUp()
+{
+    int val = value();
+    val++;
+    if (m_maximum > -1 && val > m_maximum) val = m_maximum;
+    setValue(val);
+    lineedit->clearFocus();
+    emit editingFinished();
+}
+
+void TimecodeDisplay::slotValueDown()
+{
+    int val = value();
+    val--;
+    if (val < m_minimum) val = m_minimum;
+    setValue(val);
+    lineedit->clearFocus();
+    emit editingFinished();
+}
+
+void TimecodeDisplay::slotPrepareTimeCodeFormat(Timecode t)
+{
+    m_timecode = t;
+    m_frametimecode = KdenliveSettings::frametimecode();
+    QString val = lineedit->text();
+    lineedit->setInputMask("");
+    if (m_frametimecode) {
+        int frames = m_timecode.getFrameCount(lineedit->text());
+        QIntValidator *valid = new QIntValidator(lineedit);
+        valid->setBottom(0);
+        lineedit->setValidator(valid);
+        lineedit->setText(QString::number(frames));
+    } else {
+        int pos = lineedit->text().toInt();
+        lineedit->setValidator(m_timecode.validator());
+        lineedit->setText(m_timecode.getTimecodeFromFrames(pos));
+    }
+}
+
+void TimecodeDisplay::keyPressEvent(QKeyEvent *e)
+{
+    if (e->key() == Qt::Key_Up) slotValueUp();
+    else if (e->key() == Qt::Key_Down) slotValueDown();
+    else QWidget::keyPressEvent(e);
+}
+
+void TimecodeDisplay::wheelEvent(QWheelEvent *e)
+{
+    if (e->delta() > 0) slotValueUp();
+    else slotValueDown();
+}
+
+
+int TimecodeDisplay::maximum() const
+{
+    return m_maximum;
+}
+
+int TimecodeDisplay::minimum() const
+{
+    return m_minimum;
+}
+
+int TimecodeDisplay::value() const
+{
+    int frames;
+    if (m_frametimecode) frames = lineedit->text().toInt();
+    else frames = m_timecode.getFrameCount(lineedit->text());
+    return frames;
+}
+
+void TimecodeDisplay::setMinimum(int min)
+{
+    m_minimum = min;
+}
+
+void TimecodeDisplay::setMaximum(int max)
+{
+    m_maximum = max;
+}
+
+void TimecodeDisplay::setValue(const QString &value)
+{
+    if (m_frametimecode) {
+        lineedit->setText(QString::number(m_timecode.getFrameCount(value)));
+    } else lineedit->setText(value);
+}
+
+void TimecodeDisplay::setValue(int value)
+{
+    /*    if (value < m_minimum)
+            value = m_minimum;
+        if (value > m_maximum)
+            value = m_maximum;*/
+    if (m_frametimecode) lineedit->setText(QString::number(value));
+    else lineedit->setText(m_timecode.getTimecodeFromFrames(value));
+
+    /*    setEditText(KGlobal::locale()->formatNumber(value, d->decimals));
+        d->slider->blockSignals(true);
+        d->slider->setValue(int((value - d->minimum) * 256 / (d->maximum - d->minimum) + 0.5));
+        d->slider->blockSignals(false);*/
+    //emit valueChanged(value, true);
+}
+
+#include <timecodedisplay.moc>
diff --git a/src/timecodedisplay.h b/src/timecodedisplay.h
new file mode 100644 (file)
index 0000000..394e27c
--- /dev/null
@@ -0,0 +1,134 @@
+/* This file is part of the KDE project
+   Copyright (c) 2010 Jean-Baptiste Mardelle <jb@kdenlive.org>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef TIMECODEDISPLAY_H_
+#define TIMECODEDISPLAY_H_
+
+#include "ui_timecodedisplay_ui.h"
+#include "timecode.h"
+
+#include <KRestrictedLine>
+
+
+/**
+ * @short A widget for qreal values with a popup slider
+ *
+ * TimecodeDisplay combines a numerical input and a dropdown slider in a way that takes up as
+ * little screen space as possible.
+ *
+ * It allows the user to either enter a floating point value or quickly set the value using a slider
+ *
+ * One signal is emitted when the value changes. The signal is even emitted when the slider
+ * is moving. The second argument of the signal however tells you if the value is final or not. A
+ * final value is produced by entering a value numerically or by releasing the slider.
+ *
+ * The input of the numerical line edit is constrained to numbers and decimal signs.
+ */
+class TimecodeDisplay : public QWidget, public Ui::TimecodeDisplay_UI
+{
+
+    Q_OBJECT
+
+public:
+
+    /**
+     * Constructor for the widget, where value is set to 0
+     *
+     * @param parent parent QWidget
+     */
+    TimecodeDisplay(Timecode t, QWidget *parent = 0);
+
+    /**
+     * Destructor
+     */
+    virtual ~TimecodeDisplay();
+
+    /**
+     * The minimum value that can be entered.
+     * default is 0
+     */
+    int minimum() const;
+
+    /**
+     * The maximum value that can be entered.
+     * default is 100
+     */
+    int maximum() const;
+
+    /**
+     * Sets the minimum value that can be entered.
+     * @param min the minimum value
+     */
+    void setMinimum(int min);
+
+    /**
+     * Sets the maximum value that can be entered.
+     * @param max the maximum value
+     */
+    void setMaximum(int max);
+
+    /**
+    * The value shown.
+    */
+    int value() const;
+
+    //virtual QSize minimumSizeHint() const; ///< reimplemented from QComboBox
+    //virtual QSize sizeHint() const; ///< reimplemented from QComboBox
+
+private:
+    /** timecode for widget */
+    Timecode m_timecode;
+    /** Should we display the timecode in frames or in format hh:mm:ss:ff */
+    bool m_frametimecode;
+    int m_minimum;
+    int m_maximum;
+
+public slots:
+
+    /**
+    * Sets the value.
+    * The value actually set is forced to be within the legal range: minimum <= value <= maximum
+    * @param value the new value
+    */
+    void setValue(int value);
+    void setValue(const QString &value);
+    void slotPrepareTimeCodeFormat(Timecode t);
+
+private slots:
+    void slotValueUp();
+    void slotValueDown();
+
+signals:
+
+    /**
+     * Emitted every time the value changes (by calling setValue() or
+     * by user interaction).
+     * @param value the new value
+     * @param final if the value is final ie not produced during sliding (on slider release it's final)
+     */
+    void valueChanged(int value, bool final);
+    void editingFinished();
+
+protected:
+    virtual void keyPressEvent(QKeyEvent *e);
+    virtual void wheelEvent(QWheelEvent *e);
+
+};
+
+#endif
index 70f3954580fee1421e9f6df042f88a26a151aa77..8e74d5d2a51b2b999b0239a009451967fd964874 100644 (file)
@@ -53,7 +53,7 @@
     </widget>
    </item>
    <item row="2" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout_3">
+    <layout class="QHBoxLayout" name="toolbarlayout">
      <property name="spacing">
       <number>-1</number>
      </property>
        </property>
       </widget>
      </item>
-     <item>
-      <layout class="QHBoxLayout" name="horizontalLayout_4">
-       <property name="spacing">
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="KRestrictedLine" name="timePos">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_2">
-         <item>
-          <widget class="QToolButton" name="pos_up">
-           <property name="text">
-            <string>...</string>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>3</width>
-             <height>2</height>
-            </size>
-           </property>
-           <property name="autoRaise">
-            <bool>true</bool>
-           </property>
-           <property name="arrowType">
-            <enum>Qt::UpArrow</enum>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="pos_down">
-           <property name="text">
-            <string>...</string>
-           </property>
-           <property name="iconSize">
-            <size>
-             <width>3</width>
-             <height>2</height>
-            </size>
-           </property>
-           <property name="autoRaise">
-            <bool>true</bool>
-           </property>
-           <property name="arrowType">
-            <enum>Qt::DownArrow</enum>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
     </layout>
    </item>
    <item row="3" column="0">
    <extends>QSpinBox</extends>
    <header>knuminput.h</header>
   </customwidget>
-  <customwidget>
-   <class>KLineEdit</class>
-   <extends>QLineEdit</extends>
-   <header>klineedit.h</header>
-  </customwidget>
-  <customwidget>
-   <class>KRestrictedLine</class>
-   <extends>KLineEdit</extends>
-   <header>krestrictedline.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/src/widgets/timecodedisplay_ui.ui b/src/widgets/timecodedisplay_ui.ui
new file mode 100644 (file)
index 0000000..1a333ad
--- /dev/null
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TimecodeDisplay_UI</class>
+ <widget class="QWidget" name="TimecodeDisplay_UI">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>132</width>
+    <height>31</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2">
+   <item row="0" column="0">
+    <widget class="QFrame" name="frame">
+     <property name="styleSheet">
+      <string notr="true">QToolButton {border: 0px;}</string>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="KRestrictedLine" name="lineedit">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="autoFillBackground">
+         <bool>false</bool>
+        </property>
+        <property name="frame">
+         <bool>false</bool>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2">
+       <layout class="QVBoxLayout" name="verticalLayout">
+        <property name="spacing">
+         <number>1</number>
+        </property>
+        <item>
+         <widget class="QToolButton" name="uparrow">
+          <property name="text">
+           <string>...</string>
+          </property>
+          <property name="iconSize">
+           <size>
+            <width>4</width>
+            <height>4</height>
+           </size>
+          </property>
+          <property name="autoRaise">
+           <bool>true</bool>
+          </property>
+          <property name="arrowType">
+           <enum>Qt::UpArrow</enum>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="downarrow">
+          <property name="text">
+           <string>...</string>
+          </property>
+          <property name="iconSize">
+           <size>
+            <width>4</width>
+            <height>4</height>
+           </size>
+          </property>
+          <property name="autoRaise">
+           <bool>true</bool>
+          </property>
+          <property name="arrowType">
+           <enum>Qt::DownArrow</enum>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="1">
+       <widget class="Line" name="line">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KRestrictedLine</class>
+   <extends>KLineEdit</extends>
+   <header>krestrictedline.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>