Added KoBox settings base

This commit is contained in:
Nicolas Mailloux 2021-04-27 08:40:08 -04:00
parent 10bbe560a4
commit b38a5bd9a0
7 changed files with 182 additions and 3 deletions

View file

@ -16,6 +16,7 @@ SOURCES += \
brightnessdialog.cpp \ brightnessdialog.cpp \
calendarapp.cpp \ calendarapp.cpp \
generaldialog.cpp \ generaldialog.cpp \
koboxsettings.cpp \
main.cpp \ main.cpp \
mainwindow.cpp \ mainwindow.cpp \
quit.cpp \ quit.cpp \
@ -32,6 +33,7 @@ HEADERS += \
calendarapp.h \ calendarapp.h \
functions.h \ functions.h \
generaldialog.h \ generaldialog.h \
koboxsettings.h \
mainwindow.h \ mainwindow.h \
quit.h \ quit.h \
reader.h \ reader.h \
@ -46,6 +48,7 @@ FORMS += \
brightnessdialog.ui \ brightnessdialog.ui \
calendarapp.ui \ calendarapp.ui \
generaldialog.ui \ generaldialog.ui \
koboxsettings.ui \
mainwindow.ui \ mainwindow.ui \
quit.ui \ quit.ui \
reader.ui \ reader.ui \

30
koboxsettings.cpp Normal file
View file

@ -0,0 +1,30 @@
#include "koboxsettings.h"
#include "ui_koboxsettings.h"
#include <QFile>
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();
}

25
koboxsettings.h Normal file
View file

@ -0,0 +1,25 @@
#ifndef KOBOXSETTINGS_H
#define KOBOXSETTINGS_H
#include <QWidget>
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

108
koboxsettings.ui Normal file
View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>koboxSettings</class>
<widget class="QWidget" name="koboxSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>KoBox settings</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_2"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="okBtn">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>
OK
</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -11,6 +11,7 @@
#include "usbms_splash.h" #include "usbms_splash.h"
#include "brightnessdialog.h" #include "brightnessdialog.h"
#include "generaldialog.h" #include "generaldialog.h"
#include "koboxsettings.h"
using namespace std; using namespace std;
@ -71,5 +72,6 @@ private:
usbms_splash *usbmsWindow; usbms_splash *usbmsWindow;
brightnessDialog *brightnessDialogWindow; brightnessDialog *brightnessDialogWindow;
generalDialog *generalDialogWindow; generalDialog *generalDialogWindow;
koboxSettings *koboxSettingsWindow;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -67,7 +67,14 @@ settingsChooser::~settingsChooser()
void settingsChooser::on_inkboxSettingsBtn_clicked() void settingsChooser::on_inkboxSettingsBtn_clicked()
{ {
settingsWindow = new settings(); settingsWindow = new settings();
settingsWindow->setAttribute(Qt::WA_DeleteOnClose); settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
settingsWindow->showFullScreen(); settingsWindow->showFullScreen();
}
void settingsChooser::on_koboxSettingsBtn_clicked()
{
koboxSettingsWindow = new koboxSettings();
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
koboxSettingsWindow->showFullScreen();
} }

View file

@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include "settings.h" #include "settings.h"
#include "koboxsettings.h"
namespace Ui { namespace Ui {
class settingsChooser; class settingsChooser;
@ -25,9 +26,12 @@ public:
private slots: private slots:
void on_inkboxSettingsBtn_clicked(); void on_inkboxSettingsBtn_clicked();
void on_koboxSettingsBtn_clicked();
private: private:
Ui::settingsChooser *ui; Ui::settingsChooser *ui;
settings *settingsWindow; settings *settingsWindow;
koboxSettings *koboxSettingsWindow;
}; };
#endif // SETTINGSCHOOSER_H #endif // SETTINGSCHOOSER_H