]> git.sesse.net Git - kdenlive/commitdiff
- Fix drop frame timecode format. [1]
authorAlberto Villa <avilla@FreeBSD.org>
Tue, 11 May 2010 13:25:57 +0000 (13:25 +0000)
committerAlberto Villa <avilla@FreeBSD.org>
Tue, 11 May 2010 13:25:57 +0000 (13:25 +0000)
- Fix a (possible) wrong format in the clip duration dialog when "frames" is current format.
- Reindent.

PR: http://www.kdenlive.org/mantis/view.php?id=1511 [1]

svn path=/trunk/kdenlive/; revision=4428

24 files changed:
src/abstractclipitem.cpp
src/clipdurationdialog.cpp
src/clipitem.cpp
src/clipitem.h
src/clipproperties.cpp
src/customruler.cpp
src/customtrackview.cpp
src/documentchecker.cpp
src/effectslistview.cpp
src/effectstackedit.cpp
src/geometryval.cpp
src/kis_cubic_curve.cpp
src/kis_curve_widget.cpp
src/kis_curve_widget.h
src/mainwindow.cpp
src/markerdialog.cpp
src/monitor.cpp
src/projectlist.cpp
src/recmonitor.cpp
src/renderer.cpp
src/slideshowclip.cpp
src/timecode.cpp
src/timecode.h
src/titlewidget.cpp

index 5cfcc36fb34aea469fc05560a0fff62ad9d6e18d..16c729e74be2a24753bfd0941954d2d1f387ddcd 100644 (file)
@@ -131,8 +131,8 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit)
     //kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25);
 
     if (type() == AVWIDGET) {
-       if (hasSizeLimit && cropStart() + durationDiff < GenTime())
-           durationDiff = GenTime() - cropStart();
+        if (hasSizeLimit && cropStart() + durationDiff < GenTime())
+            durationDiff = GenTime() - cropStart();
     } else if (durationDiff >= cropDuration()) {
         return;
         if (cropDuration() > GenTime(3, m_fps)) durationDiff = GenTime(3, m_fps);
index 91ced7ca7da5205cdf1e8c18194ea7118bbed7ba..1343a1633980e11f39f4451c7719f8212a1f222b 100644 (file)
@@ -59,21 +59,22 @@ ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, Timecode tc, GenT
 
     m_crop = m_clip->cropStart().frames(m_fps);
 
+    m_view.clip_position->setInputMask("");
+    m_view.crop_position->setInputMask("");
+    m_view.clip_duration->setInputMask("");
+    m_view.end_position->setInputMask("");
     if (m_framesDisplay) {
-        QValidator *valid = new QIntValidator(this);
-        m_view.clip_position->setInputMask("");
-        m_view.clip_position->setValidator(valid);
-        m_view.crop_position->setInputMask("");
-        m_view.clip_position->setValidator(valid);
-        m_view.clip_duration->setInputMask("");
-        m_view.clip_position->setValidator(valid);
-        m_view.end_position->setInputMask("");
+        QIntValidator *valid = new QIntValidator(this);
+        valid->setBottom(0);
         m_view.clip_position->setValidator(valid);
+        m_view.crop_position->setValidator(valid);
+        m_view.clip_duration->setValidator(valid);
+        m_view.end_position->setValidator(valid);
     } else {
-        m_view.clip_position->setInputMask(m_tc.inputMask());
-        m_view.crop_position->setInputMask(m_tc.inputMask());
-        m_view.clip_duration->setInputMask(m_tc.inputMask());
-        m_view.end_position->setInputMask(m_tc.inputMask());
+        m_view.clip_position->setValidator(m_tc.validator());
+        m_view.crop_position->setValidator(m_tc.validator());
+        m_view.clip_duration->setValidator(m_tc.validator());
+        m_view.end_position->setValidator(m_tc.validator());
     }
     m_view.clip_position->setText(tc.getDisplayTimecode(m_clip->startPos(), m_framesDisplay));
     m_view.crop_position->setText(tc.getDisplayTimecode(m_clip->cropStart(), m_framesDisplay));
index 39df20878d6c91fe8abe2427999786cd678dcc1e..b2de6e57a86edb7078f145cfaf907e3ef83ba812 100644 (file)
@@ -1154,9 +1154,9 @@ void ClipItem::resizeStart(int posx, bool)
 {
     bool sizeLimit = false;
     if (clipType() != IMAGE && clipType() != COLOR && clipType() != TEXT) {
-       const int min = (startPos() - cropStart()).frames(m_fps);
-       if (posx < min) posx = min;
-       sizeLimit = true;
+        const int min = (startPos() - cropStart()).frames(m_fps);
+        if (posx < min) posx = min;
+        sizeLimit = true;
     }
 
     if (posx == startPos().frames(m_fps)) return;
index a4a19c1799673b09efcd60022d9663857081a6b6..067ea231b55ce75703fb9ae87c3a4d80015efab9 100644 (file)
@@ -146,7 +146,7 @@ private:
 
     QPixmap m_startPix;
     QPixmap m_endPix;
-    
+
     bool m_hasThumbs;
     QTimer m_startThumbTimer;
     QTimer m_endThumbTimer;
index 4b8c9dc509da218d68670de05030740a7383b93c..81094821627137bb57fa977e05ba7be2f7b4facc 100644 (file)
@@ -265,7 +265,8 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
         m_view.clip_filesize->setHidden(true);
         m_view.label_size->setHidden(true);
     }
-    m_view.clip_duration->setInputMask(tc.inputMask());
+    m_view.clip_duration->setInputMask("");
+    m_view.clip_duration->setValidator(tc.validator());
     m_view.clip_duration->setText(tc.getTimecode(m_clip->duration()));
     if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
     else connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
index b7aaa48135ee640fd46fd0c6b6c3000efaaf00f6..6606b77024bc8b666351fe24a767d29b63db194c 100644 (file)
@@ -83,7 +83,7 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
     QAction *delAllGuides = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete All Guides"));
     connect(delAllGuides, SIGNAL(triggered()), m_view, SLOT(slotDeleteAllGuides()));
     m_goMenu = m_contextMenu->addMenu(i18n("Go To"));
-    connect(m_goMenu, SIGNAL(triggered( QAction *)), this, SLOT(slotGoToGuide(QAction *)));
+    connect(m_goMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotGoToGuide(QAction *)));
     setMouseTracking(true);
     setMinimumHeight(20);
 }
