From 377cbe31f1979e8024445b3869330a3261c17694 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Thu, 15 Sep 2022 01:04:52 -0400 Subject: [PATCH] To-Do app: Beta version --- src/apps/todo.cpp | 147 +++++- src/apps/todo.h | 9 + src/apps/todo.ui | 216 +++++++-- src/eink.qrc | 2 + src/resources/checkbox-checked-small.png | Bin 0 -> 6590 bytes src/resources/checkbox-unchecked-small.png | Bin 0 -> 5836 bytes .../virtualKeyboard/virtualkeyboard.cpp | 9 +- src/widgets/virtualKeyboard/virtualkeyboard.h | 1 + .../virtualKeyboard/virtualkeyboard.ui | 420 +++++++++--------- 9 files changed, 538 insertions(+), 266 deletions(-) create mode 100644 src/resources/checkbox-checked-small.png create mode 100644 src/resources/checkbox-unchecked-small.png diff --git a/src/apps/todo.cpp b/src/apps/todo.cpp index 431c334..48e0a75 100644 --- a/src/apps/todo.cpp +++ b/src/apps/todo.cpp @@ -20,17 +20,31 @@ todo::todo(QWidget *parent) : ui->newBtn->setProperty("type", "borderless"); ui->deleteBtn->setProperty("type", "borderless"); ui->setupBtn->setProperty("type", "borderless"); + ui->newItemBtn->setProperty("type", "borderless"); + ui->deleteItemBtn->setProperty("type", "borderless"); + ui->selectAllItemsBtn->setProperty("type", "borderless"); + ui->selectItemsModeBtn->setProperty("type", "borderless"); ui->deleteBtn->setStyleSheet("padding: 10px"); ui->setupBtn->setStyleSheet("padding: 10px"); + ui->newItemBtn->setStyleSheet("padding: 10px"); + ui->deleteItemBtn->setStyleSheet("padding: 10px"); + ui->selectAllItemsBtn->setStyleSheet("padding: 10px"); + ui->selectItemsModeBtn->setStyleSheet("padding: 10px"); ui->closeBtn->setIcon(QIcon(":/resources/close.png")); ui->newBtn->setIcon(QIcon(":/resources/new.png")); + ui->newItemBtn->setIcon(QIcon(":/resources/plus.png")); ui->deleteBtn->setIcon(QIcon(":/resources/x-circle.png")); ui->setupBtn->setIcon(QIcon(":/resources/arrow-right.png")); + ui->deleteItemBtn->setIcon(QIcon(":/resources/x-circle.png")); + ui->selectAllItemsBtn->setIcon(QIcon(":/resources/checkbox-checked-small.png")); + ui->selectItemsModeBtn->setIcon(QIcon(":/resources/checkbox-unchecked-small.png")); ui->listWidget->setStyleSheet("font-size: 10pt"); ui->listWidget->setWordWrap(true); ui->itemsListWidget->setStyleSheet("font-size: 10pt"); ui->itemsListWidget->setWordWrap(true); + ui->editToolbarWidget->hide(); + refreshList(); } @@ -46,28 +60,18 @@ void todo::on_closeBtn_clicked() } else { saveCurrentList(); - ui->stackedWidget->setCurrentIndex(0); - ui->closeBtn->setIcon(QIcon(":/resources/close.png")); - ui->deleteBtn->setEnabled(true); - ui->setupBtn->setEnabled(true); - currentView = currentView::home; + switchViewHome(); } } - void todo::on_newBtn_clicked() { global::keyboard::embed = false; virtualkeyboard * virtualKeyboardWidget = new virtualkeyboard(this); virtualKeyboardWidget->setAttribute(Qt::WA_DeleteOnClose); - if(currentView == currentView::home) { - QObject::connect(virtualKeyboardWidget, &virtualkeyboard::enterBtnPressed, this, &todo::createNewList); - ui->statusLabel->setText("Enter the list's name"); - } - else { - QObject::connect(virtualKeyboardWidget, &virtualkeyboard::enterBtnPressed, this, &todo::addItem); - ui->statusLabel->setText("Enter the item's name"); - } + QObject::connect(virtualKeyboardWidget, &virtualkeyboard::enterBtnPressed, this, &todo::createNewList); + QObject::connect(virtualKeyboardWidget, &virtualkeyboard::closeBtnPressed, this, &todo::setDefaultHomePageStatusText); + ui->statusLabel->setText("Enter the list's name"); virtualKeyboardWidget->show(); } @@ -167,7 +171,10 @@ void todo::setupList(QString listName) { } ui->itemsListWidget->addItem(item); } - ui->closeBtn->setIcon(QIcon(":/resources/check.png")); + // I know it's confusing; think about it twice, or better, have a device at hand to see how this behaves in reality + ui->closeBtn->setIcon(QIcon(":/resources/arrow-left.png")); + ui->line_2->hide(); + ui->newBtn->hide(); ui->statusLabel->setText("Select or create a new item"); } @@ -211,5 +218,113 @@ void todo::saveCurrentList() { void todo::on_deleteBtn_clicked() { - + QJsonDocument document = readTodoDatabase(); + QJsonObject object = document.object(); + QJsonArray mainArray = object["List"].toArray(); + for(int i = 0; i < mainArray.count(); i++) { + if(mainArray.at(i).toArray().at(0).toString() == ui->listWidget->currentItem()->text()) { + mainArray.removeAt(i); + } + } + object["List"] = mainArray; + document.setObject(object); + writeTodoDatabase(document); + refreshList(); +} + +void todo::on_newItemBtn_clicked() +{ + global::keyboard::embed = false; + virtualkeyboard * virtualKeyboardWidget = new virtualkeyboard(this); + virtualKeyboardWidget->setAttribute(Qt::WA_DeleteOnClose); + QObject::connect(virtualKeyboardWidget, &virtualkeyboard::enterBtnPressed, this, &todo::addItem); + QObject::connect(virtualKeyboardWidget, &virtualkeyboard::closeBtnPressed, this, &todo::setDefaultListPageStatusText); + ui->statusLabel->setText("Enter the item's name"); + virtualKeyboardWidget->show(); +} + +void todo::switchViewHome() { + ui->itemsListWidget->clear(); + switchItemsSelectionMode(false); + ui->stackedWidget->setCurrentIndex(0); + ui->closeBtn->setIcon(QIcon(":/resources/close.png")); + ui->line_2->show(); + ui->newBtn->show(); + ui->deleteBtn->setEnabled(true); + ui->setupBtn->setEnabled(true); + setDefaultHomePageStatusText(); + currentView = currentView::home; +} + +void todo::on_selectItemsModeBtn_clicked() +{ + if(selectItemsMode == false) { + switchItemsSelectionMode(true); + } + else { + switchItemsSelectionMode(false); + } +} + +void todo::switchItemsSelectionMode(bool selectionMode) { + if(selectionMode == true) { + log("Entering selection mode", className); + saveCurrentList(); + ui->newItemBtn->setEnabled(false); + ui->selectItemsModeBtn->setStyleSheet("padding: 10px; background-color: lightGray;"); + ui->editToolbarWidget->show(); + ui->statusLabel->setText("Selection mode"); + selectItemsMode = true; + } + else { + log("Exiting selection mode", className); + setupList(readTodoDatabase().object()["List"].toArray().at(listIndex).toArray().at(0).toString()); + ui->selectItemsModeBtn->setStyleSheet("padding: 10px; background-color: white;"); + ui->editToolbarWidget->hide(); + ui->newItemBtn->setEnabled(true); + ui->statusLabel->setText("Select or create a new item"); + selectItemsMode = false; + } + QTimer::singleShot(500, this, SLOT(repaint())); +} + +void todo::on_deleteItemBtn_clicked() +{ + log("Deleting list item(s)", className); + QJsonDocument document = readTodoDatabase(); + QJsonObject object = document.object(); + QJsonArray mainArray = object["List"].toArray(); + QJsonArray listArray = mainArray.at(listIndex).toArray(); + int itemsRemoved = 0; + for(int i = 1; i < ui->itemsListWidget->count() + 1; i++) { + if(ui->itemsListWidget->item(i - 1)->checkState() == Qt::Checked) { + listArray.removeAt(i - itemsRemoved); + itemsRemoved++; + } + } + + // Adding item array to list array + mainArray.replace(listIndex, listArray); + object["List"] = mainArray; + + document.setObject(object); + writeTodoDatabase(document); + + setupList(listArray.at(0).toString()); +} + +void todo::on_selectAllItemsBtn_clicked() +{ + int range = ui->itemsListWidget->count(); + for(int i = 0; i < range; i++) { + ui->itemsListWidget->item(i)->setCheckState(Qt::Checked); + } +} + +void todo::setDefaultHomePageStatusText() { + ui->statusLabel->setText("Select or create a new list"); +} + +void todo::setDefaultListPageStatusText() { + ui->statusLabel->setText("Select or create a new item"); } diff --git a/src/apps/todo.h b/src/apps/todo.h index 7dc488f..b8d38e1 100644 --- a/src/apps/todo.h +++ b/src/apps/todo.h @@ -22,6 +22,7 @@ public: home, list }; + bool selectItemsMode = false; currentView currentView = currentView::home; int listIndex; @@ -33,9 +34,17 @@ private slots: void refreshList(); void saveCurrentList(); void setupList(QString listName); + void switchViewHome(); + void switchItemsSelectionMode(bool selectionMode); + void setDefaultHomePageStatusText(); + void setDefaultListPageStatusText(); void on_setupBtn_clicked(); void on_listWidget_itemClicked(QListWidgetItem *item); void on_deleteBtn_clicked(); + void on_newItemBtn_clicked(); + void on_selectItemsModeBtn_clicked(); + void on_deleteItemBtn_clicked(); + void on_selectAllItemsBtn_clicked(); private: Ui::todo *ui; diff --git a/src/apps/todo.ui b/src/apps/todo.ui index 474ded7..568282d 100644 --- a/src/apps/todo.ui +++ b/src/apps/todo.ui @@ -18,6 +18,26 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + @@ -30,24 +50,13 @@ - - - - - Inter - 75 - true - + + + + QFrame::Plain - - To-Do - - - - - - - + + Qt::Vertical @@ -64,19 +73,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -84,13 +80,17 @@ - - - - QFrame::Plain + + + + + Inter + 75 + true + - - Qt::Vertical + + To-Do @@ -200,6 +200,150 @@ + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + QFrame::Plain + + + Qt::Vertical + + + + + + + + + + + + + + + 0 + 0 + + + + 0 + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + QFrame::Plain + + + Qt::Vertical + + + + + + + + + + + + + + QFrame::Plain + + + Qt::Vertical + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + QFrame::Plain + + + 4 + + + Qt::Horizontal + + + diff --git a/src/eink.qrc b/src/eink.qrc index 1479da5..358328c 100644 --- a/src/eink.qrc +++ b/src/eink.qrc @@ -99,5 +99,7 @@ resources/wifi-100.png resources/log.png resources/new.png + resources/checkbox-unchecked-small.png + resources/checkbox-checked-small.png diff --git a/src/resources/checkbox-checked-small.png b/src/resources/checkbox-checked-small.png new file mode 100644 index 0000000000000000000000000000000000000000..3906dec4c29beb460afbed81273fa68a77f9b16f GIT binary patch literal 6590 zcmeHLX;f3!77i!`kwHZeF+vE42!ygzXu952GJ$aUotCxq)zP@;}t6uVA z<;|40s8-|*aGCYV#On)$J_PkII);yS28FOzhqvz@x_dM_sgiD9emJK<)wsM-H9CzR z`ncH?*lxSv_cO*m_@5n9wELX=L$CMn{X*OB zyWKeZ0o8Gz?QZe^jpq*}s+inX}i(8>H)M8+_GWqkBiqL-a=@J%IwUi>s*N=- zEX;0Oa>rk5tKJI7d}}SO0Gs8$XJ?<8ZoSKBu}%rG{ud+dW7iG+r88NPZHyCjj$SeL zjw)278q}RZUCE8yB147|9A0O8sx2KH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oe#E z($Jjb0;i~_WO*K30i({hNcL2{os!<_0krZf7q#N^C&pJ+hHx&E@iA+(KvVnC@v$L= z1jG1iMp0LYMMfH&!gOa{$fO3i8!9|5e=6~w|3gz!YC-Sz;ez&7OIBZ!QpO5NZZv;O zF>IZ-^HTciL*Bqk@>#R&kOFJeWkR#0lT|XJ>g3O}#Cp3^w*tFbN3j;gwFQ6h_0lCX zt-1$OJPKYb{H!f5TcbSFzdHChTPI?Lu=iVE(pGoscEbujX>F!@?@6)qXtdCjbn%w_D(Y#h_0MsK!GHc-kP>O9TJ*~EveiOT@6AVEFozbL|3Ll zY;@m{q^-7}Fx1fI!Eo`W#!x9~#0N`YoPF8vZ_@u@e!q7$^O_*l>RvP3j?pn!qlCo%&L67)7`>kOE%hTVZWJ%=ae*sMj5+?uv literal 0 HcmV?d00001 diff --git a/src/resources/checkbox-unchecked-small.png b/src/resources/checkbox-unchecked-small.png new file mode 100644 index 0000000000000000000000000000000000000000..9f9cad4f44829ef7268b94d9ad1bc6e510bc1428 GIT binary patch literal 5836 zcmeHLc~leU77rqeY%Yj^B7|TqsFO_g1)?B}M2)fuD4rCcPA!tm-i1%}6B z#UkL+`Y4lM)IP%`x%2p;%y6Dz%J1Q8^WzOJyqX}1l1n?((p8S z)p)71-Z;X-6N-(aN4swGaB39QdnLJYa26#$vZ&66J7zFhwZ7B7-u5JWa)H%}gU3x& zUro)l_C7L=eCkrE?r|%N{+dJRSPP47`MaB&=@MSL;OB4CbK{&QnQyt&oSs#R%_Q1} zaZ5`Ro~N^oiTnnqkmuPdr(MOarFR~!*U9ZZf7Ld|G@(`6%k9Y(^fw2e$y?bXIhngE zV`G0#uBahImg`>=*i|T5eDhpy+trG|DHFVGI6t4d>#$wv>s+|@s+~_x#$=M8>Ofd? zI6cAp+WAFliY{!H=Gr!WR8-`?dd6X^xb!{sKh(1<>J)xo7JFq_8CEYkzQMM8l%2&~<$e5^Wj!)99oLDK;bwE}4rpwo_T*rOm_I+;Q!NM`Y)2$s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OCMH9*av4Q!WS_azN)zeAjXdOzjgkhVT$3OxREl8@r|GhLtQ`X~lI%K5XpKGXG4 z41ARHXLbGG=rVfu0EfxIueuoUc-C=Y2Lc}L^aTs%d1xQj#ra5&vao`+ii_@7vt+ZH}zQ*qbM!FP92@p$K% z)zx+D9g*X+cJ7RV`fzo@!0GBV99SqlVTI|iS>8a?`c~1z`doRD?U1p;|obor{+( g_)vil`3-C+w|ow5xq4eraseBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px"); ui->shiftBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px"); ui->spt->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px"); - ui->sat->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px"); + ui->sat->setStyleSheet("font-weight: bold; font-size: 7pt; padding: 27px"); ui->spaceBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 15px; border: 1px solid black"); } else if(global::deviceID == "n437\n") { @@ -175,7 +175,7 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) : ui->eraseBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 20px"); ui->shiftBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 20px"); ui->spt->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 20px"); - ui->sat->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 20px"); + ui->sat->setStyleSheet("font-weight: bold; font-size: 7pt; padding: 20px"); ui->spaceBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 15px; border: 1px solid black"); } else { @@ -220,7 +220,7 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) : ui->eraseBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 13px"); ui->shiftBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 13px"); ui->spt->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 13px"); - ui->sat->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 13px"); + ui->sat->setStyleSheet("font-weight: bold; font-size: 7pt; padding: 13px"); ui->spaceBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 10px; border: 1px solid black"); } @@ -446,7 +446,7 @@ void virtualkeyboard::on_la_clicked() void virtualkeyboard::on_ls_clicked() { - ui->lineEdit->insert(QString(ui->la->text().back())); + ui->lineEdit->insert(ui->ls->text()); QString text = ui->lineEdit->text(); global::keyboard::keyboardText = text; @@ -734,5 +734,6 @@ void virtualkeyboard::on_enterBtn_clicked() void virtualkeyboard::on_closeBtn_clicked() { global::keyboard::keyboardText = ""; + emit closeBtnPressed(); this->close(); } diff --git a/src/widgets/virtualKeyboard/virtualkeyboard.h b/src/widgets/virtualKeyboard/virtualkeyboard.h index 35cf300..5219725 100644 --- a/src/widgets/virtualKeyboard/virtualkeyboard.h +++ b/src/widgets/virtualKeyboard/virtualkeyboard.h @@ -81,6 +81,7 @@ private: signals: void adjust_size(); void enterBtnPressed(QString string); + void closeBtnPressed(); }; #endif // VIRTUALKEYBOARD_H diff --git a/src/widgets/virtualKeyboard/virtualkeyboard.ui b/src/widgets/virtualKeyboard/virtualkeyboard.ui index e6fad82..eb45460 100644 --- a/src/widgets/virtualKeyboard/virtualkeyboard.ui +++ b/src/widgets/virtualKeyboard/virtualkeyboard.ui @@ -115,17 +115,10 @@ - - + + - - - - - - - - 3 + y @@ -136,13 +129,6 @@ - - - - d - - - @@ -150,181 +136,6 @@ - - - - 2 - - - - - - - g - - - - - - - z - - - - - - - 9 - - - - - - - 4 - - - - - - - x - - - - - - - 8 - - - - - - - w - - - - - - - l - - - - - - - e - - - - - - - b - - - - - - - j - - - - - - - c - - - - - - - u - - - - - - - h - - - - - - - 7 - - - - - - - k - - - - - - - 0 - - - - - - - o - - - - - - - f - - - - - - - i - - - - - - - - - - - - - - s - - - - - - - . - - - - - - - t - - - @@ -332,17 +143,52 @@ - - + + - # + 9 - - + + - a + c + + + + + + + r + + + + + + + 7 + + + + + + + 5 + + + + + + + 8 + + + + + + + 3 @@ -353,6 +199,76 @@ + + + + t + + + + + + + i + + + + + + + 0 + + + + + + + b + + + + + + + 4 + + + + + + + o + + + + + + + + + + + + + + z + + + + + + + + + + + + + + 6 + + + @@ -367,31 +283,115 @@ - - + + - 6 + . - - + + - y + x - - + + - 5 + 2 - - + + - r + w + + + + + + + u + + + + + + + e + + + + + + + a + + + + + + + s + + + + + + + d + + + + + + + f + + + + + + + g + + + + + + + h + + + + + + + j + + + + + + + k + + + + + + + l + + + + + + + #?