diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 01:49:13 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 01:49:13 +0000 |
| commit | 8b5ac2ae58d3857d98b4e6d12b95be8430a1ca50 (patch) | |
| tree | 4f33be9a9c63a682f461661085bd7fa35c33eb67 /src/svg-view-slideshow.cpp | |
| parent | Inkview: Some more refactoring (diff) | |
| download | inkscape-8b5ac2ae58d3857d98b4e6d12b95be8430a1ca50.tar.gz inkscape-8b5ac2ae58d3857d98b4e6d12b95be8430a1ca50.zip | |
Inkview: Finally implement the -t or --timer option after we dragged it around for over 10 years without implementation
(bzr r15690.1.10)
Diffstat (limited to 'src/svg-view-slideshow.cpp')
| -rw-r--r-- | src/svg-view-slideshow.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp index f9a392d3e..00552130d 100644 --- a/src/svg-view-slideshow.cpp +++ b/src/svg-view-slideshow.cpp @@ -29,6 +29,8 @@ # include "config.h" #endif +#include <glibmm/main.h> + #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> #include <gtkmm/image.h> @@ -44,15 +46,14 @@ -SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides) - : - _slides(slides), - _current(0), - _doc(SPDocument::createNewDoc(_slides[0].c_str(), true, false)), - _view(NULL), - is_fullscreen(false), - _timer(0), - _ctrlwin(NULL) +SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, int timer) + : _slides(slides) + , _current(0) + , _doc(SPDocument::createNewDoc(_slides[0].c_str(), true, false)) + , _timer(timer) + , _view(NULL) + , _ctrlwin(NULL) + , is_fullscreen(false) { update_title(); @@ -72,6 +73,10 @@ SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides) add(*Glib::wrap(_view)); show(); + + if(_timer) { + Glib::signal_timeout().connect_seconds(sigc::mem_fun(*this, &timer_callback), _timer); + } } @@ -240,6 +245,18 @@ void SPSlideShow::goto_last() normal_cursor(); } +bool SPSlideShow::timer_callback() +{ + show_next(); + + // stop the timer if the last slide is reached + if (_current == _slides.size()-1) { + return false; + } else { + return true; + } +} + bool SPSlideShow::ctrlwin_delete (GdkEventAny */*event*/) { if(_ctrlwin) delete _ctrlwin; |
