From 0e463278ce1d0722ee73e90b11aa594dfb33ece1 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Fri, 31 Dec 2021 16:54:53 -0500 Subject: [PATCH] Design tweaks in Reader framework Namely, a new "Quit" button. --- reader.cpp | 41 +-- reader.h | 4 +- reader.ui | 930 +++++++++++++++++++++++++++-------------------------- 3 files changed, 493 insertions(+), 482 deletions(-) diff --git a/reader.cpp b/reader.cpp index 9c6d875..59d6f94 100644 --- a/reader.cpp +++ b/reader.cpp @@ -39,7 +39,6 @@ reader::reader(QWidget *parent) : ui->setupUi(this); ui->previousBtn->setProperty("type", "borderless"); ui->nextBtn->setProperty("type", "borderless"); - ui->hideOptionsBtn->setProperty("type", "borderless"); ui->optionsBtn->setProperty("type", "borderless"); ui->brightnessDecBtn->setProperty("type", "borderless"); ui->brightnessIncBtn->setProperty("type", "borderless"); @@ -59,6 +58,7 @@ reader::reader(QWidget *parent) : ui->gotoBtn->setProperty("type", "borderless"); ui->increaseScaleBtn->setProperty("type", "borderless"); ui->decreaseScaleBtn->setProperty("type", "borderless"); + ui->quitBtn->setProperty("type", "borderless"); // Icons ui->alignLeftBtn->setText(""); @@ -91,6 +91,8 @@ reader::reader(QWidget *parent) : ui->increaseScaleBtn->setIcon(QIcon(":/resources/zoom-in.png")); ui->decreaseScaleBtn->setText(""); ui->decreaseScaleBtn->setIcon(QIcon(":/resources/zoom-out.png")); + ui->quitBtn->setText(""); + ui->quitBtn->setIcon(QIcon(":/resources/power.png")); // Style misc. ui->bookInfoLabel->setStyleSheet("font-style: italic"); @@ -266,7 +268,6 @@ reader::reader(QWidget *parent) : ui->nextBtn->setStyleSheet("padding: 13.5px"); ui->previousBtn->setStyleSheet("padding: 13.5px"); ui->optionsBtn->setStyleSheet("padding: 13.5px"); - ui->hideOptionsBtn->setStyleSheet("padding: 13.5px"); } ui->sizeValueLabel->setStyleSheet("font-size: 9pt"); ui->homeBtn->setStyleSheet("font-size: 9pt; padding: 5px"); @@ -276,7 +277,6 @@ reader::reader(QWidget *parent) : ui->pageNumberLabel->setFont(QFont("Source Serif Pro")); // Hiding the menubar + definition widget + brightness widget + buttons bar widget - ui->hideOptionsBtn->hide(); ui->menuWidget->setVisible(false); ui->brightnessWidget->setVisible(false); ui->menuBarWidget->setVisible(false); @@ -1051,14 +1051,18 @@ void reader::refreshScreen() { void reader::on_optionsBtn_clicked() { - menubar_show(); - this->repaint(); -} - -void reader::on_hideOptionsBtn_clicked() -{ - menubar_hide(); - this->repaint(); + if(menubar_shown == true) { + menubar_hide(); + ui->optionsBtn->setStyleSheet("background: white; color: black"); + this->repaint(); + menubar_shown = false; + } + else { + menubar_show(); + ui->optionsBtn->setStyleSheet("background: black; color: white"); + this->repaint(); + menubar_shown = true; + } } void reader::on_brightnessDecBtn_clicked() @@ -1304,8 +1308,6 @@ void reader::menubar_show() { } } - ui->hideOptionsBtn->show(); - ui->optionsBtn->hide(); ui->menuWidget->setVisible(true); if(is_pdf == false) { ui->menuBarWidget->setVisible(true); @@ -1339,8 +1341,7 @@ void reader::menubar_hide() { // Safety measure ui->brightnessWidget->setVisible(false); } - ui->hideOptionsBtn->hide(); - ui->optionsBtn->show(); + if(is_pdf == false) { ui->menuBarWidget->setVisible(false); } @@ -1370,13 +1371,11 @@ void reader::menubar_hide() { void reader::wordwidget_show() { if(menubar_shown == true) { menubar_hide(); - ui->hideOptionsBtn->hide(); ui->optionsBtn->hide(); ui->line->hide(); ui->wordWidget->setVisible(true); } else { - ui->hideOptionsBtn->hide(); ui->optionsBtn->hide(); ui->line->hide(); ui->wordWidget->setVisible(true); @@ -1385,7 +1384,6 @@ void reader::wordwidget_show() { void reader::wordwidget_hide() { ui->wordWidget->setVisible(false); - ui->hideOptionsBtn->hide(); ui->optionsBtn->show(); ui->line->show(); wordwidgetLock = false; @@ -2093,3 +2091,10 @@ void reader::openBookFileNative(QString book, bool relativePath) { showToast("Not supported"); } } + +void reader::on_quitBtn_clicked() +{ + quitWindow = new quit(); + quitWindow->setAttribute(Qt::WA_DeleteOnClose); + quitWindow->showFullScreen(); +} diff --git a/reader.h b/reader.h index dc96eef..10ab44d 100644 --- a/reader.h +++ b/reader.h @@ -5,6 +5,7 @@ #include "alert.h" #include "generaldialog.h" #include "toast.h" +#include "quit.h" #include #include @@ -125,7 +126,6 @@ private slots: void on_nextBtn_clicked(); void on_previousBtn_clicked(); void on_optionsBtn_clicked(); - void on_hideOptionsBtn_clicked(); void on_brightnessDecBtn_clicked(); void on_brightnessIncBtn_clicked(); void on_aboutBtn_clicked(); @@ -157,6 +157,7 @@ private slots: void on_increaseScaleBtn_clicked(); void openBookFileNative(QString book, bool relativePath); void showToast(QString messageToDisplay); + void on_quitBtn_clicked(); signals: void openBookFile(QString book, bool relativePath); @@ -166,6 +167,7 @@ private: alert * alertWindow; generalDialog * generalDialogWindow; toast * toastWindow; + quit * quitWindow; QGraphicsScene * graphicsScene; }; diff --git a/reader.ui b/reader.ui index 0dad839..392b342 100644 --- a/reader.ui +++ b/reader.ui @@ -16,331 +16,8 @@ - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::Plain - - - 8 - - - Qt::Horizontal - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save - - - - - - - Close - - - - - - - - 75 - true - - - - Word search - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - 0 - - - - - QFrame::Plain - - - 2 - - - Qt::Vertical - - - - - - - - Source Serif Pro - - - - Definition - - - Qt::AlignJustify|Qt::AlignVCenter - - - true - - - - - - - - Inter - 75 - true - - - - Word - - - Qt::AlignCenter - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Previous - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Status - - - - - - - Next - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - QFrame::Plain - - - 8 - - - Qt::Horizontal - - - - - - - - - - - - QFrame::Plain - - - 2 - - - Qt::Horizontal - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - QFrame::Plain - - - Qt::Vertical - - - @@ -364,6 +41,16 @@ + + + + QFrame::Plain + + + Qt::Vertical + + + @@ -377,7 +64,7 @@ - + @@ -390,32 +77,89 @@ - - - - - 75 - true - - - - Hide - - - - - - - - 50 - 50 - + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + 0 + + + + + x of x + + + + + + + Go to + + + + + + + 0 + + + + + + + + + QFrame::Plain + + + 2 + + + Qt::Horizontal + + + + + + + + + + + + + + QFrame::Plain - - + + 2 + + Qt::Horizontal + + + + + QFrame::NoFrame @@ -1030,72 +774,6 @@ - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - 0 - - - - - x of x - - - - - - - Go to - - - - - - - 0 - - - - - - - - - QFrame::Plain - - - 2 - - - Qt::Horizontal - - - - - - - - - - @@ -1117,6 +795,40 @@ 0 + + + + + 75 + true + + + + Battery + + + + + + + About + + + + + + + Battery Icon + + + + + + + Night mode + + + @@ -1127,10 +839,37 @@ - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - Night mode + Quit + + + + + + + Home + + + + + + + Search @@ -1157,57 +896,13 @@ - - - - Home - - - - - - - 75 - true - + + + QFrame::Plain - - Battery - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Search - - - - - - - About - - - - - - - Battery Icon + Qt::Vertical @@ -1231,6 +926,315 @@ + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::Plain + + + 8 + + + Qt::Horizontal + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Save + + + + + + + Close + + + + + + + + 75 + true + + + + Word search + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + 0 + + + + + QFrame::Plain + + + 2 + + + Qt::Vertical + + + + + + + + Source Serif Pro + + + + Definition + + + Qt::AlignJustify|Qt::AlignVCenter + + + true + + + + + + + + Inter + 75 + true + + + + Word + + + Qt::AlignCenter + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Previous + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Status + + + + + + + Next + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + QFrame::Plain + + + 8 + + + Qt::Horizontal + + + + + + + + + + + + + 50 + 50 + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + +