Commit 48205b9f authored by luyikei's avatar luyikei

Implement TransitionsListView

parent 4fc8e2f0
......@@ -173,6 +173,7 @@ vlmc_SOURCES += \
src/Gui/effectsengine/EffectsListView.cpp \
src/Gui/effectsengine/EffectStack.cpp \
src/Gui/effectsengine/EffectWidget.cpp \
src/Gui/transition/TransitionsListView.cpp \
src/Gui/export/RendererSettings.cpp \
src/Gui/export/ShareOnInternet.cpp \
src/Gui/import/TagWidget.cpp \
......@@ -319,6 +320,7 @@ nodist_vlmc_SOURCES += \
src/Gui/media/ClipMetadataDisplayer.moc.cpp \
src/Gui/effectsengine/EffectWidget.moc.cpp \
src/Gui/effectsengine/EffectInstanceWidget.moc.cpp \
src/Gui/transition/TransitionsListView.moc.cpp \
src/Gui/preview/LCDTimecode.moc.cpp \
src/Gui/effectsengine/EffectStack.moc.cpp \
src/Gui/wizard/firstlaunch/WorkspaceLocation.moc.cpp \
......@@ -402,6 +404,7 @@ vlmc_QML = \
src/Gui/library/ui/ClipItem.qml \
src/Gui/effectsengine/Effect.qml \
src/Gui/effectsengine/EffectsListView.qml \
src/Gui/transition/TransitionsListView.qml \
$(NULL)
EXTRA_DIST += $(vlmc_QML)
......
......@@ -56,6 +56,7 @@
/* Widgets */
#include "effectsengine/EffectsListView.h"
#include "transition/TransitionsListView.h"
#include "library/MediaLibraryView.h"
#include "library/ClipLibraryView.h"
#include "preview/PreviewWidget.h"
......@@ -178,6 +179,7 @@ MainWindow::retranslateUi()
{
m_dockedUndoView->setWindowTitle( tr( "History" ) );
m_dockedEffectsList->setWindowTitle( tr( "Effects List" ) );
m_dockedTransitionsList->setWindowTitle( tr( "Transitions List" ) );
m_dockedMediaLibrary->setWindowTitle( tr( "Media Library" ) );
m_dockedClipLibrary->setWindowTitle( tr( "Clip Library" ) );
m_dockedClipPreview->setWindowTitle( tr( "Clip Preview" ) );
......@@ -482,6 +484,7 @@ MainWindow::initializeDockWidgets()
setupLibrary();
setupEffectsList();
setupTransitionsList();
setupClipPreview();
setupProjectPreview();
setupUndoRedoWidget();
......@@ -508,6 +511,13 @@ MainWindow::setupEffectsList()
m_dockedEffectsList = dockWidget( m_effectsList->container(), Qt::TopDockWidgetArea );
}
void
MainWindow::setupTransitionsList()
{
m_transitionsList = new TransitionsListView( this );
m_dockedTransitionsList = dockWidget( m_transitionsList->container(), Qt::TopDockWidgetArea );
}
void
MainWindow::setupLibrary()
{
......
......@@ -37,6 +37,7 @@ class QProgressBar;
#include "ui/MainWindow.h"
class EffectsListView;
class TransitionsListView;
class ClipLibraryView;
class MediaLibraryView;
class PreviewWidget;
......@@ -88,6 +89,7 @@ private:
void setupClipPreview();
void setupProjectPreview();
void setupEffectsList();
void setupTransitionsList();
void setupUndoRedoWidget();
void retranslateUi();
#ifdef WITH_CRASHBUTTON
......@@ -132,9 +134,11 @@ private:
MediaLibraryView* m_mediaLibrary;
ClipLibraryView* m_clipLibrary;
EffectsListView* m_effectsList;
TransitionsListView* m_transitionsList;
QUndoView* m_undoView;
QDockWidget* m_dockedUndoView;
QDockWidget* m_dockedEffectsList;
QDockWidget* m_dockedTransitionsList;
QDockWidget* m_dockedClipLibrary;
QDockWidget* m_dockedMediaLibrary;
QDockWidget* m_dockedClipPreview;
......
#include "TransitionsListView.h"
#include "Backend/IBackend.h"
#include "Backend/IInfo.h"
#include "Backend/ITransition.h"
#include <QWidget>
#include <QJsonObject>
#include <QQuickView>
#include <QQmlContext>
#include <QDrag>
#include <QMimeData>
TransitionsListView::TransitionsListView( QWidget* parent )
: QObject( parent )
{
setObjectName( QStringLiteral( "TransitionsListView" ) );
auto view = new QQuickView;
m_container = QWidget::createWindowContainer( view, parent );
m_container->setMinimumSize( 100, 1 );
m_container->setObjectName( objectName() );
view->rootContext()->setContextProperty( QStringLiteral( "view" ), this );
view->setSource( QUrl( QStringLiteral( "qrc:/QML/TransitionsListView.qml" ) ) );
view->setResizeMode( QQuickView::SizeRootObjectToView );
}
TransitionsListView::~TransitionsListView()
{
}
QWidget*
TransitionsListView::container()
{
return m_container;
}
QJsonArray
TransitionsListView::transitions()
{
QJsonArray array;
for ( auto p : Backend::instance()->availableTransitions() )
{
auto info = p.second;
QJsonObject jInfo;
jInfo[QStringLiteral( "identifier" )] = QString::fromStdString( info->identifier() );
jInfo[QStringLiteral( "name" )] = QString::fromStdString( info->name() );
jInfo[QStringLiteral( "description" )] = QString::fromStdString( info->description() );
jInfo[QStringLiteral( "author" )] = QString::fromStdString( info->author() );
array.append( jInfo );
}
return array;
}
void
TransitionsListView::startDrag( const QString& transitionId )
{
QDrag* drag = new QDrag( this );
QMimeData* mimeData = new QMimeData;
mimeData->setData( QStringLiteral( "vlmc/transition_id" ), transitionId.toUtf8() );
drag->setMimeData( mimeData );
drag->exec();
}
#ifndef TRANSITIONSLISTVIEW_H
#define TRANSITIONSLISTVIEW_H
#include <QObject>
#include <QJsonArray>
class TransitionsListView : public QObject
{
Q_OBJECT
Q_DISABLE_COPY( TransitionsListView )
public:
explicit TransitionsListView( QWidget* parent = 0);
virtual ~TransitionsListView();
QWidget* container();
Q_INVOKABLE
QJsonArray transitions();
public slots:
void startDrag( const QString& transitionId );
private:
QWidget* m_container;
};
#endif // TRANSITIONSLISTVIEW_H
import QtQuick 2.0
import QtQuick.Controls 1.4
Rectangle {
anchors.fill: parent
color: "#999999"
ListModel {
id: transitionsList
}
Component.onCompleted: {
var transitionsInfo = view.transitions();
for ( var i = 0; i < transitionsInfo.length; ++i ) {
transitionsList.append( transitionsInfo[i] );
}
}
ScrollView {
id: sView
height: parent.height
width: parent.width
ListView {
width: sView.viewport.width
model: transitionsList
delegate: Effect {
width: sView.viewport.width
identifier: model.identifier
name: model.name
description: model.description
}
}
}
}
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