]> git.sesse.net Git - kdenlive/blobdiff - src/monitor.cpp
- Cleanup.
[kdenlive] / src / monitor.cpp
index 912df46e763d7807ecef0a5888d3e2ba6f2b0977..a550944f0b6821b09e345ca44762fdb0622a6156 100644 (file)
@@ -115,10 +115,14 @@ Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget
     m_timePos = new KRestrictedLine(this);
     m_timePos->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
     m_frametimecode = KdenliveSettings::frametimecode();
+    m_timePos->setInputMask("");
     if (m_frametimecode) {
-        m_timePos->setInputMask(QString());
-        m_timePos->setValidator(new QIntValidator(this));
-    } else m_timePos->setInputMask("99:99:99:99");
+        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()));
@@ -345,8 +349,6 @@ GenTime Monitor::getSnapForPos(bool previous)
     return GenTime();
 }
 
-
-
 void Monitor::slotZoneMoved(int start, int end)
 {
     m_ruler->setZone(start, end);
@@ -393,7 +395,6 @@ void Monitor::mouseReleaseEvent(QMouseEvent * event)
     }
 }
 
-
 // virtual
 void Monitor::mouseMoveEvent(QMouseEvent *event)
 {
@@ -452,16 +453,7 @@ QStringList Monitor::mimeTypes() const
     return qstrList;
 }
 
-
 // virtual
-/** Move to other position on mousewheel
- *
- * Moves towards end of clip/timeline on mousewheel down/back,
- * opposite for mousewheel up/forward.
- *
- * Ctrl+wheel moves single frame, without Ctrl moves a second.
- *
- * See also http://www.kdenlive.org/mantis/view.php?id=265 */
 void Monitor::wheelEvent(QWheelEvent * event)
 {
     if (event->modifiers() == Qt::ControlModifier) {
@@ -784,7 +776,6 @@ void Monitor::slotSaveZone()
     //render->setSceneList(doc, 0);
 }
 
-
 void Monitor::resetProfile(const QString profile)
 {
     if (render == NULL) return;
@@ -803,7 +794,6 @@ const QString Monitor::sceneList()
     return render->sceneList();
 }
 
-
 void Monitor::setClipZone(QPoint pos)
 {
     if (m_currentClip == NULL) return;
@@ -836,15 +826,16 @@ 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());
-        m_timePos->setValidator(new QIntValidator(this));
-        m_timePos->setInputMask(QString());
+        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(0);
-        m_timePos->setInputMask("99:99:99:99");
+        m_timePos->setValidator(m_monitorManager->timecode().validator());
         m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
     }
 }
@@ -859,7 +850,6 @@ QStringList Monitor::getZoneInfo() const
     return result;
 }
 
-
 MonitorRefresh::MonitorRefresh(QWidget* parent) : \
         QWidget(parent),
         m_renderer(NULL)
@@ -879,7 +869,6 @@ void MonitorRefresh::paintEvent(QPaintEvent * /*event*/)
     if (m_renderer) m_renderer->doRefresh();
 }
 
-
 Overlay::Overlay(QWidget* parent) :
         QLabel(parent)
 {
@@ -900,8 +889,6 @@ void Overlay::paintEvent(QPaintEvent * /*event*/)
     painter.drawText(rect(), Qt::AlignCenter, text());
 }
 
-
-
 void Overlay::setOverlayText(const QString &text, bool isZone)
 {
     setHidden(true);