@@ -131,7 +131,7 @@ void CustomRuler::mousePressEvent(QMouseEvent * event)
         m_clickedGuide = m_view->hasGuide((int)(pos / m_factor), (int)(5 / m_factor + 1));
         m_editGuide->setEnabled(m_clickedGuide > 0);
         m_deleteGuide->setEnabled(m_clickedGuide > 0);
-       m_view->buildGuidesMenu(m_goMenu);
+        m_view->buildGuidesMenu(m_goMenu);
         m_contextMenu->exec(event->globalPos());
         return;
     }
index 9afe72eb7f67132b6bf30665fa511af1ecc2c2ed..597e770c982afaa876c5342d9366845a81345824 100644 (file)
@@ -4511,8 +4511,8 @@ void CustomTrackView::buildGuidesMenu(QMenu *goMenu) const
     goMenu->clear();
     double fps = m_document->fps();
     for (int i = 0; i < m_guides.count(); i++) {
-       act = goMenu->addAction(m_guides.at(i)->label() + "/" + Timecode::getStringTimecode(m_guides.at(i)->position().frames(fps), fps));
-       act->setData(m_guides.at(i)->position().frames(m_document->fps()));
+        act = goMenu->addAction(m_guides.at(i)->label() + "/" + Timecode::getStringTimecode(m_guides.at(i)->position().frames(fps), fps));
+        act->setData(m_guides.at(i)->position().frames(m_document->fps()));
     }
     goMenu->setEnabled(!m_guides.isEmpty());
 }
index ecde54cf3b88a7acf4e65a65e4b6747256a45271..b58cfc7a4c82f8261d99de10d7a06dac1c412c2b 100644 (file)
@@ -104,7 +104,7 @@ bool DocumentChecker::hasMissingClips()
     QDomNodeList trans = m_doc.elementsByTagName("transition");
     for (int i = 0; i < trans.count(); i++) {
         QString luma = getProperty(trans.at(i).toElement(), "luma");
-       if (!luma.startsWith('/')) luma.prepend(root);
+        if (!luma.startsWith('/')) luma.prepend(root);
         if (!luma.isEmpty() && !QFile::exists(luma)) {
             if (!missingLumas.contains(luma)) {
                 missingLumas.append(luma);
index 5106c142c66cfb9a95abbef6d8dd8643e06a9db0..9769ac355d36a61ffb7cebd0fa6b90b22e1e08d6 100644 (file)
@@ -84,7 +84,7 @@ void EffectsListView::filterList(int pos)
     }
     // make sure we don't show anything not matching the search expression
     search_effect->updateSearch();
-    
+
     /*item = m_effectsList->currentItem();
     if (item) {
         if (item->isHidden()) {
index 2d93948f44faca9fd7234d0c20e6836166e81404..56a1b4f46ed47dc1e149aaf533deb44193874721 100644 (file)
@@ -513,9 +513,9 @@ void EffectStackEdit::collectAllParameters()
             EffectsList::setParameter(newparam, number, QString::number(points.count()));
             for (int j = 0; (j < points.count() && j + off <= end); j++) {
                 QString in = inName;
-                in.replace("%i", QString::number(j+off));
+                in.replace("%i", QString::number(j + off));
                 QString out = outName;
-                out.replace("%i", QString::number(j+off));
+                out.replace("%i", QString::number(j + off));
                 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
                 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
             }
index 7457117472a5d6d48872935e5a4692b351a4af3d..c6fb07c6399678d48f981efeda60c7c5630a24ee 100644 (file)
@@ -75,11 +75,11 @@ Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, int s
     buttonAdd->setToolTip(i18n("Add keyframe"));
     buttonDelete->setIcon(KIcon("edit-delete"));
     buttonDelete->setToolTip(i18n("Delete keyframe"));
-    
+
     m_configMenu = new QMenu(i18n("Misc..."), this);
     buttonMenu->setMenu(m_configMenu);
     buttonMenu->setPopupMode(QToolButton::MenuButtonPopup);
-    
+
     m_editOptions = m_configMenu->addAction(KIcon("system-run"), i18n("Show/Hide options"));
     m_editOptions->setCheckable(true);
     buttonMenu->setDefaultAction(m_editOptions);
@@ -87,7 +87,7 @@ Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, int s
     slotSwitchOptions();
 
     m_reset = m_configMenu->addAction(KIcon("view-refresh"), i18n("Reset"), this, SLOT(slotResetPosition()));
-    
+
     m_syncAction = m_configMenu->addAction(i18n("Sync timeline cursor"), this, SLOT(slotSyncCursor()));
     m_syncAction->setCheckable(true);
     m_syncAction->setChecked(KdenliveSettings::transitionfollowcursor());
@@ -106,7 +106,7 @@ Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, int s
     connect(buttonAdd , SIGNAL(clicked()) , this , SLOT(slotAddFrame()));
     connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateTransitionProperties()));
     connect(m_scene, SIGNAL(doubleClickEvent()), this, SLOT(slotGeometry()));
-    
+
     buttonhcenter->setIcon(KIcon("kdenlive-align-hor"));
     buttonhcenter->setToolTip(i18n("Align item horizontally"));
     buttonvcenter->setIcon(KIcon("kdenlive-align-vert"));
@@ -119,7 +119,7 @@ Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, int s
     buttonright->setToolTip(i18n("Align item to right"));
     buttonleft->setIcon(KIcon("kdenlive-align-left"));
     buttonleft->setToolTip(i18n("Align item to left"));
-    
+
     connect(buttonhcenter, SIGNAL(clicked()), this, SLOT(slotAlignHCenter()));
     connect(buttonvcenter, SIGNAL(clicked()), this, SLOT(slotAlignVCenter()));
     connect(buttontop, SIGNAL(clicked()), this, SLOT(slotAlignTop()));
@@ -129,10 +129,10 @@ Geometryval::Geometryval(const MltVideoProfile profile, QPoint frame_size, int s
     connect(spinX, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryX(int)));
     connect(spinY, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryY(int)));
     connect(spinWidth, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryWidth(int)));
-    connect(spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryHeight(int)));    
+    connect(spinHeight, SIGNAL(valueChanged(int)), this, SLOT(slotGeometryHeight(int)));
     connect(spinResize, SIGNAL(valueChanged(int)), this, SLOT(slotResizeCustom(int)));
     connect(buttonResize, SIGNAL(clicked()), this, SLOT(slotResizeOriginal()));
-    
+
     connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateGeometry()));
 }
 
@@ -514,19 +514,19 @@ void Geometryval::slotGeometryHeight(int value)
 void Geometryval::slotUpdateGeometry()
 {
     QRectF r = m_paramRect->rect().normalized();
-    
+
     spinX->blockSignals(true);
     spinY->blockSignals(true);
     spinWidth->blockSignals(true);
     spinHeight->blockSignals(true);
     spinResize->blockSignals(true);
-    
+
     spinX->setValue(m_paramRect->pos().x());
     spinY->setValue(m_paramRect->pos().y());
     spinWidth->setValue(r.width());
     spinHeight->setValue(r.height());
     spinResize->setValue(m_paramRect->rect().width() * 100 / m_realWidth);
-    
+
     spinX->blockSignals(false);
     spinY->blockSignals(false);
     spinWidth->blockSignals(false);
index f5177b1dee9bf4676df54f3b8300f32ea9168617..589fb6a09030966b5918ad2301ce3517428a48e2 100644 (file)
@@ -306,7 +306,7 @@ void KisCubicCurve::Data::updateTransfer(QVector<_T_>* transfer, bool& valid, _T
         qreal end = 1.0 / (size - 1);
         for (int i = 0; i < size; ++i) {
             /* Direct uncached version */
-            _T2_ val = value(i * end ) * max;
+            _T2_ val = value(i * end) * max;
             val = qBound(min, val, max);
             (*transfer)[i] = val;
         }
@@ -322,9 +322,11 @@ KisCubicCurve::KisCubicCurve() : d(new Private)
 {
     d->data = new Data;
     QPointF p;
-    p.rx() = 0.0; p.ry() = 0.0;
+    p.rx() = 0.0;
+    p.ry() = 0.0;
     d->data->points.append(p);
-    p.rx() = 1.0; p.ry() = 1.0;
+    p.rx() = 1.0;
+    p.ry() = 1.0;
     d->data->points.append(p);
 }
 
index b77237f74f18371f8dc9be5ddd0778edbc592503..228373c019df5e286ddd84fb7c2f212e70c34968 100644 (file)
@@ -74,7 +74,7 @@ KisCurveWidget::KisCurveWidget(QWidget *parent, Qt::WFlags f)
 
     d->m_intIn = NULL;
     d->m_intOut = NULL;
-    
+
     d->m_maxPoints = -1;
 
     setMouseTracking(true);
@@ -202,7 +202,7 @@ void KisCurveWidget::keyPressEvent(QKeyEvent *e)
         }
         d->setCurveModified();
     } else if (e->key() == Qt::Key_Escape && d->state() != ST_NORMAL) {
-        d->m_curve.setPoint(d->m_grab_point_index, QPointF(d->m_grabOriginalX, d->m_grabOriginalY) );
+        d->m_curve.setPoint(d->m_grab_point_index, QPointF(d->m_grabOriginalX, d->m_grabOriginalY));
         setCursor(Qt::ArrowCursor);
         d->setState(ST_NORMAL);
 
@@ -269,10 +269,10 @@ void KisCurveWidget::paintEvent(QPaintEvent *)
     /*KisConfig cfg;
     if (cfg.antialiasCurves())
         p.setRenderHint(QPainter::Antialiasing);*/
-    
+
     // Draw default line
     p.setPen(QPen(Qt::gray, 1, Qt::SolidLine));
-    p.drawLine(QLineF(0, wHeight, wWidth, 0)); 
+    p.drawLine(QLineF(0, wHeight, wWidth, 0));
 
     // Draw curve.
     double prevY = wHeight - d->m_curve.value(0.) * wHeight;
@@ -323,14 +323,14 @@ void KisCurveWidget::paintEvent(QPaintEvent *)
 void KisCurveWidget::mousePressEvent(QMouseEvent * e)
 {
     if (d->m_readOnlyMode) return;
-    
+
     double x = e->pos().x() / (double)(width() - 1);
     double y = 1.0 - e->pos().y() / (double)(height() - 1);
 
 
 
     int closest_point_index = d->nearestPointInRange(QPointF(x, y), width(), height());
-    
+
     if (e->button() == Qt::RightButton && closest_point_index > 0 && closest_point_index < d->m_curve.points().count() - 1) {
         d->m_curve.removePoint(closest_point_index);
         setCursor(Qt::ArrowCursor);
@@ -340,7 +340,7 @@ void KisCurveWidget::mousePressEvent(QMouseEvent * e)
         d->setCurveModified();
         return;
     } else if (e->button() != Qt::LeftButton) return;
-    
+
     if (closest_point_index < 0) {
         if (d->m_maxPoints > 0 && d->m_curve.points().count() >= d->m_maxPoints)
             return;
index da61a6b8336771cda670dbebb42cd678936be38b..8c679fa0ec9a829c252cd82fc3d6295d83b2b03b 100644 (file)
@@ -131,7 +131,7 @@ public:
      * so the user can move this point anywhere in a moment
      */
     void addPointInTheMiddle();
-    
+
     void setMaxPoints(int max);
 
 private:
index 09b7e5199160799a410a10b37ccc51497a4321e7..38b4d51524a9a3c6d164f308b0b7424244160319 100644 (file)
@@ -262,7 +262,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
 
     m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone);
     m_clipMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, static_cast<QMenu*>(factory()->container("marker_menu", this)));
-    
+
     QMenu *clipInTimeline = static_cast<QMenu*>(factory()->container("clip_in_timeline", this));
     clipInTimeline->setIcon(KIcon("go-jump"));
     m_projectList->setupGeneratorMenu(static_cast<QMenu*>(factory()->container("generators", this)),
@@ -1150,7 +1150,7 @@ void MainWindow::setupActions()
     KAction* editItemDuration = new KAction(KIcon("measure"), i18n("Edit Duration"), this);
     collection->addAction("edit_item_duration", editItemDuration);
     connect(editItemDuration, SIGNAL(triggered(bool)), this, SLOT(slotEditItemDuration()));
-    
+
     KAction* clipInProjectTree = new KAction(KIcon("go-jump-definition"), i18n("Clip in Project Tree"), this);
     collection->addAction("clip_in_project_tree", clipInProjectTree);
     connect(clipInProjectTree, SIGNAL(triggered(bool)), this, SLOT(slotClipInProjectTree()));
index 2f9ff112928e55f7f144f3fbc9c7d60a9e39ec3b..c7c04809d0d12c32f8f7031fafbb7d44b06e7869 100644 (file)
@@ -83,11 +83,13 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons
         connect(marker_position, SIGNAL(textChanged(const QString &)), this, SIGNAL(updateThumb()));
     } else clip_thumb->setHidden(true);
 
+    marker_position->setInputMask("");
     if (m_frameDisplay) {
-        QValidator *valid = new QIntValidator(this);
-        marker_position->setInputMask("");
+        QIntValidator *valid = new QIntValidator(this);
+        valid->setBottom(0);
         marker_position->setValidator(valid);
-    } else marker_position->setInputMask(tc.inputMask());
+    } else
+        marker_position->setValidator(tc.validator());
     marker_position->setText(tc.getDisplayTimecode(t.time(), m_frameDisplay));
 
     marker_comment->setText(t.comment());
index f2db5f3691ab70962ceda7d0c8b39370c87b7873..9513a74ea2d2778327aeb7cf73e9fb4e997997ae 100644 (file)
@@ -115,10 +115,13 @@ 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(m_monitorManager->timecode().inputMask());
+        QIntValidator *valid = new QIntValidator(this);
+        valid->setBottom(0);
+        m_timePos->setValidator(valid);
+    } else
+        m_timePos->setValidator(m_monitorManager->timecode().validator());
 
     toolbar->addWidget(m_timePos);
 
@@ -837,15 +840,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(m_monitorManager->timecode().inputMask());
+        m_timePos->setValidator(m_monitorManager->timecode().validator());
         m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
     }
 }
index 82a0b68f2471349d7993a125d4c1e8840487b096..2a9a04d2018b7a35e6e3fa7a7b893bd451033c15 100644 (file)
@@ -373,8 +373,8 @@ void ProjectList::slotReloadClip(const QString &id)
     for (int i = 0; i < selected.count(); i++) {
         if (selected.at(i)->type() != PROJECTCLIPTYPE) {
             if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
-                    for (int j = 0; j < selected.at(i)->childCount(); j++)
-                        selected.append(selected.at(i)->child(j));
+                for (int j = 0; j < selected.at(i)->childCount(); j++)
+                    selected.append(selected.at(i)->child(j));
             }
             continue;
         }
