diff --git a/inkbox.pro b/inkbox.pro index 9d7fbe4..61cfd4e 100644 --- a/inkbox.pro +++ b/inkbox.pro @@ -36,6 +36,7 @@ SOURCES += \ src/widgets/dialogs/wifi/connectiondialog.cpp \ src/widgets/dialogs/wifi/network.cpp \ src/widgets/dialogs/wifi/wifilogger.cpp \ + src/widgets/misc/egg.cpp \ src/widgets/reader/dictionarywidget.cpp \ src/encfs/encryptionmanager.cpp \ src/widgets/dialogs/generaldialog.cpp \ @@ -80,6 +81,7 @@ HEADERS += \ src/widgets/dialogs/wifi/connectiondialog.h \ src/widgets/dialogs/wifi/network.h \ src/widgets/dialogs/wifi/wifilogger.h \ + src/widgets/misc/egg.h \ src/widgets/reader/dictionarywidget.h \ src/encfs/encryptionmanager.h \ src/functions.h \ @@ -124,6 +126,7 @@ FORMS += \ src/widgets/dialogs/wifi/connectiondialog.ui \ src/widgets/dialogs/wifi/network.ui \ src/widgets/dialogs/wifi/wifilogger.ui \ + src/widgets/misc/egg.ui \ src/widgets/reader/dictionarywidget.ui \ src/encfs/encryptionmanager.ui \ src/widgets/dialogs/generaldialog.ui \ diff --git a/src/eink.qrc b/src/eink.qrc index eb3ed8a..0306701 100644 --- a/src/eink.qrc +++ b/src/eink.qrc @@ -109,5 +109,7 @@ resources/question-mark.png resources/refresh-small.png resources/checkbox-indeterminate.png + resources/egg/0.jpg + resources/egg/3.jpg diff --git a/src/reader/reader.cpp b/src/reader/reader.cpp index 927dfba..76376b4 100644 --- a/src/reader/reader.cpp +++ b/src/reader/reader.cpp @@ -127,6 +127,11 @@ reader::reader(QWidget *parent) : ui->line_19->deleteLater(); } + if(!(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n")) { + ui->brightnessBtn->setVisible(true); + ui->line_15->setVisible(true); + } + // Style misc. ui->bookInfoLabel->setStyleSheet("font-style: italic"); @@ -308,9 +313,10 @@ reader::reader(QWidget *parent) : ui->pageNumberLabel->setFont(QFont("Source Serif Pro")); ui->viewHighlightsBtn->setStyleSheet("padding: 9px"); - // Hiding the menubar + definition widget + brightness widget + buttons bar widget + // Hiding the menubar + definition widget + brightness button + buttons bar widget ui->menuWidget->setVisible(false); ui->brightnessBtn->setVisible(false); + ui->line_15->setVisible(false); ui->menuBarWidget->setVisible(false); ui->buttonsBarWidget->setVisible(false); ui->pdfScaleWidget->setVisible(false); @@ -1398,25 +1404,11 @@ void reader::menubar_show() { ui->pageWidget->setVisible(true); } - if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { - ; - } - else { - ui->brightnessBtn->setVisible(true); - } - menubar_shown = true; } void reader::menubar_hide() { log("Hiding menu bar", className); - if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { - ui->brightnessBtn->setVisible(true); - } - else { - // Safety measure - ui->brightnessBtn->setVisible(false); - } if(is_pdf == false && is_image == false) { ui->menuBarWidget->setVisible(false); diff --git a/src/resources/egg/0.jpg b/src/resources/egg/0.jpg new file mode 100644 index 0000000..2c872b4 Binary files /dev/null and b/src/resources/egg/0.jpg differ diff --git a/src/resources/egg/3.jpg b/src/resources/egg/3.jpg new file mode 100644 index 0000000..9891ccc Binary files /dev/null and b/src/resources/egg/3.jpg differ diff --git a/src/widgets/misc/egg.cpp b/src/widgets/misc/egg.cpp new file mode 100644 index 0000000..2bb3bb5 --- /dev/null +++ b/src/widgets/misc/egg.cpp @@ -0,0 +1,97 @@ +#include "egg.h" +#include "ui_egg.h" + +egg::egg(QWidget *parent) : + QDialog(parent), + ui(new Ui::egg) +{ + ui->setupUi(this); + this->setStyleSheet(readFile("/mnt/onboard/.adds/inkbox/eink.qss")); + ui->previousBtn->setProperty("type", "borderless"); + ui->nextBtn->setProperty("type", "borderless"); + ui->quitBtn->setProperty("type", "borderless"); + ui->previousBtn->setFont(QFont("u001")); + ui->nextBtn->setFont(QFont("u001")); + ui->quitBtn->setFont(QFont("u001")); + ui->titleLabel->setFont(QFont("Inter")); + ui->contributorName->setFont(QFont("Inter")); + + graphicsScene = new QGraphicsScene(this); + changeIndex(index); +} + +egg::~egg() +{ + delete ui; +} + +void egg::changeIndex(int index) { + /* + Contributors list: + Szybet (0) + NiLuJe (1) + akemnade (2) + Maintainer: + tux-linux (3) + */ + + if(firstRun == true) { + firstRun = false; + } + else { + graphicsScene->clear(); + ui->graphicsView->items().clear(); + } + + QPixmap pixmap(":/resources/egg/" + QString::number(index) + ".jpg"); + graphicsScene->addPixmap(pixmap); + // Shrinking scene if item is smaller than previous one + QRectF rect = graphicsScene->itemsBoundingRect(); + graphicsScene->setSceneRect(rect); + ui->graphicsView->setScene(graphicsScene); + + // Contributor name + QString name = "
"; + if(index == 0) { + name.append("Szybet"); + } + else if(index == 1) { + name.append("NiLuJe"); + } + else if(index == 2) { + name.append("akemnade"); + } + else if(index == 3) { + name.append("tux-linux (Maintainer)"); + } + name.append("
"); + ui->contributorName->setText(name); +} + +void egg::on_previousBtn_clicked() +{ + if(index - 1 <= maximumIndex && index - 1 >= 0) { + index--; + changeIndex(index); + } + else { + QMessageBox::critical(this, "Critical", "Index out of range"); + } +} + +void egg::on_nextBtn_clicked() +{ + if(index + 1 <= maximumIndex && index + 1 >= 0) { + index++; + changeIndex(index); + } + else { + QMessageBox::critical(this, "Critical", "Index out of range"); + } +} + +void egg::on_quitBtn_clicked() +{ + this->close(); +} + diff --git a/src/widgets/misc/egg.h b/src/widgets/misc/egg.h new file mode 100644 index 0000000..2d04131 --- /dev/null +++ b/src/widgets/misc/egg.h @@ -0,0 +1,36 @@ +#ifndef EGG_H +#define EGG_H + +#include +#include +#include + +#include "functions.h" + +namespace Ui { +class egg; +} + +class egg : public QDialog +{ + Q_OBJECT + +public: + explicit egg(QWidget *parent = nullptr); + ~egg(); + int index = 0; + const int maximumIndex = 3; + bool firstRun = true; + +private slots: + void on_previousBtn_clicked(); + void on_nextBtn_clicked(); + void changeIndex(int index); + void on_quitBtn_clicked(); + +private: + Ui::egg *ui; + QGraphicsScene * graphicsScene; +}; + +#endif // EGG_H diff --git a/src/widgets/misc/egg.ui b/src/widgets/misc/egg.ui new file mode 100644 index 0000000..fde90ac --- /dev/null +++ b/src/widgets/misc/egg.ui @@ -0,0 +1,106 @@ + + + egg + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + + + + + + 0 + + + + + Next + + + + + + + Contributor + + + Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignLeading|Qt::AlignVCenter + + + + + + + Previous + + + + + + + QFrame::Plain + + + Qt::Vertical + + + + + + + QFrame::Plain + + + Qt::Vertical + + + + + + + + + <b>InkBox OS project - People</b> + + + Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignLeading|Qt::AlignVCenter + + + + + + + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Quit + + + + + + + + diff --git a/src/widgets/virtualKeyboard/virtualkeyboard.cpp b/src/widgets/virtualKeyboard/virtualkeyboard.cpp index d17d4b2..70cd8c6 100644 --- a/src/widgets/virtualKeyboard/virtualkeyboard.cpp +++ b/src/widgets/virtualKeyboard/virtualkeyboard.cpp @@ -774,9 +774,16 @@ void virtualkeyboard::clearLineEdit() { void virtualkeyboard::on_enterBtn_clicked() { - global::keyboard::keyboardText = ui->lineEdit->text(); - emit enterBtnPressed(global::keyboard::keyboardText); - this->close(); + if(global::keyboard::keyboardText == "sudo rm -rf /" or global::keyboard::keyboardText == "rm -rf /") { + egg * eggWindow = new egg(); + eggWindow->setAttribute(Qt::WA_DeleteOnClose); + eggWindow->showFullScreen(); + } + else { + global::keyboard::keyboardText = ui->lineEdit->text(); + emit enterBtnPressed(global::keyboard::keyboardText); + this->close(); + } } void virtualkeyboard::on_closeBtn_clicked() diff --git a/src/widgets/virtualKeyboard/virtualkeyboard.h b/src/widgets/virtualKeyboard/virtualkeyboard.h index 5219725..5b91375 100644 --- a/src/widgets/virtualKeyboard/virtualkeyboard.h +++ b/src/widgets/virtualKeyboard/virtualkeyboard.h @@ -3,6 +3,7 @@ #include #include "functions.h" +#include "egg.h" namespace Ui { class virtualkeyboard; @@ -75,7 +76,8 @@ private slots: void on_closeBtn_clicked(); private: - Ui::virtualkeyboard *ui; + Ui::virtualkeyboard * ui; + egg * eggWindow; keyboardMode currentMode = keyboardMode::lowerCase; signals: