]> git.sesse.net Git - kdenlive/commitdiff
indent fixes and give more info on capture failure
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 28 Jun 2008 00:31:58 +0000 (00:31 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 28 Jun 2008 00:31:58 +0000 (00:31 +0000)
svn path=/branches/KDE4/; revision=2284

20 files changed:
src/clipitem.cpp
src/customtrackview.cpp
src/customtrackview.h
src/editguidecommand.cpp
src/editkeyframecommand.cpp
src/headertrack.cpp
src/kdenlivedoc.cpp
src/kdenlivesettingsdialog.cpp
src/mainwindow.cpp
src/mainwindow.h
src/markerdialog.cpp
src/monitor.cpp
src/monitor.h
src/recmonitor.cpp
src/recmonitor.h
src/regiongrabber.cpp
src/regiongrabber.h
src/renderer.cpp
src/smallruler.cpp
src/trackview.cpp

index 585902988e08084d9bad386d5d5e2270cdb5871d..aa58e6e50c7535a6f2b38d3dd64e53a20bcb4799 100644 (file)
@@ -128,24 +128,24 @@ void ClipItem::setKeyframes(const int ix, const QString keyframes) {
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         if (!e.isNull() && e.attribute("type") == "keyframe") {
-           e.setAttribute("keyframes", keyframes);
-           if (ix == m_selectedEffect) {
-             m_keyframes.clear();
-             double max = e.attribute("max").toDouble();
-             double min = e.attribute("min").toDouble();
-             m_keyframeFactor = 100.0 / (max - min);
-             m_keyframeDefault = e.attribute("default").toDouble();
-             // parse keyframes
-             QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
-             foreach(QString str, keyframes) {
-                 int pos = str.section(":", 0, 0).toInt();
-                 double val = str.section(":", 1, 1).toDouble();
-                 m_keyframes[pos] = val;
-             }
-             update();
-             return;
-           }
-           break;
+            e.setAttribute("keyframes", keyframes);
+            if (ix == m_selectedEffect) {
+                m_keyframes.clear();
+                double max = e.attribute("max").toDouble();
+                double min = e.attribute("min").toDouble();
+                m_keyframeFactor = 100.0 / (max - min);
+                m_keyframeDefault = e.attribute("default").toDouble();
+                // parse keyframes
+                QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
+                foreach(QString str, keyframes) {
+                    int pos = str.section(":", 0, 0).toInt();
+                    double val = str.section(":", 1, 1).toDouble();
+                    m_keyframes[pos] = val;
+                }
+                update();
+                return;
+            }
+            break;
         }
     }
 
@@ -190,9 +190,9 @@ QString ClipItem::keyframes(const int index) {
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
         if (!e.isNull() && e.attribute("type") == "keyframe") {
-           result = e.attribute("keyframes");
-           break;
-       }
+            result = e.attribute("keyframes");
+            break;
+        }
     }
     return result;
 }
index 354a732f882137fa648135b439405486deec9b28..e1730613a552774aefdb62fd1d6956af1db0fa22 100644 (file)
@@ -246,14 +246,14 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
 
     if (item && event->buttons() == Qt::NoButton) {
         AbstractClipItem *clip = (AbstractClipItem*) item;
-               if (m_tool == RAZORTOOL) {
-                       // razor tool over a clip, display current frame in monitor
-                       if (item->type() == AVWIDGET) {
-                               emit showClipFrame(((ClipItem *) item)->baseClip(), mapToScene(event->pos()).x() / m_scale - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
-                       }
-                       QGraphicsView::mouseMoveEvent(event);
-                       return;
-               }
+        if (m_tool == RAZORTOOL) {
+            // razor tool over a clip, display current frame in monitor
+            if (item->type() == AVWIDGET) {
+                emit showClipFrame(((ClipItem *) item)->baseClip(), mapToScene(event->pos()).x() / m_scale - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
+            }
+            QGraphicsView::mouseMoveEvent(event);
+            return;
+        }
         opMode = clip->operationMode(mapToScene(event->pos()), m_scale);
         double size = 8;
         if (opMode == m_moveOpMode) {
@@ -406,11 +406,10 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
             setCursor(Qt::PointingHandCursor);
         }
     } // no clip under mouse
-       else if (m_tool == RAZORTOOL) {
-               QGraphicsView::mouseMoveEvent(event);
-               return;
-       }
-    else if (opMode == MOVEGUIDE) {
+    else if (m_tool == RAZORTOOL) {
+        QGraphicsView::mouseMoveEvent(event);
+        return;
+    } else if (opMode == MOVEGUIDE) {
         m_moveOpMode = opMode;
         setCursor(Qt::SplitHCursor);
     } else {
@@ -468,9 +467,9 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
                 if (item->type() == AVWIDGET || item->type() == TRANSITIONWIDGET) {
                     if (m_tool == RAZORTOOL) {
                         if (item->type() == TRANSITIONWIDGET) {
-                                                       emit displayMessage(i18n("Cannot cut a transition"), ErrorMessage);
-                                                       return;
-                                               }
+                            emit displayMessage(i18n("Cannot cut a transition"), ErrorMessage);
+                            return;
+                        }
                         AbstractClipItem *clip = (AbstractClipItem *) item;
                         ItemInfo info;
                         info.startPos = clip->startPos();
@@ -570,11 +569,11 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) {
                 int pos = m_document->timecode().getFrameCount(view.kfr_position->text(), m_document->fps());
                 m_dragItem->updateKeyFramePos(GenTime(pos, m_document->fps()) + m_dragItem->cropStart(), (double) view.kfr_value->value() * m_dragItem->keyFrameFactor());
                 ClipItem *item = (ClipItem *)m_dragItem;
-               QString previous = item->keyframes(item->selectedEffectIndex());
-               item->updateKeyframeEffect();
-               QString next = item->keyframes(item->selectedEffectIndex());
-               EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
-               m_commandStack->push(command);
+                QString previous = item->keyframes(item->selectedEffectIndex());
+                item->updateKeyframeEffect();
+                QString next = item->keyframes(item->selectedEffectIndex());
+                EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+                m_commandStack->push(command);
                 updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
             }
 
@@ -583,11 +582,11 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) {
             GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x() / m_scale), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
             m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
             ClipItem * item = (ClipItem *) m_dragItem;
-           QString previous = item->keyframes(item->selectedEffectIndex());
+            QString previous = item->keyframes(item->selectedEffectIndex());
             item->updateKeyframeEffect();
-           QString next = item->keyframes(item->selectedEffectIndex());
-           EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
-           m_commandStack->push(command);
+            QString next = item->keyframes(item->selectedEffectIndex());
+            EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
+            m_commandStack->push(command);
             updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
         }
     }
@@ -597,10 +596,9 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) {
 void CustomTrackView::editKeyFrame(const GenTime pos, const int track, const int index, const QString keyframes) {
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), track);
     if (clip) {
-      clip->setKeyframes(index, keyframes);
-      updateEffect(m_tracksList.count() - clip->track(), clip->startPos(), clip->effectAt(index));      
-    }
-    else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);
+        clip->setKeyframes(index, keyframes);
+        updateEffect(m_tracksList.count() - clip->track(), clip->startPos(), clip->effectAt(index));
+    } else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);
 }
 
 
@@ -632,8 +630,8 @@ void CustomTrackView::slotRefreshEffects(ClipItem *clip) {
     int track = m_tracksList.count() - clip->track();
     GenTime pos = clip->startPos();
     if (!m_document->renderer()->mltRemoveEffect(track, pos, "-1", false)) {
-       emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
-       return;
+        emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+        return;
     }
     bool success = true;
     for (int i = 0; i < clip->effectsCount(); i++) {
@@ -648,17 +646,16 @@ void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect) {
     if (clip) {
         QMap <QString, QString> effectParams = clip->addEffect(effect);
         if (!m_document->renderer()->mltAddEffect(track, pos, effectParams))
-           emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
+            emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
         emit clipItemSelected(clip);
-    }
-    else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
+    } else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
 }
 
 void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect) {
     QString index = effect.attribute("kdenlive_ix");
     if (!m_document->renderer()->mltRemoveEffect(track, pos, index)) {
-       emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
-       return;
+        emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+        return;
     }
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_tracksList.count() - track);
     if (clip) {
@@ -700,9 +697,9 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect) {
         if (effectParams.value("disabled") == "1") {
             QString index = effectParams.value("kdenlive_ix");
             if (!m_document->renderer()->mltRemoveEffect(track, pos, index))
-               emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+                emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
         } else if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - clip->track(), clip->startPos(), effectParams))
-           emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+            emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
     }
     m_document->setModified(true);
 }
