Author: kitone
Date: Fri Apr 17 17:17:10 2015
New Revision: 911
URL: http://svn.gna.org/viewcvs/subtitleeditor?rev=911&view=rev
Log:
Fix bug #20170 : Video/Timing
Added:
trunk/plugins/actions/timingfromplayer/dialog-timing-from-player-preferences.ui
(with props)
Modified:
trunk/ChangeLog
trunk/plugins/actions/timingfromplayer/Makefile.am
trunk/plugins/actions/timingfromplayer/timingfromplayer.cc
trunk/po/POTFILES.in
Modified: trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/ChangeLog?rev=911&r1=910&r2=911&view=diff
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Fri Apr 17 17:17:10 2015
@@ -1,3 +1,9 @@
+2015-04-17 kitone <[email protected]>
+
+ * plugins/actions/timingfromplayer/Makefile.am:
+ * plugins/actions/timingfromplayer/timingfromplayer.cc:
+ Fix bug #20170 : "Video"/"Timing from player" with an offset
+
2015-04-17 kitone <[email protected]>
*
plugins/actions/externalvideoplayer/dialog-external-video-player-preferences.ui:
Modified: trunk/plugins/actions/timingfromplayer/Makefile.am
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/actions/timingfromplayer/Makefile.am?rev=911&r1=910&r2=911&view=diff
==============================================================================
--- trunk/plugins/actions/timingfromplayer/Makefile.am (original)
+++ trunk/plugins/actions/timingfromplayer/Makefile.am Fri Apr 17 17:17:10 2015
@@ -1,10 +1,15 @@
+plugin_name = timingfromplayer
pluginlibdir = $(PACKAGE_PLUGIN_LIB_DIR)/actions
plugindescriptiondir = $(PACKAGE_PLUGIN_DESCRIPTION_DIR)/actions
+actionplugindevdir = $(abs_srcdir)
+uidir = $(PACKAGE_PLUGIN_SHARE_DIR)/$(plugin_name)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/src \
- $(SUBTITLEEDITOR_CFLAGS)
+ $(SUBTITLEEDITOR_CFLAGS) \
+ -DSE_PLUGIN_PATH_DEV=\"$(actionplugindevdir)\" \
+ -DSE_PLUGIN_PATH_UI=\"$(uidir)\"
pluginlib_LTLIBRARIES = \
libtimingfromplayer.la
@@ -20,6 +25,8 @@
@INTLTOOL_SE_PLUGIN_RULE@
-EXTRA_DIST = $(plugindescription_in_files)
+ui_DATA = dialog-timing-from-player-preferences.ui
+
+EXTRA_DIST = $(plugindescription_in_files) $(ui_DATA)
CLEANFILES = $(plugindescription_DATA) Makefile.am~ *.cc~ *.h~ *.in~
Added:
trunk/plugins/actions/timingfromplayer/dialog-timing-from-player-preferences.ui
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/actions/timingfromplayer/dialog-timing-from-player-preferences.ui?rev=911&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
trunk/plugins/actions/timingfromplayer/dialog-timing-from-player-preferences.ui
------------------------------------------------------------------------------
svn:mime-type = application/xml
Modified: trunk/plugins/actions/timingfromplayer/timingfromplayer.cc
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/actions/timingfromplayer/timingfromplayer.cc?rev=911&r1=910&r2=911&view=diff
==============================================================================
--- trunk/plugins/actions/timingfromplayer/timingfromplayer.cc (original)
+++ trunk/plugins/actions/timingfromplayer/timingfromplayer.cc Fri Apr 17
17:17:10 2015
@@ -4,7 +4,7 @@
* http://home.gna.org/subtitleeditor/
* https://gna.org/projects/subtitleeditor/
*
- * Copyright @ 2005-2011, kitone
+ * Copyright @ 2005-2015, kitone
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,38 @@
#include <i18n.h>
#include <debug.h>
#include <player.h>
+#include <utility.h>
+#include <gtkmm_utility.h>
+#include <widget_config_utility.h>
+
+/*
+ */
+class DialogTimingFromPlayerPreferences : public Gtk::Dialog
+{
+public:
+ DialogTimingFromPlayerPreferences(BaseObjectType *cobject, const
Glib::RefPtr<Gtk::Builder>& xml)
+ :Gtk::Dialog(cobject)
+ {
+ xml->get_widget("spin-offset", m_spinOffset);
+ widget_config::read_config_and_connect(m_spinOffset,
"timing-from-player", "offset");
+
+ utility::set_transient_parent(*this);
+ }
+
+ static void create()
+ {
+ std::auto_ptr<DialogTimingFromPlayerPreferences> dialog(
+
gtkmm_utility::get_widget_derived<DialogTimingFromPlayerPreferences>(
+ SE_DEV_VALUE(SE_PLUGIN_PATH_UI,
SE_PLUGIN_PATH_DEV),
+
"dialog-timing-from-player-preferences.ui",
+
"dialog-timing-from-player-preferences"));
+
+ dialog->run();
+ }
+
+protected:
+ Gtk::SpinButton* m_spinOffset;
+};
/*
* Actions to set time from the current player position.
@@ -111,6 +143,13 @@
_("Use only one key to set beginning of
the subtitle when the key "
"is pressed and the end when
the key is released.")),
sigc::mem_fun(*this,
&TimingFromPlayer::set_subtitle_start_and_end_with_one_key));
+
+ // preferences
+ action_group->add(
+ Gtk::Action::create(
+ "timing-from-player/preferences",
+ Gtk::Stock::PREFERENCES),
+ sigc::mem_fun(*this,
&TimingFromPlayer::create_configure_dialog));
// ui
Glib::RefPtr<Gtk::UIManager> ui = get_ui_manager();
@@ -133,6 +172,8 @@
" <menuitem
action='timing-from-player/set-subtitle-end-and-next'/>"
" <separator />"
" <menuitem
action='timing-from-player/set-subtitle-start-and-end-with-one-key'/>"
+ " <separator />"
+ " <menuitem
action='timing-from-player/preferences'/>"
" </menu>"
" </placeholder>"
" </menu>"
@@ -182,6 +223,20 @@
SET_SENSITIVE("timing-from-player/set-subtitle-start-and-end-with-one-key",
has_media && has_doc);
#undef SET_SENSITIVE
+ }
+
+ /*
+ */
+ bool is_configurable()
+ {
+ return true;
+ }
+
+ /*
+ */
+ void create_configure_dialog()
+ {
+ DialogTimingFromPlayerPreferences::create();
}
/*
@@ -231,6 +286,8 @@
return false;
SubtitleTime pos =
get_subtitleeditor_window()->get_player()->get_position();
+ // Apply offset coorection
+ pos = pos - get_prefered_offset();
SubtitleTime dur = sub.get_duration();
// Start recording
@@ -350,6 +407,14 @@
return true;
}
+ /*
+ */
+ SubtitleTime get_prefered_offset()
+ {
+ int offset = 0;
+ get_config().get_value_int("timing-from-player", "offset",
offset);
+ return SubtitleTime(offset);
+ }
protected:
Gtk::UIManager::ui_merge_id ui_id;
Glib::RefPtr<Gtk::ActionGroup> action_group;
Modified: trunk/po/POTFILES.in
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/po/POTFILES.in?rev=911&r1=910&r2=911&view=diff
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Fri Apr 17 17:17:10 2015
@@ -84,6 +84,7 @@
plugins/actions/textcorrection/taskspage.h
plugins/actions/textcorrection/textcorrection.cc
plugins/actions/timemodemanagement/timemodemanagement.cc
+plugins/actions/timingfromplayer/dialog-timing-from-player-preferences.ui
plugins/actions/timingfromplayer/timingfromplayer.cc
plugins/actions/typewriter/typewriter.cc
plugins/actions/videoplayermanagement/videoplayermanagement.cc
_______________________________________________
Subtitleeditor-commits mailing list
[email protected]
https://mail.gna.org/listinfo/subtitleeditor-commits