mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Basic settings stacked widget implementation
This commit is contained in:
parent
d1d03ae16e
commit
6eefeed69f
9 changed files with 257 additions and 63 deletions
2
apps.ui
2
apps.ui
|
@ -204,7 +204,7 @@
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWidth">
|
<property name="lineWidth">
|
||||||
<number>5</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
|
3
eink.qrc
3
eink.qrc
|
@ -40,5 +40,8 @@
|
||||||
<file>resources/battery_alert.png</file>
|
<file>resources/battery_alert.png</file>
|
||||||
<file>resources/apps-inverted.png</file>
|
<file>resources/apps-inverted.png</file>
|
||||||
<file>resources/home.png</file>
|
<file>resources/home.png</file>
|
||||||
|
<file>resources/settings-inverted.png</file>
|
||||||
|
<file>resources/kobox-icon.png</file>
|
||||||
|
<file>resources/X11.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -24,8 +24,11 @@ namespace global {
|
||||||
}
|
}
|
||||||
namespace mainwindow {
|
namespace mainwindow {
|
||||||
namespace tabSwitcher {
|
namespace tabSwitcher {
|
||||||
|
inline bool repaint;
|
||||||
|
|
||||||
inline bool appsWidgetCreated;
|
inline bool appsWidgetCreated;
|
||||||
inline bool appsWidgetSelected;
|
inline bool appsWidgetSelected;
|
||||||
|
inline bool settingsWidgetSelected;
|
||||||
}
|
}
|
||||||
inline bool updateDialog;
|
inline bool updateDialog;
|
||||||
inline bool lowBatteryDialog;
|
inline bool lowBatteryDialog;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
#include <QPagedPaintDevice>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui->pushButton->setProperty("type", "borderless");
|
ui->pushButton->setProperty("type", "borderless");
|
||||||
ui->brightnessBtn->setProperty("type", "borderless");
|
ui->brightnessBtn->setProperty("type", "borderless");
|
||||||
ui->homeBtn->setProperty("type", "borderless");
|
ui->homeBtn->setProperty("type", "borderless");
|
||||||
|
ui->inkboxSettingsBtn->setProperty("type", "borderless");
|
||||||
|
ui->koboxSettingsBtn->setProperty("type", "borderless");
|
||||||
|
|
||||||
ui->settingsBtn->setText("");
|
ui->settingsBtn->setText("");
|
||||||
ui->appsBtn->setText("");
|
ui->appsBtn->setText("");
|
||||||
|
@ -44,12 +47,21 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui->searchBtn->setText("");
|
ui->searchBtn->setText("");
|
||||||
ui->brightnessBtn->setText("");
|
ui->brightnessBtn->setText("");
|
||||||
ui->homeBtn->setText("");
|
ui->homeBtn->setText("");
|
||||||
|
ui->inkboxSettingsBtn->setText("\t\t\tInkBox settings");
|
||||||
|
ui->koboxSettingsBtn->setText("\t\t\tKoBox settings");
|
||||||
|
ui->quoteLabel->setText("");
|
||||||
|
|
||||||
|
ui->quotePictureLabel->setText("");
|
||||||
|
|
||||||
ui->quoteHeadingLabel->setStyleSheet("padding: 30px");
|
ui->quoteHeadingLabel->setStyleSheet("padding: 30px");
|
||||||
|
ui->homeBtn->setStyleSheet("padding: 5px");
|
||||||
|
ui->inkboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left");
|
||||||
|
ui->koboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left");
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
global::battery::showLowBatteryDialog = true;
|
global::battery::showLowBatteryDialog = true;
|
||||||
global::battery::showCriticalBatteryAlert = true;
|
global::battery::showCriticalBatteryAlert = true;
|
||||||
|
global::mainwindow::tabSwitcher::repaint = true;
|
||||||
|
|
||||||
// Getting the screen's size
|
// Getting the screen's size
|
||||||
sW = QGuiApplication::screens()[0]->size().width();
|
sW = QGuiApplication::screens()[0]->size().width();
|
||||||
|
@ -92,6 +104,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui->brightnessBtn->setIcon(QIcon(":/resources/frontlight.png"));
|
ui->brightnessBtn->setIcon(QIcon(":/resources/frontlight.png"));
|
||||||
ui->brightnessBtn->setIconSize(QSize(brightnessIconWidth, brightnessIconHeight));
|
ui->brightnessBtn->setIconSize(QSize(brightnessIconWidth, brightnessIconHeight));
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
string_checkconfig_ro("/opt/inkbox_device");
|
string_checkconfig_ro("/opt/inkbox_device");
|
||||||
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
|
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
|
||||||
|
@ -387,8 +404,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->quoteLabel->hide();
|
ui->gridLayout_4->deleteLater();
|
||||||
ui->quotePictureLabel->hide();
|
ui->quotePictureLabel->deleteLater();
|
||||||
|
ui->quoteLabel->deleteLater();
|
||||||
ui->quoteHeadingLabel->setText("Books");
|
ui->quoteHeadingLabel->setText("Books");
|
||||||
ui->book1Btn->show();
|
ui->book1Btn->show();
|
||||||
ui->book2Btn->show();
|
ui->book2Btn->show();
|
||||||
|
@ -530,13 +548,27 @@ void MainWindow::openCriticalBatteryAlertWindow() {
|
||||||
|
|
||||||
void MainWindow::on_settingsBtn_clicked()
|
void MainWindow::on_settingsBtn_clicked()
|
||||||
{
|
{
|
||||||
settingsWindow = new settings();
|
resetWindow(false);
|
||||||
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
if(global::mainwindow::tabSwitcher::settingsWidgetSelected != true) {
|
||||||
settingsWindow->showFullScreen();
|
ui->settingsBtn->setStyleSheet("background: black");
|
||||||
|
ui->settingsBtn->setIcon(QIcon(":/resources/settings-inverted.png"));
|
||||||
|
|
||||||
|
// Switch tab
|
||||||
|
ui->stackedWidget->setCurrentIndex(2);
|
||||||
|
global::mainwindow::tabSwitcher::settingsWidgetSelected = true;
|
||||||
|
|
||||||
|
// Repaint
|
||||||
|
this->repaint();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_appsBtn_clicked()
|
void MainWindow::on_appsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
resetWindow(false);
|
||||||
|
if(global::mainwindow::tabSwitcher::appsWidgetSelected != true) {
|
||||||
ui->appsBtn->setStyleSheet("background: black");
|
ui->appsBtn->setStyleSheet("background: black");
|
||||||
ui->appsBtn->setIcon(QIcon(":/resources/apps-inverted.png"));
|
ui->appsBtn->setIcon(QIcon(":/resources/apps-inverted.png"));
|
||||||
|
|
||||||
|
@ -550,6 +582,13 @@ void MainWindow::on_appsBtn_clicked()
|
||||||
// Switch tab
|
// Switch tab
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
global::mainwindow::tabSwitcher::appsWidgetSelected = true;
|
global::mainwindow::tabSwitcher::appsWidgetSelected = true;
|
||||||
|
|
||||||
|
// Repaint
|
||||||
|
this->repaint();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_pushButton_clicked()
|
void MainWindow::on_pushButton_clicked()
|
||||||
|
@ -563,11 +602,9 @@ void MainWindow::on_searchBtn_clicked()
|
||||||
{
|
{
|
||||||
/*global::battery::showCriticalBatteryAlert = true;
|
/*global::battery::showCriticalBatteryAlert = true;
|
||||||
global::battery::showLowBatteryDialog = false;
|
global::battery::showLowBatteryDialog = false;
|
||||||
|
settingsWindow = new settings();
|
||||||
alertWindow = new alert();
|
ui->stackedWidget->insertWidget(2, settingsWindow);
|
||||||
alertWindow->setAttribute(Qt::WA_DeleteOnClose);
|
ui->stackedWidget->setCurrentIndex(2);*/
|
||||||
alertWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
|
|
||||||
alertWindow->show();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_quitBtn_clicked()
|
void MainWindow::on_quitBtn_clicked()
|
||||||
|
@ -626,18 +663,27 @@ void MainWindow::on_brightnessBtn_clicked()
|
||||||
|
|
||||||
void MainWindow::on_homeBtn_clicked()
|
void MainWindow::on_homeBtn_clicked()
|
||||||
{
|
{
|
||||||
resetWindow();
|
global::mainwindow::tabSwitcher::repaint = true;
|
||||||
|
resetWindow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::resetWindow() {
|
void MainWindow::resetWindow(bool resetStackedWidget) {
|
||||||
// Reset layout
|
// Reset layout
|
||||||
|
if(resetStackedWidget == true) {
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
global::mainwindow::tabSwitcher::appsWidgetSelected = false;
|
||||||
|
global::mainwindow::tabSwitcher::settingsWidgetSelected = false;
|
||||||
resetIcons();
|
resetIcons();
|
||||||
|
if(global::mainwindow::tabSwitcher::repaint == true) {
|
||||||
this->repaint();
|
this->repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::resetIcons() {
|
void MainWindow::resetIcons() {
|
||||||
// Reset icons
|
// Reset icons
|
||||||
ui->appsBtn->setStyleSheet("background: white");
|
ui->appsBtn->setStyleSheet("background: white");
|
||||||
ui->appsBtn->setIcon(QIcon(":/resources/apps.png"));
|
ui->appsBtn->setIcon(QIcon(":/resources/apps.png"));
|
||||||
|
ui->settingsBtn->setStyleSheet("background: white");
|
||||||
|
ui->settingsBtn->setIcon(QIcon(":/resources/settings.png"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
|
|
||||||
void openLowBatteryDialog();
|
void openLowBatteryDialog();
|
||||||
void openCriticalBatteryAlertWindow();
|
void openCriticalBatteryAlertWindow();
|
||||||
void resetWindow();
|
void resetWindow(bool resetStackedWidget);
|
||||||
void resetIcons();
|
void resetIcons();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
214
mainwindow.ui
214
mainwindow.ui
|
@ -167,16 +167,29 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="recentBooksLabel">
|
<spacer name="verticalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="quoteHeadingLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Chivo</family>
|
<weight>75</weight>
|
||||||
<italic>true</italic>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Recently read books will appear here.</string>
|
<string>Author's quote</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
@ -275,35 +288,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="quoteHeadingLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Author's quote</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<spacer name="verticalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
|
@ -353,14 +337,172 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="recentBooksLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Chivo</family>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Recently read books will appear here.</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="page_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_3">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<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_5">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="Line" name="line_9">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_9">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="koboxSettingsBtn">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Chivo</family>
|
||||||
|
<weight>50</weight>
|
||||||
|
<italic>true</italic>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>KoBox settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="inkboxSettingsBtn">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Chivo</family>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>InkBox settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="Line" name="line_10">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="Line" name="line_11">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="settingsLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_3"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
BIN
resources/X11.png
Normal file
BIN
resources/X11.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
resources/kobox-icon.png
Normal file
BIN
resources/kobox-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
BIN
resources/settings-inverted.png
Normal file
BIN
resources/settings-inverted.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in a new issue