mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
To-Do app: W.-I.-P.
This commit is contained in:
parent
3555a4a90a
commit
32b051b3c7
13 changed files with 990 additions and 522 deletions
|
@ -24,6 +24,7 @@ wi
|
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
src/apps/todo.cpp \
|
||||
src/splash/alert.cpp \
|
||||
src/apps/apps.cpp \
|
||||
src/widgets/dialogs/library/bookinfodialog.cpp \
|
||||
|
@ -67,6 +68,7 @@ SOURCES += \
|
|||
src/settings/powerdaemonsettings.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/apps/todo.h \
|
||||
src/splash/alert.h \
|
||||
src/apps/apps.h \
|
||||
src/widgets/dialogs/library/bookinfodialog.h \
|
||||
|
@ -110,6 +112,7 @@ HEADERS += \
|
|||
src/settings/powerdaemonsettings.h
|
||||
|
||||
FORMS += \
|
||||
src/apps/todo.ui \
|
||||
src/splash/alert.ui \
|
||||
src/apps/apps.ui \
|
||||
src/widgets/dialogs/library/bookinfodialog.ui \
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonArray>
|
||||
#include <QScreen>
|
||||
|
||||
apps::apps(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
|
@ -24,6 +25,7 @@ apps::apps(QWidget *parent) :
|
|||
ui->vncLaunchBtn->setProperty("type", "borderless");
|
||||
ui->reversiLaunchBtn->setProperty("type", "borderless");
|
||||
ui->g2048LaunchBtn->setProperty("type", "borderless");
|
||||
ui->todoLaunchBtn->setProperty("type", "borderless");
|
||||
|
||||
ui->label->setStyleSheet("padding-top: 2px; padding-bottom: 5px");
|
||||
ui->koboxAppsOpenButton->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
@ -35,6 +37,7 @@ apps::apps(QWidget *parent) :
|
|||
ui->vncLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
ui->reversiLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
ui->g2048LaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
ui->todoLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
||||
ui->noUserAppsAvailableLabel->hide();
|
||||
|
||||
|
@ -391,3 +394,11 @@ void apps::updateJsonFileSlot(QJsonDocument jsonDocumentFunc)
|
|||
void apps::showFailedToParseMainUserAppsJsonFile() {
|
||||
emit showToast("Failed to parse 'apps.json'");
|
||||
}
|
||||
|
||||
void apps::on_todoLaunchBtn_clicked()
|
||||
{
|
||||
todo * todoWindow = new todo();
|
||||
todoWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
todoWindow->setGeometry(QRect(QPoint(0,0), qApp->primaryScreen()->geometry().size()));
|
||||
todoWindow->show();
|
||||
}
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
#define APPS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <savedwords.h>
|
||||
#include <calendarapp.h>
|
||||
#include <koboxappsdialog.h>
|
||||
#include <generaldialog.h>
|
||||
#include "savedwords.h"
|
||||
#include "calendarapp.h"
|
||||
#include "koboxappsdialog.h"
|
||||
#include "generaldialog.h"
|
||||
#include "todo.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
|
@ -40,13 +41,15 @@ private slots:
|
|||
void showUserApps(bool showDisabledJson);
|
||||
void updateJsonFileSlot(QJsonDocument jsonDocument);
|
||||
void showFailedToParseMainUserAppsJsonFile();
|
||||
void on_todoLaunchBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::apps *ui;
|
||||
savedwords *savedWordsWindow;
|
||||
calendarApp *calendarWindow;
|
||||
koboxAppsDialog *koboxAppsDialogWindow;
|
||||
generalDialog *generalDialogWindow;
|
||||
Ui::apps * ui;
|
||||
savedwords * savedWordsWindow;
|
||||
calendarApp * calendarWindow;
|
||||
koboxAppsDialog * koboxAppsDialogWindow;
|
||||
generalDialog * generalDialogWindow;
|
||||
todo * todoWindow;
|
||||
|
||||
QFile jsonFile;
|
||||
QJsonDocument jsonDocument;
|
||||
|
|
351
src/apps/apps.ui
351
src/apps/apps.ui
|
@ -53,8 +53,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>542</height>
|
||||
<width>407</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -87,6 +87,35 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Built-in apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="bottomMargin">
|
||||
|
@ -95,12 +124,13 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="calendarLaunchBtn">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="scribbleLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -109,8 +139,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="vncViewerLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -118,7 +148,33 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KoBox apps</string>
|
||||
<string>VNC viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calculator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="g2048LaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -136,6 +192,99 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QPushButton" name="lightmapsLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="scribbleLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scribble</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="g2048Label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2048</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Saved words</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Light Maps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="reversiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reversi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KoBox apps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="savedWordsLaunchBtn">
|
||||
<property name="font">
|
||||
|
@ -150,6 +299,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="calendarLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="vncLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="reversiLaunchBtn">
|
||||
<property name="font">
|
||||
|
@ -177,114 +354,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="g2048LaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Saved words</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="reversiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reversi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="g2048Label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2048</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="scribbleLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scribble</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calculator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QPushButton" name="lightmapsLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="scribbleLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="calendarLabel">
|
||||
<property name="font">
|
||||
|
@ -298,8 +367,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="todoLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
@ -307,12 +376,12 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Light Maps</string>
|
||||
<string>To-Do</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="vncLaunchBtn">
|
||||
<item row="9" column="1">
|
||||
<widget class="QPushButton" name="todoLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
|
@ -325,50 +394,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="vncViewerLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>VNC viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Built-in apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
80
src/apps/todo.cpp
Normal file
80
src/apps/todo.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
#include "todo.h"
|
||||
#include "ui_todo.h"
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
todo::todo(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::todo)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setStyleSheet(readFile("/mnt/onboard/.adds/inkbox/eink.qss"));
|
||||
this->setFont(QFont("u001"));
|
||||
|
||||
ui->closeBtn->setProperty("type", "borderless");
|
||||
ui->newListBtn->setProperty("type", "borderless");
|
||||
ui->closeBtn->setIcon(QIcon(":/resources/close.png"));
|
||||
ui->newListBtn->setIcon(QIcon(":/resources/new.png"));
|
||||
|
||||
refreshList();
|
||||
}
|
||||
|
||||
todo::~todo()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void todo::on_closeBtn_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void todo::on_newListBtn_clicked()
|
||||
{
|
||||
global::keyboard::embed = false;
|
||||
virtualkeyboard * virtualKeyboardWidget = new virtualkeyboard(this);
|
||||
virtualKeyboardWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
QObject::connect(virtualKeyboardWidget, &virtualkeyboard::enterBtnPressed, this, &todo::createNewList);
|
||||
virtualKeyboardWidget->show();
|
||||
ui->statusLabel->setText("Enter the list's name");
|
||||
}
|
||||
|
||||
void todo::createNewList(QString listName) {
|
||||
log("Initializing new To-Do list with name '" + listName + "'", className);
|
||||
QJsonDocument document;
|
||||
int index = 0;
|
||||
if(QFile::exists(global::localLibrary::todoDatabasePath)) {
|
||||
document = readTodoDatabase();
|
||||
QJsonObject object = document.object();
|
||||
index = object.length();
|
||||
if(!(index <= object[QString::number(index)].toObject().value("Name").toInt())) {
|
||||
// TODO
|
||||
index++;
|
||||
}
|
||||
}
|
||||
QJsonObject mainObject = document.object();
|
||||
QJsonObject listObject;
|
||||
|
||||
listObject.insert("Name", listName);
|
||||
mainObject.insert(QString::number(index), listObject);
|
||||
|
||||
document.setObject(mainObject);
|
||||
writeTodoDatabase(document);
|
||||
|
||||
ui->statusLabel->setText("Select or create a new list");
|
||||
refreshList();
|
||||
}
|
||||
|
||||
void todo::refreshList() {
|
||||
if(QFile::exists(global::localLibrary::todoDatabasePath)) {
|
||||
ui->listWidget->clear();
|
||||
QJsonObject mainObject = readTodoDatabase().object();
|
||||
for(int i = 0; i < mainObject.length(); i++) {
|
||||
QString name = mainObject[QString::number(i)].toObject().value("Name").toString();
|
||||
if(!name.isEmpty()) {
|
||||
ui->listWidget->addItem(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
32
src/apps/todo.h
Normal file
32
src/apps/todo.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef TODO_H
|
||||
#define TODO_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "virtualkeyboard.h"
|
||||
|
||||
namespace Ui {
|
||||
class todo;
|
||||
}
|
||||
|
||||
class todo : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString className = this->metaObject()->className();
|
||||
explicit todo(QWidget *parent = nullptr);
|
||||
~todo();
|
||||
|
||||
private slots:
|
||||
void on_closeBtn_clicked();
|
||||
void on_newListBtn_clicked();
|
||||
void createNewList(QString listName);
|
||||
void refreshList();
|
||||
|
||||
private:
|
||||
Ui::todo *ui;
|
||||
virtualkeyboard * virtualKeyboardWidget;
|
||||
};
|
||||
|
||||
#endif // TODO_H
|
177
src/apps/todo.ui
Normal file
177
src/apps/todo.ui
Normal file
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>todo</class>
|
||||
<widget class="QWidget" name="todo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>U001</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select or create a new list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="todoLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>To-Do</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="closeBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="newListBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>382</width>
|
||||
<height>229</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -98,5 +98,6 @@
|
|||
<file>resources/wifi-75.png</file>
|
||||
<file>resources/wifi-100.png</file>
|
||||
<file>resources/log.png</file>
|
||||
<file>resources/new.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -95,6 +95,7 @@ namespace global {
|
|||
inline bool wifiPassphraseDialog;
|
||||
inline QString keyboardText;
|
||||
inline QString keypadText;
|
||||
inline bool embed = true;
|
||||
}
|
||||
namespace toast {
|
||||
inline QString message;
|
||||
|
@ -139,6 +140,7 @@ namespace global {
|
|||
static inline QString recentBooksDatabasePath = databaseDirectoryPath + "RecentBooks.db";
|
||||
static inline QString pinnedBooksDatabasePath = databaseDirectoryPath + "PinnedBooks.db";
|
||||
static inline QString highlightsDatabasePath = databaseDirectoryPath + "Highlights.db";
|
||||
static inline QString todoDatabasePath = databaseDirectoryPath + "ToDo.db";
|
||||
inline bool headless;
|
||||
namespace bookOptionsDialog {
|
||||
inline int bookID;
|
||||
|
@ -978,6 +980,25 @@ namespace {
|
|||
QFile::remove(global::localLibrary::highlightsDatabasePath);
|
||||
writeFile(global::localLibrary::highlightsDatabasePath, qCompress(QJsonDocument(jsonObject).toJson()).toBase64());
|
||||
}
|
||||
QJsonDocument readTodoDatabase() {
|
||||
// Read To-Do database from file
|
||||
QFile database(global::localLibrary::todoDatabasePath);
|
||||
QByteArray data;
|
||||
if(database.open(QIODevice::ReadOnly)) {
|
||||
data = database.readAll();
|
||||
database.close();
|
||||
}
|
||||
else {
|
||||
QString function = __func__; log(function + ": Failed to open To-Do database file for reading at '" + database.fileName() + "'", "functions");
|
||||
}
|
||||
|
||||
// Parse JSON data
|
||||
return QJsonDocument::fromJson(data);
|
||||
}
|
||||
void writeTodoDatabase(QJsonDocument jsonDocument) {
|
||||
QFile::remove(global::localLibrary::todoDatabasePath);
|
||||
writeFile(global::localLibrary::todoDatabasePath, jsonDocument.toJson());
|
||||
}
|
||||
void highlightBookText(QString text, QString bookPath, bool remove) {
|
||||
if(remove == false) {
|
||||
if(!QFile::exists(global::localLibrary::highlightsDatabasePath)) {
|
||||
|
|
BIN
src/resources/new.png
Normal file
BIN
src/resources/new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -2,6 +2,7 @@
|
|||
#include "ui_virtualkeyboard.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QScreen>
|
||||
#include <QDebug>
|
||||
|
||||
virtualkeyboard::virtualkeyboard(QWidget *parent) :
|
||||
|
@ -9,6 +10,33 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) :
|
|||
ui(new Ui::virtualkeyboard)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setStyleSheet(readFile("/mnt/onboard/.adds/inkbox/eink.qss"));
|
||||
|
||||
if(global::keyboard::embed == false) {
|
||||
global::keyboard::embed = true;
|
||||
embed = false;
|
||||
ui->leftSpacerWidget->hide();
|
||||
ui->rightSpacerWidget->hide();
|
||||
ui->leftSpacerWidget->deleteLater();
|
||||
ui->rightSpacerWidget->deleteLater();
|
||||
ui->enterBtn->setProperty("type", "borderless");
|
||||
{
|
||||
int padding = 13;
|
||||
if(global::deviceID == "n873\n") {
|
||||
padding = 27;
|
||||
}
|
||||
else if(global::deviceID == "n437\n") {
|
||||
padding = 20;
|
||||
}
|
||||
ui->enterBtn->setStyleSheet("font-weight: bold; font-size: 9pt; padding: " + QString::number(padding) + "px");
|
||||
ui->enterBtn->setIcon(QIcon(":/resources/arrow-right.png"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
embed = true;
|
||||
ui->enterBtn->hide();
|
||||
ui->enterBtn->deleteLater();
|
||||
}
|
||||
|
||||
ui->n1->setProperty("type", "borderless");
|
||||
ui->n2->setProperty("type", "borderless");
|
||||
|
@ -193,11 +221,12 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) :
|
|||
if(global::keyboard::vncDialog == true or global::keyboard::wifiPassphraseDialog == true or global::keyboard::encfsDialog == true) {
|
||||
ui->lineEdit->setFont(QFont("Roboto Mono"));
|
||||
}
|
||||
else if(global::keyboard::searchDialog == true){
|
||||
else {
|
||||
ui->lineEdit->setFont(QFont("u001"));
|
||||
}
|
||||
else {
|
||||
ui->lineEdit->setFont(QFont("Roboto"));
|
||||
|
||||
if(embed == false) {
|
||||
adjust_size_function();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -672,7 +701,14 @@ void virtualkeyboard::reverseKeys(keyboardMode keyboardMode) {
|
|||
}
|
||||
|
||||
void virtualkeyboard::adjust_size_function() {
|
||||
if(embed == true) {
|
||||
emit adjust_size();
|
||||
}
|
||||
else {
|
||||
this->setFixedHeight(QGuiApplication::screens()[0]->size().height() * 45 / 100);
|
||||
this->setFixedWidth(QGuiApplication::screens()[0]->size().width());
|
||||
this->move(0, (QGuiApplication::screens()[0]->size().height() - this->height()));
|
||||
}
|
||||
}
|
||||
|
||||
void virtualkeyboard::clearLineEdit() {
|
||||
|
@ -680,3 +716,9 @@ void virtualkeyboard::clearLineEdit() {
|
|||
QString text = ui->lineEdit->text();
|
||||
global::keyboard::keyboardText = text;
|
||||
}
|
||||
|
||||
void virtualkeyboard::on_enterBtn_clicked()
|
||||
{
|
||||
emit enterBtnPressed(ui->lineEdit->text());
|
||||
this->close();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
~virtualkeyboard();
|
||||
bool shift = false;
|
||||
bool specialCharacters = false;
|
||||
bool embed;
|
||||
enum class keyboardMode {
|
||||
lowerCase,
|
||||
upperCase,
|
||||
|
@ -69,6 +70,7 @@ private slots:
|
|||
void on_lm_clicked();
|
||||
void on_shiftBtn_clicked();
|
||||
void adjust_size_function();
|
||||
void on_enterBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::virtualkeyboard *ui;
|
||||
|
@ -76,6 +78,7 @@ private:
|
|||
|
||||
signals:
|
||||
void adjust_size();
|
||||
void enterBtnPressed(QString string);
|
||||
};
|
||||
|
||||
#endif // VIRTUALKEYBOARD_H
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>999</width>
|
||||
<width>1235</width>
|
||||
<height>283</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -26,15 +26,74 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="mainWidget">
|
||||
<widget class="QWidget" name="page_7">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<item row="2" column="3">
|
||||
<widget class="QStackedWidget" name="rightSpacerWidget">
|
||||
<widget class="QWidget" name="page_11">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="rightSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_12"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="spaceBtn">
|
||||
<property name="text">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="enterBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
|
@ -349,11 +408,30 @@
|
|||
<widget class="QWidget" name="page_2"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QStackedWidget" name="leftSpacerWidget">
|
||||
<widget class="QWidget" name="page_9">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="leftSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
|
@ -362,30 +440,20 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="spaceBtn">
|
||||
<property name="text">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_10"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_8"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in a new issue