From d10d1a1213a24031f445f76fd0aed95bfa3662a5 Mon Sep 17 00:00:00 2001 From: Szybet <53944559+Szybet@users.noreply.github.com> Date: Mon, 5 Sep 2022 22:29:23 +0200 Subject: [PATCH] settings removed spin box + wifi logger removed ugly frame --- src/settings/settings.cpp | 120 +++-- src/settings/settings.h | 18 +- src/settings/settings.ui | 633 ++++++++++++++----------- src/widgets/dialogs/wifi/wifilogger.ui | 33 +- 4 files changed, 490 insertions(+), 314 deletions(-) diff --git a/src/settings/settings.cpp b/src/settings/settings.cpp index 3133a81..b11774e 100644 --- a/src/settings/settings.cpp +++ b/src/settings/settings.cpp @@ -113,37 +113,50 @@ settings::settings(QWidget *parent) : // Words number string_checkconfig(".config/07-words_number/config"); if(checkconfig_str_val == "") { - ; + if(global::deviceID == "n705\n") { + wordNumberSaved = 120; + } else if(global::deviceID == "n873\n") { + wordNumberSaved = 250; + } else { + wordNumberSaved = 175; + } } else { - int words_number = checkconfig_str_val.toInt(); - ui->wordsNumber->setValue(words_number); + QString words_number = checkconfig_str_val; + ui->wordNumberShowLabel->setText(words_number); + wordNumberSaved = checkconfig_str_val.toInt(); } // ePUB page size if(checkconfig(".config/13-epub_page_size/set") == true) { string_checkconfig_ro(".config/13-epub_page_size/width"); if(checkconfig_str_val != "") { - int pageWidth = checkconfig_str_val.toInt(); - ui->pageSizeWidthSpinBox->setValue(pageWidth); + QString pageWidth = checkconfig_str_val; + ui->pageSizeWidthLabel->setText(pageWidth); + pageSizeWidthSaved = pageWidth.toInt(); } else { // Failsafe: setting default - ui->pageSizeWidthSpinBox->setValue(defaultEpubPageWidth); + ui->pageSizeWidthLabel->setText(QString::number(defaultEpubPageWidth)); + pageSizeWidthSaved = defaultEpubPageWidth; } string_checkconfig_ro(".config/13-epub_page_size/height"); if(checkconfig_str_val != "") { - int pageHeight = checkconfig_str_val.toInt(); - ui->pageSizeHeightSpinBox->setValue(pageHeight); + QString pageHeight = checkconfig_str_val; + ui->pageSizeHeightLabel->setText(pageHeight); + pageSizeHeightSaved = pageHeight.toInt(); } else { // Failsafe: setting default - ui->pageSizeHeightSpinBox->setValue(defaultEpubPageHeight); + ui->pageSizeHeightLabel->setText(QString::number(defaultEpubPageHeight)); + pageSizeHeightSaved = defaultEpubPageHeight; } } else { - ui->pageSizeWidthSpinBox->setValue(defaultEpubPageWidth); - ui->pageSizeHeightSpinBox->setValue(defaultEpubPageHeight); + ui->pageSizeWidthLabel->setText("Width: " + QString::number(defaultEpubPageWidth)); + ui->pageSizeHeightLabel->setText("Height: " + QString::number(defaultEpubPageHeight)); + pageSizeHeightSaved = defaultEpubPageHeight; + pageSizeWidthSaved = defaultEpubPageWidth; } // QTextEdit scroll bar in Reader framework @@ -361,8 +374,34 @@ settings::~settings() { delete ui; } +/* +void settings::on_pageSizeWidthSpinBox_valueChanged(int arg1) +{ + std::string value = std::to_string(arg1); + string_writeconfig(".config/13-epub_page_size/width", value); + string_writeconfig(".config/13-epub_page_size/set", "true"); + log("Set ePUB page size width to " + QString::number(arg1), className); +} +void settings::on_pageSizeHeightSpinBox_valueChanged(int arg1) +{ + std::string value = std::to_string(arg1); + string_writeconfig(".config/13-epub_page_size/height", value); + string_writeconfig(".config/13-epub_page_size/set", "true"); + log("Set ePUB page size height to " + QString::number(arg1), className); +} +*/ void settings::on_okBtn_clicked() { + // Save things + string_writeconfig(".config/07-words_number/config", QString::number(wordNumberSaved).toStdString()); + log("Set text files words number to " + QString::number(wordNumberSaved), className); + + string_writeconfig(".config/13-epub_page_size/width", QString::number(pageSizeWidthSaved).toStdString()); + string_writeconfig(".config/13-epub_page_size/set", "true"); + + string_writeconfig(".config/13-epub_page_size/height", QString::number(pageSizeHeightSaved).toStdString()); + string_writeconfig(".config/13-epub_page_size/set", "true"); + // Prevent potential unknown damage launching via shell script this could do if(launch_sh == true) { if(ui_enable_changed == true) { @@ -795,22 +834,6 @@ void settings::on_showSystemInfoBtn_clicked() generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); } -void settings::on_pageSizeWidthSpinBox_valueChanged(int arg1) -{ - std::string value = std::to_string(arg1); - string_writeconfig(".config/13-epub_page_size/width", value); - string_writeconfig(".config/13-epub_page_size/set", "true"); - log("Set ePUB page size width to " + QString::number(arg1), className); -} - -void settings::on_pageSizeHeightSpinBox_valueChanged(int arg1) -{ - std::string value = std::to_string(arg1); - string_writeconfig(".config/13-epub_page_size/height", value); - string_writeconfig(".config/13-epub_page_size/set", "true"); - log("Set ePUB page size height to " + QString::number(arg1), className); -} - void settings::on_readerScrollBarCheckBox_toggled(bool checked) { QString settingString = "scrollbar display if necessary"; @@ -1036,3 +1059,46 @@ void settings::on_exportHighlightsBtn_clicked() writeFile("/mnt/onboard/onboard/highlights-" + QDateTime::currentDateTime().toString("dd-MM-yy_hh.mm.ss") + ".json", QJsonDocument(jsonObject).toJson()); showToast("Highlights exported successfully"); } + +void settings::on_wordNumberAddBtn_clicked() +{ + wordNumberSaved = wordNumberSaved + 5; + ui->wordNumberShowLabel->setText(QString::number(wordNumberSaved)); + +} + +void settings::on_wordNumberDelBtn_clicked() +{ + if(wordNumberSaved > 10) { + wordNumberSaved = wordNumberSaved - 5; + ui->wordNumberShowLabel->setText(QString::number(wordNumberSaved)); + } +} + +void settings::on_pageSizeHeightDelBtn_clicked() +{ + if(pageSizeHeightSaved > 100) { + pageSizeHeightSaved = pageSizeHeightSaved - 5; + ui->pageSizeHeightLabel->setText(QString::number(pageSizeHeightSaved)); + } +} + +void settings::on_pageSizeHeightAddBtn_clicked() +{ + pageSizeHeightSaved = pageSizeHeightSaved + 5; + ui->pageSizeHeightLabel->setText(QString::number(pageSizeHeightSaved)); +} + +void settings::on_pageSizeWidthDelBtn_clicked() +{ + if(pageSizeWidthSaved > 100) { + pageSizeWidthSaved = pageSizeWidthSaved - 5; + ui->pageSizeWidthLabel->setText(QString::number(pageSizeWidthSaved)); + } +} + +void settings::on_pageSizeWidthAddBtn_clicked() +{ + pageSizeWidthSaved = pageSizeWidthSaved + 5; + ui->pageSizeWidthLabel->setText(QString::number(pageSizeWidthSaved)); +} diff --git a/src/settings/settings.h b/src/settings/settings.h index 0089283..9d74050 100644 --- a/src/settings/settings.h +++ b/src/settings/settings.h @@ -52,8 +52,6 @@ private slots: void on_enableLockscreenCheckBox_toggled(bool checked); void on_enableUiScalingCheckBox_toggled(bool checked); void on_showSystemInfoBtn_clicked(); - void on_pageSizeWidthSpinBox_valueChanged(int arg1); - void on_pageSizeHeightSpinBox_valueChanged(int arg1); void on_readerScrollBarCheckBox_toggled(bool checked); void brightnessDown(); void on_globalReadingSettingsCheckBox_toggled(bool checked); @@ -73,6 +71,18 @@ private slots: void on_tzComboBox_currentTextChanged(const QString &arg1); void on_exportHighlightsBtn_clicked(); + void on_wordNumberAddBtn_clicked(); + + void on_wordNumberDelBtn_clicked(); + + void on_pageSizeHeightDelBtn_clicked(); + + void on_pageSizeHeightAddBtn_clicked(); + + void on_pageSizeWidthDelBtn_clicked(); + + void on_pageSizeWidthAddBtn_clicked(); + signals: void showToast(QString messageToDisplay); void closeIndefiniteToast(); @@ -83,6 +93,10 @@ private: generalDialog *generalDialogWindow; otaManager *otaManagerWindow; toast *toastWindow; + + int pageSizeHeightSaved; + int pageSizeWidthSaved; + int wordNumberSaved; }; #endif // SETTINGS_H diff --git a/src/settings/settings.ui b/src/settings/settings.ui index a63a5ab..ec5f004 100644 --- a/src/settings/settings.ui +++ b/src/settings/settings.ui @@ -16,6 +16,26 @@ + + + + About InkBox + + + + + + + QFrame::Plain + + + 5 + + + Qt::Horizontal + + + @@ -49,7 +69,7 @@ 0 0 457 - 657 + 667 @@ -98,8 +118,25 @@ 0 - - + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Disable "Welcome to InkBox" message + + + + + Chivo @@ -107,54 +144,7 @@ - Reading - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Request DHCP lease - - - - - - - - 75 - true - - - - Request - - - - - - - - - Disable authors quotes + USB networking @@ -163,7 +153,9 @@ Chivo + 50 true + false @@ -171,26 +163,101 @@ - - + + + + Show scroll bar if needed + + + + + + + + Chivo + 50 + true + false + + + + Reading + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Global reading settings + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Clock: Show seconds + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + + Chivo + 50 + true + false + + + + Home + + + + + + + Disable authors quotes + + + + + 0 - - - - - 75 - true - - - - Go - - - - + Qt::Horizontal @@ -202,13 +269,98 @@ - - + + - Enter USB Mass Storage session + + + + + :/resources/minus.png:/resources/minus.png + + + + + + + + :/resources/minus.png:/resources/minus.png + + + + + + + + + + + :/resources/plus.png:/resources/plus.png + + + + + + + + + + + :/resources/plus.png:/resources/plus.png + + + + + + + ePUB size: + + + + + + + Width: + + + + + + + 450 + + + + + + + Height: + + + + + + + 450 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -216,6 +368,24 @@ 0 + + + + + + + + :/resources/plus.png:/resources/plus.png + + + + + + + 30 + + + @@ -237,42 +407,57 @@ - - - 20 + + + - - 300 - - - 20 - - - 20 + + + :/resources/minus.png:/resources/minus.png - - - - - Chivo - true - + + + + 0 - - Networking - - - - - - - Clock: Show seconds - - + + + + Export highlights + + + + + + + + 75 + true + + + + Export + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -345,72 +530,45 @@ - - - - - Chivo - true - + + + + 0 - - Home - - - - - - - Disable "Welcome to InkBox" message - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - Global reading settings - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - QFrame::Plain - - - Qt::Horizontal - - - - - - - QFrame::Plain - - - Qt::Horizontal - - + + + + + 75 + true + + + + Go + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Enter USB Mass Storage session + + + + @@ -419,67 +577,13 @@ - - - - Show scroll bar if needed - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + 0 - - - - Height: - - - - - - - Width: - - - - - - - 300 - - - 700 - - - 25 - - - - - - - ePUB page size - - - - + Qt::Horizontal @@ -491,35 +595,15 @@ - - - - 300 - - - 700 - - - 25 - - - - - - - - - 0 - - + - Export highlights + Request DHCP lease - + 75 @@ -527,25 +611,28 @@ - Export + Request - - - - Qt::Horizontal - - - - 40 - 20 - - - - + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 0 + 0 + + + + @@ -1120,26 +1207,6 @@ - - - - QFrame::Plain - - - 2 - - - Qt::Horizontal - - - - - - - About InkBox - - - @@ -1162,13 +1229,13 @@ OK - - + + QFrame::Plain - 5 + 2 Qt::Horizontal @@ -1179,6 +1246,8 @@ OK - + + + diff --git a/src/widgets/dialogs/wifi/wifilogger.ui b/src/widgets/dialogs/wifi/wifilogger.ui index 2c4a561..4d9c0c7 100644 --- a/src/widgets/dialogs/wifi/wifilogger.ui +++ b/src/widgets/dialogs/wifi/wifilogger.ui @@ -22,6 +22,15 @@ + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + true @@ -30,8 +39,8 @@ 0 0 - 460 - 210 + 458 + 226 @@ -53,7 +62,7 @@ 0 - 0 + 3 @@ -389,6 +398,15 @@ + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + Qt::NoTextInteraction @@ -412,6 +430,15 @@ + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + Qt::NoTextInteraction