diff --git a/functions.h b/functions.h index a4c2438..a5cbb37 100644 --- a/functions.h +++ b/functions.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -229,18 +230,8 @@ namespace { return 0; } int display_quote() { - QDir::setCurrent(".config/05-quote"); - QString quote_prog ("sh"); - QStringList quote_args; - quote_args << "quote.sh"; - QProcess *quote_proc = new QProcess(); - quote_proc->start(quote_prog, quote_args); - quote_proc->waitForFinished(); - quote_proc->deleteLater(); - QDir::setCurrent("/mnt/onboard/.adds/inkbox"); - - int quote_value = int_checkconfig(".config/05-quote/quote"); - return quote_value; + int quoteNumber = QRandomGenerator::global()->bounded(1, 6); + return quoteNumber; return 0; } void string_writeconfig(std::string file, std::string config_option) { @@ -552,7 +543,7 @@ namespace { defaultEpubPageHeight = 425; defaultEpubPageWidth = 425; } - else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") { + else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { defaultEpubPageHeight = 450; defaultEpubPageWidth = 450; } @@ -566,7 +557,7 @@ namespace { defaultPdfPageHeight = 750; defaultPdfPageWidth = 550; } - else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") { + else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { defaultPdfPageHeight = 974; defaultPdfPageWidth = 708; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 81d6dac..2c575c8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -375,35 +375,37 @@ MainWindow::MainWindow(QWidget *parent) } if(checkconfig(".config/05-quote/config") == false) { + stdIconWidth = sW / 2; + stdIconHeight = sH / 2; int quote_value = display_quote(); if(quote_value == 1) { - QPixmap pm(":/resources/chesterton.jpg"); - ui->quotePictureLabel->setPixmap(pm); - ui->quotePictureLabel->setScaledContents(true); + QPixmap pixmap(":/resources/chesterton.jpg"); + QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); + ui->quotePictureLabel->setPixmap(scaledPixmap); ui->quoteLabel->setText("“A good novel tells us the truth about its hero; but a bad novel tells us the truth about its author.”\n― G.K. Chesterton"); } if(quote_value == 2) { - QPixmap pm(":/resources/alcott.jpg"); - ui->quotePictureLabel->setPixmap(pm); - ui->quotePictureLabel->setScaledContents(true); + QPixmap pixmap(":/resources/alcott.jpg"); + QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); + ui->quotePictureLabel->setPixmap(scaledPixmap); ui->quoteLabel->setText("“I've got the key to my castle in the air, but whether I can unlock the door remains to be seen.”\n― Louisa May Alcott"); } if(quote_value == 3) { - QPixmap pm(":/resources/king.jpg"); - ui->quotePictureLabel->setPixmap(pm); - ui->quotePictureLabel->setScaledContents(true); + QPixmap pixmap(":/resources/king.jpg"); + QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); + ui->quotePictureLabel->setPixmap(scaledPixmap); ui->quoteLabel->setText("“Quiet people have the loudest minds”\n― Stephen King"); } if(quote_value == 4) { - QPixmap pm(":/resources/davies.jpg"); - ui->quotePictureLabel->setPixmap(pm); - ui->quotePictureLabel->setScaledContents(true); + QPixmap pixmap(":/resources/davies.jpg"); + QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); + ui->quotePictureLabel->setPixmap(scaledPixmap); ui->quoteLabel->setText("“Authors like cats because they are such quiet, lovable, wise creatures, and cats like authors for the same reasons.”\n― Robertson Davies"); } if(quote_value == 5) { - QPixmap pm(":/resources/christie.png"); - ui->quotePictureLabel->setPixmap(pm); - ui->quotePictureLabel->setScaledContents(true); + QPixmap pixmap(":/resources/christie.png"); + QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); + ui->quotePictureLabel->setPixmap(scaledPixmap); ui->quoteLabel->setText("“One of the saddest things in life, is the things one remembers.”\n― Agatha Christie"); } } diff --git a/reader.cpp b/reader.cpp index 8851d88..a041861 100644 --- a/reader.cpp +++ b/reader.cpp @@ -346,7 +346,7 @@ reader::reader(QWidget *parent) : float sH = QGuiApplication::screens()[0]->size().height(); // Defining what the icons' size will be if(checkconfig("/opt/inkbox_genuine") == true) { - if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") { + if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { float stdIconWidth = sW / 16; float stdIconHeight = sW / 16; QPixmap chargingPixmap(":/resources/battery_charging.png"); @@ -836,7 +836,7 @@ int reader::setup_book(QString book, int i, bool run_parser) { } } - // Checking whether the user has defined an option for the number of words per page; if not, then setting the default. + // Checking whether or not the user has defined an option for the number of words per page; if not, then setting the default. // NOTE: This is only for plain text files. setDefaultWorkDir(); string_checkconfig(".config/07-words_number/config"); @@ -1060,7 +1060,7 @@ void reader::on_previousBtn_clicked() ui->text->setText(""); ui->text->setText(ittext); - // We always increment pagesTurned regardless whether we press the Previous or Next button + // We always increment pagesTurned regardless whether we press the Previous or Next button or not pagesTurned = pagesTurned + 1; writeconfig_pagenumber(false); alignText(textAlignment); @@ -1078,7 +1078,7 @@ void reader::on_previousBtn_clicked() setup_book(book_file, mupdf::pdf::pdfPageNumber, true); setupPng(); - // We always increment pagesTurned regardless whether we press the Previous or Next button + // We always increment pagesTurned regardless whether we press the Previous or Next button or not pagesTurned = pagesTurned + 1; writeconfig_pagenumber(false); } @@ -1093,7 +1093,7 @@ void reader::on_previousBtn_clicked() ui->text->setText(""); ui->text->setText(epubPageContent); - // We always increment pagesTurned regardless whether we press the Previous or Next button + // We always increment pagesTurned regardless whether we press the Previous or Next button not pagesTurned = pagesTurned + 1; writeconfig_pagenumber(false); alignText(textAlignment); diff --git a/resources/eink.qss b/resources/eink.qss index cfd458a..e69de29 100644 --- a/resources/eink.qss +++ b/resources/eink.qss @@ -1,391 +0,0 @@ - -QPushButton[type="borderless"] -{ - background: white; - border: 0; - padding: 2px; - outline: none; - font-size: 10pt; -} - -QPushButton[type="borderless"]:focus -{ - border: 0; -} - -QPushButton[type="borderless"]:pressed -{ - background: black; - color: white; - border: none; -} - -QPushButton[type="bw"] -{ - background: white; - border: 0; - padding: 2px; - outline: none; - font-size: 10pt; -} -QPushButton[type="bw"]:focus -{ - border: 0; -} -QPushButton[type="bw"] -{ - background: black; - color: white; - border: none; -} - -QPushButton -{ - border-radius: 10px; -} - -QLabel[type="mangainfolabel"] -{ - font-weight: bold; - font-size: 10pt; -} - -QLabel[type="mangainfocontent"] -{ - font-size: 10pt; -} - -QFrame#listViewSources -{ - border: none; - font-size: 7pt; - outline: none; -} - -QListView#listViewMangas -{ - border: none; - padding: 8px; - font-size: 12pt; -} - -QFrame#listViewChapters -{ - border: none; - padding-top: 8px; - padding-bottom: 8px; - font-size: 12pt; -} - -QFrame#topButtonsFrame -{ - border-top: 1px solid black; - border-bottom: 1px solid black; -} - -QFrame#frameButtons -{ - border-top: 1px solid black; -} - -QListView::item:selected#listViewSources -{ - background: white; - color: black; -} - -QListView::item:focused#listViewSources -{ - background: white; - color: black; -} - -QFrame#frameProgress -{ - border: 1px solid black; -} - -QLineEdit#lineEditFilter -{ - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - font-size: 12pt; -} - -QFrame#searchButtonFrame -{ - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; - border:1px solid black; -} - -QPushButton#pushButtonFilterClear -{ - font-size: 16pt; -} - - -QWidget -{ - background-color: white; - selection-color: white; - selection-background-color: black; - font-size: 10pt; -} - -QMenu -{ - border: 1px solid black; - background-color:white; -} -QMenu::item::selected -{ - border-bottom: 5px solid black; -} -QMenu::item -{ - padding: 0px 25px 0px 20px; - border-bottom: 5px solid transparent; -} -QMenu::indicator -{ - width: 20px; - height: 20px; -} -QMenu::indicator:exclusive:checked -{ - image: url(:/images/icons/checkbox-checked.png); -} - -QCheckBox::indicator -{ - width: 20px; - height: 20px; - margin: 3px; - border: none; -} - -QCheckBox::indicator:checked -{ - image: url(:/resources/checkbox-checked.png); -} - -QCheckBox::indicator:unchecked -{ - image: url(:/resources/checkbox-unchecked.png); -} - - -QLineEdit, QSpinBox, QDoubleSpinBox -{ - background-color:white; - border:1px solid black; - padding: 2px; - border-radius: 10px; -} - -QLineEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus -{ - border: 1px solid black; - padding: 1px; -} -QLineEdit:edit-focus, QSpinBox:edit-focus, QDoubleSpinBox:edit-focus -{ - border: 3px solid black; - padding: 0px; -} - -QTextEdit -{ - border: none; -} -QTextEdit:focus -{ - border: none; -} -QTextEdit:edit-focus -{ - border: none; -} - -QComboBox -{ - background-color:white; - border: 1.5px solid black; - border-radius:10px; - padding-top: 3px; - padding-right: 0px; - padding-bottom: 3px; - padding-left: 5px; -} -QComboBox:focus -{ - border: 3px solid black; - padding-top: 1px; - padding-right: 0px; - padding-bottom: 1px; - padding-left: 3px; -} -QComboBox::drop-down -{ - border-width:1px; - border-radius:10px; -} -QComboBox::down-arrow { - image:url(:/down-arrow.png); - padding-top: 2px; - padding-right: 5px; - padding-bottom: 2px; - padding-left: 0px; -} -QComboBox::down-arrow:focus -{ - padding-top: 0px; - padding-right: 0px; - padding-bottom: 0px; - padding-left: 0px; -} -QTreeView { - padding: 2px; - border: 1px solid black; - background: white; - outline: none; - font-size: 10pt; -} -QListView { - padding: 6px; - border: 1px solid black; - background: white; - outline: none; - font-size: 12pt; -} -QTreeView:focus, QTableView:focus { - padding: 1px; - border: 1px solid black; -} -QTreeView:edit-focus, QListView:edit-focus, QTableView:edit-focus { - padding: 0px; - border: 3px solid black; -} -QTreeView::branch:has-children:!has-siblings:closed, -QTreeView::branch:closed:has-children:has-siblings -{ - border-image: none; - image: url(:/plus.png); -} -QTreeView::branch:open:has-children:!has-siblings, -QTreeView::branch:open:has-children:has-siblings -{ - border-image: none; - image: url(:/minus.png); -} - -QPushButton -{ - background: white; - border: 3px solid black; - color: black; - padding: 2px; - outline: none; - font-size: 13pt; -} -QPushButton:focus { - border: 3px solid black; - padding: 2px; -} -QPushButton:pressed -{ - background: black; - color: white; - padding: 2px; -} - -QToolButton -{ - background: transparent; - border: none; - color: black; - padding: 2px; - outline: none; -} -QToolButton:checked -{ - border: none; -} - -QToolButton:focus { - border: none; - padding: 2px; -} -QToolButton:pressed { - border: none; - padding: 2px; -} - -QSlider::groove:horizontal { - border: 1.5px solid black; - border-radius: 10px; - height: 15px; - background: white; - margin: 0px 0; -} -QSlider::handle:horizontal { - background: black; - border: 1.5px solid black; - border-radius: 10px; - height: 15px; - width: 25px; - margin: 0px 0; -} - -QSlider::handle:horizontal::focus { - background: black; -} - -QScrollBar { - background: white; - border: 5px solid lightGrey; -} - -QScrollBar:vertical { - width: 30px -} -QScrollBar:horizontal { - height: 30px -} -QScrollBar::handle { - background: black; - min-width: 25px; - min-height: 25px; - border: 5px; -} -QScrollBar::add-line { - width: 0px; -} -QScrollBar::sub-line { - width: 0px; -} - -QDialog { - border: 5px solid black; - border-radius: 10px; - background: white; -} - -QProgressBar { - border: 1.5px solid black; - border-radius: 10px; - text-align: center; - background: white; - color: rgb(160, 160, 160); -} - -QProgressBar::chunk { - background: black; - color: white; - border-radius: 7px; -} - - diff --git a/settings.ui b/settings.ui index 4c0f435..9e24094 100644 --- a/settings.ui +++ b/settings.ui @@ -1054,7 +1054,7 @@ - Timezone + Timezone (reboot req.)