mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-24 14:47:21 -08:00
New built-in app: FlashExam (barebones flashcards app)
This commit is contained in:
parent
2d41f34d63
commit
4e60e966ea
7 changed files with 596 additions and 90 deletions
|
@ -24,6 +24,7 @@ DEFINES += GIT_COMMIT=\\\"$$GIT_COMMIT\\\"
|
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
src/apps/flashexam.cpp \
|
||||
src/apps/todo.cpp \
|
||||
src/audio/audiothread.cpp \
|
||||
src/splash/alert.cpp \
|
||||
|
@ -74,6 +75,7 @@ SOURCES += \
|
|||
src/settings/powerdaemonsettings.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/apps/flashexam.h \
|
||||
src/audio/audiothread.h \
|
||||
src/apps/todo.h \
|
||||
src/splash/alert.h \
|
||||
|
@ -124,6 +126,7 @@ HEADERS += \
|
|||
src/settings/powerdaemonsettings.h
|
||||
|
||||
FORMS += \
|
||||
src/apps/flashexam.ui \
|
||||
src/apps/todo.ui \
|
||||
src/splash/alert.ui \
|
||||
src/apps/apps.ui \
|
||||
|
|
|
@ -24,6 +24,7 @@ apps::apps(QWidget *parent) :
|
|||
ui->reversiLaunchBtn->setProperty("type", "borderless");
|
||||
ui->g2048LaunchBtn->setProperty("type", "borderless");
|
||||
ui->todoLaunchBtn->setProperty("type", "borderless");
|
||||
ui->flashExamLaunchBtn->setProperty("type", "borderless");
|
||||
|
||||
ui->label->setStyleSheet("padding-top: 2px; padding-bottom: 5px");
|
||||
ui->koboxAppsOpenButton->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
@ -34,6 +35,7 @@ apps::apps(QWidget *parent) :
|
|||
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->flashExamLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
||||
ui->noUserAppsAvailableLabel->hide();
|
||||
|
||||
|
@ -376,3 +378,13 @@ void apps::on_todoLaunchBtn_clicked()
|
|||
todoWindow->setGeometry(QRect(QPoint(0,0), qApp->primaryScreen()->geometry().size()));
|
||||
todoWindow->show();
|
||||
}
|
||||
|
||||
void apps::on_flashExamLaunchBtn_clicked()
|
||||
{
|
||||
flashExam * flashExamWindow = new flashExam();
|
||||
QObject::connect(flashExamWindow, &flashExam::showToast, this, &apps::showToast);
|
||||
flashExamWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
flashExamWindow->setGeometry(QRect(QPoint(0,0), qApp->primaryScreen()->geometry().size()));
|
||||
flashExamWindow->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "koboxappsdialog.h"
|
||||
#include "generaldialog.h"
|
||||
#include "todo.h"
|
||||
#include "flashexam.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
|
@ -41,6 +42,8 @@ private slots:
|
|||
void showFailedToParseMainUserAppsJsonFile();
|
||||
void on_todoLaunchBtn_clicked();
|
||||
|
||||
void on_flashExamLaunchBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::apps * ui;
|
||||
savedwords * savedWordsWindow;
|
||||
|
|
205
src/apps/apps.ui
205
src/apps/apps.ui
|
@ -34,16 +34,16 @@
|
|||
<item row="5" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<enum>QFrame::Shape::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
|
@ -53,8 +53,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>542</height>
|
||||
<width>407</width>
|
||||
<height>566</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -98,20 +98,20 @@
|
|||
<string>Built-in apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -123,44 +123,8 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KoBox apps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="g2048LaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="reversiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reversi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="vncLaunchBtn">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="calendarLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
|
@ -184,15 +148,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="calendarLabel">
|
||||
<item row="7" column="1">
|
||||
<widget class="QPushButton" name="todoLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calendar</string>
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="calculatorLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -221,8 +199,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QPushButton" name="todoLaunchBtn">
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="vncLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
|
@ -234,6 +212,54 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="calendarLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calendar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="g2048LaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="reversiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reversi</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Qalculate!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
|
@ -258,6 +284,18 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KoBox apps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="vncViewerLabel">
|
||||
<property name="font">
|
||||
|
@ -270,19 +308,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="calculatorLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Launch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="koboxAppsOpenButton">
|
||||
<property name="font">
|
||||
|
@ -296,20 +321,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Qalculate!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="calendarLaunchBtn">
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="flashExamLaunchBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
|
@ -321,6 +334,18 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="flashExamLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FlashExam</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -328,13 +353,13 @@
|
|||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -352,7 +377,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -381,7 +406,7 @@
|
|||
<string>User apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -390,10 +415,10 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -413,7 +438,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -428,13 +453,13 @@
|
|||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -460,17 +485,17 @@
|
|||
No user apps currently available</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
132
src/apps/flashexam.cpp
Normal file
132
src/apps/flashexam.cpp
Normal file
|
@ -0,0 +1,132 @@
|
|||
#include "flashexam.h"
|
||||
#include "ui_flashexam.h"
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
flashExam::flashExam(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::flashExam)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setStyleSheet(readFile("/mnt/onboard/.adds/inkbox/eink.qss"));
|
||||
this->setFont(QFont("u001"));
|
||||
ui->listWidget->setFont(QFont("u001"));
|
||||
ui->textBrowser->setFont(QFont("u001"));
|
||||
|
||||
ui->startBtn->setProperty("type", "borderless");
|
||||
ui->closeBtn->setProperty("type", "borderless");
|
||||
ui->revealBtn->setProperty("type", "borderless");
|
||||
ui->nextBtn->setProperty("type", "borderless");
|
||||
ui->backBtn->setProperty("type", "borderless");
|
||||
ui->startBtn->setStyleSheet("padding: 20px; QPushButton[type='borderless']:pressed { background: black; color: white; border: none }");
|
||||
ui->closeBtn->setStyleSheet("QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||
ui->revealBtn->setStyleSheet("padding: 20px; QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||
ui->nextBtn->setStyleSheet("padding: 20px; QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||
ui->backBtn->setStyleSheet("QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||
ui->closeBtn->setIcon(QIcon(":/resources/close.png"));
|
||||
ui->backBtn->setIcon(QIcon(":/resources/arrow-left.png"));
|
||||
ui->randomizeCheckBox->click();
|
||||
|
||||
setupCardsList();
|
||||
}
|
||||
|
||||
flashExam::~flashExam()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void flashExam::on_closeBtn_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void flashExam::setupCardsList() {
|
||||
QDir dir("/mnt/onboard/onboard/.flashexam");
|
||||
for (const QString &filename : dir.entryList(QDir::Files)) {
|
||||
ui->listWidget->addItem(filename);
|
||||
}
|
||||
}
|
||||
|
||||
void flashExam::on_startBtn_clicked()
|
||||
{
|
||||
QString currentItem = ui->listWidget->currentItem()->text();
|
||||
if(ui->listWidget->selectedItems().isEmpty()) {
|
||||
emit showToast("You must select a cards list");
|
||||
}
|
||||
else {
|
||||
QString cardsList = "/mnt/onboard/onboard/.flashexam/" + currentItem;
|
||||
QString answersList = "/mnt/onboard/onboard/.flashexam/" + currentItem + ".answers";
|
||||
if(QFile::exists(answersList)) {
|
||||
log("Setting up cards list '" + currentItem + "'", className);
|
||||
initCardsList(cardsList, answersList);
|
||||
}
|
||||
else {
|
||||
emit showToast("No answers file found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void flashExam::initCardsList(QString cardsList, QString answersList) {
|
||||
cardsStringList = readFile(cardsList).split(QRegExp("(\\r\\n)|(\\n\\r)|\\r|\\n"), QString::SkipEmptyParts);
|
||||
answersStringList = readFile(answersList).split(QRegExp("(\\r\\n)|(\\n\\r)|\\r|\\n"), QString::SkipEmptyParts);
|
||||
randomize = ui->randomizeCheckBox->isChecked();
|
||||
|
||||
int it = 1;
|
||||
for (auto& i : cardsStringList) {
|
||||
i.prepend(QString::number(it) + " ");
|
||||
it += 1;
|
||||
}
|
||||
|
||||
it = 1;
|
||||
for (auto& i : answersStringList) {
|
||||
i.prepend(QString::number(it) + " ");
|
||||
it += 1;
|
||||
}
|
||||
|
||||
cardsTotal = it;
|
||||
displayCard(false);
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void flashExam::on_backBtn_clicked()
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
|
||||
void flashExam::on_revealBtn_clicked()
|
||||
{
|
||||
if(answerShown) {
|
||||
displayCard(true);
|
||||
answerShown = false;
|
||||
ui->revealBtn->setText("Show answer");
|
||||
}
|
||||
else {
|
||||
QString answerText = answersStringList.at(currentCardNumber);
|
||||
answerText.remove(0, 2);
|
||||
ui->textBrowser->setText(answerText);
|
||||
answerShown = true;
|
||||
ui->revealBtn->setText("Hide answer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void flashExam::on_nextBtn_clicked()
|
||||
{
|
||||
displayCard(false);
|
||||
}
|
||||
|
||||
void flashExam::displayCard(bool existingCardNumber) {
|
||||
QString cardText;
|
||||
if(!existingCardNumber) {
|
||||
if(randomize) {
|
||||
currentCardNumber = QRandomGenerator::global()->bounded(cardsTotal - 1);
|
||||
}
|
||||
}
|
||||
cardText = cardsStringList.at(currentCardNumber);
|
||||
ui->graphicsView->hide();
|
||||
cardText.remove(0, 2);
|
||||
ui->cardNumberLabel->setText("Card " + QString::number(currentCardNumber + 1));
|
||||
ui->textBrowser->setText(cardText);
|
||||
}
|
||||
|
41
src/apps/flashexam.h
Normal file
41
src/apps/flashexam.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef FLASHEXAM_H
|
||||
#define FLASHEXAM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class flashExam;
|
||||
}
|
||||
|
||||
class flashExam : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString className = this->metaObject()->className();
|
||||
explicit flashExam(QWidget *parent = nullptr);
|
||||
~flashExam();
|
||||
|
||||
private:
|
||||
Ui::flashExam *ui;
|
||||
int cardsTotal;
|
||||
int currentCardNumber;
|
||||
bool randomize;
|
||||
bool answerShown = false;
|
||||
QStringList cardsStringList;
|
||||
QStringList answersStringList;
|
||||
void setupCardsList();
|
||||
void initCardsList(QString cardsList, QString answersList);
|
||||
void displayCard(bool existingCardNumber);
|
||||
|
||||
signals:
|
||||
void showToast(QString messageToDisplay);
|
||||
private slots:
|
||||
void on_closeBtn_clicked();
|
||||
void on_startBtn_clicked();
|
||||
void on_backBtn_clicked();
|
||||
void on_revealBtn_clicked();
|
||||
void on_nextBtn_clicked();
|
||||
};
|
||||
|
||||
#endif // FLASHEXAM_H
|
290
src/apps/flashexam.ui
Normal file
290
src/apps/flashexam.ui
Normal file
|
@ -0,0 +1,290 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>flashExam</class>
|
||||
<widget class="QWidget" name="flashExam">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>580</width>
|
||||
<height>636</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QPushButton" name="startBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="randomizeCheckBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>U001</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Randomized mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::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="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>U001</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select a cards list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FlashExam</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="closeBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="backBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="cardNumberLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>U001</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Card number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QPushButton" name="nextBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Next card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGraphicsView" name="graphicsView"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QPushButton" name="revealBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue