Commit d11d4df8 authored by luyikei's avatar luyikei

Use the QML Timeline

parent 9ac67fe9
......@@ -17,7 +17,7 @@ find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
# go on with other packages
if(WITH_GUI)
find_package(Qt5 COMPONENTS Widgets Gui Network)
find_package(Qt5 COMPONENTS Widgets Gui Network Qml Quick)
else()
find_package(Qt5 COMPONENTS Network)
endif()
......@@ -109,7 +109,10 @@ ELSE (WIN32)
LIST( APPEND VLMC_SRCS Main/vlmc.cpp )
ENDIF(WIN32)
SET(VLMC_RCC ../resources.qrc)
SET(VLMC_RCC
../resources.qrc
../src/Gui/timeline/resources-timeline.qrc
)
IF (WIN32)
LIST( APPEND VLMC_RCC ../resources/styles.qrc )
......@@ -275,7 +278,7 @@ ELSE(NOT WITH_GUI)
ADD_EXECUTABLE( vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS} )
TARGET_LINK_LIBRARIES( vlmc ${VLMC_LIBS} )
if (NOT Qt4_FOUND)
qt5_use_modules(vlmc Core Gui Widgets Network)
qt5_use_modules(vlmc Core Gui Widgets Network Qml Quick)
else()
# We need to know the target for this one, which is not the case when doing most of the QT4/5 specific stuff.
# We could hide this command in qt_use_modules macro, but this would be some kind of black magic uglyness
......
......@@ -33,6 +33,7 @@
#include <QUrl>
#include <QNetworkProxy>
#include <QSysInfo>
#include <QScrollArea>
#include "Main/Core.h"
#include "Project/Project.h"
#include "Library/Library.h"
......@@ -415,10 +416,8 @@ MainWindow::createStatusBar()
void
MainWindow::initializeDockWidgets()
{
m_timeline = new Timeline;
m_timeline->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_timeline->show();
setCentralWidget( m_timeline );
m_timeline = new Timeline( this );
setCentralWidget( m_timeline->container() );
m_importController = new ImportController();
......
......@@ -22,23 +22,28 @@
#include "Timeline.h"
#include "Project/Project.h"
#include "Main/Core.h"
#include "Media/Clip.h"
#include "Workflow/MainWorkflow.h"
#include "Tools/VlmcDebug.h"
#include "Renderer/AbstractRenderer.h"
#include <QHBoxLayout>
#include <QScrollBar>
#include <QtQuick/QQuickView>
#include <QUrl>
Timeline* Timeline::m_instance = nullptr;
Timeline::Timeline( QWidget *parent )
: QWidget( parent )
: QObject( parent )
, m_view( new QQuickView )
, m_container( QWidget::createWindowContainer( m_view, parent ) )
{
m_container->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_container->setFocusPolicy( Qt::TabFocus );
m_view->setSource( QUrl( QStringLiteral( "qrc:/QML/main.qml" ) ) );
}
Timeline::~Timeline()
{
delete m_view;
}
QWidget*
Timeline::container()
{
return m_container;
}
......@@ -28,17 +28,12 @@
#include "ui_Timeline.h"
#include "Workflow/Types.h"
class MainWorkflow;
class Project;
class TracksScene;
class TracksView;
class TracksControls;
class TracksRuler;
class QQuickView;
/**
* \brief Entry point of the timeline widget.
*/
class Timeline : public QWidget
class Timeline : public QObject
{
Q_OBJECT
Q_DISABLE_COPY( Timeline )
......@@ -46,6 +41,8 @@ public:
explicit Timeline( QWidget *parent = 0 );
virtual ~Timeline();
QWidget* container();
public slots:
/**
* \brief Asks the workflow to clear itself.
......@@ -55,22 +52,24 @@ public slots:
* \brief Change the zoom level for all widgets of the timeline.
* \param factor The zoom factor.
*/
void changeZoom( int factor ) {}
void changeZoom( int factor ) { Q_UNUSED( factor ) }
/**
* \brief Change the duration of the project.
* \param duration Duration in frames.
*/
void setDuration( int duration ) {}
void setDuration( int duration ) { Q_UNUSED( duration ) }
/**
* \brief Change the currently selected tool.
*/
void setTool( ToolButtons button ) {}
void setTool( ToolButtons button ) { Q_UNUSED( button ) }
protected:
virtual void changeEvent( QEvent *e ) {}
virtual void changeEvent( QEvent *e ) { Q_UNUSED( e ) }
private:
static Timeline* m_instance;
QQuickView* m_view;
QWidget* m_container;
};
#endif // TIMELINE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment