mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Basic encryption setup working & hourglass animation
This commit is contained in:
parent
db3d40d950
commit
b3da278096
11 changed files with 431 additions and 7 deletions
3
eink.qrc
3
eink.qrc
|
@ -63,5 +63,8 @@
|
|||
<file>resources/zoom-in.png</file>
|
||||
<file>resources/zoom-out.png</file>
|
||||
<file>resources/encryption.png</file>
|
||||
<file>resources/check-display.png</file>
|
||||
<file>resources/hourglass-bottom.png</file>
|
||||
<file>resources/hourglass-top.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QScreen>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
#include "functions.h"
|
||||
|
||||
encryptionManager::encryptionManager(QWidget *parent) :
|
||||
|
@ -21,18 +22,35 @@ encryptionManager::encryptionManager(QWidget *parent) :
|
|||
|
||||
ui->encryptionSetupLabel->setStyleSheet("font-size: 15pt");
|
||||
ui->descriptionLabel->setStyleSheet("font-size: 9pt");
|
||||
ui->successLabel->setStyleSheet("font-size: 15pt");
|
||||
ui->successDescriptionLabel->setStyleSheet("font-size: 9pt");
|
||||
ui->setupContinueBtn->setStyleSheet("font-size: 10pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||
ui->setupAbortBtn->setStyleSheet("font-size: 10pt; padding: 10px; font-weight: bold; background: lightGrey");
|
||||
ui->exitSuccessBtn->setStyleSheet("background: lightGrey; border: 3px solid black; color: black; padding: 10px; outline: none; font-size: 10pt; font-weight: bold");
|
||||
|
||||
// Getting the screen's size
|
||||
float sW = QGuiApplication::screens()[0]->size().width();
|
||||
float sH = QGuiApplication::screens()[0]->size().height();
|
||||
float stdIconWidth = sW / 1.50;
|
||||
float stdIconHeight = sH / 1.50;
|
||||
|
||||
float stdIconWidth;
|
||||
float stdIconHeight;
|
||||
{
|
||||
stdIconWidth = sW / 1.50;
|
||||
stdIconHeight = sH / 1.50;
|
||||
QPixmap pixmap(":/resources/encryption.png");
|
||||
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->encryptionImageLabel->setPixmap(scaledPixmap);
|
||||
}
|
||||
{
|
||||
stdIconWidth = sW / 1.65;
|
||||
stdIconHeight = sH / 1.65;
|
||||
QPixmap pixmap(":/resources/check-display.png");
|
||||
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->checkImageLabel->setPixmap(scaledPixmap);
|
||||
}
|
||||
|
||||
hourglassAnimationWidgetWindow = new hourglassAnimationWidget();
|
||||
ui->hourglassWidget->insertWidget(0, hourglassAnimationWidgetWindow);
|
||||
ui->hourglassWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
encryptionManager::~encryptionManager()
|
||||
|
@ -42,7 +60,7 @@ encryptionManager::~encryptionManager()
|
|||
|
||||
void encryptionManager::on_setupContinueBtn_clicked()
|
||||
{
|
||||
ui->activityWidget->hide();
|
||||
ui->activityWidget->setCurrentIndex(3);
|
||||
this->setStyleSheet("background-color: black");
|
||||
global::keyboard::keyboardDialog = true;
|
||||
global::keyboard::encfsDialog = true;
|
||||
|
@ -74,6 +92,7 @@ void encryptionManager::refreshScreen() {
|
|||
}
|
||||
|
||||
void encryptionManager::showToast(QString messageToDisplay) {
|
||||
qDebug() << "showToast";
|
||||
global::toast::message = messageToDisplay;
|
||||
toastWindow = new toast(this);
|
||||
toastWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
@ -82,6 +101,8 @@ void encryptionManager::showToast(QString messageToDisplay) {
|
|||
}
|
||||
|
||||
void encryptionManager::setupEncryptedStorage() {
|
||||
this->setStyleSheet("background-color: white");
|
||||
ui->activityWidget->show();
|
||||
mkEncfsDirs();
|
||||
std::string bootstrapPassphrase = global::encfs::passphrase.toStdString();
|
||||
global::encfs::passphrase = "";
|
||||
|
@ -90,6 +111,18 @@ void encryptionManager::setupEncryptedStorage() {
|
|||
string_writeconfig("/external_root/run/encfs/encrypted_storage_bootstrap_archive_location", "/data/onboard/data.encfs");
|
||||
string_writeconfig("/external_root/run/encfs/encrypted_storage_bootstrap_passphrase", bootstrapPassphrase);
|
||||
string_writeconfig("/opt/ibxd", "encfs_restart\n");
|
||||
bool exitStatus;
|
||||
ui->activityWidget->setCurrentIndex(3);
|
||||
QTimer * t = new QTimer(this);
|
||||
t->setInterval(1000);
|
||||
connect(t, &QTimer::timeout, [&]() {
|
||||
if(QFile::exists("/external_root/run/encrypted_storage_bootstrap_setup")) {
|
||||
exitStatus = checkconfig("/external_root/run/encrypted_storage_bootstrap_setup");
|
||||
QFile::remove("/external_root/run/encrypted_storage_bootstrap_setup");
|
||||
setupExitWidget(exitStatus);
|
||||
}
|
||||
} );
|
||||
t->start();
|
||||
}
|
||||
|
||||
void encryptionManager::mkEncfsDirs() {
|
||||
|
@ -102,3 +135,24 @@ void encryptionManager::mkEncfsDirs() {
|
|||
QDir decDir;
|
||||
QString decPath("/mnt/onboard/onboard/encfs-decrypted");
|
||||
}
|
||||
|
||||
void encryptionManager::on_exitSuccessBtn_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void encryptionManager::setupExitWidget(bool exitStatus) {
|
||||
if(setupExitWidgetRan == false) {
|
||||
if(exitStatus == true) {
|
||||
ui->activityWidget->setCurrentIndex(1);
|
||||
}
|
||||
else {
|
||||
string_writeconfig(".config/18-encrypted_storage/status", "false");
|
||||
ui->activityWidget->setCurrentIndex(2);
|
||||
}
|
||||
setupExitWidgetRan = true;
|
||||
}
|
||||
else {
|
||||
qDebug() << "setupExitWidgetRan";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QWidget>
|
||||
#include "generaldialog.h"
|
||||
#include "toast.h"
|
||||
#include "hourglassanimationwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class encryptionManager;
|
||||
|
@ -16,6 +17,7 @@ class encryptionManager : public QWidget
|
|||
public:
|
||||
explicit encryptionManager(QWidget *parent = nullptr);
|
||||
~encryptionManager();
|
||||
bool setupExitWidgetRan = false;
|
||||
|
||||
private slots:
|
||||
void on_setupContinueBtn_clicked();
|
||||
|
@ -25,11 +27,14 @@ private slots:
|
|||
void showToast(QString messageToDisplay);
|
||||
void setupEncryptedStorage();
|
||||
void mkEncfsDirs();
|
||||
void on_exitSuccessBtn_clicked();
|
||||
void setupExitWidget(bool exitStatus);
|
||||
|
||||
private:
|
||||
Ui::encryptionManager *ui;
|
||||
generalDialog * generalDialogWindow;
|
||||
toast * toastWindow;
|
||||
hourglassAnimationWidget * hourglassAnimationWidgetWindow;
|
||||
};
|
||||
|
||||
#endif // ENCRYPTIONMANAGER_H
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="activityWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
|
@ -119,6 +122,9 @@ Would you like to enable it?</string>
|
|||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
|
@ -151,7 +157,178 @@ Would you like to enable it?</string>
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="successLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Storage encryption successfully setup</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_9">
|
||||
<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="0" column="0">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<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="7" column="0">
|
||||
<widget class="QPushButton" name="exitSuccessBtn">
|
||||
<property name="text">
|
||||
<string>Continue</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<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="5" column="0">
|
||||
<widget class="QLabel" name="successDescriptionLabel">
|
||||
<property name="text">
|
||||
<string>Please ensure you don't forget your passphrase, as it will be impossible to access your files without it.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<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">
|
||||
<widget class="QLabel" name="checkImageLabel">
|
||||
<property name="text">
|
||||
<string>Check image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<spacer name="verticalSpacer_10">
|
||||
<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 class="QWidget" name="page_3"/>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="hourglassWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>100</horstretch>
|
||||
<verstretch>100</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_6"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_11">
|
||||
<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="0" column="0">
|
||||
<spacer name="verticalSpacer_12">
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
53
hourglassanimationwidget.cpp
Normal file
53
hourglassanimationwidget.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "hourglassanimationwidget.h"
|
||||
#include "ui_hourglassanimationwidget.h"
|
||||
|
||||
#include <QScreen>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
hourglassAnimationWidget::hourglassAnimationWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::hourglassAnimationWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Getting the screen's size
|
||||
float sW = QGuiApplication::screens()[0]->size().width();
|
||||
float sH = QGuiApplication::screens()[0]->size().height();
|
||||
float stdIconWidth;
|
||||
float stdIconHeight;
|
||||
{
|
||||
stdIconWidth = sW / 1.60;
|
||||
stdIconHeight = sH / 1.60;
|
||||
QPixmap pixmap(":/resources/hourglass-top.png");
|
||||
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->hourglassTopLabel->setPixmap(scaledPixmap);
|
||||
}
|
||||
{
|
||||
stdIconWidth = sW / 1.60;
|
||||
stdIconHeight = sH / 1.60;
|
||||
QPixmap pixmap(":/resources/hourglass-bottom.png");
|
||||
QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->hourglassBottomLabel->setPixmap(scaledPixmap);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
QTimer * t = new QTimer();
|
||||
t->setInterval(500);
|
||||
connect(t, &QTimer::timeout, [&]() {
|
||||
ui->stackedWidget->setCurrentIndex(i);
|
||||
if(i == 0) {
|
||||
i = 1;
|
||||
}
|
||||
else {
|
||||
i = 0;
|
||||
}
|
||||
} );
|
||||
t->start();
|
||||
}
|
||||
|
||||
hourglassAnimationWidget::~hourglassAnimationWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
hourglassanimationwidget.h
Normal file
22
hourglassanimationwidget.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef HOURGLASSANIMATIONWIDGET_H
|
||||
#define HOURGLASSANIMATIONWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class hourglassAnimationWidget;
|
||||
}
|
||||
|
||||
class hourglassAnimationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit hourglassAnimationWidget(QWidget *parent = nullptr);
|
||||
~hourglassAnimationWidget();
|
||||
|
||||
private:
|
||||
Ui::hourglassAnimationWidget *ui;
|
||||
};
|
||||
|
||||
#endif // HOURGLASSANIMATIONWIDGET_H
|
107
hourglassanimationwidget.ui
Normal file
107
hourglassanimationwidget.ui
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>hourglassAnimationWidget</class>
|
||||
<widget class="QWidget" name="hourglassAnimationWidget">
|
||||
<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">
|
||||
<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">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<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 row="0" column="0">
|
||||
<widget class="QLabel" name="hourglassTopLabel">
|
||||
<property name="text">
|
||||
<string>Hourglass TOP</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="hourglassBottomLabel">
|
||||
<property name="text">
|
||||
<string>Hourglass BOTTOM</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -18,6 +18,7 @@ SOURCES += \
|
|||
dictionarywidget.cpp \
|
||||
encryptionmanager.cpp \
|
||||
generaldialog.cpp \
|
||||
hourglassanimationwidget.cpp \
|
||||
koboxappsdialog.cpp \
|
||||
koboxsettings.cpp \
|
||||
main.cpp \
|
||||
|
@ -45,6 +46,7 @@ HEADERS += \
|
|||
encryptionmanager.h \
|
||||
functions.h \
|
||||
generaldialog.h \
|
||||
hourglassanimationwidget.h \
|
||||
koboxappsdialog.h \
|
||||
koboxsettings.h \
|
||||
mainwindow.h \
|
||||
|
@ -70,6 +72,7 @@ FORMS += \
|
|||
dictionarywidget.ui \
|
||||
encryptionmanager.ui \
|
||||
generaldialog.ui \
|
||||
hourglassanimationwidget.ui \
|
||||
koboxappsdialog.ui \
|
||||
koboxsettings.ui \
|
||||
mainwindow.ui \
|
||||
|
|
BIN
resources/check-display.png
Normal file
BIN
resources/check-display.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
BIN
resources/hourglass-bottom.png
Normal file
BIN
resources/hourglass-bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
resources/hourglass-top.png
Normal file
BIN
resources/hourglass-top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in a new issue