[vlmc-devel] Remove the current QtGUI timeline entirely

Yikai Lu git at videolan.org
Sun Jul 10 18:03:26 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul  9 19:41:23 2016 +0900| [25a20751607f6ecbf4be731d6f20086034bb0515] | committer: Yikai Lu

Remove the current QtGUI timeline entirely

> https://code.videolan.org/videolan/vlmc/commit/25a20751607f6ecbf4be731d6f20086034bb0515
---

 src/CMakeLists.txt            |  13 -----
 src/Gui/MainWindow.cpp        |  11 ----
 src/Gui/timeline/Timeline.cpp | 132 ------------------------------------------
 src/Gui/timeline/Timeline.h   |  30 ++--------
 4 files changed, 5 insertions(+), 181 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9beff24..556d085 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -181,23 +181,11 @@ ELSE(NOT WITH_GUI)
         Gui/settings/PreferenceWidget.cpp
         Gui/settings/SettingsDialog.cpp
         Gui/settings/StringWidget.cpp
-        Gui/timeline/AbstractGraphicsItem.cpp
-        Gui/timeline/AbstractGraphicsMediaItem.cpp
-        Gui/timeline/GraphicsAudioItem.cpp
-        Gui/timeline/GraphicsCursorItem.cpp
-        Gui/timeline/GraphicsEffectItem.cpp
-        Gui/timeline/GraphicsMovieItem.cpp
-        Gui/timeline/GraphicsTrack.cpp
         Gui/timeline/Timeline.cpp
-        Gui/timeline/TracksControls.cpp
-        Gui/timeline/TracksRuler.cpp
-        Gui/timeline/TracksScene.cpp
-        Gui/timeline/TracksView.cpp
         Gui/widgets/ExtendedLabel.cpp
         Gui/widgets/FramelessButton.cpp
         Gui/widgets/NotificationZone.cpp
         Gui/widgets/SearchLineEdit.cpp
-        Gui/widgets/TrackControls.cpp
         Gui/wizard/GeneralPage.cpp
         Gui/wizard/OpenPage.cpp
         Gui/wizard/ProjectWizard.cpp
@@ -228,7 +216,6 @@ ELSE(NOT WITH_GUI)
         Gui/ui/MainWindow.ui
         Gui/ui/Timeline.ui
         Gui/ui/WorkflowFileRendererDialog.ui
-        Gui/widgets/ui/TrackControls.ui
         Gui/widgets/ui/NotificationZone.ui
         Gui/wizard/ui/GeneralPage.ui
         Gui/wizard/ui/OpenPage.ui
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index eb7cfba..28b5ec9 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -58,7 +58,6 @@
 #include "widgets/NotificationZone.h"
 #include "preview/PreviewWidget.h"
 #include "timeline/Timeline.h"
-#include "timeline/TracksView.h"
 
 /* Settings / Preferences */
 #include "Project/RecentProjects.h"
@@ -94,16 +93,6 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
     setupCrashTester();
 #endif
 
