mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Tab switcher working
Rearranged layout, home button on the top left, time at top right. Apps is no longer a window, but embedded into stackedWidget > Index page 1. Possible to switch back and forth between main display and Apps widget.
This commit is contained in:
parent
26434797e9
commit
d1d03ae16e
9 changed files with 145 additions and 95 deletions
2
apps.cpp
2
apps.cpp
|
@ -8,7 +8,6 @@ apps::apps(QWidget *parent) :
|
|||
ui(new Ui::apps)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->backBtn->setProperty("type", "borderless");
|
||||
ui->scribbleLaunchBtn->setProperty("type", "borderless");
|
||||
ui->lightmapsLaunchBtn->setProperty("type", "borderless");
|
||||
ui->calendarLaunchBtn->setProperty("type", "borderless");
|
||||
|
@ -25,7 +24,6 @@ apps::apps(QWidget *parent) :
|
|||
stylesheetFile.open(QFile::ReadOnly);
|
||||
this->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
QObject::connect(ui->backBtn, SIGNAL(clicked()), this, SLOT(exitSlot()));
|
||||
}
|
||||
|
||||
apps::~apps()
|
||||
|
|
42
apps.ui
42
apps.ui
|
@ -7,13 +7,25 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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">
|
||||
<item row="0" column="0">
|
||||
|
@ -171,34 +183,6 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="backBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>
|
||||
Back
|
||||
</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" 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>
|
||||
<item row="4" column="0">
|
||||
|
|
2
eink.qrc
2
eink.qrc
|
@ -38,5 +38,7 @@
|
|||
<file>resources/minus.png</file>
|
||||
<file>resources/plus.png</file>
|
||||
<file>resources/battery_alert.png</file>
|
||||
<file>resources/apps-inverted.png</file>
|
||||
<file>resources/home.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -23,6 +23,10 @@ namespace global {
|
|||
inline bool startBatteryWatchdog;
|
||||
}
|
||||
namespace mainwindow {
|
||||
namespace tabSwitcher {
|
||||
inline bool appsWidgetCreated;
|
||||
inline bool appsWidgetSelected;
|
||||
}
|
||||
inline bool updateDialog;
|
||||
inline bool lowBatteryDialog;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->searchBtn->setProperty("type", "borderless");
|
||||
ui->pushButton->setProperty("type", "borderless");
|
||||
ui->brightnessBtn->setProperty("type", "borderless");
|
||||
ui->homeBtn->setProperty("type", "borderless");
|
||||
|
||||
ui->settingsBtn->setText("");
|
||||
ui->appsBtn->setText("");
|
||||
|
@ -42,35 +43,35 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->quitBtn->setText("");
|
||||
ui->searchBtn->setText("");
|
||||
ui->brightnessBtn->setText("");
|
||||
ui->homeBtn->setText("");
|
||||
|
||||
ui->quoteHeadingLabel->setStyleSheet("padding: 50px");
|
||||
ui->quoteHeadingLabel->setStyleSheet("padding: 30px");
|
||||
|
||||
// Variables
|
||||
global::battery::showLowBatteryDialog = true;
|
||||
global::battery::showCriticalBatteryAlert = true;
|
||||
|
||||
// Getting the screen's size
|
||||
float sW = QGuiApplication::screens()[0]->size().width();
|
||||
float sH = QGuiApplication::screens()[0]->size().height();
|
||||
sW = QGuiApplication::screens()[0]->size().width();
|
||||
sH = QGuiApplication::screens()[0]->size().height();
|
||||
|
||||
// Defining what the default icon size will be
|
||||
|
||||
float stdIconWidth;
|
||||
float stdIconHeight;
|
||||
float brightnessIconWidth;
|
||||
float brightnessIconHeight;
|
||||
|
||||
string_checkconfig("/opt/inkbox_device");
|
||||
if(checkconfig_str_val == "n705\n") {
|
||||
stdIconWidth = sW / 12;
|
||||
stdIconHeight = sH / 12;
|
||||
brightnessIconWidth = sW / 24;
|
||||
brightnessIconHeight = sH / 24;
|
||||
homeIconWidth = sW / 18;
|
||||
homeIconHeight = sW / 18;
|
||||
}
|
||||
else {
|
||||
stdIconWidth = sW / 14;
|
||||
stdIconHeight = sH / 14;
|
||||
brightnessIconWidth = sW / 26;
|
||||
brightnessIconHeight = sH / 26;
|
||||
homeIconWidth = sW / 20;
|
||||
homeIconHeight = sW / 20;
|
||||
}
|
||||
|
||||
// Setting icons up
|
||||
|
@ -85,6 +86,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->quitBtn->setIcon(QIcon(":/resources/power.png"));
|
||||
ui->quitBtn->setIconSize(QSize(stdIconWidth, stdIconHeight));
|
||||
|
||||
ui->homeBtn->setIcon(QIcon(":/resources/home.png"));
|
||||
ui->homeBtn->setIconSize(QSize(homeIconWidth, homeIconHeight));
|
||||
|
||||
ui->brightnessBtn->setIcon(QIcon(":/resources/frontlight.png"));
|
||||
ui->brightnessBtn->setIconSize(QSize(brightnessIconWidth, brightnessIconHeight));
|
||||
|
||||
|
@ -533,11 +537,19 @@ void MainWindow::on_settingsBtn_clicked()
|
|||
|
||||
void MainWindow::on_appsBtn_clicked()
|
||||
{
|
||||
appsWindow = new apps();
|
||||
//appsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
//appsWindow->showFullScreen();
|
||||
ui->stackedWidget->insertWidget(1, appsWindow);
|
||||
ui->appsBtn->setStyleSheet("background: black");
|
||||
ui->appsBtn->setIcon(QIcon(":/resources/apps-inverted.png"));
|
||||
|
||||
// Create the widget only once
|
||||
if(global::mainwindow::tabSwitcher::appsWidgetCreated != true) {
|
||||
appsWindow = new apps();
|
||||
ui->stackedWidget->insertWidget(1, appsWindow);
|
||||
global::mainwindow::tabSwitcher::appsWidgetCreated = true;
|
||||
}
|
||||
|
||||
// Switch tab
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
global::mainwindow::tabSwitcher::appsWidgetSelected = true;
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
|
@ -611,3 +623,21 @@ void MainWindow::on_brightnessBtn_clicked()
|
|||
brightnessDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
brightnessDialogWindow->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_homeBtn_clicked()
|
||||
{
|
||||
resetWindow();
|
||||
}
|
||||
|
||||
void MainWindow::resetWindow() {
|
||||
// Reset layout
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
resetIcons();
|
||||
this->repaint();
|
||||
}
|
||||
|
||||
void MainWindow::resetIcons() {
|
||||
// Reset icons
|
||||
ui->appsBtn->setStyleSheet("background: white");
|
||||
ui->appsBtn->setIcon(QIcon(":/resources/apps.png"));
|
||||
}
|
||||
|
|
14
mainwindow.h
14
mainwindow.h
|
@ -10,6 +10,7 @@
|
|||
#include "usbms_splash.h"
|
||||
#include "brightnessdialog.h"
|
||||
#include "generaldialog.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -23,6 +24,16 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
float stdIconWidth;
|
||||
float stdIconHeight;
|
||||
float brightnessIconWidth;
|
||||
float brightnessIconHeight;
|
||||
float homeIconWidth;
|
||||
float homeIconHeight;
|
||||
float sW;
|
||||
float sH;
|
||||
|
||||
bool existing_recent_books = false;
|
||||
bool reboot_after_update = false;
|
||||
int timerTime = 0;
|
||||
|
@ -30,6 +41,8 @@ public:
|
|||
|
||||
void openLowBatteryDialog();
|
||||
void openCriticalBatteryAlertWindow();
|
||||
void resetWindow();
|
||||
void resetIcons();
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -45,6 +58,7 @@ private slots:
|
|||
void on_book4Btn_clicked();
|
||||
void on_brightnessBtn_clicked();
|
||||
void openUpdateDialog();
|
||||
void on_homeBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
120
mainwindow.ui
120
mainwindow.ui
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<width>602</width>
|
||||
<height>601</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -17,6 +17,19 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QPushButton" name="brightnessBtn">
|
||||
<property name="text">
|
||||
|
@ -24,6 +37,43 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="batteryLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>batt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>―</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="QLabel" name="timeLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>time</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="inkboxLabel">
|
||||
<property name="font">
|
||||
|
@ -39,19 +89,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="batteryLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>batt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLabel" name="batteryIcon">
|
||||
<property name="text">
|
||||
|
@ -66,23 +103,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="timeLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>time</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -96,26 +116,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>―</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="frameShadow">
|
||||
|
@ -126,6 +126,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="homeBtn">
|
||||
<property name="text">
|
||||
<string>Home</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -343,6 +360,7 @@
|
|||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
BIN
resources/apps-inverted.png
Normal file
BIN
resources/apps-inverted.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
resources/home.png
Normal file
BIN
resources/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue