1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file UpKpr1Presentation.cpp
22 * @brief KPresenter 1 presentation.
23 * @author James Hogan <james@albanarts.com>
26 #include "UpKpr1Presentation.h"
27 #include "UpKpr1Slide.h"
28 #include "UpKpr1Backend.h"
31 * Constructors + destructor
34 /// Primary constructor.
35 UpKpr1Presentation::UpKpr1Presentation(const UpKpr1PresentationDcop
& dcop
, const UpKpr1ViewDcop
& dcopView
, UpKpr1Backend
* parent
)
36 : UpPresentation(parent
, parent
)
38 , m_dcopView(dcopView
)
41 Q_ASSERT(m_dcopView
.isValid());
45 UpKpr1Presentation::~UpKpr1Presentation()
53 void UpKpr1Presentation::close()
57 QUrl
UpKpr1Presentation::url() const
66 QString
UpKpr1Presentation::currentSlideshow()
71 QStringList
UpKpr1Presentation::slideshows()
73 return QStringList() << "All slides";
76 void UpKpr1Presentation::setSlideshow(QString slideshow
)
80 int UpKpr1Presentation::numSlides()
82 return m_dcop
.numPages();
85 UpSlide
* UpKpr1Presentation::slide(int index
)
87 return new UpKpr1Slide(this, m_dcop
.slide(index
), index
);
94 bool UpKpr1Presentation::isSlideshowRunning()
96 return m_dcopView
.getCurrentPresPage() != -1;
99 int UpKpr1Presentation::numSlidesInSlideshow()
101 return m_dcopView
.getNumPresPages();
104 int UpKpr1Presentation::currentSlideshowSlide()
106 return m_dcopView
.getCurrentPresPage() - 1;
109 int UpKpr1Presentation::stepsInCurrentSlideshowSlide()
111 return m_dcopView
.getPresStepsOfPage();
114 int UpKpr1Presentation::currentSlideshowStep()
116 return m_dcopView
.getCurrentPresStep();
123 void UpKpr1Presentation::startSlideshow()
125 m_dcopView
.screenStartFromFirst();
126 slideshowStarted(m_dcopView
.getNumPresPages());
127 signalChangedSlide();
130 void UpKpr1Presentation::stopSlideshow()
132 m_dcopView
.screenStop();
136 void UpKpr1Presentation::goToSlide(int index
)
138 m_dcopView
.gotoPresPage(index
+1);
139 signalChangedSlide();
142 void UpKpr1Presentation::previousSlide()
144 int newPage
= m_dcopView
.getCurrentPresPage() - 1;
147 m_dcopView
.gotoPresPage(newPage
);
148 signalChangedSlide();
152 void UpKpr1Presentation::nextSlide()
154 int presPages
= m_dcopView
.getNumPresPages();
155 int newPage
= m_dcopView
.getCurrentPresPage() + 1;
156 if (newPage
<= presPages
)
158 m_dcopView
.gotoPresPage(newPage
);
159 signalChangedSlide(newPage
);
163 void UpKpr1Presentation::previousStep()
165 int slide
= m_dcopView
.getCurrentPresPage();
166 m_dcopView
.screenPrev();
167 int newSlide
= m_dcopView
.getCurrentPresPage();
168 if (slide
!= newSlide
)
170 signalChangedSlide(newSlide
);
178 void UpKpr1Presentation::nextStep()
180 // don't go past the end of the slideshow
182 int steps
= m_dcopView
.getPresStepsOfPage();
183 int step
= m_dcopView
.getCurrentPresStep();
185 if (step
== steps
- 1)
187 int pages
= m_dcopView
.getNumPresPages();
188 page
= m_dcopView
.getCurrentPresPage();
196 m_dcopView
.screenNext();
197 int newSlide
= m_dcopView
.getCurrentPresPage();
198 if (page
!= newSlide
)
200 signalChangedSlide(newSlide
);
210 * Backend specific interface.
213 /// Get the dcop interface.
214 UpKpr1PresentationDcop
UpKpr1Presentation::dcop() const
219 /// Get the dcop view interface.
220 UpKpr1ViewDcop
UpKpr1Presentation::dcopView() const
229 /// Signal that the slide has changed.
230 void UpKpr1Presentation::signalChangedSlide(int slide
, int step
)
234 slide
= m_dcopView
.getCurrentPresPage();
236 slideshowSlideChanged(slide
- 1, m_dcopView
.getPresStepsOfPage());
237 signalChangedStep(step
);
240 /// Signal that the step has changed.
241 void UpKpr1Presentation::signalChangedStep(int step
)
245 step
= m_dcopView
.getCurrentPresStep();
247 slideshowStepChanged(step
);
251 #include "UpKpr1Presentation.moc"