[vlmc-devel] MainWorkflow: Use getters of TrackWorkflows instead of accessing directly to m_tracks
Yikai Lu
git at videolan.org
Sat Jul 23 18:13:08 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jul 24 01:06:55 2016 +0900| [52ca2caa635e9b09b007b85ef442951bc1924734] | committer: Yikai Lu
MainWorkflow: Use getters of TrackWorkflows instead of accessing directly to m_tracks
> https://code.videolan.org/videolan/vlmc/commit/52ca2caa635e9b09b007b85ef442951bc1924734
---
src/Workflow/MainWorkflow.cpp | 30 ++++++++++++++++--------------
src/Workflow/MainWorkflow.h | 3 ++-
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 0a8348a..18c7e20 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -85,43 +85,37 @@ MainWorkflow::~MainWorkflow()
qint64
MainWorkflow::getClipPosition( const QUuid& uuid, unsigned int trackId ) const
{
- Q_ASSERT( trackId < m_trackCount );
- return m_tracks[trackId]->getClipPosition( uuid );
+ return track( trackId )->getClipPosition( uuid );
}
void
MainWorkflow::muteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
- Q_ASSERT( trackId < m_trackCount );
- m_tracks[trackId]->mute( true, trackType );
+ track( trackId )->mute( true, trackType );
}
void
MainWorkflow::unmuteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
- Q_ASSERT( trackId < m_trackCount );
- m_tracks[trackId]->mute( false, trackType );
+ track( trackId )->mute( false, trackType );
}
void
MainWorkflow::muteClip( const QUuid& uuid, unsigned int trackId )
{
- Q_ASSERT( trackId < m_trackCount );
- m_tracks[trackId]->muteClip( uuid );
+ track( trackId )->muteClip( uuid );
}
void
MainWorkflow::unmuteClip( const QUuid& uuid, unsigned int trackId )
{
- Q_ASSERT( trackId < m_trackCount );
- m_tracks[trackId]->unmuteClip( uuid );
+ track( trackId )->unmuteClip( uuid );
}
std::shared_ptr<Clip>
MainWorkflow::clip( const QUuid &uuid, unsigned int trackId )
{
- Q_ASSERT( trackId < m_trackCount );
- return m_tracks[trackId]->clip( uuid );
+ return track( trackId )->clip( uuid );
}
void
@@ -367,7 +361,7 @@ MainWorkflow::preSave()
QVariantList l;
for ( int i = 0; i < maxTrackId + 1; ++i )
- l << m_tracks[i]->toVariant();
+ l << track( i )->toVariant();
m_settings->value( "tracks" )->set( l );
}
@@ -377,11 +371,19 @@ MainWorkflow::postLoad()
{
QVariantList l = m_settings->value( "tracks" )->get().toList();
for ( int i = 0; i < l.size(); ++i )
- m_tracks[i]->loadFromVariant( l[i] );
+ track( i )->loadFromVariant( l[i] );
}
TrackWorkflow*
MainWorkflow::track( quint32 trackId )
{
+ Q_ASSERT( trackId < m_trackCount );
+ return m_tracks[ trackId ];
+}
+
+TrackWorkflow*
+MainWorkflow::track( quint32 trackId ) const
+{
+ Q_ASSERT( trackId < m_trackCount );
return m_tracks[ trackId ];
}
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index c21580c..52fee83 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -124,7 +124,8 @@ class MainWorkflow : public QObject
*/
bool contains( const QUuid& uuid ) const;
- TrackWorkflow *track( quint32 trackId );
+ TrackWorkflow* track( quint32 trackId );
+ TrackWorkflow* track( quint32 trackId ) const;
/**
* \brief Return the number of track for each track type.
More information about the Vlmc-devel
mailing list