Wi-Fi graphics redesign WIP

This commit is contained in:
Nicolas Mailloux 2022-08-22 16:09:18 -04:00
parent 04a10aaecf
commit c49da9dc90
16 changed files with 658 additions and 442 deletions

View file

@ -93,9 +93,10 @@
<file>resources/lock.png</file> <file>resources/lock.png</file>
<file>resources/public.png</file> <file>resources/public.png</file>
<file>resources/wifi-0.png</file> <file>resources/wifi-0.png</file>
<file>resources/wifi-100.png</file>
<file>resources/wifi-25.png</file> <file>resources/wifi-25.png</file>
<file>resources/wifi-50.png</file> <file>resources/wifi-50.png</file>
<file>resources/wifi-75.png</file> <file>resources/wifi-75.png</file>
<file>resources/wifi-100.png</file>
<file>resources/log.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -166,8 +166,7 @@ namespace global {
inline QString bookPath; inline QString bookPath;
} }
namespace wifi { namespace wifi {
enum class wifiState enum class wifiState {
{
configured, configured,
enabled, enabled,
disabled, disabled,

View file

@ -134,7 +134,7 @@ MainWindow::MainWindow(QWidget *parent)
updateWifiAble(); updateWifiAble();
if(global::device::isWifiAble == true) { if(global::device::isWifiAble == true) {
// Start wifi updater // Start Wi-Fi icon updater
QTimer *wifiIconTimer = new QTimer(this); QTimer *wifiIconTimer = new QTimer(this);
wifiIconTimer->setInterval(2500); wifiIconTimer->setInterval(2500);
connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(updateWifiIcon())); connect(wifiIconTimer, SIGNAL(timeout()), this, SLOT(updateWifiIcon()));
@ -833,9 +833,9 @@ void MainWindow::updateWifiAble() {
void MainWindow::on_wifiBtn_clicked() void MainWindow::on_wifiBtn_clicked()
{ {
wifiDialog* newWIfiDialog = new wifiDialog(); wifiDialog* newWifiDialog = new wifiDialog();
QObject::connect(newWIfiDialog, &wifiDialog::showToast, this, &MainWindow::showToast); QObject::connect(newWifiDialog, &wifiDialog::showToast, this, &MainWindow::showToast);
newWIfiDialog->exec(); newWifiDialog->exec();
} }
void MainWindow::showToast(QString messageToDisplay) { void MainWindow::showToast(QString messageToDisplay) {

View file

@ -228,7 +228,6 @@ int main(int argc, char *argv[])
const QScreen * screen = qApp->primaryScreen(); const QScreen * screen = qApp->primaryScreen();
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size())); w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
w.setFixedSize(QSize(screen->geometry().height(), screen->geometry().width()));
w.show(); w.show();
return a.exec(); return a.exec();
} }

BIN
src/resources/log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -49,7 +49,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>457</width> <width>457</width>
<height>667</height> <height>657</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
@ -71,7 +71,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">

View file

@ -11,6 +11,7 @@ connectiondialog::connectiondialog(QWidget *parent) :
ui(new Ui::connectiondialog) ui(new Ui::connectiondialog)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setFont(QFont("u001"));
// Stylesheet, style & misc. // Stylesheet, style & misc.
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
@ -96,7 +97,7 @@ QString connectiondialog::searchDatabase(QString key) {
return returnedPassword; return returnedPassword;
} }
else { else {
log("Searched name '" + searchedName + "' doesn't match " + key + "'", className); log("Searched name '" + searchedName + "' doesn't match '" + key + "'", className);
} }
} }
return ""; return "";

View file

@ -2,11 +2,14 @@
#include "ui_network.h" #include "ui_network.h"
#include "connectiondialog.h" #include "connectiondialog.h"
#include <QScreen>
network::network(QWidget *parent) : network::network(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::network) ui(new Ui::network)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setFont(QFont("u001"));
// Stylesheet, style & misc. // Stylesheet, style & misc.
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
@ -17,6 +20,8 @@ network::network(QWidget *parent) :
// Buttons // Buttons
ui->encryptionIcon->setProperty("type", "borderless"); ui->encryptionIcon->setProperty("type", "borderless");
ui->encryptionIcon->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }"); ui->encryptionIcon->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }");
ui->signalStrengthIcon->setProperty("type", "borderless");
ui->signalStrengthIcon->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }");
ui->enterButton->setProperty("type", "borderless"); ui->enterButton->setProperty("type", "borderless");
} }
@ -27,6 +32,7 @@ network::~network()
void network::applyVariables() { void network::applyVariables() {
log("Applying variables for network", className); log("Applying variables for network", className);
QString percent = "%"; QString percent = "%";
if(mainData.signal < 100) { if(mainData.signal < 100) {
percent.append(" "); percent.append(" ");
@ -34,12 +40,13 @@ void network::applyVariables() {
ui->signalStrengthLabel->setText(QString::number(mainData.signal) + percent); ui->signalStrengthLabel->setText(QString::number(mainData.signal) + percent);
// Limit name size // Limit name size
QString cutSingleData = mainData.name; int nameLength = mainData.name.length();
if(cutSingleData.count() > 27) { QString name = mainData.name;
cutSingleData = cutSingleData.remove(24, cutSingleData.count() - 24); if(nameLength > 20) {
cutSingleData.append("..."); name.chop(nameLength - 20);
name.append("...");
} }
ui->nameLabel->setText(cutSingleData); ui->nameLabel->setText(name);
if(mainData.encryption == true) { if(mainData.encryption == true) {
ui->encryptionIcon->setIcon(QIcon(":/resources/lock.png")); ui->encryptionIcon->setIcon(QIcon(":/resources/lock.png"));
@ -49,18 +56,34 @@ void network::applyVariables() {
} }
if(currentlyConnectedNetwork == mainData.name) { if(currentlyConnectedNetwork == mainData.name) {
ui->frame->setStyleSheet(".QFrame{background-color: grey; border: 3px solid black; border-radius: 10px;}"); ui->frame->setStyleSheet(".QFrame{background-color: lightGray; border: 2px solid black; border-radius: 10px;}");
ui->signalStrengthLabel->setStyleSheet("background-color:grey;"); ui->signalStrengthLabel->setStyleSheet("background-color: lightGray;");
ui->nameLabel->setStyleSheet("background-color:grey;"); ui->nameLabel->setStyleSheet("background-color: lightGray;");
ui->encryptionIcon->setStyleSheet("background-color:grey;"); ui->encryptionIcon->setStyleSheet("background-color: lightGray;");
ui->enterButton->setStyleSheet("background-color:grey;"); ui->enterButton->setStyleSheet("background-color: lightGray;");
ui->encryptionIcon->setStyleSheet("QPushButton {background-color: grey; border: none}; QPushButton[type='borderless']:pressed { background: grey; color: grey; border: none; }");
ui->enterButton->setStyleSheet("QPushButton {background-color: grey; border: none}; QPushButton[type='borderless']:pressed { background: grey; color: grey; border: none; }");
ui->signalStrengthIcon->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }");
ui->encryptionIcon->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }");
ui->enterButton->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }");
} }
else { else {
ui->frame->setStyleSheet(".QFrame{background-color: white; border: 3px solid black; border-radius: 10px;}"); ui->frame->setStyleSheet(".QFrame{background-color: white; border: 2px solid black; border-radius: 10px;}");
}
if(mainData.signal >= 0 and mainData.signal <= 25) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-0.png"));
}
else if(mainData.signal >= 25 and mainData.signal <= 50) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-25.png"));
}
else if(mainData.signal >= 50 and mainData.signal <= 75) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-50.png"));
}
else if(mainData.signal >= 75 and mainData.signal <= 100) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-75.png"));
}
else if(mainData.signal == 100) {
ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-100.png"));
} }
} }

