[vlc-devel] [PATCH 2/5] Added GUI for subtitle sync in the "Track synchronization" window
Pascal Thomet
pthomet at gmail.com
Mon Jun 9 21:00:24 CEST 2014
* 4 buttons were added : "bookmark audio" / "bookmark subtitle"
"sync subtitle" / "reset sync"
* Those buttons are shown only for *file subtitles* (DVD and DVB are not concerned)
* Added tooltips that explain subtitle sync
---
modules/gui/macosx/TrackSynchronization.m | 17 +++++-
modules/gui/qt4/components/extended_panels.cpp | 76 +++++++++++++++++++++++++-
modules/gui/qt4/components/extended_panels.hpp | 4 ++
3 files changed, 94 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/TrackSynchronization.m b/modules/gui/macosx/TrackSynchronization.m
index c0b8f3c..a5ddce3 100644
--- a/modules/gui/macosx/TrackSynchronization.m
+++ b/modules/gui/macosx/TrackSynchronization.m
@@ -65,7 +65,22 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
[o_sv_lbl setStringValue: _NS("Subtitles/Video")];
[o_sv_advance_lbl setStringValue: _NS("Subtitle track synchronization:")];
[[o_sv_advance_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("s")]];
- [o_sv_advance_value_fld setToolTip: _NS("A positive value means that the subtitles are ahead of the video")];
+ [o_sv_advance_value_fld setToolTip:
+ _NS(
+ "A positive value means that the subtitles are ahead of the video\n"
+ "\n"\
+ "In order to set the subtitle track synchronization delay easily, \n"\
+ "you can use the hotkeys :\n"\
+ "\n"\
+ "* Shift-H (audio bookmark)\n"\
+ "* Shift-J (subtitle bookmark) \n"\
+ "* Shift-K (sync bookmarks)\n"\
+ "\n"\
+ "(Command-Shift-K resets the delay)\n"\
+ "\n"\
+ "(Use these hotkeys directly on the video)\n"
+ )
+ ];
[o_sv_speed_lbl setStringValue: _NS("Subtitle speed:")];
[[o_sv_speed_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("fps")]];
[o_sv_dur_lbl setStringValue: _NS("Subtitle duration factor:")];
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index 84d16ae..1f36d60 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -1446,9 +1446,12 @@ void SyncWidget::setValue( double d )
SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
QWidget( _parent ) , p_intf( _p_intf )
{
- QGroupBox *AVBox, *subsBox;
+ QGroupBox *AVBox, *subsBox, *subsVisualSyncBox;
QToolButton *updateButton;
+ int isfilesub = var_GetInteger( THEMIM->getInput(), "sub-isfilesub" );
+
+
b_userAction = true;
QGridLayout *mainLayout = new QGridLayout( this );
@@ -1472,10 +1475,29 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
QLabel *subsLabel = new QLabel;
subsLabel->setText( qtr( "Subtitle track synchronization:" ) );
subsLayout->addWidget( subsLabel, 0, 0, 1, 1 );
-
subsSpin = new SyncWidget( this );
subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
+ QString subsSpin_Tooltip = qtr(
+ "A positive value means that the subtitles are ahead of the video\n"
+ "\n"\
+ "In order to set the subtitle track synchronization delay easily, \n"\
+ "you can use the hotkeys :\n"\
+ "\n"\
+ "* Shift-H (audio bookmark)\n"\
+ "* Shift-J (subtitle bookmark) \n"\
+ "* Shift-K (sync bookmarks)\n"\
+ "\n"\
+ "(Control-Shift-K resets the delay)\n"\
+ "\n"\
+ "(Use these hotkeys directly on the video)\n"
+ );
+ if (isfilesub)
+ {
+ subsSpin->setToolTip(subsSpin_Tooltip);
+ subsLabel->setToolTip(subsSpin_Tooltip);
+ }
+
QLabel *subSpeedLabel = new QLabel;
subSpeedLabel->setText( qtr( "Subtitle speed:" ) );
subsLayout->addWidget( subSpeedLabel, 1, 0, 1, 1 );
@@ -1505,6 +1527,35 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
mainLayout->addWidget( subsBox, 2, 0, 2, 5 );
+ /* Subs Visual Sync*/
+ if (isfilesub)
+ {
+ subsVisualSyncBox = new QGroupBox( qtr( "Subtitles Visual Sync" ) );
+ QGridLayout *subsVisualSyncLayout = new QGridLayout( subsVisualSyncBox );
+
+ QPushButton *buttonBookmarkAudio = new QPushButton(_("Bookmark audio"));
+ buttonBookmarkAudio->setToolTip(_("You can also use Shift-H on the video"));
+ subsVisualSyncLayout->addWidget( buttonBookmarkAudio, 0, 0, 1, 1 );
+ CONNECT( buttonBookmarkAudio, pressed(), this, bookmarkAudio() ) ;
+
+ QPushButton *buttonBookmarkSubtitle = new QPushButton(_("Bookmark subtitle"));
+ buttonBookmarkSubtitle->setToolTip(_("You can also use Shift-J on the video"));
+ subsVisualSyncLayout->addWidget( buttonBookmarkSubtitle, 0, 1, 1, 1 );
+ CONNECT( buttonBookmarkSubtitle, pressed(), this, bookmarkSubtitle() ) ;
+
+ QPushButton *buttonBookmarkSync = new QPushButton(_("Sync subtitles"));
+ buttonBookmarkSync->setToolTip(_("You can also use Shift-K on the video"));
+ subsVisualSyncLayout->addWidget( buttonBookmarkSync, 0, 2, 1, 1 );
+ CONNECT( buttonBookmarkSync, pressed(), this, syncBookmarks() ) ;
+
+ QPushButton *buttonBookmarkResetSync = new QPushButton(_("Reset Sync"));
+ buttonBookmarkResetSync->setToolTip(_("You can also use Ctrl-Shift-K on the video"));
+ subsVisualSyncLayout->addWidget( buttonBookmarkResetSync, 0, 3, 1, 1 );
+ CONNECT( buttonBookmarkResetSync, pressed(), this, resetSync() ) ;
+
+ mainLayout->addWidget( subsVisualSyncBox, 4, 0, 1, 5 );
+ }
+
updateButton = new QToolButton;
updateButton->setAutoRaise( true );
mainLayout->addWidget( updateButton, 0, 4, 1, 1 );
@@ -1594,6 +1645,27 @@ void SyncControls::adjustSubsDuration( double f_factor )
}
}
+void SyncControls::bookmarkAudio()
+{
+ var_SetInteger( THEMIM->getInput(), "sub-bookmarkaudio", 0 );
+
+}
+void SyncControls::bookmarkSubtitle()
+{
+ var_SetInteger( THEMIM->getInput(), "sub-bookmarksubtitle", 0 );
+}
+void SyncControls::syncBookmarks()
+{
+ var_SetInteger( THEMIM->getInput(), "sub-syncbookmarks", 0 );
+ update();
+}
+void SyncControls::resetSync()
+{
+ var_SetInteger( THEMIM->getInput(), "sub-syncreset", 0 );
+ update();
+}
+
+
void SyncControls::initSubsDuration()
{
int i_mode = var_InheritInteger( p_intf, SUBSDELAY_CFG_MODE );
diff --git a/modules/gui/qt4/components/extended_panels.hpp b/modules/gui/qt4/components/extended_panels.hpp
index 770f558..0eb3fc6 100644
--- a/modules/gui/qt4/components/extended_panels.hpp
+++ b/modules/gui/qt4/components/extended_panels.hpp
@@ -242,6 +242,10 @@ private slots:
void advanceSubs( double );
void adjustSubsSpeed( double );
void adjustSubsDuration( double );
+ void bookmarkAudio();
+ void bookmarkSubtitle();
+ void syncBookmarks();
+ void resetSync();
};
#endif
--
1.9.1
More information about the vlc-devel
mailing list