diff options
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp | 9 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.h | 5 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 46 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.h | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.ui | 9 |
5 files changed, 34 insertions, 37 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp index 4f3e0acc..75b81547 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp @@ -20,6 +20,7 @@ PrintWidget::PrintWidget(QWidget *parent) : QGraphicsView(parent), scene(0), cur scene = new QGraphicsScene(this); scene->setBackgroundBrush(Qt::gray); this->setScene(scene); + this->degrees = 0; /*QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); @@ -184,6 +185,10 @@ void PrintWidget::populateScene() QSize paperSize = pictures->value(0).size(); //qDebug() << "Image paperSize" << paperSize; + //Changes the paper orientation if rotated by 90 or 270 degrees + if(degrees == 90 or degrees == 270) + paperSize.transpose(); + for (int i = 0; i < numPages; i++) { PageItem* item = new PageItem(i+1, (*pictures)[i].scaled( paperSize, Qt::KeepAspectRatio, Qt::SmoothTransformation), paperSize, degrees); scene->addItem(item); @@ -286,7 +291,9 @@ void PrintWidget::receiveDocument(Poppler::Document *DOC) { this->setVisible(true); } +//Sets how much to rotate the image, by either 90, 180, or 270 degrees. Adds 90 degrees for cw and -90 for ccw. void PrintWidget::setDegrees(int degrees) { - this->degrees = degrees; + //Mods by 360, but adds and remods because of how C++ treats negative mods + this->degrees = ( ( ( this->degrees + degrees ) % 360 ) + 360 ) % 360; this->updatePreview(); } diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h index da0dc8d3..455c86eb 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.h @@ -72,12 +72,15 @@ public: QMatrix matrix; switch(degrees) { - case -90: + case 270: matrix = QMatrix(0, -1, 1, 0, 0, 0); break; case 90: matrix = QMatrix(0, 1, -1, 0, 0, 0); break; + case 180: + matrix = QMatrix(-1, 0, 0, -1, 0, 0); + break; default: matrix = QMatrix(1, 0, 0, 1, 0 ,0); } diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index 01639b87..5f63a9e6 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -51,8 +51,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ contextMenu = new QMenu(this); connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(updateContextMenu())); //Now put the widgets into the UI - ui->bookmarksFrame->setParent(WIDGET); - ui->findGroup->setParent(WIDGET); + //ui->bookmarksFrame->setParent(WIDGET); + //ui->findGroup->setParent(WIDGET); qDebug() << "Setting central widget"; this->centralWidget()->layout()->replaceWidget(ui->label_replaceme, WIDGET); //setCentralWidget(WIDGET); ui->label_replaceme->setVisible(false); @@ -116,7 +116,15 @@ 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, &QAction::triggered, this, [&] { + if(ui->findGroup->isVisible()) { + ui->findGroup->setVisible(false); + this->setFocus(); + }else{ + ui->findGroup->setVisible(true); + ui->findGroup->setFocus(); + } + }); connect(ui->actionFind_Next, &QAction::triggered, this, [&] { find(ui->textEdit->text(), true); }); connect(ui->actionFind_Previous, &QAction::triggered, this, @@ -129,6 +137,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ [&] (bool value) { this->matchCase = value; }); connect(ui->closeFind, &QPushButton::clicked, this, [&] { ui->findGroup->setVisible(false); this->setFocus(); }); + connect(ui->closeBookmarks, &QPushButton::clicked, this, + [&] { ui->bookmarksFrame->setVisible(false); this->setFocus(); }); connect(ui->actionClearHighlights, &QAction::triggered, WIDGET, [&] { WIDGET->updatePreview(); }); connect(ui->actionBookmarks, SIGNAL(triggered()), this, SLOT(showBookmarks())); @@ -187,6 +197,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->findPrevB->setIcon(LXDG::findIcon("go-up-search")); ui->matchCase->setIcon(LXDG::findIcon("format-text-italic")); ui->closeFind->setIcon(LXDG::findIcon("dialog-close")); + ui->closeBookmarks->setIcon(LXDG::findIcon("dialog-close")); //qDebug() << "Finished setting icons"; @@ -638,35 +649,6 @@ 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(), - 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()), - QSize(WIDGET->width()-12, ui->findGroup->height()))); - ui->findGroup->setVisible(true); - WIDGET->setGeometry(QRect(WIDGET->pos(), - QSize(WIDGET->width(), WIDGET->height()-ui->findGroup->height()))); - - QTimer::singleShot(0, WIDGET, SLOT(updatePreview())); - ui->findGroup->setFocus(); - } -} - void MainUI::showBookmarks() { ui->bookmarksFrame->setVisible(true); } - -void MainUI::resizeEvent(QResizeEvent *event) { - if(ui->findGroup->isVisible()) { - 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 399404a1..6886299d 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h @@ -85,7 +85,6 @@ private slots: void showInformation(); void find(QString text, bool forward); - void enableFind(); void showBookmarks(); void paintToPrinter(QPrinter *PRINTER); @@ -107,7 +106,6 @@ signals: protected: void keyPressEvent(QKeyEvent*); void wheelEvent(QWheelEvent*); - void resizeEvent(QResizeEvent*); void closeEvent(QCloseEvent *ev){ endPresentation(); QMainWindow::closeEvent(ev); diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui index f6d53085..87922995 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui @@ -55,6 +55,13 @@ <number>4</number> </property> <item> + <widget class="QPushButton" name="closeBookmarks"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="label_2"> <property name="text"> <string>Bookmarks</string> @@ -169,7 +176,7 @@ <x>0</x> <y>0</y> <width>697</width> - <height>42</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuFile"> |