From 49729814a11cec63940d5a4102892bea493333d7 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 1 Oct 2008 01:02:19 +0100 Subject: [PATCH] Slideshow gui enhancements start/stop slideshow button depends on whether slideshow is running (from the start) nav buttons are (as a whole) enabled/disabled based on whether slideshow is running progress bars added to show how far through slide / slideshow changing presentation stops the slideshow --- design/presentation.txt | 2 - kworship/kworship.cpp | 101 ++++++++++++++++++++---- kworship/kworship.h | 18 +++++ kworship/kworshipview_base.ui | 106 ++++++++++++++++++-------- unipresent/kpresenter1/UpKpr1Presentation.cpp | 4 +- 5 files changed, 179 insertions(+), 52 deletions(-) diff --git a/design/presentation.txt b/design/presentation.txt index 198146c..57feaa7 100644 --- a/design/presentation.txt +++ b/design/presentation.txt @@ -28,8 +28,6 @@ notes display screen either fullscreen notes or a simple notes + slide display features - [ ] initialise slideshow running correctly - [ ] disable nav buttons when slideshow not running [ ] disable nav buttons which don't apply [ ] add main actions to menu [ ] start slideshow on clicked slide if not already diff --git a/kworship/kworship.cpp b/kworship/kworship.cpp index 286e8ba..a324c8c 100644 --- a/kworship/kworship.cpp +++ b/kworship/kworship.cpp @@ -81,6 +81,7 @@ kworship::kworship() , m_view(new kworshipView(this)) , m_displayManager(0) , m_presentationManager(new UpManager(this)) +, m_currentPresentation(0) , m_printer(0) { // set up presentation backends @@ -250,25 +251,29 @@ kworship::kworship() slidesToolBar->setIconSize(QSize(32,32)); m_view->layoutSlidesToolbar->layout()->addWidget(slidesToolBar); - KAction* previousSlideAction = new KAction(KIcon("media-skip-backward"), "Previous Slide", slidesToolBar); - connect(previousSlideAction, SIGNAL(triggered(bool)), this, SLOT(presentationPreviousSlide())); - slidesToolBar->addAction(previousSlideAction); + m_slideshowPrevSlideAction = new KAction(KIcon("media-skip-backward"), i18n("Previous Slide"), slidesToolBar); + connect(m_slideshowPrevSlideAction, SIGNAL(triggered(bool)), this, SLOT(presentationPreviousSlide())); + slidesToolBar->addAction(m_slideshowPrevSlideAction); - KAction* previousStepAction = new KAction(KIcon("media-seek-backward"), "Reverse", slidesToolBar); - connect(previousStepAction, SIGNAL(triggered(bool)), this, SLOT(presentationPreviousStep())); - slidesToolBar->addAction(previousStepAction); + m_slideshowPrevStepAction = new KAction(KIcon("media-seek-backward"), i18n("Previous Step"), slidesToolBar); + connect(m_slideshowPrevStepAction, SIGNAL(triggered(bool)), this, SLOT(presentationPreviousStep())); + slidesToolBar->addAction(m_slideshowPrevStepAction); - KAction* nextStepAction = new KAction(KIcon("media-seek-forward"), "Forward", slidesToolBar); - connect(nextStepAction, SIGNAL(triggered(bool)), this, SLOT(presentationNextStep())); - slidesToolBar->addAction(nextStepAction); + m_slideshowNextStepAction = new KAction(KIcon("media-seek-forward"), i18n("Next Step"), slidesToolBar); + connect(m_slideshowNextStepAction, SIGNAL(triggered(bool)), this, SLOT(presentationNextStep())); + slidesToolBar->addAction(m_slideshowNextStepAction); - KAction* nextSlideAction = new KAction(KIcon("media-skip-forward"), "Next Slide", slidesToolBar); - connect(nextSlideAction, SIGNAL(triggered(bool)), this, SLOT(presentationNextSlide())); - slidesToolBar->addAction(nextSlideAction); + m_slideshowNextSlideAction = new KAction(KIcon("media-skip-forward"), i18n("Next Slide"), slidesToolBar); + connect(m_slideshowNextSlideAction, SIGNAL(triggered(bool)), this, SLOT(presentationNextSlide())); + slidesToolBar->addAction(m_slideshowNextSlideAction); - KToggleAction* displaySlideAction = new KToggleAction(KIcon("view-presentation"), "Display Slides", slidesToolBar); - connect(displaySlideAction, SIGNAL(toggled(bool)), this, SLOT(presentationToggled(bool))); - slidesToolBar->addAction(displaySlideAction); + m_slideshowAction = new KToggleAction(KIcon("view-presentation"), i18n("Start/Stop Slideshow"), slidesToolBar); + connect(m_slideshowAction, SIGNAL(toggled(bool)), this, SLOT(presentationToggled(bool))); + slidesToolBar->addAction(m_slideshowAction); + + // Ensure the controls are as when slideshow is stopped + m_slideshowAction->setEnabled(false); + slideshowStopped(); /* * Display startup @@ -494,10 +499,12 @@ void kworship::presentationSelected(int) { m_view->listSlides->setModel(model); m_view->listSlides->setRootIndex(index); + setPresentation(presNode->getItem()); } else { m_view->listSlides->setModel(0); + setPresentation(0); } } @@ -580,4 +587,68 @@ void kworship::slide_doubleClicked(QModelIndex index) } } +// Presentations +void kworship::setPresentation(UpPresentation* presentation) +{ + if (0 != m_currentPresentation) + { + // Stop the slideshow if its running + m_currentPresentation->stopSlideshow(); + disconnect(m_currentPresentation, SIGNAL(slideshowStarted(int)), this, SLOT(slideshowStarted(int))); + disconnect(m_currentPresentation, SIGNAL(slideshowStopped()), this, SLOT(slideshowStopped())); + disconnect(m_currentPresentation, SIGNAL(slideshowSlideChanged(int, int)), this, SLOT(slideshowSlideChanged(int, int))); + disconnect(m_currentPresentation, SIGNAL(slideshowStepChanged(int)), this, SLOT(slideshowStepChanged(int))); + } + m_currentPresentation = presentation; + if (0 != m_currentPresentation) + { + connect(m_currentPresentation, SIGNAL(slideshowStarted(int)), this, SLOT(slideshowStarted(int))); + connect(m_currentPresentation, SIGNAL(slideshowStopped()), this, SLOT(slideshowStopped())); + connect(m_currentPresentation, SIGNAL(slideshowSlideChanged(int, int)), this, SLOT(slideshowSlideChanged(int, int))); + connect(m_currentPresentation, SIGNAL(slideshowStepChanged(int)), this, SLOT(slideshowStepChanged(int))); + if (m_currentPresentation->isSlideshowRunning()) + { + slideshowStarted(m_currentPresentation->numSlidesInSlideshow()); + slideshowSlideChanged(m_currentPresentation->currentSlideshowSlide(), m_currentPresentation->stepsInCurrentSlideshowSlide()); + slideshowStepChanged(m_currentPresentation->currentSlideshowStep()); + } + } + m_slideshowAction->setEnabled(0 != m_currentPresentation); +} + +// From current presentation +void kworship::slideshowStarted(int numSlides) +{ + m_view->progressPresSlides->setMaximum(numSlides); + m_view->progressPresSlides->setVisible(true); + m_slideshowAction->setChecked(true); + m_slideshowPrevSlideAction->setEnabled(true); + m_slideshowPrevStepAction->setEnabled(true); + m_slideshowNextStepAction->setEnabled(true); + m_slideshowNextSlideAction->setEnabled(true); +} + +void kworship::slideshowStopped() +{ + m_view->progressPresSlides->setVisible(false); + m_view->progressPresSteps->setVisible(false); + m_slideshowAction->setChecked(false); + m_slideshowPrevSlideAction->setEnabled(false); + m_slideshowPrevStepAction->setEnabled(false); + m_slideshowNextStepAction->setEnabled(false); + m_slideshowNextSlideAction->setEnabled(false); +} + +void kworship::slideshowSlideChanged(int slide, int numSteps) +{ + m_view->progressPresSlides->setValue(slide + 1); + m_view->progressPresSteps->setMaximum(numSteps); + m_view->progressPresSteps->setVisible(numSteps > 1); +} + +void kworship::slideshowStepChanged(int step) +{ + m_view->progressPresSteps->setValue(step + 1); +} + #include "kworship.moc" diff --git a/kworship/kworship.h b/kworship/kworship.h index 81e4cc6..81805b7 100644 --- a/kworship/kworship.h +++ b/kworship/kworship.h @@ -39,10 +39,13 @@ class KwMediaManager; class KwSongdbModel; class UpManager; +class UpPresentation; class KPrinter; class KToggleAction; class KUrl; +class KAction; +class KToggleAction; class QTreeView; @@ -88,11 +91,20 @@ private slots: void presentationNextStep(); void slide_doubleClicked(QModelIndex); + // From current presentation + void slideshowStarted(int numSlides); + void slideshowStopped(); + void slideshowSlideChanged(int slide, int numSteps); + void slideshowStepChanged(int step); + private: void setupActions(); int getCorrectDisplayScreen(); int getCurrentDisplayScreen(); + // Presentations + void setPresentation(UpPresentation* presentation); + private: Ui::prefs_base ui_prefs_base ; Ui::prefsPresentations_base ui_prefsPresentations_base ; @@ -111,6 +123,12 @@ private: UpManager* m_presentationManager; QTreeView* m_selectPresTree; + KAction* m_slideshowPrevSlideAction; + KAction* m_slideshowPrevStepAction; + KAction* m_slideshowNextStepAction; + KAction* m_slideshowNextSlideAction; + KToggleAction* m_slideshowAction; + UpPresentation* m_currentPresentation; KPrinter *m_printer; KToggleAction* m_mainDisplayAction; diff --git a/kworship/kworshipview_base.ui b/kworship/kworshipview_base.ui index 7a18832..2bfeae4 100644 --- a/kworship/kworshipview_base.ui +++ b/kworship/kworshipview_base.ui @@ -16,39 +16,6 @@ true - - - - false - - - Presentation - - - - - - - - - - - - - QListView::IconMode - - - true - - - - - - - - - - @@ -208,6 +175,9 @@ + searchBible + listBible + dockPresentation @@ -269,6 +239,76 @@ + + + + false + + + Presentation + + + + + + + + + + + + + QListView::IconMode + + + true + + + + + + + + + 2 + + + 1 + + + Slide %v of %m + + + + + + + 3 + + + 1 + + + Step %v of %m + + + + + + + + + + comboPresentations + listSlides + horizontalLayoutWidget + progressPresSteps + labelPresentationStatus + progressPresSlides + horizontalLayoutWidget + + + diff --git a/unipresent/kpresenter1/UpKpr1Presentation.cpp b/unipresent/kpresenter1/UpKpr1Presentation.cpp index 85fdf5f..eee1fe1 100644 --- a/unipresent/kpresenter1/UpKpr1Presentation.cpp +++ b/unipresent/kpresenter1/UpKpr1Presentation.cpp @@ -89,7 +89,7 @@ int UpKpr1Presentation::numSlidesInSlideshow() int UpKpr1Presentation::currentSlideshowSlide() { - return m_dcopView.getCurrentPresPage(); + return m_dcopView.getCurrentPresPage() - 1; } int UpKpr1Presentation::stepsInCurrentSlideshowSlide() @@ -219,7 +219,7 @@ void UpKpr1Presentation::signalChangedSlide(int slide, int step) { slide = m_dcopView.getCurrentPresPage(); } - slideshowSlideChanged(slide, m_dcopView.getPresStepsOfPage()); + slideshowSlideChanged(slide - 1, m_dcopView.getPresStepsOfPage()); signalChangedStep(step); } -- 2.11.4.GIT