View file

@ -21,13 +21,13 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>17</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>4</number> <number>4</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>17</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>4</number> <number>4</number>
@ -47,11 +47,11 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>3</number> <number>1</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin"> <property name="leftMargin">
<number>3</number> <number>12</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>3</number> <number>3</number>
@ -63,9 +63,21 @@
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="signalStrengthLabel"> <widget class="QPushButton" name="signalStrengthIcon">
<property name="text"> <property name="text">
<string>SIgnal strenth</string> <string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="signalStrengthLabel">
<property name="font">
<font>
<family>U001</family>
</font>
</property>
<property name="text">
<string>Signal strength</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -75,7 +87,7 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>3</number> <number>1</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -84,8 +96,13 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="nameLabel"> <widget class="QLabel" name="nameLabel">
<property name="font">
<font>
<family>U001</family>
</font>
</property>
<property name="text"> <property name="text">
<string>wifi name</string> <string>Wi-Fi network name</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -17,6 +17,7 @@ wifiDialog::wifiDialog(QWidget *parent) :
ui(new Ui::wifiDialog) ui(new Ui::wifiDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setFont(QFont("u001"));
// Stylesheet, style & misc. // Stylesheet, style & misc.
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
@ -25,33 +26,44 @@ wifiDialog::wifiDialog(QWidget *parent) :
stylesheetFile.close(); stylesheetFile.close();
this->setModal(true); this->setModal(true);
ui->stopBtn->setIcon(QIcon(":/resources/stop.png")); ui->wifiCheckBox->setFont(QFont("Inter"));
ui->logBtn->setIcon(QIcon(":/resources/file-text.png")); ui->returnBtn->setFont(QFont("Inter"));
ui->refreshBtn->setIcon(QIcon(":/resources/refresh.png")); ui->returnBtn->setStyleSheet("font-weight: bold");
ui->wifiCheckBox->setStyleSheet("QCheckBox::indicator { width:50px; height: 50px; }");
ui->refreshBtn->setProperty("type", "borderless");
ui->stopBtn->setProperty("type", "borderless");
ui->logBtn->setProperty("type", "borderless");
ui->returnBtn->setProperty("type", "borderless"); ui->returnBtn->setProperty("type", "borderless");
ui->refreshBtn->setIcon(QIcon(":/resources/refresh.png"));
ui->stopBtn->setIcon(QIcon(":/resources/stop.png"));
ui->logBtn->setIcon(QIcon(":/resources/log.png"));
// Size // Size
QRect screenGeometry = QGuiApplication::screens()[0]->geometry(); QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
this->setFixedWidth(screenGeometry.width()); this->setFixedWidth(screenGeometry.width() / 1.1);
int halfOfHalfHeight = ((screenGeometry.height() / 2) / 2) / 2; int halfOfHalfHeight = ((screenGeometry.height() / 2) / 2) / 2;
int finalHeight = screenGeometry.height() - halfOfHalfHeight * 2; int finalHeight = screenGeometry.height() - halfOfHalfHeight * 2;
this->setFixedHeight(finalHeight); this->setFixedHeight(finalHeight);
this->move(0, halfOfHalfHeight);
// Centering dialog
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height() - this->height()) / 2;
this->move(x, y);
// Button sizes // Button sizes
ui->stopBtn->setFixedWidth(screenGeometry.width() / 8); ui->stopBtn->setFixedWidth(screenGeometry.width() / 9);
ui->logBtn->setFixedWidth(screenGeometry.width() / 8); ui->logBtn->setFixedWidth(screenGeometry.width() / 9);
ui->refreshBtn->setFixedWidth(screenGeometry.width() / 8); ui->refreshBtn->setFixedWidth(screenGeometry.width() / 9);
int heighIncrease = 20; int heightIncrease = 20;
ui->stopBtn->setFixedHeight(ui->stopBtn->height() + heighIncrease); ui->stopBtn->setFixedHeight(ui->stopBtn->height() + heightIncrease);
ui->logBtn->setFixedHeight(ui->logBtn->height() + heighIncrease); ui->logBtn->setFixedHeight(ui->logBtn->height() + heightIncrease);
ui->refreshBtn->setFixedHeight(ui->refreshBtn->height() + heighIncrease); ui->refreshBtn->setFixedHeight(ui->refreshBtn->height() + heightIncrease);
// And set wifi checkbox state. also ignore this first call // Set Wi-Fi checkbox state. Ignore the first call.
global::wifi::wifiState currentWifiState = checkWifiState(); global::wifi::wifiState currentWifiState = checkWifiState();
if(currentWifiState != global::wifi::wifiState::disabled and currentWifiState != global::wifi::wifiState::unknown) { if(currentWifiState != global::wifi::wifiState::disabled and currentWifiState != global::wifi::wifiState::unknown) {
ui->wifiCheckBox->setChecked(true); ui->wifiCheckBox->setChecked(true);
@ -65,7 +77,7 @@ wifiDialog::wifiDialog(QWidget *parent) :
} }
// To avoid confusion with reconnecting // To avoid confusion with reconnecting
QTimer::singleShot(2000, this, SLOT(theWatcher())); QTimer::singleShot(2000, this, SLOT(watcher()));
} }
wifiDialog::~wifiDialog() wifiDialog::~wifiDialog()
@ -362,7 +374,7 @@ void wifiDialog::refreshScreenSlot() {
* prepare_changing_wifi.sh - Kills everything, prepares to changing network * prepare_changing_wifi.sh - Kills everything, prepares to changing network
* smarter_time_sync.sh - Syncs time * smarter_time_sync.sh - Syncs time
* toggle.sh - Turns on/off Wi-Fi adapter * toggle.sh - Turns on/off Wi-Fi adapter
* list_networks.bin - Lists networks * list_networks - Lists networks
* check_wifi_password.sh - Checks Wi-Fi network password * check_wifi_password.sh - Checks Wi-Fi network password
* watcher() first watches at processes that could kill other ones * watcher() first watches at processes that could kill other ones
*/ */
@ -399,9 +411,9 @@ void wifiDialog::watcher() {
return void(); return void();
} }
bool listing = checkProcessName("list_networks.bin"); bool listing = checkProcessName("list_networks");
if(listing == true) { if(listing == true) {
setStatusText("Scanning networks ..."); setStatusText("Scanning available networks");
QTimer::singleShot(relaunchMs, this, SLOT(watcher())); QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
return void(); return void();
} }
@ -433,13 +445,13 @@ void wifiDialog::watcher() {
bool connecting = checkProcessName("connection_manager.sh"); bool connecting = checkProcessName("connection_manager.sh");
if(connecting == true) { if(connecting == true) {
forceRefresh = true; forceRefresh = true;
setStatusText("Connecting to Wi-Fi network ..."); setStatusText("Connecting to Wi-Fi network");
QTimer::singleShot(relaunchMs, this, SLOT(watcher())); QTimer::singleShot(relaunchMs, this, SLOT(watcher()));
return void(); return void();
} }
if(ui->statusLabel->text() != "Idling") { if(ui->statusLabel->text() != "Idle") {
setStatusText("Idling"); setStatusText("Idle");
} }
if(unlockCheckBox == true) { if(unlockCheckBox == true) {

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>783</width> <width>603</width>
<height>679</height> <height>679</height>
</rect> </rect>
</property> </property>
@ -35,33 +35,21 @@
<number>10</number> <number>10</number>
</property> </property>
<item> <item>
<widget class="QPushButton" name="logBtn"> <widget class="QPushButton" name="refreshBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_3"> <widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> </widget>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="stopBtn"> <widget class="QPushButton" name="stopBtn">
@ -77,23 +65,23 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_4"> <widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> </widget>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="refreshBtn"> <widget class="QPushButton" name="logBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@ -115,20 +103,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3"/>
<item>
<widget class="QLabel" name="statusLabel">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Wifi status</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -147,8 +122,14 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Wifi</string> <string>Wi-Fi</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -163,6 +144,18 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Wi-Fi status</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">
<property name="frameShape"> <property name="frameShape">
@ -188,16 +181,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>765</width> <width>585</width>
<height>567</height> <height>557</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin"> <property name="rightMargin">
<number>9</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
@ -238,7 +237,7 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>3</number> <number>2</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -253,6 +252,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Return</string> <string>Return</string>
</property> </property>

View file

@ -1,5 +1,6 @@
#include <QFile> #include <QFile>
#include <QScrollBar> #include <QScrollBar>
#include <QScreen>
#include "wifilogger.h" #include "wifilogger.h"
#include "ui_wifilogger.h" #include "ui_wifilogger.h"
@ -10,6 +11,17 @@ wifilogger::wifilogger(QWidget *parent) :
ui(new Ui::wifilogger) ui(new Ui::wifilogger)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setFont(QFont("u001"));
// 'Not currently connected to a network' label
ui->label_8->setFont(QFont("Inter"));
ui->returnBtn->setFont(QFont("Inter"));
ui->nameLabel->setFont(QFont("Inter"));
ui->allLogsText->setFont(QFont("Noto Mono"));
ui->fancyLogsText->setFont(QFont("Noto Mono"));
ui->nameLabel->setStyleSheet("font-weight: bold");
ui->returnBtn->setStyleSheet("font-weight: bold");
ui->allLogsText->setStyleSheet("font-size: 7pt");
ui->fancyLogsText->setStyleSheet("font-size: 7pt");
// Stylesheet, style & misc. // Stylesheet, style & misc.
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
@ -20,16 +32,29 @@ wifilogger::wifilogger(QWidget *parent) :
// Scroll bar // Scroll bar
// Needed for the nia. // Needed for the nia.
ui->allLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }"); // ui->allLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }");
ui->fancyLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }"); // ui->fancyLogsText->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 50px; }");
log("Entered wifilogger", className); log("Entered wifilogger", className);
setWifiInfoPage(); setWifiInfoPage();
ui->previousBtn->setProperty("type", "borderless");
ui->nextBtn->setProperty("type", "borderless");
ui->returnBtn->setProperty("type", "borderless");
ui->refreshBtn->setProperty("type", "borderless"); ui->refreshBtn->setProperty("type", "borderless");
ui->nextBtn->setFixedWidth(70); // Size
ui->previousBtn->setFixedWidth(70); QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
this->setFixedWidth(screenGeometry.width() / 1.2);
int halfOfHalfHeight = ((screenGeometry.height() / 2) / 2) / 2;
int finalHeight = screenGeometry.height() - halfOfHalfHeight * 2.4;
this->setFixedHeight(finalHeight);
// Centering dialog
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height() - this->height()) / 2;
this->move(x, y);
} }
wifilogger::~wifilogger() wifilogger::~wifilogger()
@ -92,8 +117,9 @@ void wifilogger::changePage() {
} }
else if(currentPage == 2) { else if(currentPage == 2) {
setAllLogsPage(); setAllLogsPage();
} else { }
log("This shouldnt happen.", className); else {
log("This shouldn't happen", className);
} }
} }

View file

@ -29,7 +29,7 @@ private:
*/ */
int currentPage = 0; int currentPage = 0;
QFile fancyLogs = QFile("/external_root/run/wifi_stats"); QFile fancyLogs = QFile("/external_root/run/wifi_stats");
QFile allLogs = QFile("/external_root/run/wifi_logs"); QFile allLogs = QFile("/external_root/var/log/wifi.log");
bool waitingForFile = false; bool waitingForFile = false;
private slots: private slots:

View file

@ -6,327 +6,412 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>755</width> <width>476</width>
<height>613</height> <height>273</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0"> <item row="1" column="0">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QScrollArea" name="scrollArea">
<property name="lineWidth"> <property name="widgetResizable">
<number>0</number> <bool>true</bool>
</property> </property>
<property name="currentIndex"> <widget class="QWidget" name="scrollAreaWidgetContents_2">
<number>3</number> <property name="geometry">
</property> <rect>
<widget class="QWidget" name="page_0"> <x>0</x>
<layout class="QVBoxLayout" name="verticalLayout_2"> <y>0</y>
<width>442</width>
<height>208</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QStackedWidget" name="stackedWidget">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Network name: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="netNameLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>IP address:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ipLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Mask: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="maskLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Gateway: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gatewayLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Password protected:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="encryptionLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Signal strength: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="signalLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>MAC address: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="macLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_0_fallback">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="lineWidth"> <property name="lineWidth">
<number>0</number> <number>0</number>
</property> </property>
<property name="text"> <property name="currentIndex">
<string>No wifi connected</string> <number>0</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_1">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTextBrowser" name="fancyLogsText">
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTextBrowser" name="allLogsText">
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property> </property>
<widget class="QWidget" name="page_0">
<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="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Network name: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="netNameLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>IP address:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ipLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Mask: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="maskLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Gateway: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gatewayLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Password protected:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="encryptionLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Signal strength: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="signalLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>MAC address: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="macLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_0_fallback">
<layout class="QGridLayout" name="gridLayout">
<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 row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string>Not currently connected to a network</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_1">
<layout class="QGridLayout" name="gridLayout_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>
<item row="0" column="0">
<widget class="QTextBrowser" name="fancyLogsText">
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_4">
<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 row="0" column="0">
<widget class="QTextBrowser" name="allLogsText">
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -361,28 +446,17 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="nameLabel"> <widget class="QLabel" name="nameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="refreshBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../eink.qrc">
<normaloff>:/resources/refresh.png</normaloff>:/resources/refresh.png</iconset>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -409,10 +483,69 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="returnBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Return</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refreshBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../eink.qrc">
<normaloff>:/resources/refresh.png</normaloff>:/resources/refresh.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QPushButton" name="returnBtn"> <widget class="Line" name="line_2">
<property name="text"> <property name="frameShadow">
<string>Return</string> <enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>