├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── AUTHORS ├── LEGAL.md ├── LICENSE ├── README.md ├── inkbox.pro ├── libs └── prebuilt │ ├── libsndfile.so │ ├── libsndfile.so.1 │ └── libsndfile.so.1.0.35 ├── screenshots ├── homepage.png ├── library.png └── reading.png └── src ├── apps ├── apps.cpp ├── apps.h ├── apps.ui ├── calendarapp.cpp ├── calendarapp.h ├── calendarapp.ui ├── flashexam.cpp ├── flashexam.h ├── flashexam.ui ├── savedwords.cpp ├── savedwords.h ├── savedwords.ui ├── todo.cpp ├── todo.h ├── todo.ui ├── userapps.cpp ├── userapps.h └── userapps.ui ├── audio ├── audiothread.cpp └── audiothread.h ├── eink.qrc ├── encfs ├── encryptionmanager.cpp ├── encryptionmanager.h └── encryptionmanager.ui ├── functions.h ├── homeWidget ├── homepagewidget.cpp ├── homepagewidget.h ├── homepagewidget.ui ├── mainwindow.cpp ├── mainwindow.h └── mainwindow.ui ├── localLibrary ├── locallibrarywidget.cpp ├── locallibrarywidget.h └── locallibrarywidget.ui ├── main.cpp ├── onlineLibrary ├── librarywidget.cpp ├── librarywidget.h └── librarywidget.ui ├── otaUpdate ├── otamanager.cpp ├── otamanager.h └── otamanager.ui ├── powerDaemon ├── sleepthread.cpp └── sleepthread.h ├── quit ├── quit.cpp ├── quit.h └── quit.ui ├── reader ├── reader.cpp ├── reader.h └── reader.ui ├── resources ├── X11.png ├── alcott.jpg ├── alert-triangle.png ├── alert.png ├── align-center.png ├── align-justify.png ├── align-left.png ├── align-right.png ├── apps-inverted.png ├── apps.png ├── arrow-left.png ├── arrow-right.png ├── backspace.png ├── battery_alert.png ├── battery_charging.png ├── battery_empty.png ├── battery_full.png ├── battery_half.png ├── book.png ├── book_inverted.png ├── check-display.png ├── check.png ├── checkbox-checked-small.png ├── checkbox-checked.png ├── checkbox-indeterminate.png ├── checkbox-unchecked-small.png ├── checkbox-unchecked.png ├── checkbox-x-small.png ├── checkbox-x.png ├── chesterton.jpg ├── chevron-down.png ├── chevron-left.png ├── chevron-right.png ├── chevron-up.png ├── christie.jpg ├── christie.png ├── clean.png ├── clock-inverted.png ├── clock.png ├── close.png ├── cover_unavailable.png ├── davies.jpg ├── edit.png ├── egg │ ├── 0.jpg │ └── 1.jpg ├── eink-dark.qss ├── eink-square-encfs.qss ├── encryption-small.png ├── encryption.png ├── error.png ├── exit.png ├── file-text.png ├── folder.png ├── fonts │ ├── Bitter-Bold.ttf │ ├── Bitter-BoldItalic.ttf │ ├── Bitter-Medium.ttf │ ├── Bitter-MediumItalic.ttf │ ├── CrimsonPro-Bold.ttf │ ├── CrimsonPro-BoldItalic.ttf │ ├── CrimsonPro-Italic.ttf │ ├── CrimsonPro-Regular.ttf │ ├── IbarraRealNova-Bold.ttf │ ├── IbarraRealNova-BoldItalic.ttf │ ├── IbarraRealNova-Medium.ttf │ └── IbarraRealNova-MediumItalic.ttf ├── frontlight.png ├── hide.png ├── highlight.png ├── home.png ├── hourglass-bottom.png ├── hourglass-top-rectangular.png ├── hourglass-top.png ├── info.png ├── king.jpg ├── kobox-icon.png ├── koreader.png ├── lock.png ├── log.png ├── minus.png ├── music-library.png ├── music-note.png ├── music-queue.png ├── new.png ├── next.png ├── nightmode-empty.png ├── nightmode-full.png ├── online-library-inverted.png ├── online-library.png ├── pause.png ├── pin.png ├── play.png ├── plus.png ├── power.png ├── previous.png ├── public.png ├── question-mark.png ├── refresh-small.png ├── refresh.png ├── save.png ├── search.png ├── settings-inverted.png ├── settings.png ├── show.png ├── star.png ├── starred_star.png ├── stop.png ├── tzlist ├── unhighlight.png ├── usbms-inverted.png ├── usbms.png ├── view-highlights.png ├── wifi-0.png ├── wifi-100.png ├── wifi-25.png ├── wifi-50.png ├── wifi-75.png ├── wifi-connected.png ├── wifi-off.png ├── wifi-standby.png ├── x-circle.png ├── zoom-in.png └── zoom-out.png ├── settings ├── koboxsettings.cpp ├── koboxsettings.h ├── koboxsettings.ui ├── powerdaemonsettings.cpp ├── powerdaemonsettings.h ├── powerdaemonsettings.ui ├── settings.cpp ├── settings.h ├── settings.ui ├── settingschooser.cpp ├── settingschooser.h └── settingschooser.ui ├── splash ├── alert.cpp ├── alert.h ├── alert.ui ├── usbmsSplash.cpp ├── usbmsSplash.h └── usbmsSplash.ui ├── telemetry ├── telemetry.cpp └── telemetry.h └── widgets ├── dialogs ├── audio │ ├── audiodialog.cpp │ ├── audiodialog.h │ ├── audiodialog.ui │ ├── audiofile.cpp │ ├── audiofile.h │ ├── audiofile.ui │ ├── audiofilequeue.cpp │ ├── audiofilequeue.h │ └── audiofilequeue.ui ├── brightnessdialog.cpp ├── brightnessdialog.h ├── brightnessdialog.ui ├── generaldialog.cpp ├── generaldialog.h ├── generaldialog.ui ├── kobox │ ├── koboxappsdialog.cpp │ ├── koboxappsdialog.h │ └── koboxappsdialog.ui ├── library │ ├── bookinfodialog.cpp │ ├── bookinfodialog.h │ ├── bookinfodialog.ui │ ├── bookoptionsdialog.cpp │ ├── bookoptionsdialog.h │ └── bookoptionsdialog.ui ├── powerDaemon │ ├── sleepdialog.cpp │ ├── sleepdialog.h │ └── sleepdialog.ui ├── reader │ ├── highlightslistdialog.cpp │ ├── highlightslistdialog.h │ ├── highlightslistdialog.ui │ ├── textdialog.cpp │ ├── textdialog.h │ └── textdialog.ui └── wifi │ ├── connectiondialog.cpp │ ├── connectiondialog.h │ ├── connectiondialog.ui │ ├── network.cpp │ ├── network.h │ ├── network.ui │ ├── wifidialog.cpp │ ├── wifidialog.h │ ├── wifidialog.ui │ ├── wifilogger.cpp │ ├── wifilogger.h │ └── wifilogger.ui ├── interfaceWidgets ├── qclickablelabel.cpp ├── qclickablelabel.h ├── qtooltiplabel.cpp ├── qtooltiplabel.h ├── toast.cpp ├── toast.h └── toast.ui ├── misc ├── egg.cpp ├── egg.h ├── egg.ui ├── hourglassanimationwidget.cpp ├── hourglassanimationwidget.h └── hourglassanimationwidget.ui ├── reader ├── dictionarywidget.cpp ├── dictionarywidget.h └── dictionarywidget.ui ├── text ├── searchresultswidget.cpp ├── searchresultswidget.h ├── searchresultswidget.ui ├── textwidget.cpp ├── textwidget.h └── textwidget.ui └── virtualKeyboard ├── virtualkeyboard.cpp ├── virtualkeyboard.h ├── virtualkeyboard.ui ├── virtualkeypad.cpp ├── virtualkeypad.h └── virtualkeypad.ui /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: Kobo-InkBox 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | inkbox.pro.user 2 | inkbox 3 | *.o 4 | ui_* 5 | moc_* 6 | qrc_* 7 | .qmake.stash 8 | .vscode 9 | .qtc_clangd 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libs/libsndfile"] 2 | path = libs/libsndfile 3 | url = https://github.com/libsndfile/libsndfile 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | InkBox : Nicolas Mailloux (GitHub:tux-linux) 2 | Contribution: 3 | - Szybet (GitHub:Szybet) 4 | Lightmaps/Scribble : Qt Software Foundation 5 | Icons : feathericons.com, fonts.google.com/icons, remixicon.com 6 | Dark mode : Kobo Nightmode hack (https://github.com/gtalusan/kobo-nightmode) 7 | ePUB engine : mutool (MuPDF) - Artifex Software 8 | KOReader logo : KOReader team (https://github.com/koreader) 9 | -------------------------------------------------------------------------------- /LEGAL.md: -------------------------------------------------------------------------------- 1 | # Legal information 2 | This is the official document concerning legal information about InkBox OS. It has precedence over any other information available on the Internet. 3 | 4 | ## Definitions 5 | - 'InkBox OS' represents the system image downloadable from the Internet that an end-user can flash and use on their electronic device. It includes the GUI, internal scripts and programs, bootloader and kernel. Such images can be accessed here: http://23.163.0.39/bundles/inkbox/native/ 6 | - 'Update packages' represent packages downloadable from the Internet that can be used to update InkBox OS to a newer version. Such packages can be accessed here: http://23.163.0.39/bundles/inkbox/native/update/ 7 | - 'The Software' represents both of the things above. 8 | 9 | ## Statement 10 | The Software is provided to you WITHOUT ANY WARRANTY, and no one but you is responsible if you ever brick your device by installing it. 11 | 12 | ## Warnings 13 | ### Waveform 14 | eInk devices need special data to drive their screen properly. This data is often referenced to as "waveforms", and is usually specific to each device. When distributing images, we cannot guarantee you that the wveform used for our testing device, even if said device *is* of the same model as the one you downloaded it for, will work for yours.
Since every eInk display is unique in its conception, every waveform is different, even for the same display model. If inappropriate data is fed to the eInk display's controller, such as wrong voltages for changing the state of a pixel, it can cause permanent damage to the screen. This has been seen happening on Kindle devices with their native firmware, but has yet to be demonstrated on Kobo devices.
In summary, you shouldn't be worried of flashing a release image of InkBox OS to your device, since the eInk controller should be tolerant enough to work fine with the input data it receives. If you are using a Kindle Touch, we use an in-kernel "default" waveform provided by Amazon until you provide your own.
But exceptions *do* happen, and for them we can't be held responsible for damaging your device. 15 | -------------------------------------------------------------------------------- /libs/prebuilt/libsndfile.so: -------------------------------------------------------------------------------- 1 | libsndfile.so.1.0.35 -------------------------------------------------------------------------------- /libs/prebuilt/libsndfile.so.1: -------------------------------------------------------------------------------- 1 | libsndfile.so.1.0.35 -------------------------------------------------------------------------------- /libs/prebuilt/libsndfile.so.1.0.35: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/libs/prebuilt/libsndfile.so.1.0.35 -------------------------------------------------------------------------------- /screenshots/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/screenshots/homepage.png -------------------------------------------------------------------------------- /screenshots/library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/screenshots/library.png -------------------------------------------------------------------------------- /screenshots/reading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/screenshots/reading.png -------------------------------------------------------------------------------- /src/apps/apps.h: -------------------------------------------------------------------------------- 1 | #ifndef APPS_H 2 | #define APPS_H 3 | 4 | #include 5 | #include "savedwords.h" 6 | #include "calendarapp.h" 7 | #include "koboxappsdialog.h" 8 | #include "generaldialog.h" 9 | #include "todo.h" 10 | #include "flashexam.h" 11 | 12 | #include 13 | 14 | namespace Ui { 15 | class apps; 16 | } 17 | 18 | class apps : public QWidget 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | QString className = this->metaObject()->className(); 24 | explicit apps(QWidget *parent = nullptr); 25 | ~apps(); 26 | 27 | private slots: 28 | void exitSlot(); 29 | void on_savedWordsLaunchBtn_clicked(); 30 | void on_calendarLaunchBtn_clicked(); 31 | void on_calculatorLaunchBtn_clicked(); 32 | void on_koboxAppsOpenButton_clicked(); 33 | void on_vncLaunchBtn_clicked(); 34 | void on_reversiLaunchBtn_clicked(); 35 | void on_editUserAppsBtn_clicked(); 36 | void refreshScreenNative(); 37 | void on_g2048LaunchBtn_clicked(); 38 | void showToastNative(QString messageToDisplay); 39 | bool parseJson(); 40 | void showUserApps(bool showDisabledJson); 41 | void updateJsonFileSlot(QJsonDocument jsonDocument); 42 | void showFailedToParseMainUserAppsJsonFile(); 43 | void on_todoLaunchBtn_clicked(); 44 | void on_flashExamLaunchBtn_clicked(); 45 | 46 | private: 47 | Ui::apps * ui; 48 | savedwords * savedWordsWindow; 49 | calendarApp * calendarWindow; 50 | koboxAppsDialog * koboxAppsDialogWindow; 51 | generalDialog * generalDialogWindow; 52 | todo * todoWindow; 53 | 54 | QFile jsonFile; 55 | QJsonDocument jsonDocument; 56 | bool jsonParseSuccess = false; 57 | bool userAppsSecondPage = false; 58 | bool userAppsAvailable = false; 59 | 60 | signals: 61 | void refreshScreen(); 62 | void showToast(QString messageToDisplay); 63 | void updateJsonFileSignal(QJsonDocument jsonDocument); 64 | void clearAppsLayout(); 65 | void showUserAppsEdit(bool show); 66 | }; 67 | 68 | #endif // APPS_H 69 | -------------------------------------------------------------------------------- /src/apps/calendarapp.cpp: -------------------------------------------------------------------------------- 1 | #include "calendarapp.h" 2 | #include "ui_calendarapp.h" 3 | 4 | #include 5 | 6 | calendarApp::calendarApp(QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::calendarApp) 9 | { 10 | ui->setupUi(this); 11 | calendarApp::setFont(QFont("u001")); 12 | ui->backBtn->setFont(QFont("Inter")); 13 | ui->backBtn->setStyleSheet("font-weight: bold"); 14 | 15 | // Stylesheet 16 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 17 | stylesheetFile.open(QFile::ReadOnly); 18 | this->setStyleSheet(stylesheetFile.readAll()); 19 | stylesheetFile.close(); 20 | 21 | ui->backBtn->setProperty("type", "borderless"); 22 | } 23 | 24 | calendarApp::~calendarApp() 25 | { 26 | delete ui; 27 | } 28 | 29 | void calendarApp::on_backBtn_clicked() 30 | { 31 | calendarApp::close(); 32 | } 33 | -------------------------------------------------------------------------------- /src/apps/calendarapp.h: -------------------------------------------------------------------------------- 1 | #ifndef CALENDARAPP_H 2 | #define CALENDARAPP_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class calendarApp; 8 | } 9 | 10 | class calendarApp : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit calendarApp(QWidget *parent = nullptr); 17 | ~calendarApp(); 18 | 19 | private slots: 20 | void on_backBtn_clicked(); 21 | 22 | private: 23 | Ui::calendarApp *ui; 24 | }; 25 | 26 | #endif // CALENDARAPP_H 27 | -------------------------------------------------------------------------------- /src/apps/calendarapp.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | calendarApp 4 | 5 | 6 | 7 | 0 8 | 0 9 | 505 10 | 392 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 75 27 | true 28 | 29 | 30 | 31 | 32 | Back 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | QFrame::Plain 41 | 42 | 43 | 2 44 | 45 | 46 | Qt::Horizontal 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/apps/flashexam.h: -------------------------------------------------------------------------------- 1 | #ifndef FLASHEXAM_H 2 | #define FLASHEXAM_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class flashExam; 9 | } 10 | 11 | class flashExam : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | QString className = this->metaObject()->className(); 17 | explicit flashExam(QWidget *parent = nullptr); 18 | ~flashExam(); 19 | 20 | private: 21 | #ifndef PCBUILD 22 | QString basePath = "/mnt/onboard/onboard/"; 23 | #endif 24 | #ifdef PCBUILD 25 | QString basePath = "./"; 26 | #endif 27 | Ui::flashExam *ui; 28 | int cardsTotal; 29 | int currentCardNumber; 30 | QString listName; 31 | bool randomize; 32 | bool nonRedundantRandomization; 33 | bool saveCardsNotKnownToFile; 34 | bool brainBruteForceMode; 35 | bool brainBruteForceLock = false; 36 | int brainBruteForceCardsThreshold; 37 | QList cardsAlreadyShown; 38 | QList cardsNotKnown; 39 | bool answerShown = false; 40 | QStringList cardsStringList; 41 | QStringList answersStringList; 42 | void setupCardsList(); 43 | void initCardsList(QString cardsList, QString answersList); 44 | void displayCard(bool existingCardNumber); 45 | QString displayImage(QString cardText); 46 | QGraphicsScene * graphicsScene; 47 | 48 | signals: 49 | void showToast(QString messageToDisplay); 50 | private slots: 51 | void on_closeBtn_clicked(); 52 | void on_startBtn_clicked(); 53 | void on_backBtn_clicked(); 54 | void on_revealBtn_clicked(); 55 | void on_nextBtn_clicked(); 56 | void on_randomizeCheckBox_toggled(bool checked); 57 | void on_didNotKnowBtn_clicked(); 58 | void on_nonRedundantRandomizationCheckBox_toggled(bool checked); 59 | void on_brainBruteForceCheckBox_toggled(bool checked); 60 | }; 61 | 62 | #endif // FLASHEXAM_H 63 | -------------------------------------------------------------------------------- /src/apps/savedwords.cpp: -------------------------------------------------------------------------------- 1 | #include "savedwords.h" 2 | #include "ui_savedwords.h" 3 | #include "functions.h" 4 | #include 5 | #include 6 | #include 7 | 8 | savedwords::savedwords(QWidget *parent) : 9 | QWidget(parent), 10 | ui(new Ui::savedwords) 11 | { 12 | ui->setupUi(this); 13 | savedwords::setFont(QFont("u001")); 14 | ui->savedWordsLabel->setFont(QFont("Inter")); 15 | ui->backBtn->setFont(QFont("Inter")); 16 | ui->clearBtn->setFont(QFont("Inter")); 17 | 18 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 19 | stylesheetFile.open(QFile::ReadOnly); 20 | this->setStyleSheet(stylesheetFile.readAll()); 21 | stylesheetFile.close(); 22 | 23 | ui->backBtn->setProperty("type", "borderless"); 24 | ui->clearBtn->setProperty("type", "borderless"); 25 | 26 | ui->savedWordsLabel->setStyleSheet("font-weight: bold"); 27 | ui->wordsList->setStyleSheet("font-size: 10pt"); 28 | ui->backBtn->setStyleSheet("font-weight: bold"); 29 | ui->clearBtn->setStyleSheet("font-weight: bold"); 30 | 31 | checkwords(); 32 | 33 | QStringListModel * model = new QStringListModel(this); 34 | QStringList list = words.split("\n", QString::SkipEmptyParts); 35 | model->setStringList(list); 36 | ui->wordsList->setModel(model); 37 | ui->wordsList->setEditTriggers(QAbstractItemView::NoEditTriggers); 38 | } 39 | 40 | savedwords::~savedwords() 41 | { 42 | delete ui; 43 | } 44 | 45 | void savedwords::on_backBtn_clicked() 46 | { 47 | // Workaround for the random strange memory corruption error 48 | QProcess process; 49 | process.startDetached("inkbox", QStringList()); 50 | qApp->quit(); 51 | } 52 | 53 | void savedwords::on_clearBtn_clicked() 54 | { 55 | // Warning: possible memory leak here. Though, usually, when you press the "Clear" button and all clears up, you don't have to press it again ;) 56 | log("Wiping Saved Words list", className); 57 | save_word_init(); 58 | checkwords(); 59 | QStringListModel* model = new QStringListModel(this); 60 | QStringList list = words.split("\n", QString::SkipEmptyParts); 61 | model->setStringList(list); 62 | ui->wordsList->setModel(model); 63 | ui->wordsList->setEditTriggers(QAbstractItemView::NoEditTriggers); 64 | } 65 | 66 | void savedwords::checkwords() { 67 | QFile words_list(".config/06-words/config"); 68 | words_list.open(QIODevice::ReadWrite); 69 | QTextStream in (&words_list); 70 | words = in.readAll(); 71 | words_list.close(); 72 | } 73 | 74 | void savedwords::save_word_init() { 75 | QFile words(".config/06-words/config"); 76 | words.open(QIODevice::ReadWrite); 77 | QTextStream in (&words); 78 | QString words_list = in.readAll(); 79 | string words_list_str = words_list.toStdString(); 80 | words.close(); 81 | 82 | ofstream fhandler; 83 | fhandler.open(".config/06-words/config"); 84 | fhandler << ""; 85 | fhandler.close(); 86 | } 87 | -------------------------------------------------------------------------------- /src/apps/savedwords.h: -------------------------------------------------------------------------------- 1 | #ifndef SAVEDWORDS_H 2 | #define SAVEDWORDS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | namespace Ui { 14 | class savedwords; 15 | } 16 | 17 | class savedwords : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | QString className = this->metaObject()->className(); 23 | explicit savedwords(QWidget *parent = nullptr); 24 | ~savedwords(); 25 | QString words; 26 | void checkwords(); 27 | void save_word_init(); 28 | 29 | private slots: 30 | void on_backBtn_clicked(); 31 | void on_clearBtn_clicked(); 32 | 33 | private: 34 | Ui::savedwords *ui; 35 | }; 36 | 37 | #endif // SAVEDWORDS_H 38 | -------------------------------------------------------------------------------- /src/apps/savedwords.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | savedwords 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | 28 | 29 | 30 | 31 | 75 32 | true 33 | 34 | 35 | 36 | 37 | Back 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 75 47 | true 48 | 49 | 50 | 51 | 52 | Clear list 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | QFrame::Plain 61 | 62 | 63 | 2 64 | 65 | 66 | Qt::Vertical 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 75 77 | true 78 | 79 | 80 | 81 | Saved words 82 | 83 | 84 | Qt::AlignCenter 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/apps/todo.h: -------------------------------------------------------------------------------- 1 | #ifndef TODO_H 2 | #define TODO_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "virtualkeyboard.h" 9 | 10 | namespace Ui { 11 | class todo; 12 | } 13 | 14 | class todo : public QWidget 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | QString className = this->metaObject()->className(); 20 | explicit todo(QWidget *parent = nullptr); 21 | ~todo(); 22 | enum class currentView { 23 | home, 24 | list 25 | }; 26 | bool selectItemsMode = false; 27 | currentView currentView = currentView::home; 28 | int listIndex; 29 | int currentEditItemIndex; 30 | int buttonPadding; 31 | QString buttonPaddingString; 32 | 33 | private slots: 34 | void on_closeBtn_clicked(); 35 | void on_newBtn_clicked(); 36 | void createNewList(QString listName); 37 | void addItem(QString itemName); 38 | void editItem(int itemIndex, QString replacement); 39 | void editItemWrapper(QString replacement); 40 | void refreshList(); 41 | void saveCurrentList(); 42 | void setupList(QString listName); 43 | void switchViewHome(); 44 | void switchItemsSelectionMode(bool selectionMode); 45 | void setDefaultHomePageStatusText(); 46 | void setDefaultListPageStatusText(); 47 | void resize(); 48 | void on_setupBtn_clicked(); 49 | void on_listWidget_itemClicked(QListWidgetItem *item); 50 | void on_deleteBtn_clicked(); 51 | void on_newItemBtn_clicked(); 52 | void on_selectItemsModeBtn_clicked(); 53 | void on_deleteItemBtn_clicked(); 54 | void on_selectAllItemsBtn_clicked(); 55 | void on_deselectAllItemsBtn_clicked(); 56 | void on_saveCurrentListViewBtn_clicked(); 57 | void on_editItemBtn_clicked(); 58 | void on_itemsListWidget_itemClicked(QListWidgetItem *item); 59 | 60 | signals: 61 | void showToast(QString messageToDisplay); 62 | 63 | private: 64 | Ui::todo *ui; 65 | virtualkeyboard * virtualKeyboardWidget; 66 | }; 67 | 68 | #endif // TODO_H 69 | -------------------------------------------------------------------------------- /src/apps/userapps.h: -------------------------------------------------------------------------------- 1 | #ifndef USERAPPS_H 2 | #define USERAPPS_H 3 | 4 | #include "generaldialog.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Ui { 16 | class userapps; 17 | } 18 | 19 | class userapps : public QWidget 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | QString className = this->metaObject()->className(); 25 | explicit userapps(QWidget * parent = nullptr); 26 | ~userapps(); 27 | QJsonDocument jsonDocument; // TODO: Optimize for RAM usage 28 | QJsonObject jsonObject; // Needed for 'App info' button 29 | QString jsonFilePath; 30 | 31 | signals: 32 | // This is needed, because user application have their own JSON file. If the user changes it too fast it won't read it and overwrite previous changes 33 | void updateJsonFileSignalUA(QJsonDocument jsonDocument); 34 | 35 | 36 | public slots: 37 | void provideInfo(QJsonObject jsonObject); 38 | void changePageEnabling(bool goThere); 39 | void updateJsonFileSlotUA(QJsonDocument jsonDocument); 40 | bool manageRequiredFeatures(); 41 | QString parseJsonShow(QJsonObject json); 42 | 43 | private slots: 44 | void on_infoBtn_clicked(); 45 | void on_statusBtn_clicked(); 46 | void on_launchBtn_clicked(); 47 | 48 | private: 49 | Ui::userapps * ui; 50 | generalDialog * generalDialogWindow; 51 | 52 | QDir appDir; 53 | QFile execPath; 54 | bool userAppEnabled; 55 | QString appName; 56 | }; 57 | 58 | #endif // USERAPPS_H 59 | -------------------------------------------------------------------------------- /src/audio/audiothread.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIOTHREAD_H 2 | #define AUDIOTHREAD_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class audiothread : public QObject 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | QString className = this->metaObject()->className(); 14 | audiothread(); 15 | void sendInfo(QString message); 16 | int sockfd; 17 | struct sockaddr_un addr; 18 | int res; 19 | bool monitorProgress = false; 20 | public slots: 21 | void start(); 22 | void audioProgress(); 23 | 24 | private: 25 | }; 26 | 27 | #endif // AUDIOTHREAD_H 28 | -------------------------------------------------------------------------------- /src/encfs/encryptionmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef ENCRYPTIONMANAGER_H 2 | #define ENCRYPTIONMANAGER_H 3 | 4 | #include 5 | #include "generaldialog.h" 6 | #include "toast.h" 7 | #include "hourglassanimationwidget.h" 8 | #include "alert.h" 9 | 10 | namespace Ui { 11 | class encryptionManager; 12 | } 13 | 14 | class encryptionManager : public QWidget 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | QString className = this->metaObject()->className(); 20 | explicit encryptionManager(QWidget *parent = nullptr); 21 | ~encryptionManager(); 22 | bool setupExitWidgetRan = false; 23 | int setupPassphraseDialogMode; 24 | bool setupMessageBoxRan = false; 25 | int passphraseTries; 26 | 27 | private slots: 28 | void on_setupContinueBtn_clicked(); 29 | void on_setupAbortBtn_clicked(); 30 | void quit_restart(); 31 | void refreshScreen(); 32 | void showToast(QString messageToDisplay); 33 | void setupEncryptedStorage(); 34 | void mkEncfsDirs(); 35 | void on_exitSuccessBtn_clicked(); 36 | void setupExitWidget(bool exitStatus); 37 | void on_failureContinueBtn_clicked(); 38 | void setupPassphraseDialog(); 39 | void unlockEncryptedStorage(); 40 | void setupFailedAuthenticationMessageBox(); 41 | void on_acceptBtn_clicked(); 42 | void on_usbmsBtn_clicked(); 43 | void repackEncryptedStorage(); 44 | 45 | private: 46 | Ui::encryptionManager *ui; 47 | generalDialog * generalDialogWindow; 48 | toast * toastWindow; 49 | hourglassAnimationWidget * hourglassAnimationWidgetWindow; 50 | alert * alertWindow; 51 | usbmsSplash *usbmsWindow; 52 | }; 53 | 54 | #endif // ENCRYPTIONMANAGER_H 55 | -------------------------------------------------------------------------------- /src/homeWidget/homepagewidget.h: -------------------------------------------------------------------------------- 1 | #ifndef HOMEPAGEWIDGET_H 2 | #define HOMEPAGEWIDGET_H 3 | 4 | #include 5 | #include 6 | #include "qclickablelabel.h" 7 | #include "qtooltiplabel.h" 8 | #include "locallibrarywidget.h" 9 | #include "toast.h" 10 | #include "bookoptionsdialog.h" 11 | #include "bookinfodialog.h" 12 | 13 | namespace Ui { 14 | class homePageWidget; 15 | } 16 | 17 | class homePageWidget : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | QString className = this->metaObject()->className(); 23 | explicit homePageWidget(QWidget *parent = nullptr); 24 | ~homePageWidget(); 25 | int sW; 26 | int sH; 27 | int stdIconWidth; 28 | int stdIconHeight; 29 | float stdIconWidthDivider; 30 | float stdIconHeightDivider; 31 | int bookTitleTruncateThreshold; 32 | bool pinnedBooksDatabaseEmpty = true; 33 | 34 | signals: 35 | void openBookSignal(QString bookPath, bool relativePath); 36 | void refreshScreen(); 37 | void relaunchHomePageWidget(); 38 | 39 | private slots: 40 | void openBook(QString bookPath); 41 | void refreshScreenNative(); 42 | void setupDisplay(bool databaseGenerated); 43 | void setupDisplaySlot(); 44 | void setupDisplayWithDatabase(); 45 | void showToast(QString messageToDisplay); 46 | void openBookOptionsDialog(QString bookPath); 47 | void openLocalBookInfoDialog(); 48 | void handlePossibleBookPin(); 49 | 50 | private: 51 | Ui::homePageWidget *ui; 52 | localLibraryWidget * localLibraryWidgetWindow; 53 | toast * toastWindow; 54 | bookOptionsDialog * bookOptionsDialogWindow; 55 | bookInfoDialog * bookInfoDialogWindow; 56 | QVector bookTitleArray; 57 | QVector horizontalLayoutArray; 58 | QVector verticalLayoutArray; 59 | QVector bookBtnArray; 60 | QVector pinnedBooksTitleArray; 61 | QVector pinnedBooksHorizontalLayoutArray; 62 | QVector pinnedBooksVerticalLayoutArray; 63 | QVector pinnedBooksBtnArray; 64 | }; 65 | 66 | #endif // HOMEPAGEWIDGET_H 67 | -------------------------------------------------------------------------------- /src/homeWidget/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include "settings.h" 6 | #include "settingschooser.h" 7 | #include "apps.h" 8 | #include "reader.h" 9 | #include "quit.h" 10 | #include "alert.h" 11 | #include "usbmsSplash.h" 12 | #include "brightnessdialog.h" 13 | #include "generaldialog.h" 14 | #include "koboxsettings.h" 15 | #include "koboxappsdialog.h" 16 | #include "textwidget.h" 17 | #include "virtualkeypad.h" 18 | #include "toast.h" 19 | #include "otamanager.h" 20 | #include "librarywidget.h" 21 | #include "locallibrarywidget.h" 22 | #include "homepagewidget.h" 23 | #include "telemetry.h" 24 | 25 | using namespace std; 26 | 27 | QT_BEGIN_NAMESPACE 28 | namespace Ui { class MainWindow; } 29 | QT_END_NAMESPACE 30 | 31 | class MainWindow : public QMainWindow 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | QString className = this->metaObject()->className(); 37 | MainWindow(QWidget *parent = nullptr); 38 | ~MainWindow(); 39 | 40 | float stdIconWidth; 41 | float stdIconHeight; 42 | float brightnessIconWidth; 43 | float brightnessIconHeight; 44 | float homeIconWidth; 45 | float homeIconHeight; 46 | float wifiIconWidth; 47 | float wifiIconHeight; 48 | float sW; 49 | float sH; 50 | int truncateThreshold; 51 | 52 | bool existing_recent_books = false; 53 | bool reboot_after_update = false; 54 | bool resetFullWindowException; 55 | 56 | global::wifi::wifiState lastWifiState = global::wifi::wifiState::unknown; 57 | bool isConnecting = false; 58 | bool isReconnecting = false; 59 | 60 | int timerTime = 0; 61 | QString relative_path; 62 | QString usbmsStatus; 63 | 64 | void openLowBatteryDialog(); 65 | void openCriticalBatteryAlertWindow(); 66 | void openUsbmsDialog(); 67 | void resetIcons(); 68 | void setBatteryIcon(); 69 | 70 | QString updatesCheckConfigPath = ".config/23-updates/check-updates"; 71 | QString usbConfigPath = ".config/22-usb/show-dialog"; 72 | 73 | public slots: 74 | void showToast(QString messageToDisplay); 75 | void closeIndefiniteToast(); 76 | 77 | private slots: 78 | void on_settingsBtn_clicked(); 79 | void on_appsBtn_clicked(); 80 | void on_pushButton_clicked(); 81 | void on_searchBtn_clicked(); 82 | void on_quitBtn_clicked(); 83 | void on_brightnessBtn_clicked(); 84 | void openUpdateDialog(); 85 | void setInitialBrightness(); 86 | void on_homeBtn_clicked(); 87 | void refreshScreen(); 88 | void setupSearchDialog(); 89 | void updateWifiAble(); 90 | void on_wifiBtn_clicked(); 91 | void updateWifiIcon(); 92 | void hello(int testNumber); 93 | void openUpdateDialogOTA(bool open); 94 | void launchOtaUpdater(); 95 | void openBookFile(QString book, bool relativePath); 96 | void openReaderFramework(); 97 | void openKoreader(); 98 | void checkForUpdate(); 99 | void checkForOtaUpdate(); 100 | void openEncfsRepackDialog(); 101 | void on_libraryButton_clicked(); 102 | void resetWindow(bool resetStackedWidget); 103 | void resetFullWindow(); 104 | void setupLocalLibraryWidget(); 105 | void setupHomePageWidget(); 106 | void launchOnlineLibrary(); 107 | void on_audioBtn_clicked(); 108 | void openTelemetryDialog(); 109 | void openTelemetryMessageDialog(); 110 | void sendDeviceInformationSlot(QString message); 111 | void runKoreader(); 112 | 113 | private: 114 | Ui::MainWindow * ui; 115 | settingsChooser * settingsChooserWindow; 116 | apps * appsWindow; 117 | reader * readerWindow; 118 | quit * quitWindow; 119 | alert * alertWindow; 120 | usbmsSplash * usbmsWindow; 121 | brightnessDialog * brightnessDialogWindow; 122 | generalDialog * generalDialogWindow; 123 | koboxSettings * koboxSettingsWindow; 124 | koboxAppsDialog * koboxAppsDialogWindow; 125 | textwidget * textwidgetWindow; 126 | virtualkeypad * keypadWidget; 127 | toast * toastWindow; 128 | otaManager * otaManagerWindow; 129 | libraryWidget * libraryWidgetWindow; 130 | localLibraryWidget * localLibraryWidgetWindow; 131 | homePageWidget * homePageWidgetWindow; 132 | telemetry * telemetryInstance; 133 | }; 134 | 135 | #endif // MAINWINDOW_H 136 | -------------------------------------------------------------------------------- /src/localLibrary/locallibrarywidget.h: -------------------------------------------------------------------------------- 1 | #ifndef LOCALLIBRARYWIDGET_H 2 | #define LOCALLIBRARYWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "functions.h" 9 | #include "qclickablelabel.h" 10 | #include "generaldialog.h" 11 | #include "toast.h" 12 | #include "bookoptionsdialog.h" 13 | #include "bookinfodialog.h" 14 | 15 | namespace Ui { 16 | class localLibraryWidget; 17 | } 18 | 19 | class localLibraryWidget : public QWidget 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | QString className = this->metaObject()->className(); 25 | explicit localLibraryWidget(QWidget *parent = nullptr); 26 | ~localLibraryWidget(); 27 | int buttonsNumber; 28 | int sW; 29 | int sH; 30 | float stdIconWidthDivider; 31 | float stdIconHeightDivider; 32 | int stdIconWidth; 33 | int stdIconHeight; 34 | QJsonDocument databaseJsonDocument; 35 | QJsonObject databaseJsonObject; 36 | QJsonArray databaseJsonArrayList; 37 | int currentPageNumber = 1; 38 | int pagesNumber; 39 | int pagesTurned = 0; 40 | int booksNumber; 41 | int bookTitleTruncateThreshold; 42 | QVector idList; 43 | bool noBooksInDatabase = true; 44 | // For folder feature 45 | QString pathForFolders = "/mnt/onboard/onboard/"; 46 | bool folderFeatureEnabled = false; 47 | int firstPageForBooks; 48 | int lastPageFolderCount; 49 | int bookIndexVector = 0; 50 | int goBackInIndex = 0; 51 | QPixmap pixmapForFolder = QPixmap(":/resources/folder.png"); 52 | QPixmap hourglassPixmap = QPixmap(":/resources/hourglass-top-rectangular.png"); 53 | QVector booksListForPathIndex; 54 | int fileListCount; 55 | int directoryListCount; 56 | int completeItemsList; 57 | // If the path is set to '/mnt/onboard/onboard/', and it's empty, this will be true 58 | bool mainPathIsEmpty = false; 59 | int idForOpenBook; 60 | 61 | private slots: 62 | void setupDatabase(); 63 | void setupBooksList(int pageNumber); 64 | void on_previousPageBtn_clicked(); 65 | void on_nextPageBtn_clicked(); 66 | void openBook(int bookID = -1); 67 | void btnOpenBook(int buttonNumber); 68 | void refreshScreenNative(); 69 | void openGoToPageDialog(); 70 | void goToPage(int page); 71 | void setupDisplay(); 72 | void showToast(QString messageToDisplay); 73 | void openBookOptionsDialog(int pseudoBookID); 74 | void handlePossibleBookDeletion(); 75 | void openLocalBookInfoDialog(); 76 | void setupButtonsLook(); 77 | void cleanButtons(); 78 | // For folder feature 79 | void setupBooksListFolders(int pageNumber); 80 | void setupBooksListToggle(int pageNumber); 81 | void calculateMaximumPagesNumberForFolders(); 82 | void calculateIndexForPage(int pageNumber); 83 | void goUpFunction(); 84 | void checkIfMainPathIsEmpty(); 85 | // Dir without "/" at the end and begining 86 | void changePathAndRefresh(QString directory); 87 | void refreshFolders(); 88 | void on_goUpBtn_clicked(); 89 | void on_pathBtn_clicked(); 90 | 91 | private: 92 | Ui::localLibraryWidget * ui; 93 | generalDialog * generalDialogWindow; 94 | bookOptionsDialog * bookOptionsDialogWindow; 95 | toast * toastWindow; 96 | bookInfoDialog * bookInfoDialogWindow; 97 | QVector horizontalLayoutArray; 98 | QVector bookIconArray; 99 | QVector bookBtnArray; 100 | QVector lineArray; 101 | 102 | signals: 103 | void openBookSignal(QString bookFile, bool relativePath); 104 | void refreshScreen(); 105 | }; 106 | 107 | #endif // LOCALLIBRARYWIDGET_H 108 | -------------------------------------------------------------------------------- /src/onlineLibrary/librarywidget.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRARYWIDGET_H 2 | #define LIBRARYWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Ui { 9 | class libraryWidget; 10 | } 11 | 12 | class libraryWidget : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit libraryWidget(QWidget *parent = nullptr); 19 | ~libraryWidget(); 20 | float sH; 21 | float sW; 22 | float stdIconHeight; 23 | float stdIconWidth; 24 | 25 | private: 26 | Ui::libraryWidget * ui; 27 | toast * toastWindow; 28 | bookInfoDialog * bookInfoDialogWindow; 29 | 30 | private slots: 31 | void syncCatalog(); 32 | void syncCatalogSlot(); 33 | void setupView(); 34 | void showToast(QString messageToDisplay); 35 | void closeIndefiniteToast(); 36 | QString getTitle(int bookNumber); 37 | void openLatestBookInfoDialog(int bookNumber, QString title); 38 | 39 | void on_previousBtn_clicked(); 40 | void on_nextBtn_clicked(); 41 | void on_book1Btn_clicked(); 42 | void on_book2Btn_clicked(); 43 | void on_book3Btn_clicked(); 44 | void on_book4Btn_clicked(); 45 | void on_book5Btn_clicked(); 46 | void on_book6Btn_clicked(); 47 | void on_book7Btn_clicked(); 48 | void on_book8Btn_clicked(); 49 | void on_book9Btn_clicked(); 50 | void on_book10Btn_clicked(); 51 | void on_book11Btn_clicked(); 52 | void on_book12Btn_clicked(); 53 | void on_book13Btn_clicked(); 54 | void on_book14Btn_clicked(); 55 | void on_book15Btn_clicked(); 56 | void on_book16Btn_clicked(); 57 | }; 58 | 59 | #endif // LIBRARYWIDGET_H 60 | -------------------------------------------------------------------------------- /src/otaUpdate/otamanager.cpp: -------------------------------------------------------------------------------- 1 | #include "otamanager.h" 2 | #include "ui_otamanager.h" 3 | #include "functions.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | otaManager::otaManager(QWidget *parent) : 10 | QWidget(parent), 11 | ui(new Ui::otaManager) 12 | { 13 | ui->setupUi(this); 14 | QThread::msleep(500); 15 | if(global::otaUpdate::downloadOta == false) { 16 | log("Checking for available OTA update", className); 17 | writeFile("/opt/ibxd", "ota_update_check\n"); 18 | QTimer * otaCheckTimer = new QTimer(this); 19 | otaCheckTimer->setInterval(100); 20 | connect(otaCheckTimer, &QTimer::timeout, [&]() { 21 | if(QFile::exists("/run/can_ota_update") == true) { 22 | if(checkconfig("/run/can_ota_update") == true) { 23 | log("OTA update is available", className); 24 | emit canOtaUpdate(true); 25 | } 26 | else { 27 | log("No OTA update available", className); 28 | emit canOtaUpdate(false); 29 | } 30 | unsigned long currentEpoch = QDateTime::currentSecsSinceEpoch(); 31 | writeFile("/external_root/opt/storage/update/last_sync", QString::number(currentEpoch)); 32 | QFile::remove("/run/can_ota_update"); 33 | otaManager::close(); 34 | } 35 | } ); 36 | otaCheckTimer->start(); 37 | } 38 | else { 39 | log("Downloading OTA update", className); 40 | QFile::remove("/run/can_install_ota_update"); 41 | writeFile("/opt/ibxd", "ota_update_download\n"); 42 | QTimer * otaDownloadTimer = new QTimer(this); 43 | otaDownloadTimer->setInterval(100); 44 | connect(otaDownloadTimer, &QTimer::timeout, [&]() { 45 | if(QFile::exists("/run/can_install_ota_update") == true) { 46 | if(checkconfig("/run/can_install_ota_update") == true) { 47 | log("Download succeeded", className); 48 | emit downloadedOtaUpdate(true); 49 | global::otaUpdate::downloadOta = false; 50 | } 51 | else { 52 | log("Download failed", className); 53 | emit downloadedOtaUpdate(false); 54 | global::otaUpdate::downloadOta = false; 55 | } 56 | QFile::remove("/external_root/opt/storage/update/last_sync"); 57 | otaManager::close(); 58 | } 59 | } ); 60 | otaDownloadTimer->start(); 61 | } 62 | } 63 | 64 | otaManager::~otaManager() 65 | { 66 | delete ui; 67 | } 68 | -------------------------------------------------------------------------------- /src/otaUpdate/otamanager.h: -------------------------------------------------------------------------------- 1 | #ifndef OTAMANAGER_H 2 | #define OTAMANAGER_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class otaManager; 8 | } 9 | 10 | class otaManager : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit otaManager(QWidget *parent = nullptr); 17 | ~otaManager(); 18 | 19 | private: 20 | Ui::otaManager *ui; 21 | 22 | signals: 23 | void canOtaUpdate(bool yesno); 24 | void downloadedOtaUpdate(bool wasDownloadSuccessful); 25 | }; 26 | 27 | #endif // OTAMANAGER_H 28 | -------------------------------------------------------------------------------- /src/otaUpdate/otamanager.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | otaManager 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | OTA updates manager 23 | 24 | 25 | Qt::AlignCenter 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/powerDaemon/sleepthread.cpp: -------------------------------------------------------------------------------- 1 | #include "sleepthread.h" 2 | #include "functions.h" 3 | 4 | #include 5 | 6 | sleepThread::sleepThread() {} 7 | 8 | void sleepThread::start() 9 | { 10 | log("Sleep pipe thread active", className); 11 | QDir pipeDirPath = QDir("/dev/ipd"); 12 | QFile pipePath = QFile("/dev/ipd/fifo"); 13 | while(true) { 14 | QThread::sleep(1); 15 | if(pipePath.exists() == true and pipeDirPath.exists() == true) { 16 | log("Looking for messages in pipe", className); 17 | char * pipe = "/dev/ipd/fifo"; 18 | int fd = ::open(pipe, O_RDONLY); 19 | char * readchar[5]; 20 | ::read(fd, readchar, 5); 21 | 22 | QString result = QString::fromUtf8((const char *)readchar, 5); 23 | 24 | log("Received from pipe: " + result, className); 25 | 26 | ::close(fd); 27 | 28 | if(result == "start") { 29 | log("Emitting signal to show sleepDialog", className); 30 | emit startDialog(); 31 | } 32 | else if (result == "stop0") { 33 | log("Emitting signal to hide sleepDialog", className); 34 | emit stopDialog(); 35 | } 36 | else { 37 | log("Something went wrong", className); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/powerDaemon/sleepthread.h: -------------------------------------------------------------------------------- 1 | #ifndef SLEEPTHREAD_H 2 | #define SLEEPTHREAD_H 3 | 4 | #include 5 | 6 | class sleepThread : public QObject { 7 | Q_OBJECT 8 | public: 9 | QString className = this->metaObject()->className(); 10 | sleepThread(); 11 | 12 | public slots: 13 | void start(); 14 | 15 | signals: 16 | void startDialog(); 17 | void stopDialog(); 18 | }; 19 | 20 | #endif // SLEEPTHREAD_H 21 | -------------------------------------------------------------------------------- /src/quit/quit.cpp: -------------------------------------------------------------------------------- 1 | #include "quit.h" 2 | #include "ui_quit.h" 3 | #include "functions.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | quit::quit(QWidget *parent) : 13 | QWidget(parent), 14 | ui(new Ui::quit) 15 | { 16 | ui->setupUi(this); 17 | ui->backBtn->setFont(QFont("u001")); 18 | 19 | ui->pushButton->setProperty("type", "borderless"); 20 | ui->pushButton_2->setProperty("type", "borderless"); 21 | ui->pushButton_3->setProperty("type", "borderless"); 22 | ui->pushButton_4->setProperty("type", "borderless"); 23 | ui->backBtn->setProperty("type", "borderless"); 24 | 25 | // Stylesheet 26 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 27 | stylesheetFile.open(QFile::ReadOnly); 28 | this->setStyleSheet(stylesheetFile.readAll()); 29 | stylesheetFile.close(); 30 | 31 | // Getting the screen's size 32 | float sW = QGuiApplication::screens()[0]->size().width(); 33 | float sH = QGuiApplication::screens()[0]->size().height(); 34 | // Defining what the "Quit" icon size will be 35 | float stdIconWidth = sW / 1.25; 36 | float stdIconHeight = sH / 1.25; 37 | 38 | QPixmap pixmap(":/resources/exit.png"); 39 | QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); 40 | ui->label->setPixmap(scaledPixmap); 41 | 42 | if(checkconfig("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/9-deepSleep") == true) { 43 | ui->pushButton_3->setText("Deep suspend"); 44 | } 45 | } 46 | 47 | quit::~quit() 48 | { 49 | delete ui; 50 | } 51 | 52 | void quit::on_pushButton_clicked() 53 | { 54 | // Prevent strange "appearing from nowhere" low battery or critical battery alerts due to sysfs unmount 55 | global::battery::showCriticalBatteryAlert = false; 56 | global::battery::showLowBatteryDialog = false; 57 | 58 | // GUI apps 59 | updateUserAppsMainJsonFile(); 60 | 61 | poweroff(true); 62 | qApp->quit(); 63 | } 64 | 65 | void quit::on_pushButton_2_clicked() 66 | { 67 | global::battery::showCriticalBatteryAlert = false; 68 | global::battery::showLowBatteryDialog = false; 69 | 70 | // GUI apps 71 | updateUserAppsMainJsonFile(); 72 | 73 | reboot(true); 74 | qApp->quit(); 75 | } 76 | 77 | void quit::on_pushButton_4_clicked() 78 | { 79 | log("Restarting InkBox", className); 80 | QProcess process; 81 | process.startDetached("inkbox", QStringList()); 82 | qApp->quit(); 83 | } 84 | 85 | void quit::on_backBtn_clicked() 86 | { 87 | quit::close(); 88 | } 89 | 90 | void quit::on_pushButton_3_clicked() 91 | { 92 | log("Suspending", className); 93 | if(checkconfig("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/9-deepSleep") == true) { 94 | writeFile("/dev/ipd/sleepCall", "deepSleep"); 95 | } 96 | else { 97 | writeFile("/dev/ipd/sleepCall", "sleep"); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/quit/quit.h: -------------------------------------------------------------------------------- 1 | #ifndef QUIT_H 2 | #define QUIT_H 3 | 4 | #include 5 | 6 | using namespace std; 7 | 8 | namespace Ui { 9 | class quit; 10 | } 11 | 12 | class quit : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit quit(QWidget *parent = nullptr); 19 | ~quit(); 20 | 21 | private slots: 22 | void on_pushButton_clicked(); 23 | void on_pushButton_2_clicked(); 24 | void on_pushButton_4_clicked(); 25 | void on_backBtn_clicked(); 26 | void on_pushButton_3_clicked(); 27 | 28 | private: 29 | Ui::quit *ui; 30 | }; 31 | 32 | #endif // QUIT_H 33 | -------------------------------------------------------------------------------- /src/resources/X11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/X11.png -------------------------------------------------------------------------------- /src/resources/alcott.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/alcott.jpg -------------------------------------------------------------------------------- /src/resources/alert-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/alert-triangle.png -------------------------------------------------------------------------------- /src/resources/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/alert.png -------------------------------------------------------------------------------- /src/resources/align-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/align-center.png -------------------------------------------------------------------------------- /src/resources/align-justify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/align-justify.png -------------------------------------------------------------------------------- /src/resources/align-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/align-left.png -------------------------------------------------------------------------------- /src/resources/align-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/align-right.png -------------------------------------------------------------------------------- /src/resources/apps-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/apps-inverted.png -------------------------------------------------------------------------------- /src/resources/apps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/apps.png -------------------------------------------------------------------------------- /src/resources/arrow-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/arrow-left.png -------------------------------------------------------------------------------- /src/resources/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/arrow-right.png -------------------------------------------------------------------------------- /src/resources/backspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/backspace.png -------------------------------------------------------------------------------- /src/resources/battery_alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/battery_alert.png -------------------------------------------------------------------------------- /src/resources/battery_charging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/battery_charging.png -------------------------------------------------------------------------------- /src/resources/battery_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/battery_empty.png -------------------------------------------------------------------------------- /src/resources/battery_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/battery_full.png -------------------------------------------------------------------------------- /src/resources/battery_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/battery_half.png -------------------------------------------------------------------------------- /src/resources/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/book.png -------------------------------------------------------------------------------- /src/resources/book_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/book_inverted.png -------------------------------------------------------------------------------- /src/resources/check-display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/check-display.png -------------------------------------------------------------------------------- /src/resources/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/check.png -------------------------------------------------------------------------------- /src/resources/checkbox-checked-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-checked-small.png -------------------------------------------------------------------------------- /src/resources/checkbox-checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-checked.png -------------------------------------------------------------------------------- /src/resources/checkbox-indeterminate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-indeterminate.png -------------------------------------------------------------------------------- /src/resources/checkbox-unchecked-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-unchecked-small.png -------------------------------------------------------------------------------- /src/resources/checkbox-unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-unchecked.png -------------------------------------------------------------------------------- /src/resources/checkbox-x-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-x-small.png -------------------------------------------------------------------------------- /src/resources/checkbox-x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/checkbox-x.png -------------------------------------------------------------------------------- /src/resources/chesterton.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/chesterton.jpg -------------------------------------------------------------------------------- /src/resources/chevron-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/chevron-down.png -------------------------------------------------------------------------------- /src/resources/chevron-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/chevron-left.png -------------------------------------------------------------------------------- /src/resources/chevron-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/chevron-right.png -------------------------------------------------------------------------------- /src/resources/chevron-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/chevron-up.png -------------------------------------------------------------------------------- /src/resources/christie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/christie.jpg -------------------------------------------------------------------------------- /src/resources/christie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/christie.png -------------------------------------------------------------------------------- /src/resources/clean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/clean.png -------------------------------------------------------------------------------- /src/resources/clock-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/clock-inverted.png -------------------------------------------------------------------------------- /src/resources/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/clock.png -------------------------------------------------------------------------------- /src/resources/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/close.png -------------------------------------------------------------------------------- /src/resources/cover_unavailable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/cover_unavailable.png -------------------------------------------------------------------------------- /src/resources/davies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/davies.jpg -------------------------------------------------------------------------------- /src/resources/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/edit.png -------------------------------------------------------------------------------- /src/resources/egg/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/egg/0.jpg -------------------------------------------------------------------------------- /src/resources/egg/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/egg/1.jpg -------------------------------------------------------------------------------- /src/resources/encryption-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/encryption-small.png -------------------------------------------------------------------------------- /src/resources/encryption.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/encryption.png -------------------------------------------------------------------------------- /src/resources/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/error.png -------------------------------------------------------------------------------- /src/resources/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/exit.png -------------------------------------------------------------------------------- /src/resources/file-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/file-text.png -------------------------------------------------------------------------------- /src/resources/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/folder.png -------------------------------------------------------------------------------- /src/resources/fonts/Bitter-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/Bitter-Bold.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Bitter-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/Bitter-BoldItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Bitter-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/Bitter-Medium.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Bitter-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/Bitter-MediumItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/CrimsonPro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/CrimsonPro-Bold.ttf -------------------------------------------------------------------------------- /src/resources/fonts/CrimsonPro-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/CrimsonPro-BoldItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/CrimsonPro-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/CrimsonPro-Italic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/CrimsonPro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/CrimsonPro-Regular.ttf -------------------------------------------------------------------------------- /src/resources/fonts/IbarraRealNova-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/IbarraRealNova-Bold.ttf -------------------------------------------------------------------------------- /src/resources/fonts/IbarraRealNova-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/IbarraRealNova-BoldItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/IbarraRealNova-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/IbarraRealNova-Medium.ttf -------------------------------------------------------------------------------- /src/resources/fonts/IbarraRealNova-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/fonts/IbarraRealNova-MediumItalic.ttf -------------------------------------------------------------------------------- /src/resources/frontlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/frontlight.png -------------------------------------------------------------------------------- /src/resources/hide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/hide.png -------------------------------------------------------------------------------- /src/resources/highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/highlight.png -------------------------------------------------------------------------------- /src/resources/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/home.png -------------------------------------------------------------------------------- /src/resources/hourglass-bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/hourglass-bottom.png -------------------------------------------------------------------------------- /src/resources/hourglass-top-rectangular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/hourglass-top-rectangular.png -------------------------------------------------------------------------------- /src/resources/hourglass-top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/hourglass-top.png -------------------------------------------------------------------------------- /src/resources/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/info.png -------------------------------------------------------------------------------- /src/resources/king.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/king.jpg -------------------------------------------------------------------------------- /src/resources/kobox-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/kobox-icon.png -------------------------------------------------------------------------------- /src/resources/koreader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/koreader.png -------------------------------------------------------------------------------- /src/resources/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/lock.png -------------------------------------------------------------------------------- /src/resources/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/log.png -------------------------------------------------------------------------------- /src/resources/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/minus.png -------------------------------------------------------------------------------- /src/resources/music-library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/music-library.png -------------------------------------------------------------------------------- /src/resources/music-note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/music-note.png -------------------------------------------------------------------------------- /src/resources/music-queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/music-queue.png -------------------------------------------------------------------------------- /src/resources/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/new.png -------------------------------------------------------------------------------- /src/resources/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/next.png -------------------------------------------------------------------------------- /src/resources/nightmode-empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/nightmode-empty.png -------------------------------------------------------------------------------- /src/resources/nightmode-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/nightmode-full.png -------------------------------------------------------------------------------- /src/resources/online-library-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/online-library-inverted.png -------------------------------------------------------------------------------- /src/resources/online-library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/online-library.png -------------------------------------------------------------------------------- /src/resources/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/pause.png -------------------------------------------------------------------------------- /src/resources/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/pin.png -------------------------------------------------------------------------------- /src/resources/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/play.png -------------------------------------------------------------------------------- /src/resources/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/plus.png -------------------------------------------------------------------------------- /src/resources/power.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/power.png -------------------------------------------------------------------------------- /src/resources/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/previous.png -------------------------------------------------------------------------------- /src/resources/public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/public.png -------------------------------------------------------------------------------- /src/resources/question-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/question-mark.png -------------------------------------------------------------------------------- /src/resources/refresh-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/refresh-small.png -------------------------------------------------------------------------------- /src/resources/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/refresh.png -------------------------------------------------------------------------------- /src/resources/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/save.png -------------------------------------------------------------------------------- /src/resources/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/search.png -------------------------------------------------------------------------------- /src/resources/settings-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/settings-inverted.png -------------------------------------------------------------------------------- /src/resources/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/settings.png -------------------------------------------------------------------------------- /src/resources/show.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/show.png -------------------------------------------------------------------------------- /src/resources/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/star.png -------------------------------------------------------------------------------- /src/resources/starred_star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/starred_star.png -------------------------------------------------------------------------------- /src/resources/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/stop.png -------------------------------------------------------------------------------- /src/resources/unhighlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/unhighlight.png -------------------------------------------------------------------------------- /src/resources/usbms-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/usbms-inverted.png -------------------------------------------------------------------------------- /src/resources/usbms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/usbms.png -------------------------------------------------------------------------------- /src/resources/view-highlights.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/view-highlights.png -------------------------------------------------------------------------------- /src/resources/wifi-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-0.png -------------------------------------------------------------------------------- /src/resources/wifi-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-100.png -------------------------------------------------------------------------------- /src/resources/wifi-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-25.png -------------------------------------------------------------------------------- /src/resources/wifi-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-50.png -------------------------------------------------------------------------------- /src/resources/wifi-75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-75.png -------------------------------------------------------------------------------- /src/resources/wifi-connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-connected.png -------------------------------------------------------------------------------- /src/resources/wifi-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-off.png -------------------------------------------------------------------------------- /src/resources/wifi-standby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/wifi-standby.png -------------------------------------------------------------------------------- /src/resources/x-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/x-circle.png -------------------------------------------------------------------------------- /src/resources/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/zoom-in.png -------------------------------------------------------------------------------- /src/resources/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quill-OS/quill/d01b6751764959dec563aa09bfae2d8fc072c6e4/src/resources/zoom-out.png -------------------------------------------------------------------------------- /src/settings/koboxsettings.cpp: -------------------------------------------------------------------------------- 1 | #include "koboxsettings.h" 2 | #include "ui_koboxsettings.h" 3 | #include "functions.h" 4 | 5 | #include 6 | #include 7 | 8 | koboxSettings::koboxSettings(QWidget *parent) : 9 | QWidget(parent), 10 | ui(new Ui::koboxSettings) 11 | { 12 | ui->setupUi(this); 13 | koboxSettings::setFont(QFont("u001")); 14 | ui->okBtn->setFont(QFont("Inter")); 15 | 16 | // UI tweaks 17 | ui->okBtn->setProperty("type", "borderless"); 18 | ui->pushButton->setProperty("type", "borderless"); 19 | ui->resetKoboxBtn->setProperty("type", "borderless"); 20 | ui->pushButton->setStyleSheet("font-weight: bold"); 21 | ui->resetKoboxBtn->setStyleSheet("font-weight: bold"); 22 | ui->okBtn->setStyleSheet("font-weight: bold"); 23 | 24 | // Stylesheet 25 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 26 | stylesheetFile.open(QFile::ReadOnly); 27 | this->setStyleSheet(stylesheetFile.readAll()); 28 | stylesheetFile.close(); 29 | 30 | if(checkconfig("/external_root/boot/flags/X11_START") == true) { 31 | ui->koboxStatusLabel->setText("KoBox is enabled"); 32 | not_user_change = true; 33 | ui->checkBox->click(); 34 | ui->runtimeSettingsWidget->setVisible(true); 35 | } 36 | else { 37 | ui->koboxStatusLabel->setText("KoBox is disabled"); 38 | ui->runtimeSettingsWidget->setVisible(false); 39 | } 40 | 41 | // DPI setting 42 | QString dpiSetting; 43 | QString dpiSettingStr = readFile(".config/00-kobox/dpiSetting"); 44 | if(dpiSettingStr.isEmpty()) { 45 | if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { 46 | dpiSetting = "125"; 47 | } 48 | else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { 49 | dpiSetting = "175"; 50 | } 51 | else if(global::deviceID == "n437\n" or global::deviceID == "n249\n") { 52 | dpiSetting = "225"; 53 | } 54 | else if(global::deviceID == "n873\n") { 55 | dpiSetting = "250"; 56 | } 57 | else { 58 | dpiSetting = "125"; 59 | } 60 | writeFile(".config/00-kobox/dpiSetting", dpiSetting); 61 | } 62 | 63 | readFile(".config/00-kobox/dpiSetting"); 64 | int dpi_setting = dpiSettingStr.toInt(); 65 | ui->spinBox->setValue(dpi_setting); 66 | } 67 | 68 | koboxSettings::~koboxSettings() 69 | { 70 | delete ui; 71 | } 72 | 73 | void koboxSettings::on_okBtn_clicked() 74 | { 75 | koboxSettings::close(); 76 | } 77 | 78 | void koboxSettings::on_checkBox_toggled(bool checked) 79 | { 80 | if(checked == true) { 81 | if(not_user_change != true) { 82 | log("Enabling KoBox subsystem", className); 83 | writeFile("/external_root/boot/flags/X11_START", "true\n"); 84 | openSettingsRebootDialog(); 85 | } 86 | else { 87 | not_user_change = false; 88 | } 89 | } 90 | else { 91 | log("Disabling KoBox subsystem", className); 92 | writeFile("/external_root/boot/flags/X11_START", "false\n"); 93 | openSettingsRebootDialog(); 94 | } 95 | } 96 | 97 | void koboxSettings::openSettingsRebootDialog() { 98 | log("Showing reboot dialog", className); 99 | global::settings::settingsRebootDialog = true; 100 | global::kobox::koboxSettingsRebootDialog = true; 101 | generalDialogWindow = new generalDialog(this); 102 | generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); 103 | } 104 | void koboxSettings::openResetKoboxDialog() { 105 | log("Showing KoBox reset dialog", className); 106 | global::kobox::resetKoboxDialog = true; 107 | generalDialogWindow = new generalDialog(this); 108 | generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); 109 | } 110 | 111 | void koboxSettings::on_spinBox_valueChanged(int arg1) 112 | { 113 | QString number = QString::number(arg1); 114 | writeFile(".config/00-kobox/dpiSetting", number); 115 | log("X11 DPI set to " + number, className); 116 | } 117 | 118 | void koboxSettings::on_pushButton_clicked() 119 | { 120 | // Export Extensions disk image over USB with g_mass_storage/g_file_storage 121 | global::usbms::usbmsDialog = false; 122 | global::usbms::launchUsbms = true; 123 | global::usbms::koboxExportExtensions = true; 124 | 125 | log("Exporting KoBox extensions onboard storage via USB", className); 126 | log("Showing USBMS splash", className); 127 | usbmsWindow = new usbmsSplash(); 128 | usbmsWindow->setAttribute(Qt::WA_DeleteOnClose); 129 | usbmsWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size())); 130 | usbmsWindow->show(); 131 | } 132 | 133 | void koboxSettings::on_resetKoboxBtn_clicked() 134 | { 135 | openResetKoboxDialog(); 136 | } 137 | -------------------------------------------------------------------------------- /src/settings/koboxsettings.h: -------------------------------------------------------------------------------- 1 | #ifndef KOBOXSETTINGS_H 2 | #define KOBOXSETTINGS_H 3 | 4 | #include 5 | 6 | #include "generaldialog.h" 7 | #include "usbmsSplash.h" 8 | 9 | namespace Ui { 10 | class koboxSettings; 11 | } 12 | 13 | class koboxSettings : public QWidget 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | QString className = this->metaObject()->className(); 19 | explicit koboxSettings(QWidget *parent = nullptr); 20 | ~koboxSettings(); 21 | 22 | bool not_user_change = false; 23 | void openSettingsRebootDialog(); 24 | void openResetKoboxDialog(); 25 | 26 | private slots: 27 | void on_okBtn_clicked(); 28 | void on_checkBox_toggled(bool checked); 29 | void on_spinBox_valueChanged(int arg1); 30 | void on_pushButton_clicked(); 31 | void on_resetKoboxBtn_clicked(); 32 | 33 | private: 34 | Ui::koboxSettings *ui; 35 | generalDialog *generalDialogWindow; 36 | usbmsSplash *usbmsWindow; 37 | }; 38 | 39 | #endif // KOBOXSETTINGS_H 40 | -------------------------------------------------------------------------------- /src/settings/powerdaemonsettings.h: -------------------------------------------------------------------------------- 1 | #ifndef POWERDAEMONSETTINGS_H 2 | #define POWERDAEMONSETTINGS_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class powerDaemonSettings; 8 | } 9 | 10 | class powerDaemonSettings : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit powerDaemonSettings(QWidget *parent = nullptr); 17 | ~powerDaemonSettings(); 18 | int cinematicBrightnessMs; 19 | 20 | private slots: 21 | void on_CBSIncreaseBtn_clicked(); 22 | void on_CBSDecreaseBtn_clicked(); 23 | void on_exitBtn_clicked(); 24 | void on_expBtn_clicked(); 25 | void on_hWhenChargerSleepBtn_clicked(bool checked); 26 | void on_hChargerWakeUpBtn_clicked(bool checked); 27 | void on_wifiReconnectBtn_clicked(bool checked); 28 | void on_ledUsageBtn_clicked(bool checked); 29 | void on_idleSleepIncreaseBtn_clicked(); 30 | void on_idleSleepDecreaseBtn_clicked(); 31 | void on_hCustomCaseBtn_clicked(bool checked); 32 | void on_deepSleepBtn_clicked(bool checked); 33 | 34 | void convertIdleSleepInt(); 35 | void convertCinematicInt(); 36 | 37 | void on_idleSleepIncreaseMBtn_clicked(); 38 | 39 | void on_idleSleepDecreaseMBtn_clicked(); 40 | 41 | private: 42 | Ui::powerDaemonSettings * ui; 43 | bool whenChargerSleepBool; 44 | bool chargerWakeUpBool; 45 | bool wifiReconnectBool; 46 | bool ledUsageBool; 47 | bool customCaseBool; 48 | bool deepSleepBool; 49 | int idleSleepInt; 50 | int cinematicBrightnessInt; 51 | }; 52 | #endif // POWERDAEMONSETTINGS_H 53 | -------------------------------------------------------------------------------- /src/settings/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGS_H 2 | #define SETTINGS_H 3 | 4 | #include 5 | 6 | #include 7 | #include "generaldialog.h" 8 | #include "otamanager.h" 9 | #include "toast.h" 10 | 11 | using namespace std; 12 | 13 | namespace Ui { 14 | class settings; 15 | } 16 | 17 | class settings : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | QString className = this->metaObject()->className(); 23 | int settings_page = 1; 24 | bool launch_sh = false; 25 | bool ui_enable_changed = false; 26 | bool ui_not_user_change = false; 27 | bool not_user_change = true; 28 | bool timezone_not_user_change = true; 29 | bool enableEncryptedStorageUserChange = false; 30 | 31 | float sW; 32 | float sH; 33 | float homeIconWidth; 34 | float homeIconHeight; 35 | 36 | explicit settings(QWidget *parent = nullptr); 37 | ~settings(); 38 | 39 | private slots: 40 | void on_demoCheckBox_toggled(bool); 41 | void on_aboutBtn_clicked(); 42 | void on_okBtn_clicked(); 43 | void on_clockCheckBox_toggled(bool checked); 44 | void on_quoteCheckBox_toggled(bool checked); 45 | void on_requestLeaseBtn_clicked(); 46 | void on_usbmsBtn_clicked(); 47 | void on_updateBtn_clicked(); 48 | void on_darkModeCheckBox_toggled(bool checked); 49 | void on_uiScalingSlider_valueChanged(int value); 50 | void on_menuBarCheckBox_toggled(bool checked); 51 | void on_comboBox_currentIndexChanged(const QString &arg1); 52 | void on_resetBtn_clicked(); 53 | void on_setPasscodeBtn_clicked(); 54 | void on_enableLockscreenCheckBox_toggled(bool checked); 55 | void on_showSystemInfoBtn_clicked(); 56 | void on_readerScrollBarCheckBox_toggled(bool checked); 57 | void brightnessDown(); 58 | void on_globalReadingSettingsCheckBox_toggled(bool checked); 59 | void on_checkOtaUpdateBtn_clicked(); 60 | void openUpdateDialog(); 61 | void launchOtaUpdater(); 62 | void openUpdateDialogOTA(bool open); 63 | void showToastNative(QString messageToDisplay); 64 | void closeIndefiniteToastNative(); 65 | void usbms_launch(); 66 | void quit_restart(); 67 | void on_enableEncryptedStorageCheckBox_toggled(bool checked); 68 | void disableStorageEncryption(); 69 | void cancelDisableStorageEncryption(); 70 | void on_repackBtn_clicked(); 71 | void on_generateSystemReportBtn_clicked(); 72 | void on_tzComboBox_currentTextChanged(const QString &arg1); 73 | void on_exportHighlightsBtn_clicked(); 74 | void on_wordsNumberIncBtn_clicked(); 75 | void on_wordsNumberDecBtn_clicked(); 76 | void on_pageSizeHeightDecBtn_clicked(); 77 | void on_pageSizeHeightIncBtn_clicked(); 78 | void on_pageSizeWidthDecBtn_clicked(); 79 | void on_pageSizeWidthIncBtn_clicked(); 80 | void on_localLibraryShowFoldersCheckBox_toggled(bool checked); 81 | void on_usbmsDialogBox_clicked(bool checked); 82 | void on_autoCheckUpdatesBox_clicked(bool checked); 83 | void on_lockscreenBackgroundComboBox_currentTextChanged(const QString &arg1); 84 | void saveDeferredSettings(); 85 | void on_settingsStackedWidget_currentChanged(int arg1); 86 | void on_readingSettingsBtn_clicked(); 87 | void on_homeSettingsBtn_clicked(); 88 | void on_librarySettingsBtn_clicked(); 89 | void on_storageSettingsBtn_clicked(); 90 | void on_systemSettingsBtn_clicked(); 91 | void on_securitySettingsBtn_clicked(); 92 | void on_headerBtn_clicked(); 93 | void on_usbNetworkingCheckBox_toggled(bool checked); 94 | void on_useKoreaderCheckBox_toggled(bool checked); 95 | 96 | signals: 97 | void showToast(QString messageToDisplay); 98 | void closeIndefiniteToast(); 99 | 100 | private: 101 | Ui::settings * ui; 102 | usbmsSplash * usbmsWindow; 103 | generalDialog * generalDialogWindow; 104 | otaManager * otaManagerWindow; 105 | toast * toastWindow; 106 | 107 | int pageSizeHeightSaved; 108 | int pageSizeWidthSaved; 109 | int wordsNumberSaved; 110 | }; 111 | 112 | #endif // SETTINGS_H 113 | -------------------------------------------------------------------------------- /src/settings/settingschooser.cpp: -------------------------------------------------------------------------------- 1 | #include "settingschooser.h" 2 | #include "ui_settingschooser.h" 3 | #include "functions.h" 4 | #include "powerdaemonsettings.h" 5 | 6 | #include 7 | #include 8 | 9 | settingsChooser::settingsChooser(QWidget *parent) : 10 | QWidget(parent), 11 | ui(new Ui::settingsChooser) 12 | { 13 | ui->setupUi(this); 14 | 15 | // Stylesheet 16 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 17 | stylesheetFile.open(QFile::ReadOnly); 18 | this->setStyleSheet(stylesheetFile.readAll()); 19 | stylesheetFile.close(); 20 | 21 | // UI tweaks 22 | if(checkconfig("/opt/inkbox_kobox_support") == false) { 23 | ui->koboxSettingsBtn->hide(); 24 | ui->line_3->hide(); 25 | } 26 | 27 | // Getting the screen's size 28 | sW = QGuiApplication::screens()[0]->size().width(); 29 | sH = QGuiApplication::screens()[0]->size().height(); 30 | 31 | // Defining what the default icon size will be 32 | if(global::deviceID == "n705\n") { 33 | homeIconWidth = sW / 18; 34 | homeIconHeight = sW / 18; 35 | } 36 | else { 37 | homeIconWidth = sW / 20; 38 | homeIconHeight = sW / 20; 39 | } 40 | 41 | ui->inkboxSettingsBtn->setProperty("type", "borderless"); 42 | ui->koboxSettingsBtn->setProperty("type", "borderless"); 43 | ui->powerSettingsBtn->setProperty("type", "borderless"); 44 | 45 | if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { 46 | ui->inkboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left"); 47 | ui->koboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left"); 48 | ui->powerSettingsBtn->setStyleSheet("padding: 20px; Text-align: left"); 49 | } 50 | else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { 51 | ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left"); 52 | ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left"); 53 | ui->powerSettingsBtn->setStyleSheet("padding:25px; Text-align: left"); 54 | } 55 | else { 56 | ui->inkboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left"); 57 | ui->koboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left"); 58 | ui->powerSettingsBtn->setStyleSheet("padding: 40px; Text-align: left"); 59 | } 60 | 61 | ui->inkboxSettingsBtn->setText("\t\t\tQuill settings"); 62 | ui->koboxSettingsBtn->setText("\t\t\tKoBox settings"); 63 | ui->powerSettingsBtn->setText("\t\t\tPower settings"); 64 | 65 | ui->inkboxSettingsBtn->setIcon(QIcon(":/resources/settings.png")); 66 | ui->inkboxSettingsBtn->setIconSize(QSize(homeIconWidth, homeIconHeight)); 67 | ui->koboxSettingsBtn->setIcon(QIcon(":/resources/X11.png")); 68 | ui->koboxSettingsBtn->setIconSize(QSize(homeIconWidth, homeIconHeight)); 69 | ui->powerSettingsBtn->setIcon(QIcon(":/resources/power.png")); 70 | ui->powerSettingsBtn->setIconSize(QSize(homeIconWidth, homeIconHeight)); 71 | } 72 | 73 | settingsChooser::~settingsChooser() 74 | { 75 | delete ui; 76 | } 77 | 78 | void settingsChooser::on_inkboxSettingsBtn_clicked() 79 | { 80 | log("Launching InkBox Settings", className); 81 | settingsWindow = new settings(); 82 | settingsWindow->setAttribute(Qt::WA_DeleteOnClose); 83 | connect(settingsWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); 84 | connect(settingsWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); 85 | settingsWindow->showFullScreen(); 86 | } 87 | 88 | void settingsChooser::on_koboxSettingsBtn_clicked() 89 | { 90 | log("Launching KoBox Settings", className); 91 | koboxSettingsWindow = new koboxSettings(); 92 | koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose); 93 | koboxSettingsWindow->showFullScreen(); 94 | } 95 | 96 | void settingsChooser::on_powerSettingsBtn_clicked() 97 | { 98 | log("Launching Power Daemon Settings", className); 99 | powerDaemonSettings * powerSettingsWindow = new powerDaemonSettings(); 100 | powerSettingsWindow->setAttribute(Qt::WA_DeleteOnClose); 101 | powerSettingsWindow->showFullScreen(); 102 | } 103 | 104 | void settingsChooser::showToastNative(QString messageToDisplay) { 105 | emit showToast(messageToDisplay); 106 | } 107 | 108 | void settingsChooser::closeIndefiniteToastNative() { 109 | emit closeIndefiniteToast(); 110 | } 111 | -------------------------------------------------------------------------------- /src/settings/settingschooser.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGSCHOOSER_H 2 | #define SETTINGSCHOOSER_H 3 | 4 | #include 5 | 6 | #include "settings.h" 7 | #include "koboxsettings.h" 8 | 9 | namespace Ui { 10 | class settingsChooser; 11 | } 12 | 13 | class settingsChooser : public QWidget 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | QString className = this->metaObject()->className(); 19 | explicit settingsChooser(QWidget *parent = nullptr); 20 | ~settingsChooser(); 21 | 22 | float sW; 23 | float sH; 24 | float homeIconWidth; 25 | float homeIconHeight; 26 | 27 | private slots: 28 | void on_inkboxSettingsBtn_clicked(); 29 | void on_koboxSettingsBtn_clicked(); 30 | void on_powerSettingsBtn_clicked(); 31 | void showToastNative(QString messageToDisplay); 32 | void closeIndefiniteToastNative(); 33 | 34 | signals: 35 | void showToast(QString messageToDisplay); 36 | void closeIndefiniteToast(); 37 | 38 | private: 39 | Ui::settingsChooser *ui; 40 | settings *settingsWindow; 41 | koboxSettings *koboxSettingsWindow; 42 | }; 43 | 44 | #endif // SETTINGSCHOOSER_H 45 | -------------------------------------------------------------------------------- /src/settings/settingschooser.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | settingsChooser 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Chivo 36 | 50 37 | true 38 | false 39 | 40 | 41 | 42 | Quill settings 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Chivo 51 | 52 | 53 | 54 | Power settings 55 | 56 | 57 | 58 | 59 | 60 | 61 | QFrame::Plain 62 | 63 | 64 | 3 65 | 66 | 67 | Qt::Horizontal 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Inter 76 | 75 77 | true 78 | 79 | 80 | 81 | Settings 82 | 83 | 84 | Qt::AlignCenter 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Chivo 93 | true 94 | 95 | 96 | 97 | KoBox settings 98 | 99 | 100 | 101 | 102 | 103 | 104 | QFrame::Plain 105 | 106 | 107 | Qt::Horizontal 108 | 109 | 110 | 111 | 112 | 113 | 114 | Qt::Vertical 115 | 116 | 117 | 118 | 20 119 | 40 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | QFrame::Plain 128 | 129 | 130 | Qt::Horizontal 131 | 132 | 133 | 134 | 135 | 136 | 137 | QFrame::Plain 138 | 139 | 140 | 1 141 | 142 | 143 | Qt::Horizontal 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /src/splash/alert.h: -------------------------------------------------------------------------------- 1 | #ifndef ALERT_H 2 | #define ALERT_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class alert; 8 | } 9 | 10 | using namespace std; 11 | 12 | class alert : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit alert(QWidget *parent = nullptr); 19 | ~alert(); 20 | bool signatureError = false; 21 | bool downgradeError = false; 22 | bool criticalBattery = false; 23 | void updateReset(); 24 | 25 | private slots: 26 | void on_continueBtn_clicked(); 27 | void on_resetBtn_clicked(); 28 | void on_continue2Btn_clicked(); 29 | void quit(); 30 | 31 | private: 32 | Ui::alert *ui; 33 | }; 34 | 35 | #endif // ALERT_H 36 | -------------------------------------------------------------------------------- /src/splash/usbmsSplash.h: -------------------------------------------------------------------------------- 1 | #ifndef USBMS_SPLASH_H 2 | #define USBMS_SPLASH_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class usbmsSplash; 8 | } 9 | 10 | class usbmsSplash : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit usbmsSplash(QWidget *parent = nullptr); 17 | ~usbmsSplash(); 18 | float sW; 19 | float sH; 20 | QString massStorageModule; 21 | 22 | void usbmsLaunch(); 23 | 24 | private slots: 25 | void brightnessAndWarmthDown(); 26 | void quit_restart(); 27 | void restartServices(); 28 | 29 | private: 30 | Ui::usbmsSplash *ui; 31 | }; 32 | 33 | #endif // USBMS_SPLASH_H 34 | -------------------------------------------------------------------------------- /src/splash/usbmsSplash.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | usbmsSplash 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Qt::Vertical 23 | 24 | 25 | 26 | 20 27 | 40 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Don't forget to eject the device before unplugging the USB cable. 36 | 37 | 38 | Qt::AlignCenter 39 | 40 | 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | Qt::Vertical 49 | 50 | 51 | 52 | 20 53 | 40 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 75 63 | true 64 | 65 | 66 | 67 | USB connected 68 | 69 | 70 | Qt::AlignCenter 71 | 72 | 73 | 74 | 75 | 76 | 77 | Qt::Vertical 78 | 79 | 80 | 81 | 20 82 | 40 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 50 92 | false 93 | 94 | 95 | 96 | USB Icon 97 | 98 | 99 | Qt::AlignCenter 100 | 101 | 102 | 103 | 104 | 105 | 106 | Qt::Vertical 107 | 108 | 109 | 110 | 20 111 | 40 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /src/telemetry/telemetry.cpp: -------------------------------------------------------------------------------- 1 | #include "telemetry.h" 2 | 3 | telemetry::telemetry(QObject *parent) 4 | : QObject{parent} 5 | { 6 | QTimer::singleShot(100, this, SLOT(telemetrySlot())); 7 | } 8 | 9 | QJsonObject telemetry::collectDeviceInformation() { 10 | QJsonObject data; 11 | data.insert("DeviceUID", getUID()); 12 | data.insert("SystemVersion", readFile("/opt/version").trimmed()); 13 | data.insert("Device", global::realDeviceID.trimmed()); 14 | if(checkconfig("/external_root/opt/root/rooted")) { 15 | data.insert("DeviceRooted", "true"); 16 | } 17 | else { 18 | data.insert("DeviceRooted", "false"); 19 | } 20 | if(checkconfig("/external_root/opt/developer/valid-key")) { 21 | data.insert("DeveloperKeyInstalled", "true"); 22 | } 23 | else { 24 | data.insert("DeveloperKeyInstalled", "false"); 25 | } 26 | data.insert("Message", message); 27 | return data; 28 | } 29 | 30 | bool telemetry::sendDeviceInformation(QJsonObject data) { 31 | log("Telemetry data to be sent to server: " + QJsonDocument(data).toJson(QJsonDocument::Compact), className); 32 | 33 | QNetworkRequest request(QUrl("http://23.163.0.39:4317/")); 34 | request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); 35 | 36 | QNetworkAccessManager nam; 37 | QNetworkReply * reply = nam.post(request, QJsonDocument(data).toJson()); 38 | while(!reply->isFinished()) { 39 | QApplication::processEvents(); 40 | } 41 | QByteArray responseData = reply->readAll(); 42 | reply->deleteLater(); 43 | QString responseDataQstring = QString(responseData); 44 | log("Telemetry server's response data was: '" + responseDataQstring + "'", className); 45 | if(responseDataQstring != "Data received successfully") { 46 | return false; 47 | } 48 | else { 49 | return true; 50 | } 51 | } 52 | 53 | void telemetry::telemetrySlot() { 54 | QJsonObject data = collectDeviceInformation(); 55 | if(sendDeviceInformation(data)) { 56 | writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true"); 57 | writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/enabled", "true"); 58 | showToast("Data sent successfully\nThank you!"); 59 | } 60 | else { 61 | showToast("Error while sending data"); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/telemetry/telemetry.h: -------------------------------------------------------------------------------- 1 | #ifndef TELEMETRY_H 2 | #define TELEMETRY_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "functions.h" 9 | 10 | class telemetry : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit telemetry(QObject *parent = nullptr); 15 | QString className = this->metaObject()->className(); 16 | QString message; 17 | QString deviceUID; 18 | QString systemVersion; 19 | QString device; 20 | bool deviceRooted; 21 | bool developerKeyInstalled; 22 | bool requestSuccessful; 23 | 24 | private: 25 | QJsonObject collectDeviceInformation(); 26 | bool sendDeviceInformation(QJsonObject data); 27 | 28 | private slots: 29 | void telemetrySlot(); 30 | 31 | signals: 32 | void showToast(QString message); 33 | }; 34 | 35 | #endif // TELEMETRY_H 36 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiodialog.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIODIALOG_H 2 | #define AUDIODIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class audioDialog; 9 | } 10 | 11 | class audioDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit audioDialog(QWidget *parent = nullptr); 17 | ~audioDialog(); 18 | QString className = this->metaObject()->className(); 19 | 20 | enum audioMenu { 21 | Library, 22 | Queue, 23 | }; 24 | 25 | bool currentMenu = Library; 26 | void changeMenu(); 27 | void refreshFileList(); 28 | void refreshAudioFileWidgets(); 29 | void refreshAudioFileWidgetsQueue(); 30 | QTimer* progress; // Needs to be stopped at exit 31 | bool finishedStartingUp = false; 32 | 33 | public slots: 34 | void playFile(int itemInQueue); // Can be called from children 35 | void progressFuncManage(); 36 | 37 | private slots: 38 | void on_libraryBtn_clicked(); 39 | void on_queueBtn_clicked(); 40 | void on_refreshBtn_clicked(); 41 | void on_progressSlider_sliderPressed(); 42 | void on_soundLevelSlider_valueChanged(int value); 43 | void on_plusBtn_clicked(); 44 | void on_minusBtn_clicked(); 45 | void on_playBtn_clicked(); 46 | void on_previousBtn_clicked(); 47 | void on_nextBtn_clicked(); 48 | void on_exitBtn_clicked(); 49 | 50 | signals: 51 | void deleteItself(); 52 | 53 | private: 54 | Ui::audioDialog *ui; 55 | }; 56 | 57 | #endif // AUDIODIALOG_H 58 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofile.cpp: -------------------------------------------------------------------------------- 1 | #include "audiofile.h" 2 | #include "ui_audiofile.h" 3 | #include "functions.h" 4 | 5 | audiofile::audiofile(QWidget *parent) : 6 | QWidget(parent), 7 | ui(new Ui::audiofile) 8 | { 9 | ui->setupUi(this); 10 | audiofile::setFont(QFont("u001")); 11 | ui->nameLabel->setFont(QFont("u001")); 12 | ui->timeLabel->setFont(QFont("u001")); 13 | 14 | ui->addBtn->setProperty("type", "borderless"); 15 | 16 | ui->nameLabel->setWordWrap(true); 17 | } 18 | 19 | audiofile::~audiofile() 20 | { 21 | delete ui; 22 | } 23 | 24 | void audiofile::provideData(global::audio::musicFile fileProvided) { 25 | file = fileProvided; 26 | ui->nameLabel->setText(file.name); 27 | ui->timeLabel->setText(file.length); 28 | } 29 | 30 | void audiofile::die() { 31 | this->deleteLater(); 32 | this->close(); 33 | } 34 | 35 | void audiofile::on_addBtn_clicked() 36 | { 37 | ui->addBtn->setDisabled(true); 38 | ui->addBtn->setStyleSheet("background: black;"); 39 | 40 | log("Adding item (audio file) to queue", className); 41 | global::audio::audioMutex.lock(); 42 | global::audio::queue.append(file); 43 | if(global::audio::isSomethingCurrentlyPlaying == false) { 44 | log("Starting playback because nothing else is currently playing", className); 45 | global::audio::isSomethingCurrentlyPlaying = true; 46 | int tmpInt = global::audio::queue.length() - 1; 47 | global::audio::audioMutex.unlock(); 48 | QTimer::singleShot(700, this, SLOT(enableButton())); 49 | emit playFileChild(tmpInt); 50 | return void(); 51 | } 52 | global::audio::audioMutex.unlock(); 53 | QTimer::singleShot(700, this, SLOT(enableButton())); 54 | } 55 | 56 | void audiofile::enableButton() { 57 | log("Enabling 'Back' button", className); 58 | ui->addBtn->setEnabled(true); 59 | ui->addBtn->setStyleSheet("background: white;"); 60 | ui->addBtn->repaint(); 61 | } 62 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofile.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIOFILE_H 2 | #define AUDIOFILE_H 3 | 4 | #include "functions.h" 5 | 6 | #include 7 | 8 | namespace Ui { 9 | class audiofile; 10 | } 11 | 12 | class audiofile : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit audiofile(QWidget *parent = nullptr); 18 | ~audiofile(); 19 | QString className = this->metaObject()->className(); 20 | void provideData(global::audio::musicFile fileProvided); 21 | global::audio::musicFile file; 22 | 23 | public slots: 24 | void die(); 25 | void enableButton(); 26 | 27 | private slots: 28 | 29 | void on_addBtn_clicked(); 30 | 31 | signals: 32 | void playFileChild(int itemInQueue); 33 | 34 | private: 35 | Ui::audiofile *ui; 36 | }; 37 | 38 | #endif // AUDIOFILE_H 39 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofile.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | audiofile 4 | 5 | 6 | 7 | 0 8 | 0 9 | 316 10 | 53 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 0 42 | 0 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Qt::Horizontal 54 | 55 | 56 | QSizePolicy::Preferred 57 | 58 | 59 | 60 | 40 61 | 20 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 0 71 | 0 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | QFrame::Plain 83 | 84 | 85 | Qt::Vertical 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 0 94 | 0 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | :/resources/plus.png:/resources/plus.png 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | QFrame::Plain 112 | 113 | 114 | Qt::Horizontal 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofilequeue.cpp: -------------------------------------------------------------------------------- 1 | #include "audiofilequeue.h" 2 | #include "ui_audiofilequeue.h" 3 | 4 | audiofilequeue::audiofilequeue(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::audiofilequeue) 7 | { 8 | ui->setupUi(this); 9 | audiofilequeue::setFont(QFont("u001")); 10 | ui->nameLabel->setFont(QFont("u001")); 11 | ui->timeLabel->setFont(QFont("u001")); 12 | 13 | ui->playBtn->setProperty("type", "borderless"); 14 | ui->deleteBtn->setProperty("type", "borderless"); 15 | 16 | ui->nameLabel->setWordWrap(true); 17 | } 18 | 19 | audiofilequeue::~audiofilequeue() 20 | { 21 | delete ui; 22 | } 23 | 24 | void audiofilequeue::provideData(global::audio::musicFile fileProvided, bool gray) { 25 | file = fileProvided; 26 | ui->nameLabel->setText(file.name); 27 | ui->timeLabel->setText(file.length); 28 | if(gray == true) { 29 | log("Setting background gray", className); 30 | ui->deleteBtn->setStyleSheet("background: #aeadac;"); 31 | ui->playBtn->setStyleSheet("background: #aeadac;"); 32 | isPlaying = true; 33 | } 34 | } 35 | 36 | void audiofilequeue::die() { 37 | this->deleteLater(); 38 | this->close(); 39 | } 40 | 41 | void audiofilequeue::on_deleteBtn_clicked() 42 | { 43 | int id = -1; 44 | log("global::audio::queue.size(): " + QString::number(global::audio::queue.size()), className); 45 | global::audio::audioMutex.lock(); 46 | for(int i = 0; i < global::audio::queue.size(); i++) { 47 | if(file.id == global::audio::queue[i].id) { 48 | log("Found ID", className); 49 | id = i; 50 | } 51 | } 52 | 53 | log("File ID is: " + QString::number(id), className); 54 | global::audio::queue.remove(id); 55 | // TODO: Don't change song if the removed item is not playing 56 | // I will do it the moment I get annoyed about it 57 | log("After removing global::audio::queue.size(): " + QString::number(global::audio::queue.size()), className); 58 | if(id - 2 >= 0) { 59 | global::audio::audioMutex.unlock(); 60 | emit playFileChild(id - 2); 61 | return void(); 62 | } 63 | else if(id < global::audio::queue.size()) { 64 | global::audio::audioMutex.unlock(); 65 | emit playFileChild(id); 66 | return void(); 67 | } 68 | else { 69 | global::audio::currentAction.append(global::audio::Action::Stop); 70 | global::audio::audioMutex.unlock(); 71 | return void(); 72 | } 73 | log("Something went wrong in deleting item that was in the query", className); 74 | global::audio::audioMutex.unlock(); 75 | } 76 | 77 | void audiofilequeue::on_playBtn_clicked() 78 | { 79 | global::audio::audioMutex.lock(); 80 | for(int i = 0; i < global::audio::queue.size(); i++) { 81 | if(global::audio::queue[i].id == file.id) { 82 | global::audio::audioMutex.unlock(); 83 | emit playFileChild(i); 84 | return void(); 85 | } 86 | } 87 | global::audio::audioMutex.unlock(); 88 | log("Something went really wrong", className); 89 | } 90 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofilequeue.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIOFILEQUEUE_H 2 | #define AUDIOFILEQUEUE_H 3 | 4 | #include 5 | #include "functions.h" 6 | 7 | namespace Ui { 8 | class audiofilequeue; 9 | } 10 | 11 | class audiofilequeue : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit audiofilequeue(QWidget *parent = nullptr); 17 | ~audiofilequeue(); 18 | QString className = this->metaObject()->className(); 19 | bool isPlaying = false; 20 | 21 | void provideData(global::audio::musicFile fileProvided, bool gray); 22 | global::audio::musicFile file; 23 | 24 | public slots: 25 | void die(); 26 | 27 | private: 28 | Ui::audiofilequeue *ui; 29 | 30 | signals: 31 | void playFileChild(int itemInQueue); 32 | 33 | private slots: 34 | void on_deleteBtn_clicked(); 35 | void on_playBtn_clicked(); 36 | }; 37 | 38 | #endif // AUDIOFILEQUEUE_H 39 | -------------------------------------------------------------------------------- /src/widgets/dialogs/audio/audiofilequeue.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | audiofilequeue 4 | 5 | 6 | 7 | 0 8 | 0 9 | 284 10 | 53 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 0 42 | 0 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Qt::Horizontal 54 | 55 | 56 | QSizePolicy::Preferred 57 | 58 | 59 | 60 | 40 61 | 20 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 0 71 | 0 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | QFrame::Plain 83 | 84 | 85 | Qt::Vertical 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 0 94 | 0 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | :/resources/close.png:/resources/close.png 103 | 104 | 105 | 106 | 107 | 108 | 109 | QFrame::Plain 110 | 111 | 112 | Qt::Vertical 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 0 121 | 0 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | :/resources/chevron-right.png:/resources/chevron-right.png 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | QFrame::Plain 139 | 140 | 141 | 2 142 | 143 | 144 | Qt::Horizontal 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/widgets/dialogs/brightnessdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef BRIGHTNESSDIALOG_H 2 | #define BRIGHTNESSDIALOG_H 3 | 4 | #include 5 | 6 | using namespace std; 7 | 8 | namespace Ui { 9 | class brightnessDialog; 10 | } 11 | 12 | class brightnessDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | int oldValue; 19 | int oldWarmthValue; 20 | void preSetBrightness(int brightnessValue); 21 | explicit brightnessDialog(QWidget *parent = nullptr); 22 | ~brightnessDialog(); 23 | 24 | private slots: 25 | void on_quitBtn_clicked(); 26 | void on_horizontalSlider_valueChanged(int value); 27 | void on_incBtn_clicked(); 28 | void on_decBtn_clicked(); 29 | void on_okBtn_clicked(); 30 | void on_warmthSlider_valueChanged(int value); 31 | void on_warmthDecBtn_clicked(); 32 | void on_warmthIncBtn_clicked(); 33 | 34 | private: 35 | Ui::brightnessDialog *ui; 36 | }; 37 | 38 | #endif // BRIGHTNESSDIALOG_H 39 | -------------------------------------------------------------------------------- /src/widgets/dialogs/generaldialog.h: -------------------------------------------------------------------------------- 1 | #ifndef GENERALDIALOG_H 2 | #define GENERALDIALOG_H 3 | 4 | #include 5 | 6 | #include "usbmsSplash.h" 7 | #include "textwidget.h" 8 | #include "virtualkeyboard.h" 9 | #include "virtualkeypad.h" 10 | #include "dictionarywidget.h" 11 | #include "otamanager.h" 12 | #include "searchresultswidget.h" 13 | 14 | using namespace std; 15 | 16 | namespace Ui { 17 | class generalDialog; 18 | } 19 | 20 | class generalDialog : public QDialog 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | QString className = this->metaObject()->className(); 26 | explicit generalDialog(QWidget *parent = nullptr); 27 | ~generalDialog(); 28 | bool resetDialog = false; 29 | bool updateDialog = false; 30 | bool settingsRebootDialog = false; 31 | bool koboxSettingsRebootDialog = false; 32 | bool lowBatteryDialog = false; 33 | bool usbmsDialog = false; 34 | bool textBrowserDialog = false; 35 | bool appCompatibilityDialog = false; 36 | bool appInfoDialog = false; 37 | bool resetKoboxDialog = false; 38 | bool keyboardDialog = false; 39 | bool keypadDialog = false; 40 | bool librarySyncDialog = false; 41 | bool telemetryDialog = false; 42 | bool dictionaryResults = false; 43 | bool vncServerSet = false; 44 | bool vncPasswordSet = false; 45 | bool gutenbergSyncDone = false; 46 | bool gutenbergSyncStatus = false; 47 | bool noGutenbergSyncToDo = false; 48 | bool searchTimerDone = false; 49 | QString vncServerAddress; 50 | QString vncServerPassword; 51 | QString vncServerPort; 52 | QString wifiEssid; 53 | QString wifiPassphrase; 54 | void setupKeyboardDialog(); 55 | void startVNC(QString server, QString password, QString port); 56 | float yIncrease; 57 | 58 | public slots: 59 | void increaseSize(); 60 | 61 | private slots: 62 | void on_cancelBtn_clicked(); 63 | void on_okBtn_clicked(); 64 | void on_acceptBtn_clicked(); 65 | void adjust_size(); 66 | void restartSearchDialog(); 67 | void refreshScreenNative(); 68 | void startOtaUpdate(bool wasDownloadSuccessful); 69 | void openBookFileNative(QString book, bool relativePath); 70 | void showToastNative(QString messageToDisplay); 71 | void closeIndefiniteToastNative(); 72 | void quit_restart(); 73 | void syncGutenbergCatalog(); 74 | void waitForGutenbergSearchDone(); 75 | 76 | private: 77 | Ui::generalDialog *ui; 78 | usbmsSplash *usbmsWindow; 79 | textwidget *textwidgetWindow; 80 | virtualkeyboard *keyboardWidget; 81 | virtualkeypad *keypadWidget; 82 | dictionaryWidget *dictionaryWidgetWindow; 83 | otaManager *otaManagerWindow; 84 | searchResultsWidget * searchResultsWidgetWindow; 85 | 86 | signals: 87 | void gotoPageSelected(int value); 88 | void refreshScreen(); 89 | void updateWifiIcon(int mode); 90 | void showToast(QString messageToDisplay); 91 | void closeIndefiniteToast(); 92 | void openBookFile(QString book, bool relativePath); 93 | void cancelDisableStorageEncryption(); 94 | void disableStorageEncryption(); 95 | void syncOnlineLibrary(); 96 | void noSyncOnlineLibrary(); 97 | void telemetryMessage(QString message); 98 | }; 99 | 100 | #endif // GENERALDIALOG_H 101 | -------------------------------------------------------------------------------- /src/widgets/dialogs/kobox/koboxappsdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef KOBOXAPPSDIALOG_H 2 | #define KOBOXAPPSDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | #include "usbmsSplash.h" 8 | 9 | namespace Ui { 10 | class koboxAppsDialog; 11 | } 12 | 13 | class koboxAppsDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | QString className = this->metaObject()->className(); 19 | explicit koboxAppsDialog(QWidget *parent = nullptr); 20 | ~koboxAppsDialog(); 21 | 22 | void checkApps(); 23 | 24 | QString apps; 25 | QString itemText; 26 | QString dpiSetting; 27 | QString dpModeSetting; 28 | QModelIndex index; 29 | 30 | private slots: 31 | void on_cancelBtn_clicked(); 32 | void on_launchBtn_clicked(); 33 | 34 | signals: 35 | void showToast(QString messageToDisplay); 36 | 37 | private: 38 | Ui::koboxAppsDialog *ui; 39 | usbmsSplash *usbmsSplashWindow; 40 | }; 41 | 42 | #endif // KOBOXAPPSDIALOG_H 43 | -------------------------------------------------------------------------------- /src/widgets/dialogs/kobox/koboxappsdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | koboxAppsDialog 4 | 5 | 6 | Qt::NonModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 468 13 | 361 14 | 15 | 16 | 17 | Form 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | 28 | 29 | 30 | 31 | Inter 32 | 75 33 | true 34 | 35 | 36 | 37 | Back 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Inter 46 | 75 47 | true 48 | 49 | 50 | 51 | Launch 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Inter 65 | 75 66 | true 67 | 68 | 69 | 70 | KoBox apps launcher 71 | 72 | 73 | Qt::AlignCenter 74 | 75 | 76 | 77 | 78 | 79 | 80 | Please select an application and click on 'Launch' to start it. 81 | 82 | 83 | Qt::AutoText 84 | 85 | 86 | Qt::AlignCenter 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/widgets/dialogs/library/bookinfodialog.h: -------------------------------------------------------------------------------- 1 | #ifndef BOOKINFODIALOG_H 2 | #define BOOKINFODIALOG_H 3 | 4 | #include 5 | 6 | #include "textwidget.h" 7 | 8 | namespace Ui { 9 | class bookInfoDialog; 10 | } 11 | 12 | class bookInfoDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit bookInfoDialog(QWidget *parent = nullptr); 19 | ~bookInfoDialog(); 20 | float sH; 21 | float sW; 22 | float stdIconHeight; 23 | float stdIconWidth; 24 | 25 | private slots: 26 | void on_closeBtn_clicked(); 27 | void on_getBtn_clicked(); 28 | void waitForBookFetch(); 29 | 30 | signals: 31 | void showToast(QString messageToDisplay); 32 | void closeIndefiniteToast(); 33 | 34 | private: 35 | Ui::bookInfoDialog * ui; 36 | textwidget * textwidgetWindow; 37 | }; 38 | 39 | #endif // BOOKINFODIALOG_H 40 | -------------------------------------------------------------------------------- /src/widgets/dialogs/library/bookoptionsdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef BOOKOPTIONSDIALOG_H 2 | #define BOOKOPTIONSDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class bookOptionsDialog; 9 | } 10 | 11 | class bookOptionsDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | QString className = this->metaObject()->className(); 17 | explicit bookOptionsDialog(QWidget *parent = nullptr); 18 | ~bookOptionsDialog(); 19 | QString bookPath; 20 | QString bookChecksum; 21 | bool bookPinned; 22 | bool isFolder; 23 | 24 | private slots: 25 | void on_pinBtn_clicked(); 26 | void on_deleteBtn_clicked(); 27 | void on_infoBtn_clicked(); 28 | void on_wipeLocalReadingSettingsBtn_clicked(); 29 | void pinBook(int bookID); 30 | void unpinBook(int bookID); 31 | void deleteBook(); 32 | void deleteFolder(); 33 | bool isBookPinned(int bookID); 34 | 35 | signals: 36 | void openLocalBookInfoDialog(); 37 | void showToast(QString messageToDisplay); 38 | void removedFolder(); 39 | 40 | private: 41 | Ui::bookOptionsDialog *ui; 42 | }; 43 | 44 | #endif // BOOKOPTIONSDIALOG_H 45 | -------------------------------------------------------------------------------- /src/widgets/dialogs/library/bookoptionsdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | bookOptionsDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 18 19 | 20 | 21 | 22 22 | 23 | 24 | 18 25 | 26 | 27 | 22 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 75 36 | true 37 | 38 | 39 | 40 | padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; 41 | 42 | 43 | Delete 44 | 45 | 46 | 47 | 48 | 49 | 50 | QFrame::Plain 51 | 52 | 53 | 4 54 | 55 | 56 | Qt::Horizontal 57 | 58 | 59 | 60 | 61 | 62 | 63 | QFrame::Plain 64 | 65 | 66 | 4 67 | 68 | 69 | Qt::Horizontal 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 75 78 | true 79 | 80 | 81 | 82 | padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; 83 | 84 | 85 | More info 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 75 94 | true 95 | 96 | 97 | 98 | padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; 99 | 100 | 101 | Pin 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 75 110 | true 111 | 112 | 113 | 114 | padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; 115 | 116 | 117 | Wipe reading settings 118 | 119 | 120 | 121 | 122 | 123 | 124 | QFrame::Plain 125 | 126 | 127 | 4 128 | 129 | 130 | Qt::Horizontal 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /src/widgets/dialogs/powerDaemon/sleepdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "sleepdialog.h" 2 | #include "ui_sleepdialog.h" 3 | 4 | #include "functions.h" 5 | 6 | sleepDialog::sleepDialog(QDialog *parent) : 7 | QDialog(parent), 8 | ui(new Ui::sleepDialog) 9 | { 10 | ui->setupUi(this); 11 | 12 | // Stylesheet 13 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 14 | stylesheetFile.open(QFile::ReadOnly); 15 | this->setStyleSheet(stylesheetFile.readAll()); 16 | stylesheetFile.close(); 17 | } 18 | 19 | sleepDialog::~sleepDialog() 20 | { 21 | delete ui; 22 | } 23 | 24 | void sleepDialog::launchSleepDialog() 25 | { 26 | log("Launching sleep dialog", className); 27 | this->exec(); 28 | } 29 | 30 | void sleepDialog::hideSleepDialog() 31 | { 32 | log("Hiding sleep dialog", className); 33 | this->hide(); 34 | } 35 | -------------------------------------------------------------------------------- /src/widgets/dialogs/powerDaemon/sleepdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SLEEPDIALOG_H 2 | #define SLEEPDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class sleepDialog; 8 | } 9 | 10 | class sleepDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit sleepDialog(QDialog *parent = nullptr); 17 | ~sleepDialog(); 18 | 19 | public slots: 20 | void launchSleepDialog(); 21 | void hideSleepDialog(); 22 | 23 | 24 | private: 25 | Ui::sleepDialog * ui; 26 | }; 27 | 28 | #endif // SLEEPDIALOG_H 29 | -------------------------------------------------------------------------------- /src/widgets/dialogs/powerDaemon/sleepdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | sleepDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 220 10 | 64 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 0 34 | 35 | 36 | 37 | 38 | 75 39 | true 40 | 41 | 42 | 43 | 0 44 | 45 | 46 | Sleeping 47 | 48 | 49 | Qt::AlignCenter 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/highlightslistdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "highlightslistdialog.h" 2 | #include "ui_highlightslistdialog.h" 3 | 4 | #include 5 | 6 | highlightsListDialog::highlightsListDialog(QWidget *parent) : 7 | QDialog(parent), 8 | ui(new Ui::highlightsListDialog) 9 | { 10 | // Preventing outside interaction 11 | this->setModal(true); 12 | 13 | ui->setupUi(this); 14 | ui->listWidget->setFont(QFont("u001")); 15 | 16 | ui->okBtn->setProperty("type", "borderless"); 17 | ui->cancelBtn->setProperty("type", "borderless"); 18 | ui->selectAllBtn->setProperty("type", "borderless"); 19 | ui->okBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey"); 20 | ui->cancelBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey"); 21 | ui->selectAllBtn->setStyleSheet("font-size: 9pt; padding: 10px"); 22 | ui->listWidget->setStyleSheet("font-size: 10pt"); 23 | ui->listWidget->setWordWrap(true); 24 | 25 | QJsonObject jsonObject = getHighlightsForBook(global::highlightsListDialog::bookPath); 26 | int keyCount = 1; 27 | 28 | foreach(const QString& key, jsonObject.keys()) { 29 | if(keyCount <= 1) { 30 | keyCount++; 31 | continue; 32 | } 33 | else { 34 | QListWidgetItem * item = new QListWidgetItem(); 35 | item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); 36 | item->setCheckState(Qt::Unchecked); 37 | item->setText(jsonObject.value(key).toString()); 38 | ui->listWidget->addItem(item); 39 | } 40 | } 41 | 42 | QTimer::singleShot(150, this, SLOT(increaseSize())); 43 | } 44 | 45 | highlightsListDialog::~highlightsListDialog() 46 | { 47 | delete ui; 48 | } 49 | 50 | void highlightsListDialog::increaseSize() 51 | { 52 | log("Resizing", className); 53 | 54 | ui->listWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 55 | 56 | QRect screenGeometry = QGuiApplication::screens()[0]->geometry(); 57 | { 58 | int wx = screenGeometry.width(); 59 | int x = wx - 25; 60 | int y = this->height() * determineYIncrease(); 61 | this->setFixedWidth(x); 62 | this->setFixedHeight(y); 63 | } 64 | { 65 | this->adjustSize(); 66 | int x = (screenGeometry.width() - this->width()) / 2; 67 | int y = (screenGeometry.height() - this->height()) / 2; 68 | this->move(x, y); 69 | } 70 | 71 | this->show(); 72 | } 73 | 74 | void highlightsListDialog::on_cancelBtn_clicked() 75 | { 76 | highlightsListDialog::close(); 77 | } 78 | 79 | void highlightsListDialog::on_okBtn_clicked() 80 | { 81 | int itemsCount = 0; 82 | int range = ui->listWidget->count(); 83 | for(int i = 0; i < range; i++) { 84 | if(ui->listWidget->item(i)->checkState() == Qt::Checked) { 85 | QString highlight = ui->listWidget->item(i)->text(); 86 | // The last argument indicates that we want to remove the specified highlight, not add it 87 | highlightBookText(highlight, global::highlightsListDialog::bookPath, true); 88 | itemsCount++; 89 | } 90 | } 91 | 92 | global::toast::delay = 3000; 93 | if(itemsCount >= 1) { 94 | if(itemsCount >= 2) { 95 | emit showToast("Items deleted successfully"); 96 | } 97 | else { 98 | emit showToast("Item deleted successfully"); 99 | } 100 | highlightsListDialog::close(); 101 | } 102 | else { 103 | emit showToast("Please select items to delete"); 104 | } 105 | } 106 | 107 | void highlightsListDialog::on_selectAllBtn_clicked() 108 | { 109 | int range = ui->listWidget->count(); 110 | for(int i = 0; i < range; i++) { 111 | ui->listWidget->item(i)->setCheckState(Qt::Checked); 112 | } 113 | } 114 | 115 | void highlightsListDialog::on_listWidget_itemClicked(QListWidgetItem *item) 116 | { 117 | if(item->checkState() == Qt::Unchecked) { 118 | item->setCheckState(Qt::Checked); 119 | } 120 | else { 121 | item->setCheckState(Qt::Unchecked); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/highlightslistdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef HIGHLIGHTSLISTDIALOG_H 2 | #define HIGHLIGHTSLISTDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | #include "functions.h" 8 | 9 | namespace Ui { 10 | class highlightsListDialog; 11 | } 12 | 13 | class highlightsListDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | QString className = this->metaObject()->className(); 19 | explicit highlightsListDialog(QWidget *parent = nullptr); 20 | ~highlightsListDialog(); 21 | 22 | private slots: 23 | void increaseSize(); 24 | void on_cancelBtn_clicked(); 25 | void on_okBtn_clicked(); 26 | void on_selectAllBtn_clicked(); 27 | void on_listWidget_itemClicked(QListWidgetItem *item); 28 | 29 | signals: 30 | void showToast(QString messageToDisplay); 31 | 32 | private: 33 | Ui::highlightsListDialog *ui; 34 | }; 35 | 36 | #endif // HIGHLIGHTSLISTDIALOG_H 37 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/highlightslistdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | highlightsListDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | 27 | 50 28 | false 29 | 30 | 31 | 32 | <font face="Inter"><b>Highlights list</b></font><font face="u001"><br>Select items to delete</br></font> 33 | 34 | 35 | Qt::AlignCenter 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | U001 49 | 50 | 51 | 52 | Select all 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | QFrame::Plain 62 | 63 | 64 | Qt::Horizontal 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 75 | true 76 | 77 | 78 | 79 | OK 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 75 88 | true 89 | 90 | 91 | 92 | Close 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/textdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "textdialog.h" 2 | #include "ui_textdialog.h" 3 | 4 | textDialog::textDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::textDialog) 7 | { 8 | ui->setupUi(this); 9 | ui->highlightBtn->setProperty("type", "borderless"); 10 | if(global::reader::highlightAlreadyDone == true) { 11 | global::reader::highlightAlreadyDone = false; 12 | highlightAlreadyDone = true; 13 | ui->highlightBtn->setIcon(QIcon(":/resources/unhighlight.png")); 14 | } 15 | else { 16 | highlightAlreadyDone = false; 17 | ui->highlightBtn->setIcon(QIcon(":/resources/highlight.png")); 18 | } 19 | this->adjustSize(); 20 | } 21 | 22 | textDialog::~textDialog() 23 | { 24 | delete ui; 25 | } 26 | 27 | void textDialog::on_highlightBtn_clicked() 28 | { 29 | if(highlightAlreadyDone == true) { 30 | emit unhighlightText(); 31 | } 32 | else { 33 | emit highlightText(); 34 | } 35 | textDialog::close(); 36 | } 37 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/textdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTDIALOG_H 2 | #define TEXTDIALOG_H 3 | 4 | #include 5 | 6 | #include "functions.h" 7 | 8 | namespace Ui { 9 | class textDialog; 10 | } 11 | 12 | class textDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit textDialog(QWidget *parent = nullptr); 19 | ~textDialog(); 20 | bool highlightAlreadyDone = false; 21 | 22 | signals: 23 | void highlightText(); 24 | void unhighlightText(); 25 | 26 | private slots: 27 | void on_highlightBtn_clicked(); 28 | 29 | private: 30 | Ui::textDialog *ui; 31 | }; 32 | 33 | #endif // TEXTDIALOG_H 34 | -------------------------------------------------------------------------------- /src/widgets/dialogs/reader/textdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | textDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 83 10 | 61 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Dialog 21 | 22 | 23 | 24 | 10 25 | 26 | 27 | 10 28 | 29 | 30 | 10 31 | 32 | 33 | 10 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 75 42 | true 43 | 44 | 45 | 46 | padding: 10px 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/connectiondialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTIONDIALOG_H 2 | #define CONNECTIONDIALOG_H 3 | 4 | #include 5 | #include "functions.h" 6 | 7 | namespace Ui { 8 | class connectiondialog; 9 | } 10 | 11 | class connectiondialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | QString className = this->metaObject()->className(); 17 | explicit connectiondialog(QWidget *parent = nullptr); 18 | ~connectiondialog(); 19 | global::wifi::wifiNetworkData connectedNetworkData; 20 | QString currentlyConnectedNetworkName; 21 | QFile passphraseDatabase = QFile("/mnt/onboard/.adds/inkbox/.config/17-wifi_connection_information/passphrases.json"); 22 | 23 | signals: 24 | void showToastSignal(QString message); 25 | void refreshScreenSignal(); 26 | 27 | public slots: 28 | void applyVariables(); 29 | void showToastSlot(QString message); 30 | void refreshScreenSlot(); 31 | 32 | private slots: 33 | // We are opening/loading the JSON database many times, it might not be efficient, but: 34 | // 1. It's modular 35 | // 2. Those operations are rare 36 | QString searchDatabase(QString key); 37 | void writeToDatabase(QString name, QString passphrase); 38 | void removeFromDatabase(QString name); 39 | 40 | void finalConnectWait(); 41 | bool checkIfWifiBusy(); 42 | 43 | void on_cancelBtn_clicked(); 44 | void on_passphraseTextEdit_selectionChanged(); 45 | void on_passphraseTextEdit_cursorPositionChanged(int arg1, int arg2); 46 | void on_showPassphraseBtn_clicked(); 47 | void on_connectBtn_clicked(); 48 | 49 | private: 50 | Ui::connectiondialog *ui; 51 | bool cursorPositionIgnore = false; 52 | bool showedPassphrase; 53 | QString savedPassphrase; 54 | int waitTry = 0; 55 | QString passphraseForReconnecting; 56 | }; 57 | 58 | #endif // CONNECTIONDIALOG_H 59 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/network.cpp: -------------------------------------------------------------------------------- 1 | #include "network.h" 2 | #include "ui_network.h" 3 | #include "connectiondialog.h" 4 | 5 | #include 6 | 7 | network::network(QWidget *parent) : 8 | QWidget(parent), 9 | ui(new Ui::network) 10 | { 11 | ui->setupUi(this); 12 | this->setFont(QFont("u001")); 13 | 14 | // Stylesheet, style & misc. 15 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 16 | stylesheetFile.open(QFile::ReadOnly); 17 | this->setStyleSheet(stylesheetFile.readAll()); 18 | stylesheetFile.close(); 19 | 20 | // Buttons 21 | ui->encryptionIcon->setProperty("type", "borderless"); 22 | ui->encryptionIcon->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }"); 23 | ui->signalStrengthIcon->setProperty("type", "borderless"); 24 | ui->signalStrengthIcon->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }"); 25 | ui->enterButton->setProperty("type", "borderless"); 26 | } 27 | 28 | network::~network() 29 | { 30 | delete ui; 31 | } 32 | 33 | void network::applyVariables() { 34 | log("Applying variables for network", className); 35 | 36 | QString percent = "%"; 37 | if(mainData.signal < 100) { 38 | percent.append(" "); 39 | } 40 | ui->signalStrengthLabel->setText(QString::number(mainData.signal) + percent); 41 | 42 | // Limit name size 43 | int truncateThreshold; 44 | if(global::deviceID == "n705\n") { 45 | truncateThreshold = 12; 46 | } 47 | else { 48 | truncateThreshold = 20; 49 | } 50 | int nameLength = mainData.name.length(); 51 | QString name = mainData.name; 52 | if(nameLength > truncateThreshold) { 53 | name.chop(nameLength - truncateThreshold); 54 | name.append("..."); 55 | } 56 | ui->nameLabel->setText(name); 57 | 58 | if(mainData.encryption == true) { 59 | ui->encryptionIcon->setIcon(QIcon(":/resources/lock.png")); 60 | } 61 | else { 62 | ui->encryptionIcon->setIcon(QIcon(":/resources/public.png")); 63 | } 64 | 65 | if(currentlyConnectedNetwork == mainData.name) { 66 | ui->frame->setStyleSheet(".QFrame{background-color: lightGray; border: 2px solid black; border-radius: 10px;}"); 67 | ui->signalStrengthLabel->setStyleSheet("background-color: lightGray;"); 68 | ui->nameLabel->setStyleSheet("background-color: lightGray;"); 69 | ui->encryptionIcon->setStyleSheet("background-color: lightGray;"); 70 | ui->enterButton->setStyleSheet("background-color: lightGray;"); 71 | 72 | ui->signalStrengthIcon->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }"); 73 | ui->encryptionIcon->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }"); 74 | ui->enterButton->setStyleSheet("QPushButton {background-color: lightGray; border: none}; QPushButton[type='borderless']:pressed { background: lightGray; color: lightGray; border: none; }"); 75 | } 76 | else { 77 | ui->frame->setStyleSheet(".QFrame{background-color: white; border: 2px solid black; border-radius: 10px;}"); 78 | } 79 | 80 | if(mainData.signal >= 0 and mainData.signal <= 25) { 81 | ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-0.png")); 82 | } 83 | else if(mainData.signal >= 25 and mainData.signal < 50) { 84 | ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-25.png")); 85 | } 86 | else if(mainData.signal >= 50 and mainData.signal < 75) { 87 | ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-50.png")); 88 | } 89 | else if(mainData.signal >= 75 and mainData.signal < 100) { 90 | ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-75.png")); 91 | } 92 | else if(mainData.signal == 100) { 93 | ui->signalStrengthIcon->setIcon(QIcon(":/resources/wifi-100.png")); 94 | } 95 | } 96 | 97 | void network::on_enterButton_clicked() 98 | { 99 | connectiondialog* newConnectionDialog = new connectiondialog; 100 | newConnectionDialog->connectedNetworkData = mainData; 101 | newConnectionDialog->currentlyConnectedNetworkName = currentlyConnectedNetwork; 102 | newConnectionDialog->applyVariables(); 103 | connect(newConnectionDialog, &connectiondialog::showToastSignal, this, &network::showToastSlot); 104 | connect(newConnectionDialog, &connectiondialog::refreshScreenSignal, this, &network::refreshScreenSlot); 105 | newConnectionDialog->exec(); 106 | } 107 | 108 | void network::closeWrapper() { 109 | this->deleteLater(); 110 | this->close(); 111 | } 112 | 113 | void network::showToastSlot(QString message) { 114 | emit showToastSignal(message); 115 | } 116 | 117 | void network::refreshScreenSlot() { 118 | emit refreshScreenSignal(); 119 | } 120 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/network.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_H 2 | #define NETWORK_H 3 | 4 | #include 5 | 6 | #include "functions.h" 7 | 8 | namespace Ui { 9 | class network; 10 | } 11 | 12 | class network : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit network(QWidget *parent = nullptr); 19 | ~network(); 20 | global::wifi::wifiNetworkData mainData; 21 | QString currentlyConnectedNetwork; 22 | 23 | signals: 24 | void showToastSignal(QString message); 25 | void refreshScreenSignal(); 26 | 27 | public slots: 28 | void applyVariables(); 29 | void closeWrapper(); 30 | void showToastSlot(QString message); 31 | void refreshScreenSlot(); 32 | 33 | private slots: 34 | void on_enterButton_clicked(); 35 | 36 | private: 37 | Ui::network *ui; 38 | }; 39 | 40 | #endif // NETWORK_H 41 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/network.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | network 4 | 5 | 6 | 7 | 0 8 | 0 9 | 605 10 | 62 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 4 28 | 29 | 30 | 0 31 | 32 | 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | QFrame::StyledPanel 45 | 46 | 47 | QFrame::Plain 48 | 49 | 50 | 1 51 | 52 | 53 | 54 | 16 55 | 56 | 57 | 10 58 | 59 | 60 | 3 61 | 62 | 63 | 10 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | U001 77 | 78 | 79 | 80 | Signal strength 81 | 82 | 83 | 84 | 85 | 86 | 87 | QFrame::Plain 88 | 89 | 90 | 1 91 | 92 | 93 | Qt::Vertical 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | U001 102 | 103 | 104 | 105 | Wi-Fi network name 106 | 107 | 108 | 109 | 110 | 111 | 112 | Qt::Horizontal 113 | 114 | 115 | 116 | 40 117 | 20 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | :/resources/chevron-right.png:/resources/chevron-right.png 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/wifidialog.h: -------------------------------------------------------------------------------- 1 | #ifndef WIFIDIALOG_H 2 | #define WIFIDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | #include "generaldialog.h" 8 | #include "wifilogger.h" 9 | 10 | namespace Ui { 11 | class wifiDialog; 12 | } 13 | 14 | class wifiDialog : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | QString className = this->metaObject()->className(); 20 | explicit wifiDialog(QWidget *parent = nullptr); 21 | ~wifiDialog(); 22 | global::wifi::wifiNetworkData connectedNetworkDataParent; 23 | bool connectedNetworkDataParentSet = false; 24 | 25 | private: 26 | Ui::wifiDialog *ui; 27 | bool wifiButtonEnabled = false; 28 | bool scannedAtLeastOnce = false; 29 | 30 | // Variables for refreshWait() and network refresh in general 31 | int elapsedSeconds = 0; 32 | QFile fullList = QFile("/external_root/run/wifi_list_full"); 33 | QFile formattedList = QFile("/external_root/run/wifi_list_format"); 34 | 35 | // Used by watcher 36 | bool forceRefresh = false; 37 | int relaunchMs = 300; 38 | bool refreshFromWatcher = false; 39 | bool unlockCheckBox = false; 40 | bool scanInProgress = false; 41 | 42 | bool isToggleRunning = false; 43 | bool ignoreCheckBoxCall = false; 44 | 45 | bool secondScanTry = false; 46 | 47 | public slots: 48 | void launchRefresh(); 49 | void refreshNetworksList(); 50 | void showToastSlot(QString message); 51 | void refreshScreenSlot(); 52 | 53 | // Shows status of Wi-Fi processes, like reconnection and others. Also manages refreshing the networks list after connection 54 | void watcher(); 55 | 56 | signals: 57 | void refreshScreen(); 58 | void updateWifiIconSig(int mode); 59 | void showToast(QString messageToDisplay); 60 | void killNetworkWidgets(); 61 | 62 | private slots: 63 | void on_refreshBtn_clicked(); 64 | void on_wifiCheckBox_stateChanged(int arg1); 65 | void turnOnWifi(); 66 | void turnOffWifi(); 67 | void on_logBtn_clicked(); 68 | 69 | // This function is a more clever sleep(1), non-blocking 70 | void refreshWait(); 71 | 72 | void setStatusText(QString message); 73 | void on_stopBtn_clicked(); 74 | void on_returnBtn_clicked(); 75 | void waitToScan(); 76 | }; 77 | 78 | #endif // WIFIDIALOG_H 79 | -------------------------------------------------------------------------------- /src/widgets/dialogs/wifi/wifilogger.h: -------------------------------------------------------------------------------- 1 | #ifndef WIFILOGGER_H 2 | #define WIFILOGGER_H 3 | 4 | #include 5 | #include "functions.h" 6 | 7 | namespace Ui { 8 | class wifilogger; 9 | } 10 | 11 | class wifilogger : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | QString className = this->metaObject()->className(); 17 | explicit wifilogger(QWidget *parent = nullptr); 18 | ~wifilogger(); 19 | global::wifi::wifiNetworkData connectedNetworkData; 20 | // To the above value 21 | bool isThereData = false; 22 | 23 | private: 24 | Ui::wifilogger *ui; 25 | /* 26 | * 0 Is Wi-Fi info/no Wi-Fi info page 27 | * 1 Is fancy logs page 28 | * 2 Is all logs page 29 | */ 30 | int currentPage = 0; 31 | QFile fancyLogs = QFile("/external_root/run/wifi_stats"); 32 | QFile allLogs = QFile("/external_root/var/log/wifi.log"); 33 | bool waitingForFile = false; 34 | QTimer getWifiInformationTimer; 35 | 36 | private slots: 37 | void setWifiInfoPage(); 38 | void setFancyLoggingPage(); 39 | void setAllLogsPage(); 40 | void on_nextBtn_clicked(); 41 | void on_previousBtn_clicked(); 42 | void changePage(); 43 | void getWifiInformation(); 44 | void on_returnBtn_clicked(); 45 | void updateLogs(); 46 | void on_refreshBtn_clicked(); 47 | }; 48 | 49 | #endif // WIFILOGGER_H 50 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/qclickablelabel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "qclickablelabel.h" 5 | 6 | QClickableLabel::QClickableLabel(QWidget* parent, Qt::WindowFlags f) 7 | : QLabel(parent) {} 8 | 9 | QClickableLabel::~QClickableLabel() {} 10 | 11 | void QClickableLabel::mousePressEvent(QMouseEvent * event) { 12 | timeAtClick = QDateTime::currentMSecsSinceEpoch(); 13 | emit clicked(); 14 | if(objectName() == "pageNumberLabel") { 15 | QClickableLabel::setStyleSheet("border-radius: 10px; padding-left: 10px; padding-right: 10px"); 16 | } 17 | else { 18 | QClickableLabel::setStyleSheet("color: white; background-color: black; border-radius: 10px; padding: 10px"); 19 | } 20 | } 21 | 22 | void QClickableLabel::mouseReleaseEvent(QMouseEvent * event) { 23 | if(QDateTime::currentMSecsSinceEpoch() >= timeAtClick + 500) { 24 | if(objectName().toInt()) { 25 | emit longPressInt(objectName().toInt()); 26 | } 27 | else { 28 | emit longPressString(QJsonDocument::fromJson(qUncompress(QByteArray::fromBase64(objectName().toUtf8()))).object()["BookPath"].toString()); 29 | } 30 | } 31 | else { 32 | if(!objectName().toInt()) { 33 | this->setPixmap(QPixmap(":/resources/hourglass-top-rectangular.png").scaled(stdIconWidth, stdIconHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); 34 | } 35 | QTimer::singleShot(500, this, SLOT(unclickedSlot())); 36 | } 37 | if(objectName() == "pageNumberLabel") { 38 | QClickableLabel::setStyleSheet("border-radius: 10px; padding-left: 10px; padding-right: 10px"); 39 | } 40 | else { 41 | QClickableLabel::setStyleSheet("color: black; background-color: white; border-radius: 10px; padding: 10px"); 42 | } 43 | } 44 | 45 | void QClickableLabel::unclickedSlot() { 46 | emit unclicked(); 47 | emit bookID(objectName().toInt()); 48 | emit bookPath(QJsonDocument::fromJson(qUncompress(QByteArray::fromBase64(objectName().toUtf8()))).object()["BookPath"].toString()); 49 | } 50 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/qclickablelabel.h: -------------------------------------------------------------------------------- 1 | #ifndef QCLICKABLELABEL_H 2 | #define QCLICKABLELABEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QClickableLabel : public QLabel { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit QClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); 13 | ~QClickableLabel(); 14 | long long timeAtClick; 15 | int stdIconWidth; 16 | int stdIconHeight; 17 | 18 | signals: 19 | void clicked(); 20 | void unclicked(); 21 | void bookID(int id); 22 | void bookPath(QString path); 23 | void longPressInt(int id); 24 | void longPressString(QString bookPath); 25 | 26 | private slots: 27 | void unclickedSlot(); 28 | 29 | protected: 30 | void mousePressEvent(QMouseEvent * event); 31 | void mouseReleaseEvent(QMouseEvent * event); 32 | 33 | }; 34 | 35 | #endif // CLICKABLELABEL_H 36 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/qtooltiplabel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "qtooltiplabel.h" 5 | 6 | QToolTipLabel::QToolTipLabel(QWidget* parent, Qt::WindowFlags f) 7 | : QLabel(parent) { 8 | this->setStyleSheet("QToolTip { font-size: 40pt }"); 9 | } 10 | 11 | QToolTipLabel::~QToolTipLabel() {} 12 | 13 | void QToolTipLabel::mousePressEvent(QMouseEvent * event) { 14 | if(QToolTipLabel::property("showToolTip").toString() == "true") { 15 | QToolTip::showText(mapToGlobal(QPoint(0, 0)), "" + objectName() + ""); 16 | } 17 | } 18 | 19 | void QToolTipLabel::mouseReleaseEvent(QMouseEvent * event) { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/qtooltiplabel.h: -------------------------------------------------------------------------------- 1 | #ifndef QTOOLTIPLABEL_H 2 | #define QTOOLTIPLABEL_H 3 | 4 | #include 5 | #include 6 | 7 | class QToolTipLabel : public QLabel { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit QToolTipLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); 12 | ~QToolTipLabel(); 13 | 14 | protected: 15 | void mousePressEvent(QMouseEvent * event); 16 | void mouseReleaseEvent(QMouseEvent * event); 17 | 18 | }; 19 | 20 | #endif // QTOOLTIPLABEL_H 21 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/toast.cpp: -------------------------------------------------------------------------------- 1 | #include "toast.h" 2 | #include "ui_toast.h" 3 | #include "functions.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | toast::toast(QWidget *parent) : 10 | QDialog(parent), 11 | ui(new Ui::toast) 12 | { 13 | ui->setupUi(this); 14 | log("Displaying message '" + global::toast::message + "'", className); 15 | 16 | if(global::toast::modalToast == true) { 17 | global::toast::modalToast = false; 18 | this->setModal(true); 19 | } 20 | 21 | ui->messageLabel->setStyleSheet("padding: 35px"); 22 | ui->messageLabel->setText(global::toast::message); 23 | this->adjustSize(); 24 | centerToast(); 25 | if(global::toast::indefiniteToast == false) { 26 | if(global::toast::delay == 0) { 27 | global::toast::delay = 5000; 28 | } 29 | } 30 | if(global::toast::indefiniteToast == false) { 31 | QTimer::singleShot(global::toast::delay, this, SLOT(close())); 32 | global::toast::delay = 0; 33 | } 34 | else { 35 | global::toast::indefiniteToast = false; 36 | } 37 | } 38 | 39 | toast::~toast() 40 | { 41 | delete ui; 42 | } 43 | 44 | void toast::centerToast() { 45 | // Centering toast (https://stackoverflow.com/a/58682351) 46 | // Get current screen size 47 | QRect rec = QGuiApplication::screenAt(this->pos())->geometry(); 48 | // Using minimum size of window 49 | QSize size = this->minimumSize(); 50 | // Set top left point 51 | QPoint topLeft = QPoint((rec.width() / 2) - (size.width() / 2), (rec.height() / 2) - (size.height() / 2)); 52 | // Set window position 53 | setGeometry(QRect(topLeft, size)); 54 | } 55 | 56 | void toast::exitSlot(int exitCode) { 57 | if(exitCode == 0) { 58 | toast::close(); 59 | } 60 | else { 61 | emit showToast("No networks found"); 62 | } 63 | } 64 | 65 | void toast::refreshScreenNative() { 66 | emit refreshScreen(); 67 | } 68 | 69 | void toast::showToastNative(QString messageToDisplay) { 70 | emit showToast(messageToDisplay); 71 | } 72 | 73 | void toast::closeIndefiniteToastNative() { 74 | emit closeIndefiniteToast(); 75 | } 76 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/toast.h: -------------------------------------------------------------------------------- 1 | #ifndef TOAST_H 2 | #define TOAST_H 3 | 4 | #include 5 | 6 | #include "wifidialog.h" 7 | 8 | namespace Ui { 9 | class toast; 10 | } 11 | 12 | class toast : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit toast(QWidget *parent = nullptr); 19 | ~toast(); 20 | void centerToast(); 21 | 22 | private: 23 | Ui::toast *ui; 24 | 25 | private slots: 26 | void exitSlot(int exitCode); 27 | void refreshScreenNative(); 28 | void showToastNative(QString messageToDisplay); 29 | void closeIndefiniteToastNative(); 30 | 31 | signals: 32 | void updateWifiIconSig(int mode); 33 | void refreshScreen(); 34 | void showToast(QString messageToDisplay); 35 | void closeIndefiniteToast(); 36 | }; 37 | 38 | #endif // TOAST_H 39 | -------------------------------------------------------------------------------- /src/widgets/interfaceWidgets/toast.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | toast 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 63 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 6 19 | 20 | 21 | 6 22 | 23 | 24 | 6 25 | 26 | 27 | 6 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 75 36 | true 37 | 38 | 39 | 40 | Message 41 | 42 | 43 | Qt::AlignCenter 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/widgets/misc/egg.cpp: -------------------------------------------------------------------------------- 1 | #include "egg.h" 2 | #include "ui_egg.h" 3 | 4 | egg::egg(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::egg) 7 | { 8 | ui->setupUi(this); 9 | this->setStyleSheet(readFile("/mnt/onboard/.adds/inkbox/eink.qss")); 10 | ui->previousBtn->setProperty("type", "borderless"); 11 | ui->nextBtn->setProperty("type", "borderless"); 12 | ui->quitBtn->setProperty("type", "borderless"); 13 | ui->infoBtn->setProperty("type", "borderless"); 14 | ui->previousBtn->setText(""); 15 | ui->previousBtn->setIcon(QIcon(":/resources/arrow-left.png")); 16 | ui->nextBtn->setText(""); 17 | ui->nextBtn->setIcon(QIcon(":/resources/arrow-right.png")); 18 | ui->quitBtn->setText(""); 19 | ui->quitBtn->setIcon(QIcon(":/resources/close.png")); 20 | ui->infoBtn->setText(""); 21 | ui->infoBtn->setIcon(QIcon(":/resources/info.png")); 22 | ui->titleLabel->setFont(QFont("Inter")); 23 | ui->contributorName->setFont(QFont("Inter")); 24 | if(global::deviceID == "n873\n") { 25 | ui->nextBtn->setStyleSheet("padding: 13.5px"); 26 | ui->previousBtn->setStyleSheet("padding: 13.5px"); 27 | } 28 | else if(global::deviceID == "n437\n" or global::deviceID == "n249\n") { 29 | ui->nextBtn->setStyleSheet("padding: 12.5px"); 30 | ui->previousBtn->setStyleSheet("padding: 12.5px"); 31 | } 32 | else { 33 | ui->nextBtn->setStyleSheet("padding: 10px"); 34 | ui->previousBtn->setStyleSheet("padding: 10px"); 35 | } 36 | 37 | graphicsScene = new QGraphicsScene(this); 38 | // Set first contributor name 39 | ui->contributorName->setText("
Szybet
(Contributor)
"); 40 | QTimer::singleShot(500, this, SLOT(changeIndexSlot())); 41 | } 42 | 43 | egg::~egg() 44 | { 45 | delete ui; 46 | } 47 | 48 | void egg::changeIndex(int index) { 49 | /* 50 | Contributors list: 51 | Szybet (0) 52 | Maintainer: 53 | tux-linux (1) 54 | */ 55 | 56 | // Contributor name 57 | QString name = "
"; 58 | if(index == 0) { 59 | name.append("Szybet
(Contributor)"); 60 | } 61 | else if(index == 1) { 62 | name.append("tux-linux
(Maintainer)"); 63 | } 64 | name.append("
"); 65 | ui->contributorName->setText(name); 66 | 67 | ui->graphicsView->items().clear(); 68 | graphicsScene->clear(); 69 | 70 | QPixmap pixmap(":/resources/egg/" + QString::number(index) + ".jpg"); 71 | graphicsScene->addPixmap(pixmap); 72 | ui->graphicsView->setScene(graphicsScene); 73 | // Shrinking scene if item is smaller than previous one 74 | QRectF rect = graphicsScene->itemsBoundingRect(); 75 | graphicsScene->setSceneRect(rect); 76 | ui->graphicsView->fitInView(graphicsScene->sceneRect(), Qt::KeepAspectRatio); 77 | } 78 | 79 | void egg::changeIndexSlot() { 80 | changeIndex(index); 81 | } 82 | 83 | void egg::on_previousBtn_clicked() 84 | { 85 | if(index - 1 <= maximumIndex && index - 1 >= 0) { 86 | index--; 87 | changeIndex(index); 88 | } 89 | else { 90 | QMessageBox::critical(this, "Critical", "Index out of range."); 91 | } 92 | } 93 | 94 | void egg::on_nextBtn_clicked() 95 | { 96 | if(index + 1 <= maximumIndex && index + 1 >= 0) { 97 | index++; 98 | changeIndex(index); 99 | } 100 | else { 101 | QMessageBox::critical(this, "Critical", "Index out of range."); 102 | } 103 | } 104 | 105 | void egg::on_quitBtn_clicked() 106 | { 107 | this->close(); 108 | } 109 | 110 | void egg::on_infoBtn_clicked() 111 | { 112 | QMessageBox::information(this, "Information", "Congratulations, you've found the easter egg!"); 113 | } 114 | -------------------------------------------------------------------------------- /src/widgets/misc/egg.h: -------------------------------------------------------------------------------- 1 | #ifndef EGG_H 2 | #define EGG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "functions.h" 10 | 11 | namespace Ui { 12 | class egg; 13 | } 14 | 15 | class egg : public QDialog 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit egg(QWidget *parent = nullptr); 21 | ~egg(); 22 | int index = 0; 23 | const int maximumIndex = 1; 24 | bool firstRun = true; 25 | void changeIndex(int index); 26 | 27 | private slots: 28 | void on_previousBtn_clicked(); 29 | void on_nextBtn_clicked(); 30 | void changeIndexSlot(); 31 | void on_quitBtn_clicked(); 32 | void on_infoBtn_clicked(); 33 | 34 | private: 35 | Ui::egg *ui; 36 | QGraphicsScene * graphicsScene; 37 | }; 38 | 39 | #endif // EGG_H 40 | -------------------------------------------------------------------------------- /src/widgets/misc/hourglassanimationwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "hourglassanimationwidget.h" 2 | #include "ui_hourglassanimationwidget.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | hourglassAnimationWidget::hourglassAnimationWidget(QWidget *parent) : 10 | QWidget(parent), 11 | ui(new Ui::hourglassAnimationWidget) 12 | { 13 | ui->setupUi(this); 14 | 15 | // Getting the screen's size 16 | float sW = QGuiApplication::screens()[0]->size().width(); 17 | float sH = QGuiApplication::screens()[0]->size().height(); 18 | float stdIconWidth; 19 | float stdIconHeight; 20 | { 21 | stdIconWidth = sW / 2.5; 22 | stdIconHeight = sH / 2.5; 23 | QPixmap pixmap(":/resources/hourglass-top.png"); 24 | QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); 25 | ui->hourglassTopLabel->setPixmap(scaledPixmap); 26 | } 27 | { 28 | stdIconWidth = sW / 2.5; 29 | stdIconHeight = sH / 2.5; 30 | QPixmap pixmap(":/resources/hourglass-bottom.png"); 31 | QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); 32 | ui->hourglassBottomLabel->setPixmap(scaledPixmap); 33 | } 34 | 35 | i = 0; 36 | QTimer * t = new QTimer(); 37 | t->setInterval(500); 38 | connect(t, &QTimer::timeout, [&]() { 39 | ui->stackedWidget->setCurrentIndex(i); 40 | if(i == 0) { 41 | i = 1; 42 | } 43 | else { 44 | i = 0; 45 | } 46 | } ); 47 | t->start(); 48 | } 49 | 50 | hourglassAnimationWidget::~hourglassAnimationWidget() 51 | { 52 | delete ui; 53 | } 54 | -------------------------------------------------------------------------------- /src/widgets/misc/hourglassanimationwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef HOURGLASSANIMATIONWIDGET_H 2 | #define HOURGLASSANIMATIONWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class hourglassAnimationWidget; 8 | } 9 | 10 | class hourglassAnimationWidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit hourglassAnimationWidget(QWidget *parent = nullptr); 17 | ~hourglassAnimationWidget(); 18 | int i; 19 | 20 | private: 21 | Ui::hourglassAnimationWidget *ui; 22 | }; 23 | 24 | #endif // HOURGLASSANIMATIONWIDGET_H 25 | -------------------------------------------------------------------------------- /src/widgets/misc/hourglassanimationwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | hourglassAnimationWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 0 33 | 34 | 35 | 36 | 37 | 1 38 | 39 | 40 | 41 | 42 | 0 43 | 44 | 45 | 0 46 | 47 | 48 | 0 49 | 50 | 51 | 0 52 | 53 | 54 | 55 | 56 | 57 | 58 | Hourglass TOP 59 | 60 | 61 | Qt::AlignCenter 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 0 73 | 74 | 75 | 0 76 | 77 | 78 | 0 79 | 80 | 81 | 0 82 | 83 | 84 | 85 | 86 | 87 | 88 | Hourglass BOTTOM 89 | 90 | 91 | Qt::AlignCenter 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/widgets/reader/dictionarywidget.cpp: -------------------------------------------------------------------------------- 1 | #include "dictionarywidget.h" 2 | #include "ui_dictionarywidget.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | dictionaryWidget::dictionaryWidget(QWidget *parent) : 13 | QWidget(parent), 14 | ui(new Ui::dictionaryWidget) 15 | { 16 | ui->setupUi(this); 17 | ui->wordLabel->setStyleSheet("font-weight: bold"); 18 | ui->definitionStatusLabel->setFont(QFont("u001")); 19 | 20 | ui->backBtn->setProperty("type", "borderless"); 21 | ui->backBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px"); 22 | ui->nextDefinitionBtn->setProperty("type", "borderless"); 23 | ui->previousDefinitionBtn->setProperty("type", "borderless"); 24 | 25 | ui->nextDefinitionBtn->setText(""); 26 | ui->nextDefinitionBtn->setIcon(QIcon(":/resources/chevron-right.png")); 27 | ui->previousDefinitionBtn->setText(""); 28 | ui->previousDefinitionBtn->setIcon(QIcon(":/resources/chevron-left.png")); 29 | 30 | QStringList parts = global::keyboard::keyboardText.split(' ', QString::SkipEmptyParts); 31 | for (int i = 0; i < parts.size(); ++i) 32 | parts[i].replace(0, 1, parts[i][0].toUpper()); 33 | wordQstr = parts.join(" "); 34 | searchedWord = wordQstr.toStdString(); 35 | letter = global::keyboard::keyboardText.left(1); 36 | letter = letter.toUpper(); 37 | dictionaryPosition = 1; 38 | 39 | dictionaryLookup(searchedWord, letter, dictionaryPosition); 40 | 41 | definition.prepend("
"); 42 | definition.append("
"); 43 | ui->wordLabel->setText(wordQstr); 44 | ui->definitionLabel->setText(definition); 45 | ui->definitionStatusLabel->setText("1"); 46 | 47 | QTimer::singleShot(1000, this, SLOT(refreshScreenNative())); 48 | } 49 | 50 | dictionaryWidget::~dictionaryWidget() 51 | { 52 | delete ui; 53 | } 54 | 55 | void dictionaryWidget::on_backBtn_clicked() 56 | { 57 | dictionaryWidget::close(); 58 | } 59 | 60 | void dictionaryWidget::dictionaryLookup(std::string word, QString first_letter, int position) { 61 | log("Dictionary lookup requested for word '" + QString::fromStdString(word) + "', position " + QString::number(position), className); 62 | QDir dictdir; 63 | dictdir.mkpath("/inkbox/dictionary"); 64 | 65 | std::ofstream fhandler; 66 | fhandler.open("/inkbox/dictionary/word"); 67 | fhandler << word; 68 | fhandler.close(); 69 | 70 | QDir::setCurrent("dictionary"); 71 | QDir::setCurrent(first_letter); 72 | QString lookup_prog ("sh"); 73 | QStringList lookup_args; 74 | QString position_str = QString::number(position); 75 | lookup_args << "../scripts/lookup.sh" << position_str; 76 | QProcess *lookup_proc = new QProcess(); 77 | lookup_proc->start(lookup_prog, lookup_args); 78 | lookup_proc->waitForFinished(); 79 | lookup_proc->deleteLater(); 80 | 81 | QFile definition_file("/inkbox/dictionary/definition"); 82 | definition_file.open(QIODevice::ReadWrite); 83 | QTextStream in (&definition_file); 84 | definition = in.readAll(); 85 | definition = definition.remove(QRegExp("[\n]")); 86 | if(definition == "No definition found.") { 87 | nextdefinition_lock = true; 88 | } 89 | else { 90 | nextdefinition_lock = false; 91 | } 92 | definition_file.close(); 93 | 94 | setDefaultWorkDir(); 95 | } 96 | 97 | void dictionaryWidget::on_nextDefinitionBtn_clicked() 98 | { 99 | dictionaryPosition = dictionaryPosition + 1; 100 | dictionaryLookup(searchedWord, letter, dictionaryPosition); 101 | if(nextdefinition_lock == true) { 102 | dictionaryPosition = dictionaryPosition - 1; 103 | } 104 | else { 105 | ui->definitionLabel->setText(definition); 106 | QString dictionaryPositionQstr = QString::number(dictionaryPosition); 107 | ui->definitionStatusLabel->setText(dictionaryPositionQstr); 108 | } 109 | } 110 | 111 | void dictionaryWidget::on_previousDefinitionBtn_clicked() 112 | { 113 | dictionaryPosition = dictionaryPosition - 1; 114 | if(dictionaryPosition <= 0) { 115 | dictionaryPosition = 1; 116 | } 117 | else { 118 | dictionaryLookup(searchedWord, letter, dictionaryPosition); 119 | ui->definitionLabel->setText(definition); 120 | QString dictionaryPositionQstr = QString::number(dictionaryPosition); 121 | ui->definitionStatusLabel->setText(dictionaryPositionQstr); 122 | } 123 | } 124 | 125 | void dictionaryWidget::refreshScreenNative() { 126 | emit refreshScreen(); 127 | } 128 | -------------------------------------------------------------------------------- /src/widgets/reader/dictionarywidget.h: -------------------------------------------------------------------------------- 1 | #ifndef DICTIONARYWIDGET_H 2 | #define DICTIONARYWIDGET_H 3 | 4 | #include "functions.h" 5 | 6 | #include 7 | 8 | namespace Ui { 9 | class dictionaryWidget; 10 | } 11 | 12 | class dictionaryWidget : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit dictionaryWidget(QWidget *parent = nullptr); 19 | ~dictionaryWidget(); 20 | void dictionaryLookup(std::string word, QString first_letter, int position); 21 | QString wordQstr; 22 | QString definition; 23 | QString letter; 24 | std::string searchedWord; 25 | bool nextdefinition_lock = false; 26 | int dictionaryPosition; 27 | 28 | private slots: 29 | void on_backBtn_clicked(); 30 | void on_nextDefinitionBtn_clicked(); 31 | void on_previousDefinitionBtn_clicked(); 32 | void refreshScreenNative(); 33 | 34 | private: 35 | Ui::dictionaryWidget *ui; 36 | 37 | signals: 38 | void refreshScreen(); 39 | }; 40 | 41 | #endif // DICTIONARYWIDGET_H 42 | -------------------------------------------------------------------------------- /src/widgets/reader/dictionarywidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | dictionaryWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Source Serif Pro 36 | 37 | 38 | 39 | QFrame::NoFrame 40 | 41 | 42 | QFrame::Plain 43 | 44 | 45 | 0 46 | 47 | 48 | Qt::NoTextInteraction 49 | 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 57 | 58 | 59 | 60 | Next 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Inter 69 | 75 70 | true 71 | 72 | 73 | 74 | Word 75 | 76 | 77 | true 78 | 79 | 80 | 81 | 82 | 83 | 84 | Status 85 | 86 | 87 | Qt::AutoText 88 | 89 | 90 | Qt::AlignCenter 91 | 92 | 93 | 94 | 95 | 96 | 97 | Previous 98 | 99 | 100 | 101 | 102 | 103 | 104 | Qt::Horizontal 105 | 106 | 107 | 108 | 40 109 | 20 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 75 121 | true 122 | 123 | 124 | 125 | Back 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /src/widgets/text/searchresultswidget.cpp: -------------------------------------------------------------------------------- 1 | #include "searchresultswidget.h" 2 | #include "ui_searchresultswidget.h" 3 | #include "functions.h" 4 | 5 | #include 6 | 7 | searchResultsWidget::searchResultsWidget(QWidget *parent) : 8 | QWidget(parent), 9 | ui(new Ui::searchResultsWidget) 10 | { 11 | ui->setupUi(this); 12 | 13 | // Variables 14 | libraryResults = false; 15 | 16 | ui->listView->setFont(QFont("u001")); 17 | ui->listView->setStyleSheet("font-size: 10pt"); 18 | ui->backBtn->setProperty("type", "borderless"); 19 | ui->backBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey"); 20 | ui->openBtn->setProperty("type", "borderless"); 21 | ui->openBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey"); 22 | 23 | if(global::library::libraryResults == true) { 24 | global::library::libraryResults = false; 25 | libraryResults = true; 26 | ui->openBtn->setText("Get info"); 27 | } 28 | } 29 | 30 | searchResultsWidget::~searchResultsWidget() 31 | { 32 | delete ui; 33 | } 34 | 35 | void searchResultsWidget::setListViewContents(QStringList searchResults) { 36 | QStringListModel * model = new QStringListModel(this); 37 | model->setStringList(searchResults); 38 | ui->listView->setModel(model); 39 | } 40 | 41 | void searchResultsWidget::on_openBtn_clicked() 42 | { 43 | if(libraryResults == true) { 44 | index = ui->listView->currentIndex(); 45 | item = index.data(Qt::DisplayRole).toString(); 46 | if(!item.isEmpty()) { 47 | // Get currently selected row number 48 | int selectedRow = ui->listView->currentIndex().row(); 49 | // So that row 0 becomes row 1 50 | selectedRow = selectedRow + 1; 51 | QString selectedRowQstr = QString::number(selectedRow); 52 | 53 | QString prog ("sed"); 54 | QStringList args; 55 | args << "-n" << selectedRowQstr + "p" << "/inkbox/gutenberg-search/search_results_ids"; 56 | QProcess *proc = new QProcess(); 57 | proc->start(prog, args); 58 | proc->waitForFinished(); 59 | QString bookIdQstr = proc->readAllStandardOutput(); 60 | proc->deleteLater(); 61 | 62 | unsigned long bookId = bookIdQstr.toULong(); 63 | global::library::bookId = bookId; 64 | 65 | index = ui->listView->currentIndex(); 66 | item = index.data(Qt::DisplayRole).toString(); 67 | global::library::bookTitle = item; 68 | 69 | bookInfoDialog * bookInfoDialogWindow = new bookInfoDialog(); 70 | connect(bookInfoDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); 71 | connect(bookInfoDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); 72 | connect(bookInfoDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(close())); 73 | bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose); 74 | bookInfoDialogWindow->setModal(true); 75 | emit hideDialog(); 76 | bookInfoDialogWindow->show(); 77 | 78 | global::keyboard::searchDialog = false; 79 | global::keyboard::keyboardDialog = false; 80 | } 81 | else { 82 | emit showToast("Please select a search result"); 83 | } 84 | } 85 | else { 86 | index = ui->listView->currentIndex(); 87 | item = global::localStorage::searchResultsPaths.at(index.row()); 88 | if(!item.isEmpty()) { 89 | emit openBookFile(item, false); 90 | global::keyboard::searchDialog = false; 91 | global::keyboard::keyboardDialog = false; 92 | searchResultsWidget::close(); 93 | } 94 | else { 95 | emit showToast("Please select a search result"); 96 | } 97 | } 98 | } 99 | 100 | 101 | void searchResultsWidget::on_backBtn_clicked() 102 | { 103 | global::forbidOpenSearchDialog = false; 104 | searchResultsWidget::close(); 105 | } 106 | 107 | void searchResultsWidget::showToastNative(QString messageToDisplay) { 108 | emit showToast(messageToDisplay); 109 | } 110 | 111 | void searchResultsWidget::closeIndefiniteToastNative() { 112 | emit closeIndefiniteToast(); 113 | } 114 | -------------------------------------------------------------------------------- /src/widgets/text/searchresultswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCHRESULTSWIDGET_H 2 | #define SEARCHRESULTSWIDGET_H 3 | 4 | #include 5 | #include 6 | #include "bookinfodialog.h" 7 | 8 | namespace Ui { 9 | class searchResultsWidget; 10 | } 11 | 12 | class searchResultsWidget : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit searchResultsWidget(QWidget *parent = nullptr); 19 | ~searchResultsWidget(); 20 | void setListViewContents(QStringList searchResults); 21 | QModelIndex index; 22 | QString item; 23 | bool libraryResults; 24 | 25 | private slots: 26 | void on_openBtn_clicked(); 27 | void on_backBtn_clicked(); 28 | void showToastNative(QString messageToDisplay); 29 | void closeIndefiniteToastNative(); 30 | 31 | private: 32 | Ui::searchResultsWidget *ui; 33 | bookInfoDialog * bookInfoDialogWindow; 34 | 35 | signals: 36 | void openBookFile(QString book, bool relativePath); 37 | void showToast(QString messageToDisplay); 38 | void closeIndefiniteToast(); 39 | void hideDialog(); 40 | }; 41 | 42 | #endif // SEARCHRESULTSWIDGET_H 43 | -------------------------------------------------------------------------------- /src/widgets/text/searchresultswidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | searchResultsWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 75 39 | true 40 | 41 | 42 | 43 | Search results 44 | 45 | 46 | Qt::AlignCenter 47 | 48 | 49 | 50 | 51 | 52 | 53 | 0 54 | 55 | 56 | 57 | 58 | Open 59 | 60 | 61 | 62 | 63 | 64 | 65 | Back 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/widgets/text/textwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "textwidget.h" 2 | #include "ui_textwidget.h" 3 | #include "functions.h" 4 | 5 | #include 6 | #include 7 | 8 | textwidget::textwidget(QWidget *parent) : 9 | QWidget(parent), 10 | ui(new Ui::textwidget) 11 | { 12 | ui->setupUi(this); 13 | ui->textBrowser->setFont(QFont("u001")); 14 | 15 | // Stylesheet 16 | QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); 17 | stylesheetFile.open(QFile::ReadOnly); 18 | this->setStyleSheet(stylesheetFile.readAll()); 19 | stylesheetFile.close(); 20 | 21 | if(global::text::textBrowserDialog == true) { 22 | ui->textBrowser->setStyleSheet("font-size: 9pt"); 23 | } 24 | ui->textBrowser->setText(global::text::textBrowserContents); 25 | } 26 | 27 | textwidget::~textwidget() 28 | { 29 | delete ui; 30 | } 31 | -------------------------------------------------------------------------------- /src/widgets/text/textwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTWIDGET_H 2 | #define TEXTWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class textwidget; 8 | } 9 | 10 | class textwidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QString className = this->metaObject()->className(); 16 | explicit textwidget(QWidget *parent = nullptr); 17 | ~textwidget(); 18 | 19 | private: 20 | Ui::textwidget *ui; 21 | }; 22 | 23 | #endif // TEXTWIDGET_H 24 | -------------------------------------------------------------------------------- /src/widgets/text/textwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | textwidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 50 36 | 50 37 | 38 | 39 | 40 | QFrame::NoFrame 41 | 42 | 43 | QFrame::Plain 44 | 45 | 46 | 0 47 | 48 | 49 | Qt::NoTextInteraction 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/widgets/virtualKeyboard/virtualkeyboard.h: -------------------------------------------------------------------------------- 1 | #ifndef VIRTUALKEYBOARD_H 2 | #define VIRTUALKEYBOARD_H 3 | 4 | #include 5 | #include "functions.h" 6 | #include "egg.h" 7 | 8 | namespace Ui { 9 | class virtualkeyboard; 10 | } 11 | 12 | class virtualkeyboard : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | QString className = this->metaObject()->className(); 18 | explicit virtualkeyboard(QWidget *parent = nullptr); 19 | ~virtualkeyboard(); 20 | bool shift = false; 21 | bool specialCharacters = false; 22 | bool embed; 23 | enum class keyboardMode { 24 | lowerCase, 25 | upperCase, 26 | specialCharacters, 27 | }; 28 | void reverseKeys(keyboardMode keyboardMode); 29 | void clearLineEdit(); 30 | 31 | private slots: 32 | void on_spaceBtn_clicked(); 33 | void on_eraseBtn_clicked(); 34 | void on_spt_clicked(); 35 | void on_n1_clicked(); 36 | void on_n2_clicked(); 37 | void on_n3_clicked(); 38 | void on_n4_clicked(); 39 | void on_n5_clicked(); 40 | void on_n6_clicked(); 41 | void on_n7_clicked(); 42 | void on_n8_clicked(); 43 | void on_n9_clicked(); 44 | void on_n0_clicked(); 45 | void on_lq_clicked(); 46 | void on_lw_clicked(); 47 | void on_le_clicked(); 48 | void on_lr_clicked(); 49 | void on_lt_clicked(); 50 | void on_ly_clicked(); 51 | void on_lu_clicked(); 52 | void on_li_clicked(); 53 | void on_lo_clicked(); 54 | void on_lp_clicked(); 55 | void on_la_clicked(); 56 | void on_ls_clicked(); 57 | void on_ld_clicked(); 58 | void on_lf_clicked(); 59 | void on_lg_clicked(); 60 | void on_lh_clicked(); 61 | void on_lj_clicked(); 62 | void on_lk_clicked(); 63 | void on_ll_clicked(); 64 | void on_sat_clicked(); 65 | void on_lz_clicked(); 66 | void on_lx_clicked(); 67 | void on_lc_clicked(); 68 | void on_lv_clicked(); 69 | void on_lb_clicked(); 70 | void on_ln_clicked(); 71 | void on_lm_clicked(); 72 | void on_shiftBtn_clicked(); 73 | void adjust_size_function(); 74 | void on_enterBtn_clicked(); 75 | 76 | void on_closeBtn_clicked(); 77 | 78 | private: 79 | Ui::virtualkeyboard * ui; 80 | egg * eggWindow; 81 | keyboardMode currentMode = keyboardMode::lowerCase; 82 | 83 | signals: 84 | void adjust_size(); 85 | void enterBtnPressed(QString string); 86 | void closeBtnPressed(); 87 | }; 88 | 89 | #endif // VIRTUALKEYBOARD_H 90 | -------------------------------------------------------------------------------- /src/widgets/virtualKeyboard/virtualkeypad.cpp: -------------------------------------------------------------------------------- 1 | #include "virtualkeypad.h" 2 | #include "ui_virtualkeypad.h" 3 | #include "reader.h" 4 | #include 5 | 6 | virtualkeypad::virtualkeypad(QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::virtualkeypad) 9 | { 10 | ui->setupUi(this); 11 | ui->lineEdit->setFont(QFont("u001")); 12 | 13 | // Style 14 | ui->n1->setProperty("type", "borderless"); 15 | ui->n2->setProperty("type", "borderless"); 16 | ui->n3->setProperty("type", "borderless"); 17 | ui->n4->setProperty("type", "borderless"); 18 | ui->n5->setProperty("type", "borderless"); 19 | ui->n6->setProperty("type", "borderless"); 20 | ui->n7->setProperty("type", "borderless"); 21 | ui->n8->setProperty("type", "borderless"); 22 | ui->n9->setProperty("type", "borderless"); 23 | ui->n0->setProperty("type", "borderless"); 24 | ui->eraseBtn->setProperty("type", "borderless"); 25 | ui->clearBtn->setProperty("type", "borderless"); 26 | 27 | ui->n1->setStyleSheet("font-weight: bold; font-size: 13pt"); 28 | ui->n2->setStyleSheet("font-weight: bold; font-size: 13pt"); 29 | ui->n3->setStyleSheet("font-weight: bold; font-size: 13pt"); 30 | ui->n4->setStyleSheet("font-weight: bold; font-size: 13pt"); 31 | ui->n5->setStyleSheet("font-weight: bold; font-size: 13pt"); 32 | ui->n6->setStyleSheet("font-weight: bold; font-size: 13pt"); 33 | ui->n7->setStyleSheet("font-weight: bold; font-size: 13pt"); 34 | ui->n8->setStyleSheet("font-weight: bold; font-size: 13pt"); 35 | ui->n9->setStyleSheet("font-weight: bold; font-size: 13pt"); 36 | ui->n0->setStyleSheet("font-weight: bold; font-size: 13pt"); 37 | ui->eraseBtn->setStyleSheet("font-weight: bold; font-size: 13pt; padding: 7.35px"); 38 | ui->clearBtn->setStyleSheet("font-weight: bold; font-size: 13pt; padding: 7.35px"); 39 | 40 | ui->eraseBtn->setText(""); 41 | ui->eraseBtn->setIcon(QIcon(":/resources/backspace.png")); 42 | ui->clearBtn->setText(""); 43 | ui->clearBtn->setIcon(QIcon(":/resources/x-circle.png")); 44 | } 45 | 46 | virtualkeypad::~virtualkeypad() 47 | { 48 | delete ui; 49 | } 50 | 51 | void virtualkeypad::on_clearBtn_clicked() 52 | { 53 | ui->lineEdit->clear(); 54 | QString text = ui->lineEdit->text(); 55 | global::keyboard::keypadText = text; 56 | } 57 | 58 | void virtualkeypad::on_eraseBtn_clicked() 59 | { 60 | ui->lineEdit->backspace(); 61 | QString text = ui->lineEdit->text(); 62 | global::keyboard::keypadText = text; 63 | } 64 | 65 | void virtualkeypad::on_n1_clicked() 66 | { 67 | ui->lineEdit->insert("1"); 68 | QString text = ui->lineEdit->text(); 69 | global::keyboard::keypadText = text; 70 | } 71 | 72 | void virtualkeypad::on_n2_clicked() 73 | { 74 | ui->lineEdit->insert("2"); 75 | QString text = ui->lineEdit->text(); 76 | global::keyboard::keypadText = text; 77 | } 78 | 79 | void virtualkeypad::on_n3_clicked() 80 | { 81 | ui->lineEdit->insert("3"); 82 | QString text = ui->lineEdit->text(); 83 | global::keyboard::keypadText = text; 84 | } 85 | 86 | void virtualkeypad::on_n4_clicked() 87 | { 88 | ui->lineEdit->insert("4"); 89 | QString text = ui->lineEdit->text(); 90 | global::keyboard::keypadText = text; 91 | } 92 | 93 | void virtualkeypad::on_n5_clicked() 94 | { 95 | ui->lineEdit->insert("5"); 96 | QString text = ui->lineEdit->text(); 97 | global::keyboard::keypadText = text; 98 | } 99 | 100 | void virtualkeypad::on_n6_clicked() 101 | { 102 | ui->lineEdit->insert("6"); 103 | QString text = ui->lineEdit->text(); 104 | global::keyboard::keypadText = text; 105 | } 106 | 107 | void virtualkeypad::on_n7_clicked() 108 | { 109 | ui->lineEdit->insert("7"); 110 | QString text = ui->lineEdit->text(); 111 | global::keyboard::keypadText = text; 112 | } 113 | 114 | void virtualkeypad::on_n8_clicked() 115 | { 116 | ui->lineEdit->insert("8"); 117 | QString text = ui->lineEdit->text(); 118 | global::keyboard::keypadText = text; 119 | } 120 | 121 | void virtualkeypad::on_n9_clicked() 122 | { 123 | ui->lineEdit->insert("9"); 124 | QString text = ui->lineEdit->text(); 125 | global::keyboard::keypadText = text; 126 | } 127 | 128 | void virtualkeypad::on_n0_clicked() 129 | { 130 | ui->lineEdit->insert("0"); 131 | QString text = ui->lineEdit->text(); 132 | global::keyboard::keypadText = text; 133 | } 134 | -------------------------------------------------------------------------------- /src/widgets/virtualKeyboard/virtualkeypad.h: -------------------------------------------------------------------------------- 1 | #ifndef VIRTUALKEYPAD_H 2 | #define VIRTUALKEYPAD_H 3 | 4 | #include 5 | #include "functions.h" 6 | 7 | namespace Ui { 8 | class virtualkeypad; 9 | } 10 | 11 | class virtualkeypad : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | QString className = this->metaObject()->className(); 17 | explicit virtualkeypad(QWidget *parent = nullptr); 18 | ~virtualkeypad(); 19 | 20 | private slots: 21 | void on_n1_clicked(); 22 | void on_clearBtn_clicked(); 23 | void on_eraseBtn_clicked(); 24 | void on_n2_clicked(); 25 | void on_n3_clicked(); 26 | void on_n4_clicked(); 27 | void on_n5_clicked(); 28 | void on_n6_clicked(); 29 | void on_n7_clicked(); 30 | void on_n8_clicked(); 31 | void on_n9_clicked(); 32 | void on_n0_clicked(); 33 | 34 | private: 35 | Ui::virtualkeypad *ui; 36 | }; 37 | 38 | #endif // VIRTUALKEYPAD_H 39 | --------------------------------------------------------------------------------