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 |
--------------------------------------------------------------------------------