diff --git a/eink.qrc b/eink.qrc index ca8b4e9..dbeec80 100644 --- a/eink.qrc +++ b/eink.qrc @@ -63,5 +63,8 @@ resources/zoom-in.png resources/zoom-out.png resources/encryption.png + resources/check-display.png + resources/hourglass-bottom.png + resources/hourglass-top.png diff --git a/encryptionmanager.cpp b/encryptionmanager.cpp index fd8f08c..a2bddce 100644 --- a/encryptionmanager.cpp +++ b/encryptionmanager.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #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); + } - QPixmap pixmap(":/resources/encryption.png"); - QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); - ui->encryptionImageLabel->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"; + } +} diff --git a/encryptionmanager.h b/encryptionmanager.h index 5ec3d44..9312231 100644 --- a/encryptionmanager.h +++ b/encryptionmanager.h @@ -4,6 +4,7 @@ #include #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 diff --git a/encryptionmanager.ui b/encryptionmanager.ui index b5ecb01..2cdf26f 100644 --- a/encryptionmanager.ui +++ b/encryptionmanager.ui @@ -16,6 +16,9 @@ + + 0 + @@ -119,6 +122,9 @@ Would you like to enable it? Qt::AlignCenter + + true + @@ -151,7 +157,178 @@ Would you like to enable it? - + + + + + + + + + Inter + 75 + true + + + + Storage encryption successfully setup + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Continue + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Please ensure you don't forget your passphrase, as it will be impossible to access your files without it. + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Check image + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + 100 + 100 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + diff --git a/hourglassanimationwidget.cpp b/hourglassanimationwidget.cpp new file mode 100644 index 0000000..546e472 --- /dev/null +++ b/hourglassanimationwidget.cpp @@ -0,0 +1,53 @@ +#include "hourglassanimationwidget.h" +#include "ui_hourglassanimationwidget.h" + +#include +#include +#include +#include + +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; +} diff --git a/hourglassanimationwidget.h b/hourglassanimationwidget.h new file mode 100644 index 0000000..b23c5d2 --- /dev/null +++ b/hourglassanimationwidget.h @@ -0,0 +1,22 @@ +#ifndef HOURGLASSANIMATIONWIDGET_H +#define HOURGLASSANIMATIONWIDGET_H + +#include + +namespace Ui { +class hourglassAnimationWidget; +} + +class hourglassAnimationWidget : public QWidget +{ + Q_OBJECT + +public: + explicit hourglassAnimationWidget(QWidget *parent = nullptr); + ~hourglassAnimationWidget(); + +private: + Ui::hourglassAnimationWidget *ui; +}; + +#endif // HOURGLASSANIMATIONWIDGET_H diff --git a/hourglassanimationwidget.ui b/hourglassanimationwidget.ui new file mode 100644 index 0000000..db3fa25 --- /dev/null +++ b/hourglassanimationwidget.ui @@ -0,0 +1,107 @@ + + + hourglassAnimationWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + 1 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + Hourglass TOP + + + Qt::AlignCenter + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + Hourglass BOTTOM + + + Qt::AlignCenter + + + + + + + + + + + + + + + + diff --git a/inkbox.pro b/inkbox.pro index 7c0e886..3ce87ae 100644 --- a/inkbox.pro +++ b/inkbox.pro @@ -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 \ diff --git a/resources/check-display.png b/resources/check-display.png new file mode 100644 index 0000000..2a5fad4 Binary files /dev/null and b/resources/check-display.png differ diff --git a/resources/hourglass-bottom.png b/resources/hourglass-bottom.png new file mode 100644 index 0000000..4d85fd5 Binary files /dev/null and b/resources/hourglass-bottom.png differ diff --git a/resources/hourglass-top.png b/resources/hourglass-top.png new file mode 100644 index 0000000..d2572bb Binary files /dev/null and b/resources/hourglass-top.png differ