@@ -1053,7 +1053,8 @@ void ProjectList::slotAddColorClip()
     dia_ui.setupUi(dia);
     dia->setWindowTitle(i18n("Color Clip"));
     dia_ui.clip_name->setText(i18n("Color Clip"));
-    dia_ui.clip_duration->setInputMask(m_timecode.inputMask());
+    dia_ui.clip_duration->setInputMask("");
+    dia_ui.clip_duration->setValidator(m_timecode.validator());
     dia_ui.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::color_duration()));
     if (dia->exec() == QDialog::Accepted) {
         QString color = dia_ui.clip_color->color().name();
@@ -1531,7 +1532,7 @@ void ProjectList::addClipCut(const QString &id, int in, int out, const QString d
         SubProjectItem *sub = new SubProjectItem(clip, in, out, desc);
         if (newItem && desc.isEmpty() && !m_listView->isColumnHidden(1)) {
             if (!clip->isExpanded()) clip->setExpanded(true);
-           m_listView->scrollToItem(sub);
+            m_listView->scrollToItem(sub);
             m_listView->editItem(sub, 1);
         }
         QPixmap p = clip->referencedClip()->thumbProducer()->extractImage(in, (int)(sub->sizeHint(0).height()  * m_render->dar()), sub->sizeHint(0).height() - 2);
index 0abc6e83ffebf502f5cc0dbb4c0b137bcbb5ec87..645ab89e29df085bb1e832096e116d7f84b24e0f 100644 (file)
@@ -503,7 +503,7 @@ void RecMonitor::slotRecord()
                 if (KdenliveSettings::rmd_use_jack()) {
                     m_captureArgs << "--use-jack";
                     QStringList ports = KdenliveSettings::rmd_jackports().split(" ", QString::SkipEmptyParts);
-                    for(int i = 0; i < ports.count(); ++i) {
+                    for (int i = 0; i < ports.count(); ++i) {
                         m_captureArgs << ports.at(i);
                     }
                     if (KdenliveSettings::rmd_jack_buffer() > 0.0)
index f3fc8e2a561e8c486836af64891a1f459743e246..fbee984951ac5aa2e2084d85893610666416b490 100644 (file)
@@ -2759,7 +2759,7 @@ bool Render::mltResizeClipStart(ItemInfo info, GenTime diff)
     int previousStart = trackPlaylist.clip_start(clipIndex);
     int previousDuration = trackPlaylist.clip_length(clipIndex) - 1;
     m_isBlocked = true;
-    kDebug() << "RESIZE, old start: " << previousStart + moveFrame<<", "<<previousStart + previousDuration;
+    kDebug() << "RESIZE, old start: " << previousStart + moveFrame << ", " << previousStart + previousDuration;
     trackPlaylist.resize_clip(clipIndex, previousStart + moveFrame, previousStart + previousDuration);
     if (moveFrame > 0) trackPlaylist.insert_blank(clipIndex, moveFrame - 1);
     else {
index 1067ea3d3f53be994200b0d5971db237c2b5594b..e4557ab07e2a5dd7abce223f1337d2fedc0380d9 100644 (file)
@@ -58,9 +58,11 @@ SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) :
     m_view.image_type->addItem("TIFF (*.tiff)", "tiff");
     m_view.image_type->addItem("Open EXR (*.exr)", "exr");
 
-    m_view.clip_duration->setInputMask(m_timecode.inputMask());
+    m_view.clip_duration->setInputMask("");
+    m_view.clip_duration->setValidator(m_timecode.validator());
     m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::image_duration()));
-    m_view.luma_duration->setInputMask(m_timecode.inputMask());
+    m_view.luma_duration->setInputMask("");
+    m_view.luma_duration->setValidator(m_timecode.validator());
     m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))));
     m_view.folder_url->setUrl(QDir::homePath());
 
