diff options
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp | 38 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.h | 182 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 69 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.h | 27 |
4 files changed, 162 insertions, 154 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp index be00e675..30f94e32 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp @@ -1,6 +1,6 @@ #include "PrintWidget.h" -PrintWidget::PrintWidget(QWidget *parent) : QGraphicsView(parent), scene(0), curPage(1), +PrintWidget::PrintWidget(QWidget *parent) : QGraphicsView(parent), scene(0), curPage(1), viewMode(SinglePageView), zoomMode(FitInView), zoomFactor(1), initialized(false), fitting(true) { this->setMouseTracking(true); @@ -101,9 +101,10 @@ void PrintWidget::setVisible(bool visible) { } void PrintWidget::setCurrentPage(int pageNumber) { + if(pageNumber < 0 || pageNumber > (pages.count()+1) ){ return; } + publicPageNum = pageNumber; //publicly requested page number (+/- 1 from actual page range) if(pageNumber < 1 || pageNumber > pages.count()) return; - int lastPage = curPage; curPage = pageNumber; @@ -132,8 +133,8 @@ void PrintWidget::generatePreview() { populateScene(); // i.e. setPreviewPrintedPictures() e.l. layoutPages(); curPage = qBound(1, curPage, pages.count()); - if (fitting) - fit(); + publicPageNum = curPage; + if (fitting){ fit(); } } void PrintWidget::layoutPages() { @@ -145,22 +146,22 @@ void PrintWidget::layoutPages() { int cols = 1; // singleMode and default if (viewMode == AllPagesView) { cols = ((pictures->value(0)).width() > (pictures->value(0)).height()) ? qFloor(qSqrt(numPages)) : qCeil(qSqrt(numPages)); - cols += cols % 2; // Nicer with an even number of cols - } else if (viewMode == FacingPagesView) { + cols += cols % 2; // Nicer with an even number of cols + } else if (viewMode == FacingPagesView) { cols = 2; - numPagePlaces += 1; - } + numPagePlaces += 1; + } int rows = qCeil(double(numPagePlaces) / cols); - double itemWidth = pages.at(0)->boundingRect().width(); - double itemHeight = pages.at(0)->boundingRect().height(); - int pageNum = 1; for (int i = 0; i < rows && pageNum <= numPages; i++) { - for (int j = 0; j < cols && pageNum <= numPages; j++) { + double itemWidth = pages.at(0)->boundingRect().width(); + double itemHeight = pages.at(0)->boundingRect().height(); + int pageNum = 1; for (int i = 0; i < rows && pageNum <= numPages; i++) { + for (int j = 0; j < cols && pageNum <= numPages; j++) { if (!i && !j && viewMode == FacingPagesView) { - continue; - } else { - pages.at(pageNum-1)->setPos(QPointF(j*itemWidth, i*itemHeight)); - pageNum++; + continue; + } else { + pages.at(pageNum-1)->setPos(QPointF(j*itemWidth, i*itemHeight)); + pageNum++; } } } @@ -180,7 +181,7 @@ void PrintWidget::populateScene() qDebug() << "Image paperSize" << paperSize; for (int i = 0; i < numPages; i++) { - PageItem* item = new PageItem(i+1, (*pictures)[i], paperSize); + PageItem* item = new PageItem(i+1, (*pictures)[i].scaled( paperSize, Qt::KeepAspectRatio, Qt::SmoothTransformation), paperSize); scene->addItem(item); pages.append(item); } @@ -194,6 +195,7 @@ void PrintWidget::updateCurrentPage() { int newPage = calcCurrentPage(); if (newPage != curPage) { curPage = newPage; + publicPageNum = curPage; } } @@ -272,7 +274,7 @@ void PrintWidget::fit(bool doFitting) { void PrintWidget::setPictures(QHash<int, QImage> *hash) { pictures = hash; -} +} void PrintWidget::setOrientation(QPageLayout::Orientation ori) { this->orientation = ori; diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h index 62543e45..f18f8ace 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h @@ -20,26 +20,62 @@ #include <QtMath> #include <QPageLayout> -namespace { -class PageItem : public QGraphicsItem -{ +class PageItem : public QGraphicsItem { public: - PageItem(int _pageNum, const QImage _pagePicture, QSize _paperSize) - : pageNum(_pageNum), pagePicture(_pagePicture), - paperSize(_paperSize) - { - brect = QRectF(QPointF(-25, -25), - QSizeF(paperSize)+QSizeF(50, 50)); - setCacheMode(DeviceCoordinateCache); - } - - QRectF boundingRect() const Q_DECL_OVERRIDE - { return brect; } - - inline int pageNumber() const - { return pageNum; } + PageItem(int _pageNum, const QImage _pagePicture, QSize _paperSize) + : pageNum(_pageNum), pagePicture(_pagePicture), paperSize(_paperSize) + { + brect = QRectF(QPointF(-25, -25), + QSizeF(paperSize)+QSizeF(50, 50)); + setCacheMode(DeviceCoordinateCache); + } - void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE; + QRectF boundingRect() const Q_DECL_OVERRIDE + { return brect; } + + inline int pageNumber() const + { return pageNum; } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE + { + Q_UNUSED(widget); + //Ensure all the antialiasing/smoothing options are turned on + painter->setRenderHint(QPainter::Antialiasing); + painter->setRenderHint(QPainter::TextAntialiasing); + painter->setRenderHint(QPainter::SmoothPixmapTransform); + + QRectF paperRect(0,0, paperSize.width(), paperSize.height()); + + // Draw shadow + painter->setClipRect(option->exposedRect); + qreal shWidth = paperRect.width()/100; + QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), + paperRect.bottomRight() + QPointF(shWidth, 0)); + QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight()); + rgrad.setColorAt(0.0, QColor(0,0,0,255)); + rgrad.setColorAt(1.0, QColor(0,0,0,0)); + painter->fillRect(rshadow, QBrush(rgrad)); + QRectF bshadow(paperRect.bottomLeft() + QPointF(shWidth, 0), + paperRect.bottomRight() + QPointF(0, shWidth)); + QLinearGradient bgrad(bshadow.topLeft(), bshadow.bottomLeft()); + bgrad.setColorAt(0.0, QColor(0,0,0,255)); + bgrad.setColorAt(1.0, QColor(0,0,0,0)); + painter->fillRect(bshadow, QBrush(bgrad)); + QRectF cshadow(paperRect.bottomRight(), + paperRect.bottomRight() + QPointF(shWidth, shWidth)); + QRadialGradient cgrad(cshadow.topLeft(), shWidth, cshadow.topLeft()); + cgrad.setColorAt(0.0, QColor(0,0,0,255)); + cgrad.setColorAt(1.0, QColor(0,0,0,0)); + painter->fillRect(cshadow, QBrush(cgrad)); + + painter->setClipRect(paperRect & option->exposedRect); + painter->fillRect(paperRect, Qt::white); + if (pagePicture.isNull()){ + qDebug() << "NULL"; + return; + } + painter->drawImage(QPoint(0,0), pagePicture); + } private: int pageNum; @@ -48,49 +84,11 @@ private: QRectF brect; }; -void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(widget); - QRectF paperRect(0,0, paperSize.width(), paperSize.height()); - - // Draw shadow - painter->setClipRect(option->exposedRect); - qreal shWidth = paperRect.width()/100; - QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), - paperRect.bottomRight() + QPointF(shWidth, 0)); - QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight()); - rgrad.setColorAt(0.0, QColor(0,0,0,255)); - rgrad.setColorAt(1.0, QColor(0,0,0,0)); - painter->fillRect(rshadow, QBrush(rgrad)); - QRectF bshadow(paperRect.bottomLeft() + QPointF(shWidth, 0), - paperRect.bottomRight() + QPointF(0, shWidth)); - QLinearGradient bgrad(bshadow.topLeft(), bshadow.bottomLeft()); - bgrad.setColorAt(0.0, QColor(0,0,0,255)); - bgrad.setColorAt(1.0, QColor(0,0,0,0)); - painter->fillRect(bshadow, QBrush(bgrad)); - QRectF cshadow(paperRect.bottomRight(), - paperRect.bottomRight() + QPointF(shWidth, shWidth)); - QRadialGradient cgrad(cshadow.topLeft(), shWidth, cshadow.topLeft()); - cgrad.setColorAt(0.0, QColor(0,0,0,255)); - cgrad.setColorAt(1.0, QColor(0,0,0,0)); - painter->fillRect(cshadow, QBrush(cgrad)); - - painter->setClipRect(paperRect & option->exposedRect); - painter->fillRect(paperRect, Qt::white); - if (pagePicture.isNull()){ - qDebug() << "NULL"; - return; - } - painter->drawImage(QPoint(0,0), pagePicture); -} -} class PrintWidget : public QGraphicsView { Q_OBJECT public: - PrintWidget(QWidget *parent = 0); - ~PrintWidget(); enum ViewMode { SinglePageView, FacingPagesView, @@ -103,33 +101,57 @@ public: FitInView }; - double getZoomFactor() const { return this->zoomFactor; }; - ZoomMode getZoomMode() const { return this->zoomMode; }; - int currentPage() const { return curPage; }; - void setPictures(QHash<int, QImage>*); +private: + void generatePreview(); + void layoutPages(); + void populateScene(); + void setViewMode(ViewMode); + void setZoomMode(ZoomMode); + + QGraphicsScene *scene; + + int curPage, publicPageNum; + ViewMode viewMode; + ZoomMode zoomMode; + QPageLayout::Orientation orientation; + double zoomFactor; + bool initialized, fitting; + QList<QGraphicsItem*> pages; + QHash<int, QImage> *pictures; + +public: + PrintWidget(QWidget *parent = 0); + ~PrintWidget(); + + double getZoomFactor() const { return this->zoomFactor; }; + ZoomMode getZoomMode() const { return this->zoomMode; }; + int currentPage() const { return publicPageNum; }; + void setPictures(QHash<int, QImage>*); signals: void resized(); void customContextMenuRequested(const QPoint&); + public slots: void zoomIn(double factor=1.2); - void zoomOut(double factor=1.2); - void setCurrentPage(int); - void setVisible(bool) Q_DECL_OVERRIDE; - void setOrientation(QPageLayout::Orientation); - void highlightText(int, QRectF); + void zoomOut(double factor=1.2); + void setCurrentPage(int); + void setVisible(bool) Q_DECL_OVERRIDE; + void setOrientation(QPageLayout::Orientation); + void highlightText(int, QRectF); - void updatePreview(); + void updatePreview(); void fitView(); - void fitToWidth(); - void setAllPagesViewMode(); - void setSinglePageViewMode(); - void setFacingPagesViewMode(); + void fitToWidth(); + void setAllPagesViewMode(); + void setSinglePageViewMode(); + void setFacingPagesViewMode(); private slots: void updateCurrentPage(); - int calcCurrentPage(); - void fit(bool doFitting=false); + int calcCurrentPage(); + void fit(bool doFitting=false); + protected: void resizeEvent(QResizeEvent* e) Q_DECL_OVERRIDE { /*{ @@ -144,21 +166,5 @@ protected: QGraphicsView::showEvent(e); emit resized(); } -private: - void generatePreview(); - void layoutPages(); - void populateScene(); - void setViewMode(ViewMode); - void setZoomMode(ZoomMode); - QGraphicsScene *scene; - - int curPage; - ViewMode viewMode; - ZoomMode zoomMode; - QPageLayout::Orientation orientation; - double zoomFactor; - bool initialized, fitting; - QList<QGraphicsItem*> pages; - QHash<int, QImage> *pictures; }; #endif diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index 57afbfe1..04cba34b 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -106,7 +106,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ connect(ui->actionNext_Page, SIGNAL(triggered()), this, SLOT(nextPage()) ); connect(ui->actionLast_Page, SIGNAL(triggered()), this, SLOT(lastPage()) ); connect(ui->actionProperties, SIGNAL(triggered()), this, SLOT(showInformation())); - connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(enableFind())); + connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(enableFind())); connect(ui->actionFind_Next, &QAction::triggered, this, [&] { find(ui->textEdit->text(), true); }); connect(ui->actionFind_Previous, &QAction::triggered, this, @@ -244,20 +244,12 @@ void MainUI::loadFile(QString path){ } void MainUI::loadPage(int num, Poppler::Document *doc, MainUI *obj, QSize dpi, QSizeF page){ - //PERFORMANCE NOTES: - // Using Poppler to scale the image (adjust dpi value) helps a bit but you take a large CPU loading hit (and still quite a lot of pixelization) - // Using Qt to scale the image (adjust page value) smooths out the image quite a bit without a lot of performance loss (but cannot scale up without pixelization) - // The best approach seams to be to increase the DPI a bit, but match that with the same scaling on the page size (smoothing) - //qDebug() << " - Render Page:" << num; Poppler::Page *PAGE = doc->page(num); if(PAGE!=0){ - //qDebug() << "DPI:" << dpi << "Size:" << page << "Page Size (pt):" << PAGE->pageSize(); - float scalefactor = (dpi.width()/72.0); //How different the screen DPI compares to standard page DPI - //qDebug() << "Scale Factor:" << scalefactor; - QImage raw = PAGE->renderToImage((scalefactor+0.2)*dpi.width(), (scalefactor+0.2)*dpi.height()); //make the raw image a tiny bit larger than the end result + QImage raw = PAGE->renderToImage(dpi.width(),dpi.height()); //make the raw image a bit larger than the end result //qDebug() << " - Raw Image Size:" << raw.size(); - loadingHash.insert(num, raw.scaled(scalefactor*page.width(), scalefactor*page.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ); + loadingHash.insert(num, raw.scaled(page.width(), page.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) ); raw = QImage(); //clear it /* QList<Annotation*> anno = PAGE->annotations(Annotations::AText ); @@ -312,7 +304,7 @@ void MainUI::startPresentation(bool atStart){ QScreen *screen = getScreen(false, cancelled); //let the user select which screen to use (if multiples) if(cancelled){ return;} int page = 0; - if(!atStart){ page = WIDGET->currentPage()-1; } //currentPage() starts at 1 rather than 0 + if(!atStart){ page = WIDGET->currentPage(); } //PDPI = QSize(SCALEFACTOR*screen->physicalDotsPerInchX(), SCALEFACTOR*screen->physicalDotsPerInchY()); //Now create the full-screen window on the selected screen if(presentationLabel == 0){ @@ -343,16 +335,18 @@ void MainUI::startPresentation(bool atStart){ void MainUI::ShowPage(int page){ //Check for valid document/page //qDebug() << "Load Page:" << page << "/" << numPages << "Index:" << page; - if(page<0 || page > numPages || (page==numPages && CurrentPage==page) ){ + if(page<0 || page > numPages+1 || (page==numPages && CurrentPage==page) ){ endPresentation(); return; //invalid - no document loaded or invalid page specified } WIDGET->setCurrentPage(page); //page numbers start at 1 for this widget //Stop here if no presentation currently running + if(presentationLabel == 0 || !presentationLabel->isVisible()){ return; } + //qDebug() << "Show Page:" << page << "/" << numPages; CurrentPage = page; QImage PAGEIMAGE; - if(page<numPages){ PAGEIMAGE = loadingHash[page]; } + if(page<numPages+1){ PAGEIMAGE = loadingHash[page-1]; } //Now scale the image according to the user-designations and show it if(!PAGEIMAGE.isNull()){ @@ -379,21 +373,31 @@ void MainUI::endPresentation(){ void MainUI::startLoadingPages(){ if(numPages>0){ return; } //currently loaded[ing] - qDebug() << " - Start Loading Pages"; + //qDebug() << " - Start Loading Pages"; + loadingHash.clear(); numPages = DOC->numPages(); //qDebug() << "numPages:" << numPages; progress->setRange(0,numPages); progress->setValue(0); progAct->setVisible(true); - QSizeF pageSize = DOC->page(0)->pageSizeF()*2; + + //PERFORMANCE NOTES: + // Using Poppler to scale the image (adjust dpi value) helps a bit but you take a larger CPU loading hit (and still quite a lot of pixelization) + // Using Qt to scale the image (adjust page value) smooths out the image quite a bit without a lot of performance loss (but cannot scale up without pixelization) + // The best approach seams to be to increase the DPI a bit, but match that with the same scaling on the page size (smoothing) + + double scalefactor = 2.0; + QSizeF pageSize = DOC->page(0)->pageSizeF()*scalefactor; //QSize DPI(loadingHash[0]->resolution(),loadingHash[0]->resolution()); QSize DPI(76,76); + DPI = DPI*(scalefactor+1); //need this a bit higher than the page scaling + /*qDebug() << "Screen Resolutions:"; QList<QScreen*> screens = QApplication::screens(); for(int i=0; i<screens.length(); i++){ qDebug() << screens[i]->name() << screens[i]->logicalDotsPerInchX() << screens[i]->logicalDotsPerInchY(); }*/ - qDebug() << "Poppler pageSize: " << pageSize; + //qDebug() << "Poppler pageSize: " << pageSize; for(int i=0; i<numPages; i++){ //qDebug() << " - Kickoff page load:" << i; QtConcurrent::run(this, &MainUI::loadPage, i, DOC, this, DPI, pageSize); @@ -404,12 +408,13 @@ void MainUI::slotPageLoaded(int page){ Q_UNUSED(page); //qDebug() << "Page Loaded:" << page; int finished = loadingHash.keys().length(); + //qDebug() << " - finished:" << finished; if(finished == numPages){ progAct->setVisible(false); - qDebug() << "Setting Pictures"; + //qDebug() << "Setting Pictures"; WIDGET->setPictures(&loadingHash); WIDGET->setVisible(true); - //QTimer::singleShot(10, WIDGET, SLOT(updatePreview())); + QTimer::singleShot(10, WIDGET, SLOT(updatePreview())); //qDebug() << "Updating"; ui->actionStop_Presentation->setEnabled(false); ui->actionStart_Here->setEnabled(true); @@ -419,10 +424,6 @@ void MainUI::slotPageLoaded(int page){ } } -/*void MainUI::slotStartPresentation(QAction *act){ - startPresentation(act == ui->actionAt_Beginning); -}*/ - void MainUI::paintToPrinter(QPrinter *PRINTER){ if(loadingHash.keys().length() != numPages){ return; } @@ -512,7 +513,7 @@ void MainUI::rotate(bool ccw) { loadingHash.insert(i, image); } //Rotates the page as well as the image - //WIDGET->setOrientation((WIDGET->orientation() == QPageLayout::Landscape) ? + //WIDGET->setOrientation((WIDGET->orientation() == QPageLayout::Landscape) ? //QPageLayout::Portrait : QPageLayout::Landscape); QTimer::singleShot(0, WIDGET, SLOT(updatePreview())); } @@ -553,7 +554,7 @@ void MainUI::keyPressEvent(QKeyEvent *event){ if(inPresentation){ endPresentation(); } else{ startPresentationHere(); } }else if(event->key() == Qt::Key_Up) { - //Scroll the widget up + //Scroll the widget up }else if(event->key() == Qt::Key_Down) { //Scroll the widget down /*qDebug() << "Send Wheel Event"; @@ -589,7 +590,7 @@ void MainUI::find(QString text, bool forward) { for(int i = 0; i < numPages; i++) { QList<Poppler::TextBox*> textList = DOC->page(i)->textList(); for(int j = 0; j < textList.size(); j++) { - if(textList[j]->text().contains(text, (matchCase) + if(textList[j]->text().contains(text, (matchCase) ? Qt::CaseSensitive : Qt::CaseInsensitive)) { results.insert(textList[j], i); } @@ -606,7 +607,7 @@ void MainUI::find(QString text, bool forward) { }else{ currentHighlight--; //Ensure currentHighlight will be between 0 and results.size() - 1 - if(currentHighlight < 0) + if(currentHighlight < 0) currentHighlight = results.size() - 1; } @@ -618,7 +619,7 @@ void MainUI::find(QString text, bool forward) { QTimer::singleShot(10, WIDGET, SLOT(updatePreview())); }else{ - //Print "No results found" + //Print "No results found" } } } @@ -626,17 +627,17 @@ void MainUI::find(QString text, bool forward) { void MainUI::enableFind() { if(ui->findGroup->isVisible()) { qDebug() << "Disabling Find"; - ui->findGroup->setVisible(false); - WIDGET->setGeometry(QRect(WIDGET->pos(), + ui->findGroup->setVisible(false); + WIDGET->setGeometry(QRect(WIDGET->pos(), QSize(WIDGET->width(), WIDGET->height()+ui->findGroup->height()))); QTimer::singleShot(0, WIDGET, SLOT(updatePreview())); this->setFocus(); }else{ qDebug() << "Enabling Find"; - ui->findGroup->setGeometry(QRect(QPoint(0, WIDGET->height()-ui->findGroup->height()), + ui->findGroup->setGeometry(QRect(QPoint(0, WIDGET->height()-ui->findGroup->height()), QSize(WIDGET->width()-12, ui->findGroup->height()))); - ui->findGroup->setVisible(true); - WIDGET->setGeometry(QRect(WIDGET->pos(), + ui->findGroup->setVisible(true); + WIDGET->setGeometry(QRect(WIDGET->pos(), QSize(WIDGET->width(), WIDGET->height()-ui->findGroup->height()))); QTimer::singleShot(0, WIDGET, SLOT(updatePreview())); @@ -650,7 +651,7 @@ void MainUI::showBookmarks() { void MainUI::resizeEvent(QResizeEvent *event) { if(ui->findGroup->isVisible()) { - ui->findGroup->setGeometry(QRect(QPoint(0, WIDGET->height()-ui->findGroup->height()), + ui->findGroup->setGeometry(QRect(QPoint(0, WIDGET->height()-ui->findGroup->height()), QSize(WIDGET->width()-10, ui->findGroup->height()))); } QMainWindow::resizeEvent(event); diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.h b/src-qt5/desktop-utils/lumina-pdf/mainUI.h index 2d23b402..ca32f74d 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h @@ -73,21 +73,20 @@ private: private slots: void startLoadingPages(); void slotPageLoaded(int); - //void slotStartPresentation(QAction *act); //Simplification routines - void nextPage(){ ShowPage( WIDGET->currentPage() ); } //currentPage() starts at 1 rather than 0 - void prevPage(){ ShowPage( WIDGET->currentPage()-2 ); } //currentPage() starts at 1 rather than 0 - void firstPage(){ ShowPage(0); } - void lastPage(){ ShowPage(numPages-1); } + void nextPage(){ ShowPage( WIDGET->currentPage()+1 ); } //currentPage() starts at 1 rather than 0 + void prevPage(){ ShowPage( WIDGET->currentPage()-1 ); } //currentPage() starts at 1 rather than 0 + void firstPage(){ ShowPage(1); } + void lastPage(){ ShowPage(numPages); } void startPresentationHere(){ startPresentation(false); } void startPresentationBeginning(){ startPresentation(true); } void closePresentation(){ endPresentation(); } - void showInformation(); - void find(QString text, bool forward); - void enableFind(); - void showBookmarks(); + void showInformation(); + void find(QString text, bool forward); + void enableFind(); + void showBookmarks(); void paintToPrinter(QPrinter *PRINTER); @@ -99,15 +98,15 @@ private slots: void showContextMenu(const QPoint&){ contextMenu->popup(QCursor::pos()); } void updateContextMenu(); - void setScroll(bool); - void rotate(bool); + void setScroll(bool); + void rotate(bool); signals: void PageLoaded(int); protected: - void keyPressEvent(QKeyEvent*); - void wheelEvent(QWheelEvent*); - void resizeEvent(QResizeEvent*); + void keyPressEvent(QKeyEvent*); + void wheelEvent(QWheelEvent*); + void resizeEvent(QResizeEvent*); }; #endif |