mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
FlashExam: add option to save forgotten cards or not
This commit is contained in:
parent
c87bdd8e02
commit
7be7b15e8d
3 changed files with 69 additions and 42 deletions
|
@ -31,6 +31,7 @@ flashExam::flashExam(QWidget *parent)
|
||||||
ui->didNotKnowBtn->setIcon(QIcon(":/resources/close.png"));
|
ui->didNotKnowBtn->setIcon(QIcon(":/resources/close.png"));
|
||||||
ui->nextBtn->setIcon(QIcon(":/resources/check.png"));
|
ui->nextBtn->setIcon(QIcon(":/resources/check.png"));
|
||||||
ui->nonRedundantRandomizationCheckBox->setDisabled(true);
|
ui->nonRedundantRandomizationCheckBox->setDisabled(true);
|
||||||
|
ui->saveCardsNotKnownToFileCheckBox->setDisabled(true);
|
||||||
ui->randomizeCheckBox->click();
|
ui->randomizeCheckBox->click();
|
||||||
ui->randomizeCheckBox->setDisabled(true);
|
ui->randomizeCheckBox->setDisabled(true);
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ void flashExam::initCardsList(QString cardsList, QString answersList) {
|
||||||
answersStringList = readFile(answersList).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();
|
randomize = ui->randomizeCheckBox->isChecked();
|
||||||
nonRedundantRandomization = ui->nonRedundantRandomizationCheckBox->isChecked();
|
nonRedundantRandomization = ui->nonRedundantRandomizationCheckBox->isChecked();
|
||||||
|
saveCardsNotKnownToFile = ui->saveCardsNotKnownToFileCheckBox->isChecked();
|
||||||
cardsAlreadyShown.clear();
|
cardsAlreadyShown.clear();
|
||||||
cardsNotKnown.clear();
|
cardsNotKnown.clear();
|
||||||
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
||||||
|
@ -95,7 +97,7 @@ void flashExam::initCardsList(QString cardsList, QString answersList) {
|
||||||
|
|
||||||
void flashExam::on_backBtn_clicked()
|
void flashExam::on_backBtn_clicked()
|
||||||
{
|
{
|
||||||
if(nonRedundantRandomization) {
|
if(nonRedundantRandomization && cardsNotKnown.count() > 0 && saveCardsNotKnownToFile) {
|
||||||
QString cardsNotKnownQstring;
|
QString cardsNotKnownQstring;
|
||||||
for(int i = 0; i < cardsNotKnown.count(); i++) {
|
for(int i = 0; i < cardsNotKnown.count(); i++) {
|
||||||
cardsNotKnownQstring.append(cardsStringList.at(cardsNotKnown.at(i)) + "\n");
|
cardsNotKnownQstring.append(cardsStringList.at(cardsNotKnown.at(i)) + "\n");
|
||||||
|
@ -229,3 +231,14 @@ void flashExam::on_didNotKnowBtn_clicked()
|
||||||
on_nextBtn_clicked();
|
on_nextBtn_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flashExam::on_nonRedundantRandomizationCheckBox_toggled(bool checked)
|
||||||
|
{
|
||||||
|
if(checked) {
|
||||||
|
ui->saveCardsNotKnownToFileCheckBox->setDisabled(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->saveCardsNotKnownToFileCheckBox->setDisabled(true);
|
||||||
|
ui->saveCardsNotKnownToFileCheckBox->setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ private:
|
||||||
QString listName;
|
QString listName;
|
||||||
bool randomize;
|
bool randomize;
|
||||||
bool nonRedundantRandomization;
|
bool nonRedundantRandomization;
|
||||||
|
bool saveCardsNotKnownToFile;
|
||||||
QList<int> cardsAlreadyShown;
|
QList<int> cardsAlreadyShown;
|
||||||
QList<int> cardsNotKnown;
|
QList<int> cardsNotKnown;
|
||||||
bool answerShown = false;
|
bool answerShown = false;
|
||||||
|
@ -45,6 +46,7 @@ private slots:
|
||||||
void on_nextBtn_clicked();
|
void on_nextBtn_clicked();
|
||||||
void on_randomizeCheckBox_toggled(bool checked);
|
void on_randomizeCheckBox_toggled(bool checked);
|
||||||
void on_didNotKnowBtn_clicked();
|
void on_didNotKnowBtn_clicked();
|
||||||
|
void on_nonRedundantRandomizationCheckBox_toggled(bool checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLASHEXAM_H
|
#endif // FLASHEXAM_H
|
||||||
|
|
|
@ -35,46 +35,6 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<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="3" column="0">
|
|
||||||
<widget class="QListWidget" name="listWidget"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" 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="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
|
@ -142,7 +102,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="Line" name="line_2">
|
<widget class="Line" name="line_2">
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Shadow::Plain</enum>
|
<enum>QFrame::Shadow::Plain</enum>
|
||||||
|
@ -152,6 +112,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="nonRedundantRandomizationCheckBox">
|
<widget class="QCheckBox" name="nonRedundantRandomizationCheckBox">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -164,6 +137,45 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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="8" 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="3" column="0">
|
||||||
|
<widget class="QListWidget" name="listWidget"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QCheckBox" name="saveCardsNotKnownToFileCheckBox">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>U001</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save forgotten cards list to file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in a new issue