@@ -274,9 +276,11 @@ void SlideshowClip::slotUpdateDurationFormat(int ix)
         m_view.luma_duration_frames->setValue(m_timecode.getFrameCount(m_view.luma_duration->text()));
     } else {
         // switching to timecode format
-        m_view.clip_duration->setInputMask(m_timecode.inputMask());
+        m_view.clip_duration->setInputMask("");
+        m_view.clip_duration->setValidator(m_timecode.validator());
         m_view.clip_duration->setText(m_timecode.getTimecodeFromFrames(m_view.clip_duration_frames->value()));
-        m_view.luma_duration->setInputMask(m_timecode.inputMask());
+        m_view.luma_duration->setInputMask("");
+        m_view.luma_duration->setValidator(m_timecode.validator());
         m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(m_view.luma_duration_frames->value()));
     }
     m_view.clip_duration_frames->setHidden(!framesFormat);
index 8e8465ff938e7e0ad99d6be2ca0f31708218a3e8..3fcc5ad52e537f66ae157e61c3276f356d90a1ef 100644 (file)
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
-#include "timecode.h"
+#include <QValidator>
+
+#include <KDebug>
+#include <KLocale>
 
-#include <kdebug.h>
-#include <klocale.h>
+#include "timecode.h"
 
-Timecode::Timecode(Formats format, double framesPerSecond, bool dropFrame) :
-        m_format(format),
-        m_dropFrame(dropFrame),
-        m_displayedFramesPerSecond(framesPerSecond + 0.5),
-        m_realFps(framesPerSecond)
+Timecode::Timecode(Formats format, double framesPerSecond, bool dropFrame)
 {
+    m_validator = new QRegExpValidator(0);
+    setFormat(framesPerSecond, dropFrame, format);
 }
 
 Timecode::~Timecode()
 {
 }
 
