[vlmc-devel] Timeline: Apply the new fps if it's changed by Project's settings
Yikai Lu
git at videolan.org
Thu Jul 28 14:39:14 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed Jul 27 12:46:13 2016 +0900| [8edb932f86536ad556cc6ba940d37ab4f0ec7dfe] | committer: Yikai Lu
Timeline: Apply the new fps if it's changed by Project's settings
> https://code.videolan.org/videolan/vlmc/commit/8edb932f86536ad556cc6ba940d37ab4f0ec7dfe
---
src/Gui/timeline/main.qml | 5 +++++
src/Main/Core.cpp | 1 +
src/Project/Project.cpp | 4 +---
src/Project/Project.h | 1 +
src/Workflow/MainWorkflow.cpp | 7 +++++++
src/Workflow/MainWorkflow.h | 4 ++++
6 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/Gui/timeline/main.qml b/src/Gui/timeline/main.qml
index 7a50c2f..95e8aca 100644
--- a/src/Gui/timeline/main.qml
+++ b/src/Gui/timeline/main.qml
@@ -514,6 +514,11 @@ Rectangle {
Connections {
target: workflow
+
+ onFpsChanged: {
+ page.fps = fps;
+ }
+
onLengthChanged: {
if ( page.length < length ) {
page.length = length;
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index da822f2..9529d3a 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -58,6 +58,7 @@ Core::Core()
QObject::connect( m_currentProject, &Project::projectLoaded, m_recentProjects, &RecentProjects::projectLoaded );
QObject::connect( m_currentProject, &Project::projectClosed, m_library, &Library::clear );
QObject::connect( m_currentProject, &Project::projectClosed, m_workflow, &MainWorkflow::clear );
+ QObject::connect( m_currentProject, &Project::fpsChanged, m_workflow, &MainWorkflow::fpsChanged );
m_timer.start();
}
diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index 2f19542..555d6a1 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -217,9 +217,7 @@ Project::initSettings()
QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ),
SettingValue::NotEmpty );
connect( pName, SIGNAL( changed( QVariant ) ), this, SLOT( projectNameChanged( QVariant ) ) );
- connect( fps, &SettingValue::changed, this,
- [this]( const QVariant& var ){ Backend::instance()->profile().setFrameRate( var.toDouble() * 100, 100 ); }
- );
+ connect( fps, &SettingValue::changed, this, [this]( const QVariant& var ){ emit fpsChanged( var.toDouble() ); } );
}
void
diff --git a/src/Project/Project.h b/src/Project/Project.h
index f69c72c..f1b514e 100644
--- a/src/Project/Project.h
+++ b/src/Project/Project.h
@@ -124,6 +124,7 @@ class Project : public QObject
void projectClosed();
void backupProjectLoaded();
void outdatedBackupFileFound();
+ void fpsChanged( double fps );
private:
QFile* m_projectFile;
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index c122c69..41caab8 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -132,6 +132,13 @@ MainWorkflow::setPosition( qint64 newFrame )
m_renderer->setPosition( newFrame );
}
+void
+MainWorkflow::setFps( double fps )
+{
+ Backend::instance()->profile().setFrameRate( fps * 100, 100 );
+ emit fpsChanged( fps );
+}
+
AbstractRenderer*
MainWorkflow::renderer()
{
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index ed8b389..f7a5400 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -206,6 +206,8 @@ class MainWorkflow : public QObject
void setPosition( qint64 newFrame );
+ void setFps( double fps );
+
signals:
/**
* \brief Used to notify a change to the timeline and preview widget cursor
@@ -239,6 +241,8 @@ class MainWorkflow : public QObject
*/
void lengthChanged( qint64 length );
+ void fpsChanged( double fps );
+
void clipAdded( const QString& uuid );
void clipResized( const QString& uuid );
void clipRemoved( const QString& uuid );
More information about the Vlmc-devel
mailing list