[vlmc-devel] commit: TrackControl: Allow a track to be renamed. ( 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:02:05 2010 +0200| [ab02e700225534fcc3a871916926ef5d33765d1f] | committer: Hugo Beauzée-Luyssen
TrackControl: Allow a track to be renamed.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=ab02e700225534fcc3a871916926ef5d33765d1f
---
src/Gui/widgets/TrackControls.cpp | 29 ++++++++++++++++++++++++-----
src/Gui/widgets/TrackControls.h | 3 ++-
src/Gui/widgets/ui/TrackControls.ui | 11 +++++++++--
3 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/src/Gui/widgets/TrackControls.cpp b/src/Gui/widgets/TrackControls.cpp
index f145119..53b001d 100644
--- a/src/Gui/widgets/TrackControls.cpp
+++ b/src/Gui/widgets/TrackControls.cpp
@@ -20,18 +20,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include <QIcon>
#include "GraphicsTrack.h"
#include "TrackControls.h"
+
#include "ui_TrackControls.h"
+#include <QIcon>
+#include <QInputDialog>
+
TrackControls::TrackControls( GraphicsTrack* track, QWidget *parent ) :
- QWidget( parent ), m_ui( new Ui::TrackControls ), m_track( track )
+ QWidget( parent ),
+ m_ui( new Ui::TrackControls ),
+ m_track( track )
{
m_ui->setupUi( this );
setTrackDisabled( !m_track->isEnabled() );
connect( m_ui->disableButton, SIGNAL( clicked(bool) ),
this, SLOT( setTrackDisabled(bool) ) );
+ connect( m_ui->trackLabel, SIGNAL( doubleClicked() ),
+ this, SLOT( trackNameDoubleClicked() ) );
updateTextLabels();
}
@@ -40,7 +47,8 @@ TrackControls::~TrackControls()
delete m_ui;
}
-void TrackControls::updateTextLabels()
+void
+TrackControls::updateTextLabels()
{
if ( m_track->mediaType() == Workflow::VideoTrack )
m_ui->trackLabel->setText( tr( "Video #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
@@ -48,7 +56,8 @@ void TrackControls::updateTextLabels()
m_ui->trackLabel->setText( tr( "Audio #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
}
-void TrackControls::changeEvent( QEvent *e )
+void
+TrackControls::changeEvent( QEvent *e )
{
QWidget::changeEvent( e );
switch ( e->type() ) {
@@ -61,7 +70,8 @@ void TrackControls::changeEvent( QEvent *e )
}
}
-void TrackControls::setTrackDisabled( bool disable )
+void
+TrackControls::setTrackDisabled( bool disable )
{
m_track->setTrackEnabled( !disable );
if ( !disable )
@@ -79,3 +89,12 @@ void TrackControls::setTrackDisabled( bool disable )
m_ui->disableButton->setIcon( QIcon( ":/images/hpoff" ) );
}
}
+
+void
+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 );
+}
diff --git a/src/Gui/widgets/TrackControls.h b/src/Gui/widgets/TrackControls.h
index 8a7c4b1..8889bfd 100644
--- a/src/Gui/widgets/TrackControls.h
+++ b/src/Gui/widgets/TrackControls.h
@@ -42,7 +42,8 @@ protected:
void changeEvent( QEvent *e );
private slots:
- void setTrackDisabled( bool disable );
+ void setTrackDisabled( bool disable );
+ void trackNameDoubleClicked();
private:
void updateTextLabels();
diff --git a/src/Gui/widgets/ui/TrackControls.ui b/src/Gui/widgets/ui/TrackControls.ui
index b69f34e..f115c1a 100644
--- a/src/Gui/widgets/ui/TrackControls.ui
+++ b/src/Gui/widgets/ui/TrackControls.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>104</width>
- <height>19</height>
+ <height>22</height>
</rect>
</property>
<property name="sizePolicy">
@@ -52,7 +52,7 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="trackLabel">
+ <widget class="ExtendedLabel" name="trackLabel">
<property name="text">
<string>TextLabel</string>
</property>
@@ -60,6 +60,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>ExtendedLabel</class>
+ <extends>QLabel</extends>
+ <header>ExtendedLabel.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
More information about the Vlmc-devel
mailing list