+void Timecode::setFormat(double framesPerSecond, bool dropFrame, Formats format)
+{
+    m_displayedFramesPerSecond = (int)(framesPerSecond + 0.5);
+    m_dropFrame = dropFrame;
+    m_format = format;
+    m_realFps = framesPerSecond;
+    QRegExp regExp;
+    if (m_dropFrame)
+        regExp.setPattern("^\\d{2}:\\d{2}:\\d{2};\\d{2}$");
+    else
+        regExp.setPattern("^\\d{2}:\\d{2}:\\d{2}:\\d{2}$");
+    m_validator->setRegExp(regExp);
+}
+
 double Timecode::fps() const
 {
     return m_realFps; //m_displayedFramesPerSecond;
@@ -41,18 +55,18 @@ bool Timecode::df() const
     return m_dropFrame;
 }
 
-QString Timecode::inputMask() const
+const QValidator *Timecode::validator() const
 {
-    if (m_dropFrame) return "99:99.99:99";
-    return "99:99:99:99";
+    return m_validator;
 }
 
+
+
 QString Timecode::reformatSeparators(QString duration) const
 {
-    if (m_dropFrame) {
-        return duration.replace(5, 1, '.');
-    }
-    return duration.replace(5, 1, ':');
+    if (m_dropFrame)
+        return duration.replace(8, 1, ';');
+    return duration.replace(8, 1, ':');
 }
 
 int Timecode::getDisplayFrameCount(const QString duration, bool frameDisplay) const
@@ -68,13 +82,12 @@ int Timecode::getFrameCount(const QString duration) const
         int hours, minutes, seconds, frames;
 
         hours = duration.section(':', 0, 0).toInt();
