aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/mainUI.cpp12
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/mainUI.h14
2 files changed, 12 insertions, 14 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
index c2f31e01..5cfc5da9 100644
--- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
@@ -82,6 +82,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
//Now set the default state of the menu's and actions
ui->menuStart_Presentation->setEnabled(false);
ui->actionStop_Presentation->setEnabled(false);
+ this->grabKeyboard();
}
MainUI::~MainUI(){
@@ -187,7 +188,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 = CurrentPage; }
+ if(!atStart){ page = WIDGET->currentPage()-1; } //currentPage() starts at 1 rather than 0
//PDPI = QSize(SCALEFACTOR*screen->physicalDotsPerInchX(), SCALEFACTOR*screen->physicalDotsPerInchY());
//Now create the full-screen window on the selected screen
if(presentationLabel == 0){
@@ -209,13 +210,15 @@ void MainUI::startPresentation(bool atStart){
}
void MainUI::ShowPage(int page){
- if(presentationLabel == 0 || !presentationLabel->isVisible()){ return; }
//Check for valid document/page
- //qDebug() << "Load Page:" << page << "/" << numPages-1;
- if(page<0 || page > numPages ){
+ //qDebug() << "Load Page:" << page << "/" << numPages << "Index:" << page;
+ if(page<0 || page > numPages || (page==numPages && CurrentPage==page) ){
endPresentation();
return; //invalid - no document loaded or invalid page specified
}
+ WIDGET->setCurrentPage(page+1); //page numbers start at 1 for this widget
+ //Stop here if no presentation currently running
+ if(presentationLabel == 0 || !presentationLabel->isVisible()){ return; }
CurrentPage = page;
QImage PAGEIMAGE;
if(page<numPages){ PAGEIMAGE = loadingHash[page]; }
@@ -244,6 +247,7 @@ void MainUI::startLoadingPages(QPrinter *printer){
if(numPages>0){ return; } //currently loaded[ing]
//qDebug() << " - Start Loading Pages";
numPages = DOC->numPages();
+ //qDebug() << "numPages:" << numPages;
progress->setRange(0,numPages);
progress->setValue(0);
progAct->setVisible(true);
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.h b/src-qt5/desktop-utils/lumina-pdf/mainUI.h
index c1fc7c7c..c43d0ada 100644
--- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h
+++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h
@@ -75,19 +75,16 @@ signals:
protected:
void keyPressEvent(QKeyEvent *event){
//See if this is one of the special hotkeys and act appropriately
- // NOTE: Some of this is duplicated with the QShortcut definitions (for non-presentation mode)
- // This routine does not always work for the main window viewer due to differing widget focus policies
- if(presentationLabel!=0 && presentationLabel->isVisible()){
//qDebug() << "Got Key Press:";
if( event->key()==Qt::Key_Escape || event->key()==Qt::Key_Backspace){
//qDebug() << " - Escape/Backspace";
endPresentation();
- }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Down || event->key()==Qt::Key_Space){
+ }else if(event->key()==Qt::Key_Right || event->key()==Qt::Key_Down || event->key()==Qt::Key_Space || event->key()==Qt::Key_PageDown){
//qDebug() << " - Right/Down/Spacebar";
- ShowPage( CurrentPage+1 );
- }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_Up){
+ ShowPage( WIDGET->currentPage() ); //currentPage() starts at 1 rather than 0
+ }else if(event->key()==Qt::Key_Left || event->key()==Qt::Key_Up || event->key()==Qt::Key_PageUp){
//qDebug() << " - Left/Up";
- ShowPage( CurrentPage-1 );
+ ShowPage( WIDGET->currentPage()-2 ); //currentPage() starts at 1 rather than 0
}else if(event->key()==Qt::Key_Home){
//qDebug() << " - Home";
ShowPage(0); //go to the first page
@@ -100,9 +97,6 @@ protected:
}else{
QMainWindow::keyPressEvent(event);
}
- }else{
- QMainWindow::keyPressEvent(event);
- }
}
};
#endif
bgstack15