2021-04-24 09:44:57 -07:00
|
|
|
#include "settingschooser.h"
|
|
|
|
#include "ui_settingschooser.h"
|
|
|
|
#include "functions.h"
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
#include <QScreen>
|
|
|
|
|
|
|
|
settingsChooser::settingsChooser(QWidget *parent) :
|
|
|
|
QWidget(parent),
|
|
|
|
ui(new Ui::settingsChooser)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
// Stylesheet
|
|
|
|
QFile stylesheetFile(":/resources/eink.qss");
|
|
|
|
stylesheetFile.open(QFile::ReadOnly);
|
|
|
|
this->setStyleSheet(stylesheetFile.readAll());
|
|
|
|
stylesheetFile.close();
|
|
|
|
|
2021-04-25 08:27:51 -07:00
|
|
|
// UI tweaks
|
2021-08-25 10:32:33 -07:00
|
|
|
if(checkconfig("/opt/inkbox_kobox_support") == false) {
|
2021-04-25 08:27:51 -07:00
|
|
|
ui->koboxSettingsBtn->hide();
|
|
|
|
ui->line_3->hide();
|
|
|
|
}
|
|
|
|
|
2021-04-24 09:44:57 -07:00
|
|
|
// Getting the screen's size
|
|
|
|
sW = QGuiApplication::screens()[0]->size().width();
|
|
|
|
sH = QGuiApplication::screens()[0]->size().height();
|
|
|
|
|
|
|
|
// Defining what the default icon size will be
|
2022-04-02 13:49:18 -07:00
|
|
|
if(global::deviceID == "n705\n") {
|
2021-04-24 09:44:57 -07:00
|
|
|
homeIconWidth = sW / 18;
|
|
|
|
homeIconHeight = sW / 18;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
homeIconWidth = sW / 20;
|
|
|
|
homeIconHeight = sW / 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->inkboxSettingsBtn->setProperty("type", "borderless");
|
|
|
|
ui->koboxSettingsBtn->setProperty("type", "borderless");
|
|
|
|
|
2022-04-02 13:49:18 -07:00
|
|
|
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
|
2021-04-25 08:27:51 -07:00
|
|
|
ui->inkboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left");
|
|
|
|
ui->koboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left");
|
|
|
|
}
|
2022-04-02 13:49:18 -07:00
|
|
|
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
|
2021-06-26 16:29:51 -07:00
|
|
|
ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left");
|
|
|
|
ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left");
|
|
|
|
}
|
2021-04-25 08:27:51 -07:00
|
|
|
else {
|
|
|
|
ui->inkboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left");
|
|
|
|
ui->koboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left");
|
|
|
|
}
|
|
|
|
|
2021-04-24 09:44:57 -07:00
|
|
|
ui->inkboxSettingsBtn->setText("\t\t\tInkBox settings");
|
|
|
|
ui->koboxSettingsBtn->setText("\t\t\tKoBox settings");
|
|
|
|
|
|
|
|
ui->inkboxSettingsBtn->setIcon(QIcon(":/resources/settings.png"));
|
|
|
|
ui->inkboxSettingsBtn->setIconSize(QSize(homeIconWidth, homeIconHeight));
|
|
|
|
ui->koboxSettingsBtn->setIcon(QIcon(":/resources/X11.png"));
|
|
|
|
ui->koboxSettingsBtn->setIconSize(QSize(homeIconWidth, homeIconHeight));
|
|
|
|
}
|
|
|
|
|
|
|
|
settingsChooser::~settingsChooser()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void settingsChooser::on_inkboxSettingsBtn_clicked()
|
|
|
|
{
|
2021-04-27 05:40:08 -07:00
|
|
|
settingsWindow = new settings();
|
|
|
|
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
2021-08-25 10:32:33 -07:00
|
|
|
connect(settingsWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
|
|
|
connect(settingsWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
|
2021-04-27 05:40:08 -07:00
|
|
|
settingsWindow->showFullScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void settingsChooser::on_koboxSettingsBtn_clicked()
|
|
|
|
{
|
|
|
|
koboxSettingsWindow = new koboxSettings();
|
|
|
|
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
koboxSettingsWindow->showFullScreen();
|
2021-04-24 09:44:57 -07:00
|
|
|
}
|
2021-08-25 10:32:33 -07:00
|
|
|
|
|
|
|
void settingsChooser::showToastNative(QString messageToDisplay) {
|
|
|
|
emit showToast(messageToDisplay);
|
|
|
|
}
|
|
|
|
|
|
|
|
void settingsChooser::closeIndefiniteToastNative() {
|
|
|
|
emit closeIndefiniteToast();
|
|
|
|
}
|