-        if (duration.contains('.')) {
-            minutes = duration.section('.', 0, 0).section(':', 1, 1).toInt();
-            seconds = duration.section('.', 1, 1).section(':', 0, 0).toInt();
-            frames = duration.section('.', 1, 1).section(':', 1, 1).toInt();
+        minutes = duration.section(':', 1, 1).toInt();
+        if (duration.contains(';')) {
+            seconds = duration.section(';', 0, 0).section(':', 2, 2).toInt();
+            frames = duration.section(';', 1, 1).toInt();
         } else {
-            //Handle Drop Frame timecode frame calculations, even if the timecode supplied uses incorrect "99:99:99:99" format instead of "99:99.99:99"
-            minutes = duration.section(':', 1, 1).toInt();
+            //Handle Drop Frame timecode frame calculations, even if the timecode supplied uses incorrect "99:99:99:99" format instead of "99:99:99;99"
             seconds = duration.section(':', 2, 2).toInt();
             frames = duration.section(':', 3, 3).toInt();
         }
@@ -242,13 +255,12 @@ QString Timecode::getTimecodeHH_MM_SS_HH(const GenTime & time) const
     text.append(QString::number(hours).rightJustified(2, '0', false));
     text.append(':');
     text.append(QString::number(minutes).rightJustified(2, '0', false));
-    if (m_dropFrame) {
-        text.append('.');
-    } else {
-        text.append(':');
-    }
-    text.append(QString::number(seconds).rightJustified(2, '0', false));
     text.append(':');
+    text.append(QString::number(seconds).rightJustified(2, '0', false));
+    if (m_dropFrame)
+        text.append(';');
+    else
+        text.append(':');
     text.append(QString::number(hundredths).rightJustified(2, '0', false));
 
     return text;
@@ -320,13 +332,12 @@ QString Timecode::getTimecodeDropFrame(int frames) const
     text.append(':');
     text.append(QString::number(tenMinuteIntervals));
     text.append(QString::number(numMinutes));
-    if (m_dropFrame) {
-        text.append('.');
-    } else {
-        text.append(':');
-    }
-    text.append(QString::number(seconds).rightJustified(2, '0', false));
     text.append(':');
+    text.append(QString::number(seconds).rightJustified(2, '0', false));
+    if (m_dropFrame)
+        text.append(';');
+    else
+        text.append(':');
     text.append(QString::number(frames).rightJustified(2, '0', false));
 
     return text;
index 3fac06441cbaccbeafa7037c4f543322f766955e..8521aa822f28d29970b58ee163e6d3f54e51def6 100644 (file)
 #ifndef TIMECODE_H
 #define TIMECODE_H
 
-#include <qstring.h>
+#include <QString>
 
 #include "gentime.h"
 
+class QValidator;
+class QRegExpValidator;
+
 /**
 Handles the conversion of a GenTime into a nicely formatted string, taking into account things such as drop frame if necessary. Handles multiple formats, such as HH:MM:SS:FF, HH:MM:SS:F, All Frames, All Seconds, etc.
 
@@ -31,16 +34,14 @@ class Timecode
 public:
     enum Formats { HH_MM_SS_FF, HH_MM_SS_HH, Frames, Seconds };
 
-    explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond =
-                          25, bool dropFrame = false);
+    explicit Timecode(Formats format = HH_MM_SS_FF, double framesPerSecond = 25,
+                      bool dropFrame = false);
 
-    /** Set the current timecode format; this is the output format for this timecode. */
-    void setFormat(double framesPerSecond, bool dropFrame = false, Formats format = HH_MM_SS_FF) {
-        m_displayedFramesPerSecond = (int)(framesPerSecond + 0.5);
-        m_dropFrame = dropFrame;
-        m_format = format;
-        m_realFps = framesPerSecond;
-    }
+    /**
+     * Set the current timecode format; this is the output format for this timecode.
+     */
+    void setFormat(double framesPerSecond, bool dropFrame = false,
+                   Formats format = HH_MM_SS_FF);
 
     Formats format() const {
         return m_format;
@@ -59,7 +60,7 @@ public:
     const QString getTimecodeFromFrames(int frames) const;
     double fps() const;
     bool df() const;
-    QString inputMask() const;
+    const QValidator *validator() const;
     QString reformatSeparators(QString duration) const;
 
 private:
@@ -67,6 +68,7 @@ private:
     bool m_dropFrame;
     int m_displayedFramesPerSecond;
     double m_realFps;
+    QRegExpValidator *m_validator;
 
     const QString getTimecodeHH_MM_SS_FF(const GenTime & time) const;
     const QString getTimecodeHH_MM_SS_FF(int frames) const;
index 4bb5ddf62743c9138fc8535bc31ae1cbeabe814d..8f96c33445543b892170580d51b85a5c1e82f9d9 100644 (file)
@@ -143,7 +143,8 @@ TitleWidget::TitleWidget(KUrl url, Timecode tc, QString projectTitlePath, Render
     showToolbars(TITLE_SELECT);
 
     //If project is drop frame, set the input mask as such.
-    title_duration->setInputMask(m_tc.inputMask());
+    title_duration->setInputMask("");
+    title_duration->setValidator(m_tc.validator());
     title_duration->setText(m_tc.reformatSeparators(KdenliveSettings::title_duration()));
 
     connect(backgroundColor, SIGNAL(clicked()), this, SLOT(slotChangeBackground())) ;