mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
Compare commits
2 commits
77e3adfe9b
...
32e05489f4
Author | SHA1 | Date | |
---|---|---|---|
|
32e05489f4 | ||
|
36c4693869 |
3 changed files with 152 additions and 70 deletions
|
@ -18,16 +18,21 @@ flashExam::flashExam(QWidget *parent)
|
||||||
ui->revealBtn->setProperty("type", "borderless");
|
ui->revealBtn->setProperty("type", "borderless");
|
||||||
ui->nextBtn->setProperty("type", "borderless");
|
ui->nextBtn->setProperty("type", "borderless");
|
||||||
ui->backBtn->setProperty("type", "borderless");
|
ui->backBtn->setProperty("type", "borderless");
|
||||||
|
ui->didNotKnowBtn->setProperty("type", "borderless");
|
||||||
ui->startBtn->setStyleSheet("padding: 20px; QPushButton[type='borderless']:pressed { background: black; color: white; border: none }");
|
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->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->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->nextBtn->setStyleSheet("padding: 20px; QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||||
|
ui->didNotKnowBtn->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->backBtn->setStyleSheet("QPushButton[type='borderless']:pressed { background: black; color: white; border: none}");
|
||||||
ui->textBrowser->setStyleSheet("font-size: 12pt");
|
ui->textBrowser->setStyleSheet("font-size: 12pt");
|
||||||
ui->closeBtn->setIcon(QIcon(":/resources/close.png"));
|
ui->closeBtn->setIcon(QIcon(":/resources/close.png"));
|
||||||
ui->backBtn->setIcon(QIcon(":/resources/arrow-left.png"));
|
ui->backBtn->setIcon(QIcon(":/resources/arrow-left.png"));
|
||||||
|
ui->didNotKnowBtn->setIcon(QIcon(":/resources/close.png"));
|
||||||
|
ui->nextBtn->setIcon(QIcon(":/resources/check.png"));
|
||||||
ui->nonRedundantRandomizationCheckBox->setDisabled(true);
|
ui->nonRedundantRandomizationCheckBox->setDisabled(true);
|
||||||
ui->randomizeCheckBox->click();
|
ui->randomizeCheckBox->click();
|
||||||
|
ui->randomizeCheckBox->setDisabled(true);
|
||||||
|
|
||||||
graphicsScene = new QGraphicsScene(this);
|
graphicsScene = new QGraphicsScene(this);
|
||||||
setupCardsList();
|
setupCardsList();
|
||||||
|
@ -46,6 +51,7 @@ void flashExam::on_closeBtn_clicked()
|
||||||
void flashExam::setupCardsList() {
|
void flashExam::setupCardsList() {
|
||||||
QDir dir("/mnt/onboard/onboard/.flashexam");
|
QDir dir("/mnt/onboard/onboard/.flashexam");
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
|
ui->cardNumberLabel->show();
|
||||||
for (const QString &filename : dir.entryList(QDir::Files)) {
|
for (const QString &filename : dir.entryList(QDir::Files)) {
|
||||||
if(!filename.contains(".answers")) {
|
if(!filename.contains(".answers")) {
|
||||||
ui->listWidget->addItem(filename);
|
ui->listWidget->addItem(filename);
|
||||||
|
@ -80,6 +86,7 @@ void flashExam::initCardsList(QString cardsList, QString answersList) {
|
||||||
randomize = ui->randomizeCheckBox->isChecked();
|
randomize = ui->randomizeCheckBox->isChecked();
|
||||||
nonRedundantRandomization = ui->nonRedundantRandomizationCheckBox->isChecked();
|
nonRedundantRandomization = ui->nonRedundantRandomizationCheckBox->isChecked();
|
||||||
cardsAlreadyShown.clear();
|
cardsAlreadyShown.clear();
|
||||||
|
cardsNotKnown.clear();
|
||||||
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
||||||
cardsTotal = cardsStringList.count() + 1;
|
cardsTotal = cardsStringList.count() + 1;
|
||||||
displayCard(false);
|
displayCard(false);
|
||||||
|
@ -101,9 +108,11 @@ void flashExam::on_revealBtn_clicked()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString answerText = displayImage(answersStringList.at(currentCardNumber));
|
QString answerText = displayImage(answersStringList.at(currentCardNumber));
|
||||||
ui->textBrowser->setText(answerText);
|
ui->textBrowser->clear();
|
||||||
|
ui->textBrowser->setText("<i>" + answerText + "</i>");
|
||||||
answerShown = true;
|
answerShown = true;
|
||||||
ui->revealBtn->setText("Hide answer");
|
ui->revealBtn->setText("Hide answer");
|
||||||
|
ui->continueWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +123,16 @@ void flashExam::on_nextBtn_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
void flashExam::displayCard(bool existingCardNumber) {
|
void flashExam::displayCard(bool existingCardNumber) {
|
||||||
|
if(nonRedundantRandomization) {
|
||||||
|
float cardsTotalFloat = cardsTotal * 1.0;
|
||||||
|
float cardsAlreadyShownNumber = cardsAlreadyShown.count() * 1.0;
|
||||||
|
float cardsNotKnownNumber = cardsNotKnown.count() * 1.0;
|
||||||
|
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->cardNumberLabel->hide();
|
||||||
|
}
|
||||||
|
|
||||||
if(!existingCardNumber) {
|
if(!existingCardNumber) {
|
||||||
if(randomize) {
|
if(randomize) {
|
||||||
while(true) {
|
while(true) {
|
||||||
|
@ -142,11 +161,13 @@ void flashExam::displayCard(bool existingCardNumber) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString cardText = displayImage(cardsStringList.at(currentCardNumber));
|
QString cardText = displayImage(cardsStringList.at(currentCardNumber));
|
||||||
ui->cardNumberLabel->setText("Card " + QString::number(currentCardNumber + 1));
|
|
||||||
|
ui->textBrowser->clear();
|
||||||
ui->textBrowser->setText(cardText);
|
ui->textBrowser->setText(cardText);
|
||||||
|
|
||||||
ui->revealBtn->setText("Show answer");
|
ui->revealBtn->setText("Show answer");
|
||||||
answerShown = false;
|
answerShown = false;
|
||||||
|
ui->continueWidget->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString flashExam::displayImage(QString cardText) {
|
QString flashExam::displayImage(QString cardText) {
|
||||||
|
@ -193,3 +214,10 @@ void flashExam::on_randomizeCheckBox_toggled(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void flashExam::on_didNotKnowBtn_clicked()
|
||||||
|
{
|
||||||
|
cardsNotKnown.append(currentCardNumber);
|
||||||
|
on_nextBtn_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ private:
|
||||||
bool randomize;
|
bool randomize;
|
||||||
bool nonRedundantRandomization;
|
bool nonRedundantRandomization;
|
||||||
QList<int> cardsAlreadyShown;
|
QList<int> cardsAlreadyShown;
|
||||||
|
QList<int> cardsNotKnown;
|
||||||
bool answerShown = false;
|
bool answerShown = false;
|
||||||
QStringList cardsStringList;
|
QStringList cardsStringList;
|
||||||
QStringList answersStringList;
|
QStringList answersStringList;
|
||||||
|
@ -43,6 +44,7 @@ private slots:
|
||||||
void on_revealBtn_clicked();
|
void on_revealBtn_clicked();
|
||||||
void on_nextBtn_clicked();
|
void on_nextBtn_clicked();
|
||||||
void on_randomizeCheckBox_toggled(bool checked);
|
void on_randomizeCheckBox_toggled(bool checked);
|
||||||
|
void on_didNotKnowBtn_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLASHEXAM_H
|
#endif // FLASHEXAM_H
|
||||||
|
|
|
@ -93,17 +93,18 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="3">
|
||||||
<widget class="QLabel" name="label_2">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="font">
|
<property name="orientation">
|
||||||
<font>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
<family>U001</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="sizeHint" stdset="0">
|
||||||
<string>Select a cards list</string>
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
@ -120,18 +121,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="2">
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="orientation">
|
<property name="font">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<font>
|
||||||
|
<family>U001</family>
|
||||||
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="text">
|
||||||
<size>
|
<string>Select a cards list</string>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="closeBtn">
|
<widget class="QPushButton" name="closeBtn">
|
||||||
|
@ -184,17 +184,53 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QTextBrowser" name="textBrowser">
|
<widget class="QGraphicsView" name="graphicsView">
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QStackedWidget" name="continueWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<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>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="didNotKnowBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="nextBtn">
|
<widget class="QPushButton" name="nextBtn">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
@ -202,11 +238,13 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Next card</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="Line" name="line_3">
|
<widget class="Line" name="line_3">
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Shadow::Plain</enum>
|
<enum>QFrame::Shadow::Plain</enum>
|
||||||
|
@ -216,6 +254,35 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_4"/>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" 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="3" column="0">
|
||||||
|
<widget class="QTextBrowser" name="textBrowser">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
|
@ -255,8 +322,18 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QGraphicsView" name="graphicsView"/>
|
<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>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="Line" name="line_5">
|
<widget class="Line" name="line_5">
|
||||||
|
@ -271,31 +348,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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="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>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in a new issue