[vlmc-devel] commit: TracksControl: Saving track names ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Tue Aug 24 22:24:13 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Aug 24 22:23:45 2010 +0200| [d4774bc1c536f43baa206049d382096eaf8be537] | committer: Hugo Beauzée-Luyssen
TracksControl: Saving track names
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=d4774bc1c536f43baa206049d382096eaf8be537
---
src/Gui/widgets/TrackControls.cpp | 33 ++++++++++++++++++++++++++++++---
src/Gui/widgets/TrackControls.h | 11 +++++++----
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/src/Gui/widgets/TrackControls.cpp b/src/Gui/widgets/TrackControls.cpp
index 53b001d..b325d91 100644
--- a/src/Gui/widgets/TrackControls.cpp
+++ b/src/Gui/widgets/TrackControls.cpp
@@ -25,14 +25,23 @@
#include "ui_TrackControls.h"
+#include <QDesktopServices>
#include <QIcon>
#include <QInputDialog>
+#include <QSettings>
TrackControls::TrackControls( GraphicsTrack* track, QWidget *parent ) :
QWidget( parent ),
m_ui( new Ui::TrackControls ),
m_track( track )
{
+ QSettings s( QSettings::UserScope, qApp->organizationName(), "timeline" );
+ if ( track->mediaType() == Workflow::VideoTrack &&
+ s.contains( "video" + QString::number( track->trackNumber() ) ) )
+ m_title = s.value( "video" + QString::number( track->trackNumber() ) ).toString();
+ else if ( track->mediaType() == Workflow::AudioTrack &&
+ s.contains( "audio" + QString::number( track->trackNumber() ) ) )
+ m_title = s.value( "audio" + QString::number( track->trackNumber() ) ).toString();
m_ui->setupUi( this );
setTrackDisabled( !m_track->isEnabled() );
connect( m_ui->disableButton, SIGNAL( clicked(bool) ),
@@ -51,9 +60,19 @@ void
TrackControls::updateTextLabels()
{
if ( m_track->mediaType() == Workflow::VideoTrack )
- m_ui->trackLabel->setText( tr( "Video #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
+ {
+ if ( m_title.isEmpty() == true )
+ m_ui->trackLabel->setText( tr( "Video #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
+ else
+ m_ui->trackLabel->setText( m_title );
+ }
else if ( m_track->mediaType() == Workflow::AudioTrack )
- m_ui->trackLabel->setText( tr( "Audio #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
+ {
+ if ( m_title.isEmpty() )
+ m_ui->trackLabel->setText( tr( "Audio #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
+ else
+ m_ui->trackLabel->setText( m_title );
+ }
}
void
@@ -96,5 +115,13 @@ TrackControls::trackNameDoubleClicked()
QString name = QInputDialog::getText( NULL, tr( "Rename track" ),
tr( "Enter the track new name") );
if ( name.isEmpty() == false )
- m_ui->trackLabel->setText( name );
+ {
+ QSettings s( QSettings::UserScope, qApp->organizationName(), "timeline" );
+ m_title = name;
+ if ( m_track->mediaType() == Workflow::VideoTrack )
+ s.setValue("video" + QString::number( m_track->trackNumber() ), name );
+ else
+ s.setValue("audio" + QString::number( m_track->trackNumber() ), name );
+ updateTextLabels();
+ }
}
diff --git a/src/Gui/widgets/TrackControls.h b/src/Gui/widgets/TrackControls.h
index 8889bfd..03d9003 100644
--- a/src/Gui/widgets/TrackControls.h
+++ b/src/Gui/widgets/TrackControls.h
@@ -39,16 +39,19 @@ public:
~TrackControls();
protected:
- void changeEvent( QEvent *e );
+ void changeEvent( QEvent *e );
private slots:
void setTrackDisabled( bool disable );
void trackNameDoubleClicked();
private:
- void updateTextLabels();
- Ui::TrackControls *m_ui;
- GraphicsTrack* m_track;
+ void updateTextLabels();
+
+private:
+ Ui::TrackControls *m_ui;
+ GraphicsTrack *m_track;
+ QString m_title;
};
#endif // TRACKCONTROLS_H
More information about the Vlmc-devel
mailing list