-    // Zoom
-    connect( m_zoomSlider, SIGNAL( valueChanged( int ) ),
-             m_timeline, SLOT( changeZoom( int ) ) );
-    connect( m_timeline->tracksView(), SIGNAL( zoomIn() ),
-             this, SLOT( zoomIn() ) );
-    connect( m_timeline->tracksView(), SIGNAL( zoomOut() ),
-             this, SLOT( zoomOut() ) );
-    connect( this, SIGNAL( toolChanged( ToolButtons ) ),
-             m_timeline, SLOT( setTool( ToolButtons ) ) );
-
     connect( Core::instance()->project(), SIGNAL( projectNameChanged(QString) ),
              this, SLOT( projectNameChanged( QString ) ) );
     connect( Core::instance()->project(), SIGNAL( outdatedBackupFileFound() ),
diff --git a/src/Gui/timeline/Timeline.cpp b/src/Gui/timeline/Timeline.cpp
index ffd2c77..e6f310b 100644
--- a/src/Gui/timeline/Timeline.cpp
+++ b/src/Gui/timeline/Timeline.cpp
@@ -25,10 +25,6 @@
 #include "Project/Project.h"
 #include "Main/Core.h"
 #include "Media/Clip.h"
-#include "TracksView.h"
-#include "TracksScene.h"
-#include "TracksControls.h"
-#include "TracksRuler.h"
 #include "Workflow/MainWorkflow.h"
 #include "Tools/VlmcDebug.h"
 #include "Renderer/AbstractRenderer.h"
@@ -40,137 +36,9 @@ Timeline*   Timeline::m_instance = nullptr;
 
 Timeline::Timeline( QWidget *parent )
     : QWidget( parent )
-    , m_tracksView( nullptr )
-    , m_tracksScene( nullptr )
-    , m_tracksRuler( nullptr )
-    , m_tracksControls( nullptr )
-    , m_scale( 1.0 )
 {
-    Q_ASSERT( m_instance == nullptr );
-    m_instance = this;
-    m_ui.setupUi( this );
-
-    m_tracksScene = new TracksScene( this );
-    m_mainWorkflow = Core::instance()->workflow();
-    initialize();
 }
 
 Timeline::~Timeline()
 {
 }
-
-void
-Timeline::changeEvent( QEvent *e )
-{
-    switch ( e->type() )
-    {
-    case QEvent::LanguageChange:
-        m_ui.retranslateUi( this );
-        break;
-    default:
-        break;
-    }
-}
-
-void
-Timeline::initialize()
-{
-    delete m_tracksControls;
-    delete m_tracksRuler;
-    delete m_tracksView;
-
-    m_tracksView = new TracksView( m_tracksScene, m_mainWorkflow, nullptr, m_ui.tracksFrame );
-    m_tracksView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
-    m_tracksView->scale(1, 1);
-
-    QHBoxLayout* tracksViewLayout = new QHBoxLayout();
-    tracksViewLayout->setContentsMargins( 0, 0, 0, 0 );
-    m_ui.tracksFrame->setLayout( tracksViewLayout );
-    tracksViewLayout->addWidget( m_tracksView );
-
-    m_tracksRuler = new TracksRuler( tracksView(), this );
-    QHBoxLayout* tracksRulerLayout = new QHBoxLayout();
-    tracksRulerLayout->setContentsMargins( 0, 0, 0, 0 );
-    m_ui.rulerFrame->setLayout( tracksRulerLayout );
-    tracksRulerLayout->addWidget( m_tracksRuler );
-
-    m_tracksControls = new TracksControls( this );
-    QHBoxLayout* tracksControlsLayout = new QHBoxLayout();
-    tracksControlsLayout->setContentsMargins( 0, 0, 0, 0 );
-    m_ui.controlsFrame->setLayout( tracksControlsLayout );
-    tracksControlsLayout->addWidget( m_tracksControls );
-
-    changeZoom( 10 );
-    setDuration( 0 );
-
-    // Scroll
-    connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged(int) ),
-             m_tracksRuler, SLOT( moveRuler(int) ) );
-    connect( m_tracksView->verticalScrollBar(), SIGNAL( valueChanged(int) ),
-             m_tracksControls->verticalScrollBar(), SLOT( setValue(int) ) );
-    connect( m_tracksControls->verticalScrollBar(), SIGNAL( valueChanged(int) ),
-             m_tracksView->verticalScrollBar(), SLOT( setValue(int) ) );
-
-    // Project duration change
-    connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
-
-    // Clear / reset
-    connect( m_mainWorkflow, SIGNAL( cleared() ), m_tracksControls, SLOT( clear() ) );
-    connect( m_mainWorkflow, SIGNAL( cleared() ), tracksView(), SLOT( clear() ) );
-
-    // Tracks controls
-    connect( m_tracksView, SIGNAL( videoTrackAdded(GraphicsTrack*) ),
-             m_tracksControls, SLOT( addVideoTrack(GraphicsTrack*) ) );
-    connect( m_tracksView, SIGNAL( audioTrackAdded(GraphicsTrack*) ),
-             m_tracksControls, SLOT( addAudioTrack(GraphicsTrack*) ) );
-    connect( m_tracksView, SIGNAL( videoTrackRemoved() ),
-             m_tracksControls, SLOT( removeVideoTrack() ) );
-    connect( m_tracksView, SIGNAL( audioTrackRemoved() ),
-             m_tracksControls, SLOT( removeAudioTrack() ) );
-
-    auto renderer = Core::instance()->workflow()->renderer();
-
-    // Cursor position updates
-    connect( m_tracksView->tracksCursor(), &GraphicsCursorItem::cursorPositionChanged,
-             renderer, &AbstractRenderer::setPosition );
-
-    m_tracksView->createLayout();
-
-
-    // Frames updates
-    connect( renderer, &AbstractRenderer::frameChanged,
-             m_tracksView->tracksCursor(), &GraphicsCursorItem::frameChanged,
-             Qt::QueuedConnection );
-    connect( renderer, SIGNAL( frameChanged(qint64,Vlmc::FrameChangedReason) ),
-             m_tracksRuler, SLOT( update() ) );
-    connect( m_tracksRuler, &TracksRuler::frameChanged,
-             renderer, &AbstractRenderer::setPosition );
-}
-
-void
-Timeline::clear()
-{
-    // The main workflow will ask the GUI to clear itself.
-    m_mainWorkflow->clear();
-}
-
-void
-Timeline::changeZoom( int factor )
-{
-    m_tracksRuler->setPixelPerMark( factor );
-    m_scale = (double) FRAME_SIZE / m_tracksRuler->comboScale[factor];
-    m_tracksView->setScale( m_scale );
-}
-
-void
-Timeline::setDuration( int duration )
-{
-    m_tracksView->setDuration( duration );
-    m_tracksRuler->setDuration( duration );
-}
-
-void
-Timeline::setTool( ToolButtons button )
-{
-    tracksView()->setTool( button );
-}
diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index e1ffd8b..abbe0ef 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -45,51 +45,31 @@ class Timeline : public QWidget
 public:
     explicit Timeline( QWidget *parent = 0 );
     virtual ~Timeline();