@@ -996,16 +993,15 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
         // move clip
         if (m_dragItem->type() == AVWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
             bool success = m_document->renderer()->mltMoveClip((int)(m_tracksList.count() - m_dragItemInfo.track), (int)(m_tracksList.count() - m_dragItem->track()), (int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItem->startPos().frames(m_document->fps())));
-                       if (success) {
-                               MoveClipCommand *command = new MoveClipCommand(this, m_dragItemInfo, info, false);
-                               m_commandStack->push(command);
-                       }
-                       else {
-                               // undo last move and emit error message
-                               MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
-                               m_commandStack->push(command);
-                               emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
-                       }
+            if (success) {
+                MoveClipCommand *command = new MoveClipCommand(this, m_dragItemInfo, info, false);
+                m_commandStack->push(command);
+            } else {
+                // undo last move and emit error message
+                MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
+                m_commandStack->push(command);
+                emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
+            }
         }
         if (m_dragItem->type() == TRANSITIONWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
             MoveTransitionCommand *command = new MoveTransitionCommand(this, m_dragItemInfo, info, false);
@@ -1096,11 +1092,11 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
     } else if (m_operationMode == KEYFRAME) {
         // update the MLT effect
         ClipItem * item = (ClipItem *) m_dragItem;
-       QString previous = item->keyframes(item->selectedEffectIndex());
+        QString previous = item->keyframes(item->selectedEffectIndex());
         item->updateKeyframeEffect();
-       QString next = item->keyframes(item->selectedEffectIndex());
-       EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
-       m_commandStack->push(command);
+        QString next = item->keyframes(item->selectedEffectIndex());
+        EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+        m_commandStack->push(command);
         updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
     }
 
@@ -1231,15 +1227,14 @@ void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end) {
         return;
     }
     //kDebug() << "----------------  Move CLIP FROM: " << startPos.x() << ", END:" << endPos.x() << ",TRACKS: " << startPos.y() << " TO " << endPos.y();
-    
+
     bool success = m_document->renderer()->mltMoveClip((int)(m_tracksList.count() - start.track), (int)(m_tracksList.count() - end.track), (int) start.startPos.frames(m_document->fps()), (int)end.startPos.frames(m_document->fps()));
-       if (success) {
-               item->moveTo((int) end.startPos.frames(m_document->fps()), m_scale, (int)((end.track - start.track) * m_tracksHeight), end.track);
-       }
-       else {
-               // undo last move and emit error message
-               emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
-       }
+    if (success) {
+        item->moveTo((int) end.startPos.frames(m_document->fps()), m_scale, (int)((end.track - start.track) * m_tracksHeight), end.track);
+    } else {
+        // undo last move and emit error message
+        emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
+    }
 }
 
 void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end) {
@@ -1304,7 +1299,7 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
             QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
             if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
-               emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+                emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
         }
     } else {
         int start = item->fadeOut();
@@ -1318,7 +1313,7 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
             QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
             if (m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
-               emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+                emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
         }
     }
 }
@@ -1336,7 +1331,7 @@ double CustomTrackView::getSnapPointForPos(double pos) {
 
 void CustomTrackView::updateSnapPoints(AbstractClipItem *selected) {
     m_snapPoints.clear();
-       if (!KdenliveSettings::snaptopoints()) return;
+    if (!KdenliveSettings::snaptopoints()) return;
     GenTime offset;
     if (selected) offset = selected->duration();
     QList<QGraphicsItem *> itemList = items();
@@ -1449,22 +1444,22 @@ void CustomTrackView::slotDeleteClipMarker() {
     }
     AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
     if (item->type() != AVWIDGET) {
-               emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
+        return;
+    }
     GenTime pos = GenTime(m_cursorPos, m_document->fps());
     if (item->startPos() > pos || item->endPos() < pos) {
-               emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
+        return;
+    }
     ClipItem *clip = (ClipItem *) item;
     int id = clip->baseClip()->getId();
     GenTime position = pos - item->startPos() + item->cropStart();
     QString comment = clip->baseClip()->markerComment(position);
     if (comment.isEmpty()) {
-               emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
+        return;
+    }
     AddMarkerCommand *command = new AddMarkerCommand(this, comment, QString(), id, position, true);
     m_commandStack->push(command);
 }
@@ -1478,22 +1473,22 @@ void CustomTrackView::slotEditClipMarker() {
     }
     AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
     if (item->type() != AVWIDGET) {
-               emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
+        return;
+    }
     GenTime pos = GenTime(m_cursorPos, m_document->fps());
     if (item->startPos() > pos || item->endPos() < pos) {
-               emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
+        return;
+    }
     ClipItem *clip = (ClipItem *) item;
     int id = clip->baseClip()->getId();
     GenTime position = pos - item->startPos() + item->cropStart();
     QString oldcomment = clip->baseClip()->markerComment(position);
     if (oldcomment.isEmpty()) {
-               emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
-               return;
-       }
+        emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
+        return;
+    }
 
     CommentedTime marker(position, oldcomment);
     MarkerDialog d(clip->baseClip(), marker, m_document->timecode(), this);
@@ -1537,51 +1532,51 @@ void CustomTrackView::editGuide(const GenTime oldPos, const GenTime pos, const Q
     } else if (pos > GenTime()) addGuide(pos, comment);
     else {
         // remove guide
-               bool found = false;
+        bool found = false;
         for (int i = 0; i < m_guides.count(); i++) {
             if (m_guides.at(i)->position() == oldPos) {
                 Guide *item = m_guides.takeAt(i);
                 delete item;
-                               found = true;
+                found = true;
                 break;
             }
         }
-               if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+        if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
     }
 }
 
 bool CustomTrackView::addGuide(const GenTime pos, const QString &comment) {
     for (int i = 0; i < m_guides.count(); i++) {
-               if (m_guides.at(i)->position() == pos) {
-                       emit displayMessage(i18n("A guide already exists at that position"), ErrorMessage);
-                       return false;
-               }
+        if (m_guides.at(i)->position() == pos) {
+            emit displayMessage(i18n("A guide already exists at that position"), ErrorMessage);
+            return false;
+        }
     }
     Guide *g = new Guide(this, pos, comment, m_scale, m_document->fps(), m_tracksHeight * m_tracksList.count());
     scene()->addItem(g);
     m_guides.append(g);
-       return true;
+    return true;
 }
 
 void CustomTrackView::slotAddGuide() {
     if (addGuide(GenTime(m_cursorPos, m_document->fps()), i18n("guide"))) {
-               EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), GenTime(m_cursorPos, m_document->fps()), i18n("guide"), false);
-               m_commandStack->push(command);
-       }
+        EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), GenTime(m_cursorPos, m_document->fps()), i18n("guide"), false);
+        m_commandStack->push(command);
+    }
 }
 
 void CustomTrackView::slotDeleteGuide() {
     GenTime pos = GenTime(m_cursorPos, m_document->fps());
-       bool found = false;
+    bool found = false;
     for (int i = 0; i < m_guides.count(); i++) {
         if (m_guides.at(i)->position() == pos) {
             EditGuideCommand *command = new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(), QString(), true);
             m_commandStack->push(command);
-                       found = true;
+            found = true;
             break;
         }
     }
-       if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+    if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
 }
 
 void CustomTrackView::setTool(PROJECTTOOL tool) {
index f0869f1f25870ff9888fbe51e11c6109d5d0a07c..e26d5aa7372bea71a801b22ec3a6069e94131c8c 100644 (file)
@@ -173,7 +173,7 @@ signals:
     void activateDocumentMonitor();
     void trackHeightChanged();
     void displayMessage(const QString, MessageType);
-       void showClipFrame(DocClipBase *, const int);
+    void showClipFrame(DocClipBase *, const int);
 };
 
 #endif
index d614d407c0057355579231771383c1ee9fe7a52e..e1687d38a1af764612630fa3f0d9c87de49fd62b 100644 (file)
@@ -22,7 +22,7 @@
 EditGuideCommand::EditGuideCommand(CustomTrackView *view, const GenTime oldPos, const QString &oldcomment, const GenTime pos, const QString &comment, bool doIt) : m_view(view), m_oldPos(oldPos), m_oldcomment(oldcomment), m_pos(pos), m_comment(comment), m_doIt(doIt) {
     if (m_oldcomment.isEmpty()) setText(i18n("Add guide"));
     else if (m_oldPos == m_pos) setText(i18n("Edit guide"));
-       else if (m_pos <= GenTime()) setText(i18n("Delete guide"));
+    else if (m_pos <= GenTime()) setText(i18n("Delete guide"));
     else setText(i18n("Move guide"));
     kDebug() << "///  CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
 }
index edc89816e0016a261a9ea2d087e4b315e65f5f8d..f9dde76cadeb1f357b57d9dfca8fde9b18b35696 100644 (file)
@@ -36,7 +36,7 @@ void EditKeyFrameCommand::undo() {
 // virtual
 void EditKeyFrameCommand::redo() {
     if (m_doIt) {
-    m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
+        m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
     }
     m_doIt = true;
 }
index ffee227d976e5be281d89d7927d97db9f6d515e3..23f9e3b68c8194615c053b5a6b7857e359f286f5 100644 (file)
@@ -19,11 +19,11 @@ HeaderTrack::HeaderTrack(int index, TrackInfo info, QWidget *parent)
     if (m_type == VIDEOTRACK) {
         view.frame->setBackgroundRole(QPalette::AlternateBase);
         view.frame->setAutoFillBackground(true);
-               view.buttonVideo->setIcon(KIcon("kdenlive-show-video"));
+        view.buttonVideo->setIcon(KIcon("kdenlive-show-video"));
     } else {
         view.buttonVideo->setHidden(true);
     }
-       view.buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
+    view.buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
     view.buttonVideo->setChecked(!info.isBlind);
     view.buttonAudio->setChecked(!info.isMute);
     connect(view.buttonVideo, SIGNAL(clicked()), this, SLOT(switchVideo()));
index 4ed2ce67933dc53f9e28053865cf6eb09d90513e..ca12bc7754a6084c767f24ef5ab10ebc02ae1ae5 100644 (file)
@@ -37,7 +37,7 @@
 #include "mainwindow.h"
 
 KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0) {
-       kDebug()<<"// init profile, ratnum: "<<profile.frame_rate_num<<", "<<profile.frame_rate_num<<", width: "<<profile.width;
+    kDebug() << "// init profile, ratnum: " << profile.frame_rate_num << ", " << profile.frame_rate_num << ", width: " << profile.width;
     m_clipManager = new ClipManager(this);
     if (!url.isEmpty()) {
         QString tmpFile;
@@ -196,7 +196,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoPro
         westley.appendChild(tractor);
     }
     m_scenelist = m_document.toString();
-    kDebug() << "KDEnnlive document, init timecode: "<<m_fps;
+    kDebug() << "KDEnnlive document, init timecode: " << m_fps;
     if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
     else m_timecode.setFormat((int) m_fps);
 }
@@ -367,7 +367,7 @@ void KdenliveDoc::setProfilePath(QString path) {
     m_fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
     m_width = m_profile.width;
     m_height = m_profile.height;
-    kDebug() << "KDEnnlive document, init timecode from path: "<<path<<",  "<<m_fps;
+    kDebug() << "KDEnnlive document, init timecode from path: " << path << ",  " << m_fps;
     if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
     else m_timecode.setFormat((int) m_fps);
 }
index 1061cc1b47e6dc5e7fd6e8c9dced667b476a495e..8ca2706a39d44dc58458d68f08179cd0da6f2822 100644 (file)
@@ -57,7 +57,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog(
     QWidget *p4 = new QWidget;
     m_configCapture.setupUi(p4);
     page4 = addPage(p4, i18n("Capture"), "audio-card");
-       m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
+    m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
 
     QWidget *p5 = new QWidget;
     m_configShuttle.setupUi(p5);
index 7f6f1715381a95654398af27a10d65924b7b8229..589befd761926c909a1a9ee1774b5dc27ddb49e2 100644 (file)
@@ -179,7 +179,7 @@ MainWindow::MainWindow(QWidget *parent)
     projectListDock->raise();
 
     tabifyDockWidget(clipMonitorDock, projectMonitorDock);
-       tabifyDockWidget(clipMonitorDock, recMonitorDock);
+    tabifyDockWidget(clipMonitorDock, recMonitorDock);
     setCentralWidget(m_timelineArea);
 
     setupGUI(Default, NULL /*"kdenliveui.rc"*/);
@@ -250,9 +250,9 @@ MainWindow::MainWindow(QWidget *parent)
     setAutoSaveSettings();
 
     if (KdenliveSettings::openlastproject()) {
-      KSharedConfigPtr config = KGlobal::config();
-      QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
-      openFile(KUrl(Lastproject));
+        KSharedConfigPtr config = KGlobal::config();
+        QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
+        openFile(KUrl(Lastproject));
 
     } else newFile();
 
@@ -396,16 +396,16 @@ void MainWindow::setupActions() {
     m_toolGroup->addAction(m_buttonSelectTool);
     m_toolGroup->addAction(m_buttonRazorTool);
     m_toolGroup->setExclusive(true);
-       toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+    toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
 
-       QWidget * actionWidget;
-       actionWidget = toolbar->widgetForAction( m_buttonSelectTool );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    QWidget * actionWidget;
+    actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
-       actionWidget = toolbar->widgetForAction( m_buttonRazorTool );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
     toolbar->setStyleSheet(style1);
     connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
@@ -415,9 +415,9 @@ void MainWindow::setupActions() {
     m_buttonFitZoom->setCheckable(false);
     connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
 
-       actionWidget = toolbar->widgetForAction( m_buttonFitZoom );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
     m_zoomSlider = new QSlider(Qt::Horizontal, this);
     m_zoomSlider->setMaximum(13);
@@ -459,21 +459,21 @@ void MainWindow::setupActions() {
     layout->addWidget(toolbar);
 
 
-       actionWidget = toolbar->widgetForAction( m_buttonVideoThumbs );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
-       actionWidget = toolbar->widgetForAction( m_buttonAudioThumbs );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
-       actionWidget = toolbar->widgetForAction( m_buttonShowMarkers );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
-       actionWidget = toolbar->widgetForAction( m_buttonSnap );
-       actionWidget->setMaximumWidth(24);
-       actionWidget->setMinimumHeight(17);
+    actionWidget = toolbar->widgetForAction(m_buttonSnap);
+    actionWidget->setMaximumWidth(24);
+    actionWidget->setMinimumHeight(17);
 
     m_messageLabel = new StatusBarMessageLabel(this);
     m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
@@ -491,8 +491,8 @@ void MainWindow::setupActions() {
 
     actionCollection()->addAction("show_video_thumbs", m_buttonVideoThumbs);
     actionCollection()->addAction("show_audio_thumbs", m_buttonAudioThumbs);
-       actionCollection()->addAction("show_markers", m_buttonShowMarkers);
-       actionCollection()->addAction("snap", m_buttonSnap);
+    actionCollection()->addAction("show_markers", m_buttonShowMarkers);
+    actionCollection()->addAction("snap", m_buttonSnap);
     actionCollection()->addAction("zoom_fit", m_buttonFitZoom);
 
 
@@ -638,8 +638,8 @@ void MainWindow::newFile() {
         delete w;
     }
     MltVideoProfile prof;
-       if (!profileName.isEmpty()) prof = ProfilesDialog::getVideoProfile(profileName);
-       else prof = ProfilesDialog::getVideoProfile("dv_pal");
+    if (!profileName.isEmpty()) prof = ProfilesDialog::getVideoProfile(profileName);
+    else prof = ProfilesDialog::getVideoProfile("dv_pal");
     if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
     KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack, this);
     TrackView *trackView = new TrackView(doc, this);
@@ -882,7 +882,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
             disconnect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
             disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
             disconnect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
-                       disconnect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
+            disconnect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
 
             disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
             disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
index 2a0deea1c26d2fe23f9807c342e245b67901dbf0..b893f4392b357f48b5ccfb50d9da8d524a135385 100644 (file)
@@ -163,7 +163,7 @@ private slots:
     void slotSwitchVideoThumbs();
     void slotSwitchAudioThumbs();
     void slotSwitchMarkersComments();
-       void slotSwitchSnap();
+    void slotSwitchSnap();
     void slotRenderProject();
     void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
     void slotFullScreen();
index 0a93cf72173fe07b1764cadac859f774dcd5f342..e036720b1a2d8af5ccab4ae1c1536fa4896ed05f 100644 (file)
@@ -52,7 +52,7 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWid
 
     m_view.marker_comment->selectAll();
     m_view.marker_comment->setFocus();
-    QPixmap p((int) (100 * m_dar), 100);
+    QPixmap p((int)(100 * m_dar), 100);
     QString colour = clip->getProperty("colour");
     switch (m_clip->clipType()) {
     case VIDEO:
index 2ab55376a10542ae9fa2145d6df84cfc75935126..c9c537909d7555b3a18f1263286392c1c9f103dc 100644 (file)
@@ -110,7 +110,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
     m_contextMenu->addMenu(playMenu);
     QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"));
     connect(extractFrame, SIGNAL(triggered()), this, SLOT(slotExtractCurrentFrame()));
-       connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
+    connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
     kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId();
 }
 
@@ -268,18 +268,18 @@ void Monitor::slotSetXml(DocClipBase *clip, const int position) {
     if (render == NULL) return;
     if (!m_isActive) m_monitorManager->activateMonitor(m_name);
     if (!clip) return;
-       if (clip != m_currentClip) {
-               m_currentClip = clip;
-               QDomDocument doc;
-               QDomElement westley = doc.createElement("westley");
-               doc.appendChild(westley);
-               westley.appendChild(doc.importNode(m_currentClip->toXML(), true));
-               render->setSceneList(doc, 0);
-               m_ruler->slotNewValue(0);
-               m_timePos->setText("00:00:00:00");
-               m_position = 0;
-       }
-       if (position != -1) render->seek(GenTime(position, render->fps()));
+    if (clip != m_currentClip) {
+        m_currentClip = clip;
+        QDomDocument doc;
+        QDomElement westley = doc.createElement("westley");
+        doc.appendChild(westley);
+        westley.appendChild(doc.importNode(m_currentClip->toXML(), true));
+        render->setSceneList(doc, 0);
+        m_ruler->slotNewValue(0);
+        m_timePos->setText("00:00:00:00");
+        m_position = 0;
+    }
+    if (position != -1) render->seek(GenTime(position, render->fps()));
 }
 
 void Monitor::slotOpenFile(const QString &file) {
index 7e1c486813c9a74f81904f15b563a6df2d18555b..1d4c1dd62adbb50136c58ce64c736117ed1ca6f0 100644 (file)
@@ -74,7 +74,7 @@ private:
     KRestrictedLine *m_timePos;
     QAction *m_playAction;
     QMenu *m_contextMenu;
-       DocClipBase *m_currentClip;
+    DocClipBase *m_currentClip;
 
 private slots:
     void adjustRulerSize(int length);
index 25de021ca74049ce72f4fdc3ea4119b9817ae39e..d26f2eaae419b318ec1ec98a78d73fbdb2d91800 100644 (file)
@@ -30,6 +30,7 @@
 #include <KLocale>
 #include <KStandardDirs>
 #include <KComboBox>
+#include <KIO/NetAccess>
 
 #include "gentime.h"
 #include "kdenlivesettings.h"
@@ -104,34 +105,45 @@ QString RecMonitor::name() const {
 }
 
 void RecMonitor::slotVideoDeviceChanged(int ix) {
-       switch (ix) {
-               case SCREENGRAB:
-                       m_discAction->setEnabled(false);
-                       m_rewAction->setEnabled(false);
-                       m_fwdAction->setEnabled(false);
-                       m_recAction->setEnabled(true);
-                       m_stopAction->setEnabled(false);
-                       m_playAction->setEnabled(false);
-                       break;
-               case VIDEO4LINUX:
-                       m_discAction->setEnabled(false);
-                       m_rewAction->setEnabled(false);
-                       m_fwdAction->setEnabled(false);
-                       m_recAction->setEnabled(true);
-                       m_stopAction->setEnabled(false);
-                       m_playAction->setEnabled(true);
-                       break;
-               default: // FIREWIRE
-                       m_discAction->setEnabled(true);
-                       m_recAction->setEnabled(false);
-                       m_stopAction->setEnabled(false);
-                       m_playAction->setEnabled(false);
-                       m_rewAction->setEnabled(false);
-                       m_fwdAction->setEnabled(false);
-                       break;
+    switch (ix) {
+    case SCREENGRAB:
+        m_discAction->setEnabled(false);
+        m_rewAction->setEnabled(false);
+        m_fwdAction->setEnabled(false);
+        m_recAction->setEnabled(true);
+        m_stopAction->setEnabled(false);
+        m_playAction->setEnabled(false);
+        ui.video_frame->setText(i18n("Press record button\nto start screen capture"));
+        break;
+    case VIDEO4LINUX:
+        m_discAction->setEnabled(false);
+        m_rewAction->setEnabled(false);
+        m_fwdAction->setEnabled(false);
+        m_recAction->setEnabled(true);
+        m_stopAction->setEnabled(false);
+        m_playAction->setEnabled(true);
+        checkDeviceAvailability();
+        break;
+    default: // FIREWIRE
+        m_discAction->setEnabled(true);
+        m_recAction->setEnabled(false);
+        m_stopAction->setEnabled(false);
+        m_playAction->setEnabled(false);
+        m_rewAction->setEnabled(false);
+        m_fwdAction->setEnabled(false);
+        ui.video_frame->setText(i18n("Press connect button\nto initialize connection"));
+        break;
     }
 }
 
+void RecMonitor::checkDeviceAvailability() {
+    if (!KIO::NetAccess::exists(KUrl(KdenliveSettings::video4vdevice()), KIO::NetAccess::SourceSide , this)) {
+        m_playAction->setEnabled(false);
+        m_recAction->setEnabled(false);
+        ui.video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
+    } else ui.video_frame->setText(i18n("Press play or record button\nto start video capture"));
+}
+
 void RecMonitor::slotDisconnect() {
     if (captureProcess->state() == QProcess::NotRunning) {
         slotStartCapture(false);
@@ -144,13 +156,6 @@ void RecMonitor::slotDisconnect() {
         m_fwdAction->setEnabled(true);
     } else {
         captureProcess->write("q", 1);
-        m_discAction->setIcon(KIcon("network-connect"));
-        m_discAction->setText(i18n("Connect"));
-        m_recAction->setEnabled(false);
-        m_stopAction->setEnabled(false);
-        m_playAction->setEnabled(false);
-        m_rewAction->setEnabled(false);
-        m_fwdAction->setEnabled(false);
     }
 }
 
@@ -164,24 +169,24 @@ void RecMonitor::slotForward() {
 
 void RecMonitor::slotStopCapture() {
     // stop capture
-       switch (ui.device_selector->currentIndex()) {
+    switch (ui.device_selector->currentIndex()) {
     case FIREWIRE:
         captureProcess->write("\e", 2);
         m_playAction->setIcon(m_playIcon);
         m_isPlaying = false;
-               break;
+        break;
     case VIDEO4LINUX:
-        captureProcess->kill();
-        displayProcess->kill();
-               if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
-               break;
+        QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+        captureProcess->write("q\n", 3);
+
+        break;
     case SCREENGRAB:
-               QTimer::singleShot(1000, captureProcess, SLOT(kill()));
-               if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
-               break;
-       default:
-               break;
-       }
+        QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+        if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
+        break;
+    default:
+        break;
+    }
 }
 
 void RecMonitor::slotStartCapture(bool play) {
@@ -243,32 +248,32 @@ void RecMonitor::slotStartCapture(bool play) {
     m_displayArgs.clear();
     m_isPlaying = false;
 
-       switch (ui.device_selector->currentIndex()) {
+    switch (ui.device_selector->currentIndex()) {
     case FIREWIRE:
         m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-";
         m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
-               captureProcess->setStandardOutputProcess(displayProcess);
+        captureProcess->setStandardOutputProcess(displayProcess);
         captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
         captureProcess->start("dvgrab", m_captureArgs);
         if (play) captureProcess->write(" ", 1);
         m_discAction->setEnabled(true);
-               break;
+        break;
     case VIDEO4LINUX:
         m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-";
         m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
-               captureProcess->setStandardOutputProcess(displayProcess);
-               captureProcess->start("ffmpeg", m_captureArgs);
-               break;
-       default:
-               break;
+        captureProcess->setStandardOutputProcess(displayProcess);
+        captureProcess->start("ffmpeg", m_captureArgs);
+        break;
+    default:
+        break;
     }
 
     if (ui.device_selector->currentIndex() != SCREENGRAB) {
-               displayProcess->start("ffplay", m_displayArgs);
-               ui.video_frame->setText(i18n("Initialising..."));
-       } else {
-               // do something when starting screen grab
-       }
+        displayProcess->start("ffplay", m_displayArgs);
+        ui.video_frame->setText(i18n("Initialising..."));
+    } else {
+        // do something when starting screen grab
+    }
 }
 
 void RecMonitor::slotRecord() {
@@ -276,24 +281,24 @@ void RecMonitor::slotRecord() {
         slotStartCapture();
     }
     if (m_isCapturing) {
-               switch (ui.device_selector->currentIndex()) {
-               case FIREWIRE:
+        switch (ui.device_selector->currentIndex()) {
+        case FIREWIRE:
             captureProcess->write("\e", 2);
             m_playAction->setIcon(m_playIcon);
             m_isCapturing = false;
             m_isPlaying = false;
             m_recAction->setChecked(false);
-                       break;
+            break;
         case VIDEO4LINUX:
             slotStopCapture();
-            m_isCapturing = false;
+            //m_isCapturing = false;
             QTimer::singleShot(1000, this, SLOT(slotStartCapture()));
-                       break;
+            break;
         case SCREENGRAB:
-                       captureProcess->write("q\n", 3);
-                       // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
-                       QTimer::singleShot(1000, captureProcess, SLOT(kill()));
-                       break;
+            captureProcess->write("q\n", 3);
+            // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
+            QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+            break;
         }
         return;
     } else if (ui.device_selector->currentIndex() == FIREWIRE) {
@@ -303,8 +308,8 @@ void RecMonitor::slotRecord() {
     }
     if (captureProcess->state() == QProcess::NotRunning) {
         m_recAction->setChecked(true);
-               QString extension = "mpg";
-               if (ui.device_selector->currentIndex() == SCREENGRAB) extension = KdenliveSettings::screengrabextension();
+        QString extension = "mpg";
+        if (ui.device_selector->currentIndex() == SCREENGRAB) extension = KdenliveSettings::screengrabextension();
         QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension;
         int i = 1;
         while (QFile::exists(path)) {
@@ -317,47 +322,46 @@ void RecMonitor::slotRecord() {
 
         m_captureArgs.clear();
         m_displayArgs.clear();
-               QString args;
+        QString args;
 
-               switch (ui.device_selector->currentIndex()) {
-               case FIREWIRE:
+        switch (ui.device_selector->currentIndex()) {
+        case FIREWIRE:
             m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-";
             m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
-                       captureProcess->setStandardOutputProcess(displayProcess);
-                       captureProcess->start("dvgrab", m_captureArgs);
-                       break;
-               case VIDEO4LINUX:
+            captureProcess->setStandardOutputProcess(displayProcess);
+            captureProcess->start("dvgrab", m_captureArgs);
+            break;
+        case VIDEO4LINUX:
             m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-y" << m_captureFile.path() << "-f" << KdenliveSettings::video4vencoding() << "-";
             m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
-                       captureProcess->setStandardOutputProcess(displayProcess);
-                       captureProcess->start("ffmpeg", m_captureArgs);
-                       break;
-               case SCREENGRAB:
-                       if (KdenliveSettings::fullscreengrab()) {
-                               const QRect rect = QApplication::desktop()->screenGeometry();
-                               args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(rect.width()) + "x" + QString::number(rect.height())).replace("%offset", QString());
-                               kDebug()<<"// capture params: "<<args;
-                               m_captureArgs << args.simplified().split(' ') <<KdenliveSettings::screengrabencoding().simplified().split(' ')<<m_captureFile.path();
-                               ui.video_frame->setText(i18n("Capturing..."));
-                               m_isCapturing = true;
-                               captureProcess->start("ffmpeg", m_captureArgs);
-                       }
-                       else {
-                               ui.video_frame->setText(i18n("Select region..."));
-                               rgnGrab = new RegionGrabber();
-                               connect( rgnGrab, SIGNAL( regionGrabbed( const QRect&) ), SLOT( slotStartGrab( const QRect & ) ) );
-                       }
-                       break;
-               default:
-                       break;
-               }
+            captureProcess->setStandardOutputProcess(displayProcess);
+            captureProcess->start("ffmpeg", m_captureArgs);
+            break;
+        case SCREENGRAB:
+            if (KdenliveSettings::fullscreengrab()) {
+                const QRect rect = QApplication::desktop()->screenGeometry();
+                args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(rect.width()) + "x" + QString::number(rect.height())).replace("%offset", QString());
+                kDebug() << "// capture params: " << args;
+                m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
+                ui.video_frame->setText(i18n("Capturing..."));
+                m_isCapturing = true;
+                captureProcess->start("ffmpeg", m_captureArgs);
+            } else {
+                ui.video_frame->setText(i18n("Select region..."));
+                rgnGrab = new RegionGrabber();
+                connect(rgnGrab, SIGNAL(regionGrabbed(const QRect&)), SLOT(slotStartGrab(const QRect &)));
+            }
+            break;
+        default:
+            break;
+        }
 
         //ui.video_frame->setScaledContents(false);
         if (ui.device_selector->currentIndex() != SCREENGRAB) {
-                       m_isCapturing = true;
-                       displayProcess->start("ffplay", m_displayArgs);
-                       ui.video_frame->setText(i18n("Initialising..."));
-               }
+            m_isCapturing = true;
+            displayProcess->start("ffplay", m_displayArgs);
+            ui.video_frame->setText(i18n("Initialising..."));
+        }
     } else {
         // stop capture
         displayProcess->kill();
@@ -366,39 +370,46 @@ void RecMonitor::slotRecord() {
     }
 }
 
-void RecMonitor::slotStartGrab(const QRect &rect)
-{
-       rgnGrab->deleteLater();
-       QApplication::restoreOverrideCursor();
-       show();
-       if (rect.isNull()) return;
-       int width = rect.width();
-       int height = rect.height();
-       if (width % 2 != 0) width--;
-       if (height % 2 != 0) height--;
-       QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
-       kDebug()<<"// capture params: "<<args;
-       m_captureArgs << args.simplified().split(' ') <<KdenliveSettings::screengrabencoding().simplified().split(' ')<<m_captureFile.path();
-       m_isCapturing = true;
-       ui.video_frame->setText(i18n("Capturing..."));
-       captureProcess->start("ffmpeg", m_captureArgs);
+void RecMonitor::slotStartGrab(const QRect &rect) {
+    rgnGrab->deleteLater();
+    QApplication::restoreOverrideCursor();
+    show();
+    if (rect.isNull()) return;
+    int width = rect.width();
+    int height = rect.height();
+    if (width % 2 != 0) width--;
+    if (height % 2 != 0) height--;
+    QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
+    kDebug() << "// capture params: " << args;
+    m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
+    m_isCapturing = true;
+    ui.video_frame->setText(i18n("Capturing..."));
+    captureProcess->start("ffmpeg", m_captureArgs);
 }
 
 void RecMonitor::slotProcessStatus(QProcess::ProcessState status) {
     if (status == QProcess::NotRunning) {
-               if (m_isCapturing && ui.device_selector->currentIndex() == SCREENGRAB) {
-                       if (ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
-               }
+        displayProcess->kill();
+        if (m_isCapturing && ui.device_selector->currentIndex() != FIREWIRE)
+            if (ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
+        if (ui.device_selector->currentIndex() == FIREWIRE) {
+            m_discAction->setIcon(KIcon("network-connect"));
+            m_discAction->setText(i18n("Connect"));
+            m_recAction->setEnabled(false);
+            m_stopAction->setEnabled(false);
+            m_playAction->setEnabled(false);
+            m_rewAction->setEnabled(false);
+            m_fwdAction->setEnabled(false);
+        }
         m_isCapturing = false;
         m_isPlaying = false;
         m_playAction->setIcon(m_playIcon);
         m_recAction->setChecked(false);
         m_stopAction->setEnabled(false);
         ui.device_selector->setEnabled(true);
-               if (captureProcess && captureProcess->exitStatus() == QProcess::CrashExit) {
-                       ui.video_frame->setText(i18n("Capture crashed, please check your parameters"));
-               }
-        else ui.video_frame->setText(i18n("Not connected"));
+        if (captureProcess && captureProcess->exitStatus() == QProcess::CrashExit) {
+            ui.video_frame->setText(i18n("Capture crashed, please check your parameters"));
+        } else ui.video_frame->setText(i18n("Not connected"));
     } else {
         m_stopAction->setEnabled(true);
         ui.device_selector->setEnabled(false);
index b783f5379e9fa34dd0eb80396c04d7be26d7ce9e..0f6ac33dfc832b9ebff8efd8bb7d6435406255fd 100644 (file)
@@ -41,7 +41,7 @@ public:
     RecMonitor(QString name, QWidget *parent = 0);
     QString name() const;
 
-enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB =2};
+    enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2};
 
 protected:
     virtual void mousePressEvent(QMouseEvent * event);
@@ -50,7 +50,7 @@ private:
     Ui::RecMonitor_UI ui;
     QString m_tmpFolder;
     QString m_name;
-       RegionGrabber *rgnGrab;
+    RegionGrabber *rgnGrab;
     bool m_isActive;
 
 
@@ -71,6 +71,7 @@ private:
     QAction *m_rewAction;
     QAction *m_stopAction;
     QAction *m_discAction;
+    void checkDeviceAvailability();
 
 private slots:
     void slotStartCapture(bool play = true);
@@ -81,7 +82,7 @@ private slots:
     void slotRewind();
     void slotForward();
     void slotDisconnect();
-       void slotStartGrab(const QRect &rect);
+    void slotStartGrab(const QRect &rect);
 
 public slots:
     void refreshRecMonitor(bool visible);
index a8292e347a4ebed36673b84bb4c7632e1353c932..d85e923254cd45fe1b59303e0949703511de7766 100644 (file)
 #include <klocale.h>
 #include <KWindowSystem>
 
-RegionGrabber::RegionGrabber( ) :
-    QWidget( 0 ), selection(), mouseDown( false ), newSelection( false ),
-    handleSize( 10 ), mouseOverHandle( 0 ), idleTimer(),
-    showHelp( true ), grabbing( false ),
-    TLHandle(0,0,handleSize,handleSize), TRHandle(0,0,handleSize,handleSize),
-    BLHandle(0,0,handleSize,handleSize), BRHandle(0,0,handleSize,handleSize),
-    LHandle(0,0,handleSize,handleSize), THandle(0,0,handleSize,handleSize),
-    RHandle(0,0,handleSize,handleSize), BHandle(0,0,handleSize,handleSize)
-{
+RegionGrabber::RegionGrabber() :
+        QWidget(0), selection(), mouseDown(false), newSelection(false),
+        handleSize(10), mouseOverHandle(0), idleTimer(),
+        showHelp(true), grabbing(false),
+        TLHandle(0, 0, handleSize, handleSize), TRHandle(0, 0, handleSize, handleSize),
+        BLHandle(0, 0, handleSize, handleSize), BRHandle(0, 0, handleSize, handleSize),
+        LHandle(0, 0, handleSize, handleSize), THandle(0, 0, handleSize, handleSize),
+        RHandle(0, 0, handleSize, handleSize), BHandle(0, 0, handleSize, handleSize) {
     handles << &TLHandle << &TRHandle << &BLHandle << &BRHandle
-            << &LHandle << &THandle << &RHandle << &BHandle;
-    setMouseTracking( true );
-    setWindowFlags( Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+    << &LHandle << &THandle << &RHandle << &BHandle;
+    setMouseTracking(true);
+    setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
     int timeout = KWindowSystem::compositingActive() ? 200 : 50;
-    QTimer::singleShot( timeout, this, SLOT(init()) );
-    connect( &idleTimer, SIGNAL( timeout() ), this, SLOT( displayHelp() ) );
-    idleTimer.start( 3000 );
+    QTimer::singleShot(timeout, this, SLOT(init()));
+    connect(&idleTimer, SIGNAL(timeout()), this, SLOT(displayHelp()));
+    idleTimer.start(3000);
 }
 
-RegionGrabber::~RegionGrabber()
-{
+RegionGrabber::~RegionGrabber() {
 }
 
-void RegionGrabber::init()
-{
-    pixmap = QPixmap::grabWindow( QApplication::desktop()->winId() );
+void RegionGrabber::init() {
+    pixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
     showFullScreen();
-    resize( pixmap.size() );
+    resize(pixmap.size());
     move(0, 0);
-    setCursor( Qt::CrossCursor );
+    setCursor(Qt::CrossCursor);
 }
 
-void RegionGrabber::displayHelp()
-{
+void RegionGrabber::displayHelp() {
     showHelp = true;
     update();
 }
 
-void RegionGrabber::paintEvent( QPaintEvent* e )
-{
-    Q_UNUSED( e );
-    if ( grabbing ) // grabWindow() should just get the background
+void RegionGrabber::paintEvent(QPaintEvent* e) {
+    Q_UNUSED(e);
+    if (grabbing)   // grabWindow() should just get the background
         return;
 
-    QPainter painter( this );
+    QPainter painter(this);
 
     QPalette pal(QToolTip::palette());
     QFont font = QToolTip::font();
 
-    QColor handleColor = pal.color( QPalette::Active, QPalette::Highlight );
-    handleColor.setAlpha( 160 );
-    QColor overlayColor( 0, 0, 0, 160 );
-    QColor textColor = pal.color( QPalette::Active, QPalette::Text );
-    QColor textBackgroundColor = pal.color( QPalette::Active, QPalette::Base );
+    QColor handleColor = pal.color(QPalette::Active, QPalette::Highlight);
+    handleColor.setAlpha(160);
+    QColor overlayColor(0, 0, 0, 160);
+    QColor textColor = pal.color(QPalette::Active, QPalette::Text);
+    QColor textBackgroundColor = pal.color(QPalette::Active, QPalette::Base);
     painter.drawPixmap(0, 0, pixmap);
     painter.setFont(font);
-    
-    QRect r = selection.normalized().adjusted( 0, 0, -1, -1 );
-    if ( !selection.isNull() )
-    {
-        QRegion grey( rect() );
-        grey = grey.subtracted( r );
-        painter.setPen( handleColor );
-        painter.setBrush( overlayColor );
-        painter.setClipRegion( grey );
-        painter.drawRect( -1, -1, rect().width() + 1, rect().height() + 1 );
-        painter.setClipRect( rect() );
-        painter.setBrush( Qt::NoBrush );
-        painter.drawRect( r );
+
+    QRect r = selection.normalized().adjusted(0, 0, -1, -1);
+    if (!selection.isNull()) {
+        QRegion grey(rect());
+        grey = grey.subtracted(r);
+        painter.setPen(handleColor);
+        painter.setBrush(overlayColor);
+        painter.setClipRegion(grey);
+        painter.drawRect(-1, -1, rect().width() + 1, rect().height() + 1);
+        painter.setClipRect(rect());
+        painter.setBrush(Qt::NoBrush);
+        painter.drawRect(r);
     }
 
-    if ( showHelp )
-    {
-        painter.setPen( textColor );
-        painter.setBrush( textBackgroundColor );
-        QString helpText = i18n( "Select a region using the mouse. To take the snapshot, press the Enter key. Press Esc to quit." );
-        QRect textRect = painter.boundingRect( rect().adjusted( 2, 2, -2, -2 ), Qt::TextWordWrap, helpText );
-        textRect.adjust( -2, -2, 4, 2 );
-        painter.drawRect( textRect );
-        textRect.moveTopLeft( QPoint( 3, 3 ) );
-        painter.drawText( textRect, helpText );
+    if (showHelp) {
+        painter.setPen(textColor);
+        painter.setBrush(textBackgroundColor);
+        QString helpText = i18n("Select a region using the mouse. To take the snapshot, press the Enter key. Press Esc to quit.");
+        QRect textRect = painter.boundingRect(rect().adjusted(2, 2, -2, -2), Qt::TextWordWrap, helpText);
+        textRect.adjust(-2, -2, 4, 2);
+        painter.drawRect(textRect);
+        textRect.moveTopLeft(QPoint(3, 3));
+        painter.drawText(textRect, helpText);
     }
 
-    if ( selection.isNull() )
-    {
+    if (selection.isNull()) {
         return;
     }
 
     // The grabbed region is everything which is covered by the drawn
     // rectangles (border included). This means that there is no 0px
     // selection, since a 0px wide rectangle will always be drawn as a line.
-    QString txt = QString( "%1x%2" ).arg( selection.width() == 0 ? 2 : selection.width() )
-                  .arg( selection.height() == 0 ? 2 : selection.height() );
-    QRect textRect = painter.boundingRect( rect(), Qt::AlignLeft, txt );
-    QRect boundingRect = textRect.adjusted( -4, 0, 0, 0);
-
-    if ( textRect.width() < r.width() - 2*handleSize &&
-         textRect.height() < r.height() - 2*handleSize &&
-         ( r.width() > 100 && r.height() > 100 ) ) // center, unsuitable for small selections
-    {
-        boundingRect.moveCenter( r.center() );
-        textRect.moveCenter( r.center() );
-    }
-    else if ( r.y() - 3 > textRect.height() &&
-              r.x() + textRect.width() < rect().right() ) // on top, left aligned
-    {
-        boundingRect.moveBottomLeft( QPoint( r.x(), r.y() - 3 ) );
-        textRect.moveBottomLeft( QPoint( r.x() + 2, r.y() - 3 ) );
-    }
-    else if ( r.x() - 3 > textRect.width() ) // left, top aligned
-    {
-        boundingRect.moveTopRight( QPoint( r.x() - 3, r.y() ) );
-        textRect.moveTopRight( QPoint( r.x() - 5, r.y() ) );
-    }
-    else if ( r.bottom() + 3 + textRect.height() < rect().bottom() &&
-              r.right() > textRect.width() ) // at bottom, right aligned
-    {
-        boundingRect.moveTopRight( QPoint( r.right(), r.bottom() + 3 ) );
-        textRect.moveTopRight( QPoint( r.right() - 2, r.bottom() + 3 ) );
-    }
-    else if ( r.right() + textRect.width() + 3 < rect().width() ) // right, bottom aligned
-    {
-        boundingRect.moveBottomLeft( QPoint( r.right() + 3, r.bottom() ) );
-        textRect.moveBottomLeft( QPoint( r.right() + 5, r.bottom() ) );
+    QString txt = QString("%1x%2").arg(selection.width() == 0 ? 2 : selection.width())
+                  .arg(selection.height() == 0 ? 2 : selection.height());
+    QRect textRect = painter.boundingRect(rect(), Qt::AlignLeft, txt);
+    QRect boundingRect = textRect.adjusted(-4, 0, 0, 0);
+
+    if (textRect.width() < r.width() - 2*handleSize &&
+            textRect.height() < r.height() - 2*handleSize &&
+            (r.width() > 100 && r.height() > 100)) {  // center, unsuitable for small selections
+        boundingRect.moveCenter(r.center());
+        textRect.moveCenter(r.center());
+    } else if (r.y() - 3 > textRect.height() &&
+               r.x() + textRect.width() < rect().right()) { // on top, left aligned
+        boundingRect.moveBottomLeft(QPoint(r.x(), r.y() - 3));
+        textRect.moveBottomLeft(QPoint(r.x() + 2, r.y() - 3));
+    } else if (r.x() - 3 > textRect.width()) { // left, top aligned
+        boundingRect.moveTopRight(QPoint(r.x() - 3, r.y()));
+        textRect.moveTopRight(QPoint(r.x() - 5, r.y()));
+    } else if (r.bottom() + 3 + textRect.height() < rect().bottom() &&
+               r.right() > textRect.width()) { // at bottom, right aligned
+        boundingRect.moveTopRight(QPoint(r.right(), r.bottom() + 3));
+        textRect.moveTopRight(QPoint(r.right() - 2, r.bottom() + 3));
+    } else if (r.right() + textRect.width() + 3 < rect().width()) { // right, bottom aligned
+        boundingRect.moveBottomLeft(QPoint(r.right() + 3, r.bottom()));
+        textRect.moveBottomLeft(QPoint(r.right() + 5, r.bottom()));
     }
     // if the above didn't catch it, you are running on a very tiny screen...
-    painter.setPen( textColor );
-    painter.setBrush( textBackgroundColor );
-    painter.drawRect( boundingRect );
-    painter.drawText( textRect, txt );
-
-    if ( ( r.height() > handleSize*2 && r.width() > handleSize*2 )
-         || !mouseDown )
-    {
+    painter.setPen(textColor);
+    painter.setBrush(textBackgroundColor);
+    painter.drawRect(boundingRect);
+    painter.drawText(textRect, txt);
+
+    if ((r.height() > handleSize*2 && r.width() > handleSize*2)
+            || !mouseDown) {
         updateHandles();
-        painter.setPen( handleColor );
-        handleColor.setAlpha( 60 );
-        painter.setBrush( handleColor );
-        painter.drawRects( handleMask().rects() );
+        painter.setPen(handleColor);
+        handleColor.setAlpha(60);
+        painter.setBrush(handleColor);
+        painter.drawRects(handleMask().rects());
     }
 }
 
-void RegionGrabber::resizeEvent( QResizeEvent* e )
-{
-    Q_UNUSED( e );
-    if ( selection.isNull() )
+void RegionGrabber::resizeEvent(QResizeEvent* e) {
+    Q_UNUSED(e);
+    if (selection.isNull())
         return;
     QRect r = selection;
-    r.setTopLeft( limitPointToRect( r.topLeft(), rect() ) );
-    r.setBottomRight( limitPointToRect( r.bottomRight(), rect() ) );
-    if ( r.width() <= 1 || r.height() <= 1 ) //this just results in ugly drawing...
+    r.setTopLeft(limitPointToRect(r.topLeft(), rect()));
+    r.setBottomRight(limitPointToRect(r.bottomRight(), rect()));
+    if (r.width() <= 1 || r.height() <= 1)   //this just results in ugly drawing...
         r = QRect();
     selection = r;
 }
 
-void RegionGrabber::mousePressEvent( QMouseEvent* e )
-{
+void RegionGrabber::mousePressEvent(QMouseEvent* e) {
     showHelp = false;
     idleTimer.stop();
-    if ( e->button() == Qt::LeftButton )
-    {
+    if (e->button() == Qt::LeftButton) {
         mouseDown = true;
         dragStartPoint = e->pos();
         selectionBeforeDrag = selection;
-        if ( !selection.contains( e->pos() ) )
-        {
+        if (!selection.contains(e->pos())) {
             newSelection = true;
             selection = QRect();
             showHelp = true;
+        } else {
+            setCursor(Qt::ClosedHandCursor);
         }
-        else
-        {
-            setCursor( Qt::ClosedHandCursor );
-        }
-    }
-    else if ( e->button() == Qt::RightButton )
-    {
+    } else if (e->button() == Qt::RightButton) {
         newSelection = false;
         selection = QRect();
-        setCursor( Qt::CrossCursor );
+        setCursor(Qt::CrossCursor);
     }
     update();
 }
 
-void RegionGrabber::mouseMoveEvent( QMouseEvent* e )
-{
-    if ( mouseDown )
-    {
-        if ( newSelection )
-        {
+void RegionGrabber::mouseMoveEvent(QMouseEvent* e) {
+    if (mouseDown) {
+        if (newSelection) {
             QPoint p = e->pos();
             QRect r = rect();
-            selection = QRect( dragStartPoint, limitPointToRect( p, r ) ).normalized();
-        }
-        else if ( mouseOverHandle == 0 ) // moving the whole selection
-        {
+            selection = QRect(dragStartPoint, limitPointToRect(p, r)).normalized();
+        } else if (mouseOverHandle == 0) { // moving the whole selection
             QRect r = rect().normalized(), s = selectionBeforeDrag.normalized();
             QPoint p = s.topLeft() + e->pos() - dragStartPoint;
-            r.setBottomRight( r.bottomRight() - QPoint( s.width(), s.height() ) );
-            if ( !r.isNull() && r.isValid() )
-                selection.moveTo( limitPointToRect( p, r ) );
-        }
-        else // dragging a handle
-        {
+            r.setBottomRight(r.bottomRight() - QPoint(s.width(), s.height()));
+            if (!r.isNull() && r.isValid())
+                selection.moveTo(limitPointToRect(p, r));
+        } else { // dragging a handle
             QRect r = selectionBeforeDrag;
             QPoint offset = e->pos() - dragStartPoint;
 
-            if ( mouseOverHandle == &TLHandle || mouseOverHandle == &THandle
-                 || mouseOverHandle == &TRHandle ) // dragging one of the top handles
-            {
-                r.setTop( r.top() + offset.y() );
+            if (mouseOverHandle == &TLHandle || mouseOverHandle == &THandle
+                    || mouseOverHandle == &TRHandle) { // dragging one of the top handles
+                r.setTop(r.top() + offset.y());
             }
 
-            if ( mouseOverHandle == &TLHandle || mouseOverHandle == &LHandle
-                 || mouseOverHandle == &BLHandle ) // dragging one of the left handles
-            {
-                r.setLeft( r.left() + offset.x() );
+            if (mouseOverHandle == &TLHandle || mouseOverHandle == &LHandle
+                    || mouseOverHandle == &BLHandle) { // dragging one of the left handles
+                r.setLeft(r.left() + offset.x());
             }
 
-            if ( mouseOverHandle == &BLHandle || mouseOverHandle == &BHandle
-                 || mouseOverHandle == &BRHandle ) // dragging one of the bottom handles
-            {
-                r.setBottom( r.bottom() + offset.y() );
+            if (mouseOverHandle == &BLHandle || mouseOverHandle == &BHandle
+                    || mouseOverHandle == &BRHandle) { // dragging one of the bottom handles
+                r.setBottom(r.bottom() + offset.y());
             }
 
-            if ( mouseOverHandle == &TRHandle || mouseOverHandle == &RHandle
-                 || mouseOverHandle == &BRHandle ) // dragging one of the right handles
-            {
-                r.setRight( r.right() + offset.x() );
+            if (mouseOverHandle == &TRHandle || mouseOverHandle == &RHandle
+                    || mouseOverHandle == &BRHandle) { // dragging one of the right handles
+                r.setRight(r.right() + offset.x());
             }
             r = r.normalized();
-            r.setTopLeft( limitPointToRect( r.topLeft(), rect() ) );
-            r.setBottomRight( limitPointToRect( r.bottomRight(), rect() ) );
+            r.setTopLeft(limitPointToRect(r.topLeft(), rect()));
+            r.setBottomRight(limitPointToRect(r.bottomRight(), rect()));
             selection = r;
         }
         update();
-    }
-    else
-    {
-        if ( selection.isNull() )
+    } else {
+        if (selection.isNull())
             return;
         bool found = false;
-        foreach( QRect* r, handles )
-        {
-            if ( r->contains( e->pos() ) )
-            {
+        foreach(QRect* r, handles) {
+            if (r->contains(e->pos())) {
                 mouseOverHandle = r;
                 found = true;
                 break;
             }
         }
-        if ( !found )
-        {
+        if (!found) {
             mouseOverHandle = 0;
-            if ( selection.contains( e->pos() ) )
-                setCursor( Qt::OpenHandCursor );
+            if (selection.contains(e->pos()))
+                setCursor(Qt::OpenHandCursor);
             else
-                setCursor( Qt::CrossCursor );
-        }
-        else
-        {
-            if ( mouseOverHandle == &TLHandle || mouseOverHandle == &BRHandle )
-                setCursor( Qt::SizeFDiagCursor );
-            if ( mouseOverHandle == &TRHandle || mouseOverHandle == &BLHandle )
-                setCursor( Qt::SizeBDiagCursor );
-            if ( mouseOverHandle == &LHandle || mouseOverHandle == &RHandle )
-                setCursor( Qt::SizeHorCursor );
-            if ( mouseOverHandle == &THandle || mouseOverHandle == &BHandle )
-                setCursor( Qt::SizeVerCursor );
+                setCursor(Qt::CrossCursor);
+        } else {
+            if (mouseOverHandle == &TLHandle || mouseOverHandle == &BRHandle)
+                setCursor(Qt::SizeFDiagCursor);
+            if (mouseOverHandle == &TRHandle || mouseOverHandle == &BLHandle)
+                setCursor(Qt::SizeBDiagCursor);
+            if (mouseOverHandle == &LHandle || mouseOverHandle == &RHandle)
+                setCursor(Qt::SizeHorCursor);
+            if (mouseOverHandle == &THandle || mouseOverHandle == &BHandle)
+                setCursor(Qt::SizeVerCursor);
         }
     }
 }
 
-void RegionGrabber::mouseReleaseEvent( QMouseEvent* e )
-{
+void RegionGrabber::mouseReleaseEvent(QMouseEvent* e) {
     mouseDown = false;
     newSelection = false;
     idleTimer.start();
-    if ( mouseOverHandle == 0 && selection.contains( e->pos() ) )
-        setCursor( Qt::OpenHandCursor );
+    if (mouseOverHandle == 0 && selection.contains(e->pos()))
+        setCursor(Qt::OpenHandCursor);
     update();
 }
 
-void RegionGrabber::mouseDoubleClickEvent( QMouseEvent* )
-{
+void RegionGrabber::mouseDoubleClickEvent(QMouseEvent*) {
     grabRect();
 }
 
-void RegionGrabber::keyPressEvent( QKeyEvent* e )
-{
-    if ( e->key() == Qt::Key_Escape )
-    {
-        emit regionGrabbed( QRect() );
-               close();
-    }
-    else if ( e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return )
-    {
+void RegionGrabber::keyPressEvent(QKeyEvent* e) {
+    if (e->key() == Qt::Key_Escape) {
+        emit regionGrabbed(QRect());
+        close();
+    } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
         grabRect();
-    }
-    else
-    {
+    } else {
         e->ignore();
     }
 }
 
-void RegionGrabber::grabRect()
-{
+void RegionGrabber::grabRect() {
     QRect r = selection.normalized();
-    if ( !r.isNull() && r.isValid() )
-    {
-       grabbing = true;
-        emit regionGrabbed( r );
+    if (!r.isNull() && r.isValid()) {
+        grabbing = true;
+        emit regionGrabbed(r);
     }
-       close();
+    close();
 }
 
-void RegionGrabber::updateHandles()
-{
-    QRect r = selection.normalized().adjusted( 0, 0, -1, -1 );
+void RegionGrabber::updateHandles() {
+    QRect r = selection.normalized().adjusted(0, 0, -1, -1);
     int s2 = handleSize / 2;
 
-    TLHandle.moveTopLeft( r.topLeft() );
-    TRHandle.moveTopRight( r.topRight() );
-    BLHandle.moveBottomLeft( r.bottomLeft() );
-    BRHandle.moveBottomRight( r.bottomRight() );
+    TLHandle.moveTopLeft(r.topLeft());
+    TRHandle.moveTopRight(r.topRight());
+    BLHandle.moveBottomLeft(r.bottomLeft());
+    BRHandle.moveBottomRight(r.bottomRight());
 
-    LHandle.moveTopLeft( QPoint( r.x(), r.y() + r.height() / 2 - s2) );
-    THandle.moveTopLeft( QPoint( r.x() + r.width() / 2 - s2, r.y() ) );
-    RHandle.moveTopRight( QPoint( r.right(), r.y() + r.height() / 2 - s2 ) );
-    BHandle.moveBottomLeft( QPoint( r.x() + r.width() / 2 - s2, r.bottom() ) );
+    LHandle.moveTopLeft(QPoint(r.x(), r.y() + r.height() / 2 - s2));
+    THandle.moveTopLeft(QPoint(r.x() + r.width() / 2 - s2, r.y()));
+    RHandle.moveTopRight(QPoint(r.right(), r.y() + r.height() / 2 - s2));
+    BHandle.moveBottomLeft(QPoint(r.x() + r.width() / 2 - s2, r.bottom()));
 }
 
-QRegion RegionGrabber::handleMask() const
-{
+QRegion RegionGrabber::handleMask() const {
     // note: not normalized QRects are bad here, since they will not be drawn
     QRegion mask;
-    foreach( QRect* rect, handles ) mask += QRegion( *rect );
+    foreach(QRect* rect, handles) mask += QRegion(*rect);
     return mask;
 }
 
-QPoint RegionGrabber::limitPointToRect( const QPoint &p, const QRect &r ) const
-{
+QPoint RegionGrabber::limitPointToRect(const QPoint &p, const QRect &r) const {
     QPoint q;
-    q.setX( p.x() < r.x() ? r.x() : p.x() < r.right() ? p.x() : r.right() );
-    q.setY( p.y() < r.y() ? r.y() : p.y() < r.bottom() ? p.y() : r.bottom() );
+    q.setX(p.x() < r.x() ? r.x() : p.x() < r.right() ? p.x() : r.right());
+    q.setY(p.y() < r.y() ? r.y() : p.y() < r.bottom() ? p.y() : r.bottom());
     return q;
 }
 
index 5de59bcd18de80a1ba8459f7fd1f503004181fe1..1a88277745a3774e3e9fdb120a312c106fc51bfd 100644 (file)
@@ -31,8 +31,7 @@ class QPaintEvent;
 class QResizeEvent;
 class QMouseEvent;
 
-class RegionGrabber : public QWidget
-{
+class RegionGrabber : public QWidget {
     Q_OBJECT
 public:
     RegionGrabber();
@@ -43,19 +42,19 @@ protected slots:
     void displayHelp();
 
 signals:
-    void regionGrabbed( const QRect & );
+    void regionGrabbed(const QRect &);
 
 protected:
-    void paintEvent( QPaintEvent* e );
-    void resizeEvent( QResizeEvent* e );
-    void mousePressEvent( QMouseEvent* e );
-    void mouseMoveEvent( QMouseEvent* e );
-    void mouseReleaseEvent( QMouseEvent* e );
-    void mouseDoubleClickEvent( QMouseEvent* );
-    void keyPressEvent( QKeyEvent* e );
+    void paintEvent(QPaintEvent* e);
+    void resizeEvent(QResizeEvent* e);
+    void mousePressEvent(QMouseEvent* e);
+    void mouseMoveEvent(QMouseEvent* e);
+    void mouseReleaseEvent(QMouseEvent* e);
+    void mouseDoubleClickEvent(QMouseEvent*);
+    void keyPressEvent(QKeyEvent* e);
     void updateHandles();
     QRegion handleMask() const;
-    QPoint limitPointToRect( const QPoint &p, const QRect &r ) const;
+    QPoint limitPointToRect(const QPoint &p, const QRect &r) const;
     void grabRect();
 
     QRect selection;
index f084b5f64768b3872c0e3f39848082978fed51fe..127ee7bfd782b0f94a5c6f7f7573d0751dc94e1d 100644 (file)
@@ -808,7 +808,7 @@ void Render::switchPlay() {
     if (m_mltProducer->get_speed() == 0.0) m_mltProducer->set_speed(1.0);
     else {
         m_isBlocked = true;
-               m_mltProducer->set_speed(0.0);
+        m_mltProducer->set_speed(0.0);
         //m_mltConsumer->set("refresh", 0);
         m_mltProducer->seek((int) m_framePosition);
         m_isBlocked = false;
@@ -1226,9 +1226,9 @@ bool Render::mltEditEffect(int track, GenTime position, QMap <QString, QString>
     QMap<QString, QString>::Iterator it = args.begin();
     if (!args.value("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
         // This is a keyframe effect, to edit it, we remove it and re-add it.
-       bool success = mltRemoveEffect(track, position, index);
+        bool success = mltRemoveEffect(track, position, index);
         if (success) success = mltAddEffect(track, position, args);
-       return success;
+        return success;
     }
 
     // create filter
@@ -1467,39 +1467,37 @@ bool Render::mltMoveClip(int startTrack, int endTrack, int moveStart, int moveEn
         Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
         trackPlaylist.consolidate_blanks(0);
         if (!trackPlaylist.is_blank_at(moveEnd)) {
-                       // error, destination is not empty
+            // error, destination is not empty
             //int ix = trackPlaylist.get_clip_index_at(moveEnd);
-                       mlt_service_unlock(m_mltConsumer->get_service());
-                       m_isBlocked = false;
-                       return false;
+            mlt_service_unlock(m_mltConsumer->get_service());
+            m_isBlocked = false;
+            return false;
+        } else {
+            trackPlaylist.insert_at(moveEnd, clipProducer, 1);
+            trackPlaylist.consolidate_blanks(0);
         }
-               else {
-                       trackPlaylist.insert_at(moveEnd, clipProducer, 1);
-                       trackPlaylist.consolidate_blanks(0);
-               }
         //mlt_service_unlock(service.get_service());
     } else {
         Mlt::Producer destTrackProducer(tractor.track(endTrack));
         Mlt::Playlist destTrackPlaylist((mlt_playlist) destTrackProducer.get_service());
-               if (!destTrackPlaylist.is_blank_at(moveEnd)) {
-                       // error, destination is not empty
-                       mlt_service_unlock(m_mltConsumer->get_service());
-                       m_isBlocked = false;
-                       return false;
-               }
-               else {
-                       Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
-                       trackPlaylist.consolidate_blanks(0);
-                       destTrackPlaylist.consolidate_blanks(1);
-                       destTrackPlaylist.insert_at(moveEnd, clipProducer, 1);
-                       destTrackPlaylist.consolidate_blanks(0);
-               }
+        if (!destTrackPlaylist.is_blank_at(moveEnd)) {
+            // error, destination is not empty
+            mlt_service_unlock(m_mltConsumer->get_service());
+            m_isBlocked = false;
+            return false;
+        } else {
+            Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
+            trackPlaylist.consolidate_blanks(0);
+            destTrackPlaylist.consolidate_blanks(1);
+            destTrackPlaylist.insert_at(moveEnd, clipProducer, 1);
+            destTrackPlaylist.consolidate_blanks(0);
+        }
     }
     mltCheckLength();
     mlt_service_unlock(m_mltConsumer->get_service());
     m_isBlocked = false;
     m_mltConsumer->set("refresh", 1);
-       return true;
+    return true;
 }
 
 void Render::mltMoveTransition(QString type, int startTrack, int newTrack, int newTransitionTrack, GenTime oldIn, GenTime oldOut, GenTime newIn, GenTime newOut) {
@@ -1638,7 +1636,7 @@ void Render::mltDeleteTransition(QString tag, int a_track, int b_track, GenTime
         if (resource == tag && b_track == currentTrack && currentIn <= old_pos && currentOut >= old_pos) {
             //kDebug() << " / / / / /DELETE TRANS DOOOMNE";
             mlt_field_disconnect_service(field->get_field(), nextservice);
-                       mlt_service_close(nextservice);
+            mlt_service_close(nextservice);
             break;
         }
         nextservice = mlt_service_producer(nextservice);
index 4516d1d5b6a1c546055ac1009a646f27b81400b0..73243e0b0f6fc02b14198a294b47d63bcec3c5e8 100644 (file)
@@ -72,7 +72,7 @@ void SmallRuler::mouseMoveEvent(QMouseEvent * event) {
 }
 
 void SmallRuler::slotNewValue(int _value) {
-    m_cursorPosition = (int)(_value ); /// pixelPerMark());
+    m_cursorPosition = (int)(_value);  /// pixelPerMark());
     KRuler::slotNewValue(_value * pixelPerMark());
 }
 
index a94f9436a84bda735eb283a6030ec7f162083ed6..257d182251c548b1aa92aca037c7367681945844 100644 (file)
@@ -461,7 +461,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool videotrack) {
                             }
                         }
                         item->addEffect(clipeffect, false);
-                       item->effectsCounter();
+                        item->effectsCounter();
                     }
                 }