Implemented goToSlide for kpresenter1
[kworship.git] / unipresent / kpresenter1 / UpKpr1Presentation.cpp
blob94d2bf57fd51da0e61fefa46eaf7355c89bbf0a2
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
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 3 of the License, or *
8 * (at your option) any later version. *
9 * *
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. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
19 /**
20 * @file UpKpr1Presentation.cpp
21 * @brief KPresenter 1 presentation.
22 * @author James Hogan <james@albanarts.com>
25 #include "UpKpr1Presentation.h"
26 #include "UpKpr1Slide.h"
29 * Constructors + destructor
32 /// Primary constructor.
33 UpKpr1Presentation::UpKpr1Presentation(const UpKpr1PresentationDcop& dcop, QObject* parent)
34 : UpPresentation(parent)
35 , m_dcop(dcop)
36 , m_url(dcop.url())
40 /// Destructor.
41 UpKpr1Presentation::~UpKpr1Presentation()
46 * Main interface
49 void UpKpr1Presentation::close()
53 QUrl UpKpr1Presentation::url() const
55 return m_url;
59 * Slides
62 int UpKpr1Presentation::numSlides()
64 return m_dcop.numSlides();
67 UpSlide* UpKpr1Presentation::slide(int index)
69 return new UpKpr1Slide(m_dcop.slide(index), this);
73 * Slideshow control
76 void UpKpr1Presentation::startSlideshow()
78 UpKpr1Dcop view = m_dcop.view();
79 if (view.isValid())
81 view.eval(QStringList() << "screenStart()");
85 void UpKpr1Presentation::stopSlideshow()
87 UpKpr1Dcop view = m_dcop.view();
88 if (view.isValid())
90 view.eval(QStringList() << "screenStop()");
94 void UpKpr1Presentation::goToSlide(int index)
96 UpKpr1Dcop view = m_dcop.view();
97 if (view.isValid())
99 QString num;
100 num.setNum(index + 1);
101 // Warning: An out of range argument kills kpresenter
102 view.eval(QStringList() << "gotoPresPage(int)" << num);
106 #include "UpKpr1Presentation.moc"