From b38a5bd9a012ed2630d8763d252a646df6c184a1 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Tue, 27 Apr 2021 08:40:08 -0400 Subject: [PATCH] Added KoBox settings base --- inkbox.pro | 3 ++ koboxsettings.cpp | 30 ++++++++++++ koboxsettings.h | 25 ++++++++++ koboxsettings.ui | 108 ++++++++++++++++++++++++++++++++++++++++++++ mainwindow.h | 2 + settingschooser.cpp | 13 ++++-- settingschooser.h | 4 ++ 7 files changed, 182 insertions(+), 3 deletions(-) create mode 100644 koboxsettings.cpp create mode 100644 koboxsettings.h create mode 100644 koboxsettings.ui diff --git a/inkbox.pro b/inkbox.pro index cfd5f64..e6e4acd 100644 --- a/inkbox.pro +++ b/inkbox.pro @@ -16,6 +16,7 @@ SOURCES += \ brightnessdialog.cpp \ calendarapp.cpp \ generaldialog.cpp \ + koboxsettings.cpp \ main.cpp \ mainwindow.cpp \ quit.cpp \ @@ -32,6 +33,7 @@ HEADERS += \ calendarapp.h \ functions.h \ generaldialog.h \ + koboxsettings.h \ mainwindow.h \ quit.h \ reader.h \ @@ -46,6 +48,7 @@ FORMS += \ brightnessdialog.ui \ calendarapp.ui \ generaldialog.ui \ + koboxsettings.ui \ mainwindow.ui \ quit.ui \ reader.ui \ diff --git a/koboxsettings.cpp b/koboxsettings.cpp new file mode 100644 index 0000000..c303014 --- /dev/null +++ b/koboxsettings.cpp @@ -0,0 +1,30 @@ +#include "koboxsettings.h" +#include "ui_koboxsettings.h" + +#include + +koboxSettings::koboxSettings(QWidget *parent) : + QWidget(parent), + ui(new Ui::koboxSettings) +{ + ui->setupUi(this); + + // Stylesheet + QFile stylesheetFile(":/resources/eink.qss"); + stylesheetFile.open(QFile::ReadOnly); + this->setStyleSheet(stylesheetFile.readAll()); + stylesheetFile.close(); + + // UI tweaks + ui->okBtn->setProperty("type", "borderless"); +} + +koboxSettings::~koboxSettings() +{ + delete ui; +} + +void koboxSettings::on_okBtn_clicked() +{ + koboxSettings::close(); +} diff --git a/koboxsettings.h b/koboxsettings.h new file mode 100644 index 0000000..4f830d6 --- /dev/null +++ b/koboxsettings.h @@ -0,0 +1,25 @@ +#ifndef KOBOXSETTINGS_H +#define KOBOXSETTINGS_H + +#include + +namespace Ui { +class koboxSettings; +} + +class koboxSettings : public QWidget +{ + Q_OBJECT + +public: + explicit koboxSettings(QWidget *parent = nullptr); + ~koboxSettings(); + +private slots: + void on_okBtn_clicked(); + +private: + Ui::koboxSettings *ui; +}; + +#endif // KOBOXSETTINGS_H diff --git a/koboxsettings.ui b/koboxsettings.ui new file mode 100644 index 0000000..d2c4392 --- /dev/null +++ b/koboxsettings.ui @@ -0,0 +1,108 @@ + + + koboxSettings + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + QFrame::Plain + + + 5 + + + Qt::Horizontal + + + + + + + + Inter + 75 + true + + + + KoBox settings + + + Qt::AlignCenter + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + + Inter + 75 + true + + + + +OK + + + + + + + + QFrame::Plain + + + 2 + + + Qt::Horizontal + + + + + + + + + + diff --git a/mainwindow.h b/mainwindow.h index fbe3913..93ba49a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -11,6 +11,7 @@ #include "usbms_splash.h" #include "brightnessdialog.h" #include "generaldialog.h" +#include "koboxsettings.h" using namespace std; @@ -71,5 +72,6 @@ private: usbms_splash *usbmsWindow; brightnessDialog *brightnessDialogWindow; generalDialog *generalDialogWindow; + koboxSettings *koboxSettingsWindow; }; #endif // MAINWINDOW_H diff --git a/settingschooser.cpp b/settingschooser.cpp index 0bc955f..d8a3c99 100644 --- a/settingschooser.cpp +++ b/settingschooser.cpp @@ -67,7 +67,14 @@ settingsChooser::~settingsChooser() void settingsChooser::on_inkboxSettingsBtn_clicked() { - settingsWindow = new settings(); - settingsWindow->setAttribute(Qt::WA_DeleteOnClose); - settingsWindow->showFullScreen(); + settingsWindow = new settings(); + settingsWindow->setAttribute(Qt::WA_DeleteOnClose); + settingsWindow->showFullScreen(); +} + +void settingsChooser::on_koboxSettingsBtn_clicked() +{ + koboxSettingsWindow = new koboxSettings(); + koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose); + koboxSettingsWindow->showFullScreen(); } diff --git a/settingschooser.h b/settingschooser.h index 77b2961..583daae 100644 --- a/settingschooser.h +++ b/settingschooser.h @@ -4,6 +4,7 @@ #include #include "settings.h" +#include "koboxsettings.h" namespace Ui { class settingsChooser; @@ -25,9 +26,12 @@ public: private slots: void on_inkboxSettingsBtn_clicked(); + void on_koboxSettingsBtn_clicked(); + private: Ui::settingsChooser *ui; settings *settingsWindow; + koboxSettings *koboxSettingsWindow; }; #endif // SETTINGSCHOOSER_H