-    /// Return a pointer to the TracksView instance.
-    TracksView*         tracksView() { return m_tracksView; }
-    /// Returns a const pointer to the TracksView instance
-    const TracksView*   tracksView() const { return m_tracksView; }
-    /// Return a pointer to the TracksScene instance.
-    TracksScene*        tracksScene() { return m_tracksScene; }
-    /// Return a pointer to the TracksRuler instance.
-    TracksRuler*        tracksRuler() { return m_tracksRuler; }
-    /// Return a pointer to the Timeline instance (singleton).
-    static Timeline*    instance() { return m_instance; }
 
 public slots:
     /**
      * \brief Asks the workflow to clear itself.
      */
-    void clear();
+    void clear() {}
     /**
      * \brief Change the zoom level for all widgets of the timeline.
      * \param factor The zoom factor.
      */
-    void changeZoom( int factor );
+    void changeZoom( int factor ) {}
     /**
      * \brief Change the duration of the project.
      * \param duration Duration in frames.
      */
-    void setDuration( int duration );
+    void setDuration( int duration ) {}
     /**
      * \brief Change the currently selected tool.
      */
-    void setTool( ToolButtons button );
+    void setTool( ToolButtons button ) {}
 
 protected:
-    virtual void changeEvent( QEvent *e );
+    virtual void changeEvent( QEvent *e ) {}
 
 private:
-    void                initialize();
-
-private:
-    Ui::Timeline        m_ui;
-    TracksView*         m_tracksView;
-    TracksScene*        m_tracksScene;
-    TracksRuler*        m_tracksRuler;
-    TracksControls*     m_tracksControls;
-    double              m_scale;
-    MainWorkflow*       m_mainWorkflow;
     static Timeline*    m_instance;
 };
 



More information about the Vlmc-devel mailing list