mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
settings
This commit is contained in:
@@ -1,47 +1,21 @@
|
|||||||
12.08.2024 12\:05
|
12.08.2024 15\:05
|
||||||
|
|
||||||
- [2.52] Arrange these events in the order they occurred >
|
- [69.00] Arrange these events in the order they
|
||||||
-^ The Fall of the Roman Empire
|
occurred >
|
||||||
-^ The Renaissance
|
-^ The Fall of the Roman Empire
|
||||||
-^ The Industrial Revolution
|
-^ The Renaissance
|
||||||
|
-^ The Industrial Revolution
|
||||||
|
|
||||||
- [3.22] Match Planets to Their Characteristics >
|
- What is the capital of Latvia? >
|
||||||
- Earth:
|
- Rīga
|
||||||
- Contains Life
|
|
||||||
- Mars:
|
|
||||||
- Red Planet
|
|
||||||
- Jupiter:
|
|
||||||
- Largest Planet
|
|
||||||
- Has Rings
|
|
||||||
- Venus:
|
|
||||||
- Hottest Planet
|
|
||||||
- Mercury:
|
|
||||||
- Smallest Planet
|
|
||||||
- Saturn:
|
|
||||||
- Has Rings
|
|
||||||
- Neptune:
|
|
||||||
- Farthest from the Sun
|
|
||||||
- Has Rings
|
|
||||||
|
|
||||||
- What countries reside in Europe? >
|
- What is the capital of Estonia? >
|
||||||
+ Latvia
|
- Tallin
|
||||||
- Peru
|
|
||||||
+ Poland
|
|
||||||
- China
|
|
||||||
|
|
||||||
|
- Place the following steps of the scientific
|
||||||
|
method in the correct order >
|
||||||
- What is the capital of Latvia? >
|
-^ Ask a Question
|
||||||
- Rīga
|
-^ Form a Hypothesis
|
||||||
|
-^ Conduct an Experiment
|
||||||
- What is the capital of Estonia? >
|
-^ Analyze Data
|
||||||
- Tallin
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- Place the following steps of the scientific method in the correct order >
|
|
||||||
- Ask a Question
|
|
||||||
- Form a Hypothesis
|
|
||||||
-^ Conduct an Experiment
|
|
||||||
- Analyze Data
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
- Another question? >
|
|
||||||
- Answer
|
|
||||||
- Answer
|
|
||||||
- Answer
|
|
||||||
- Answer
|
|
||||||
- Answer
|
|
||||||
|
|
||||||
|
|
||||||
oejcoewjic
|
|
||||||
|
|
||||||
- Question? >
|
|
||||||
- Answer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fwefew
|
|
||||||
|
|
||||||
dwedew
|
|
||||||
dwe
|
|
||||||
|
|
||||||
|
|
||||||
dee
|
|
||||||
|
|||||||
23
memorybase/generated.mdem
Normal file
23
memorybase/generated.mdem
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
- fewfew ew >
|
||||||
|
- fewfeww
|
||||||
|
- fewfewfew
|
||||||
|
|
||||||
|
- fewfew ew >
|
||||||
|
- fewfeww
|
||||||
|
- fewfewfew
|
||||||
|
|
||||||
|
- fewfew ew >
|
||||||
|
- fewfeww
|
||||||
|
- fewfewfew
|
||||||
|
|
||||||
|
- fewfew ew >
|
||||||
|
- fewfeww
|
||||||
|
- fewfewfew
|
||||||
|
|
||||||
|
- fewfew ew >
|
||||||
|
- fewfeww
|
||||||
|
- fewfewfew
|
||||||
|
|
||||||
|
- ifjiewfew >
|
||||||
|
- fewfewfe
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
#include <qmainwindow.h>
|
#include <qmainwindow.h>
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
#include <qobjectdefs.h>
|
#include <qobjectdefs.h>
|
||||||
|
#include <qsettings.h>
|
||||||
#include <qsizepolicy.h>
|
#include <qsizepolicy.h>
|
||||||
#include <qtoolbutton.h>
|
#include <qtoolbutton.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
@@ -45,9 +47,18 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <qabstractitemmodel.h>
|
#include <qabstractitemmodel.h>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
#include "qscilexer.h"
|
||||||
#include "trainWindow.h"
|
#include "trainWindow.h"
|
||||||
|
|
||||||
#define TEXT_LG = 20
|
#define TEXT_LG = 20
|
||||||
@@ -125,6 +136,8 @@ QToolButton *practice;
|
|||||||
QsciScintilla *editor;
|
QsciScintilla *editor;
|
||||||
QMainWindow* editorWindow;
|
QMainWindow* editorWindow;
|
||||||
|
|
||||||
|
QSettings *settings;
|
||||||
|
|
||||||
const std::regex lastPathElementExp = std::regex("(.+\\/)*(.+)");
|
const std::regex lastPathElementExp = std::regex("(.+\\/)*(.+)");
|
||||||
|
|
||||||
void showBacklabels(Mdem *mdem) {
|
void showBacklabels(Mdem *mdem) {
|
||||||
@@ -719,6 +732,81 @@ int main(int argc, char *argv[]) {
|
|||||||
pickDirectory
|
pickDirectory
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto* settingsWindow = new QWidget;
|
||||||
|
QString configDir = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||||
|
QDir().mkpath(configDir); // Ensure the directory exists
|
||||||
|
QString settingsFile = configDir + "/mdem.ini";
|
||||||
|
settings = new QSettings(settingsFile, QSettings::IniFormat);
|
||||||
|
{ // Settings window.
|
||||||
|
settingsWindow->setWindowTitle("Settings");
|
||||||
|
|
||||||
|
auto formLayout = new QFormLayout;
|
||||||
|
|
||||||
|
/*auto notificationsCheckBox = new QCheckBox("Enable notifications");*/
|
||||||
|
/*formLayout->addRow(notificationsCheckBox);*/
|
||||||
|
|
||||||
|
auto characterWrap = new QSpinBox;
|
||||||
|
characterWrap->setRange(50, 150);
|
||||||
|
formLayout->addRow("Character wrap in code gen:", characterWrap);
|
||||||
|
|
||||||
|
auto* timezone = new QSpinBox;
|
||||||
|
timezone->setRange(-12, 12);
|
||||||
|
formLayout->addRow("Timezone as number (e.g. +2 as 2):", timezone);
|
||||||
|
|
||||||
|
auto* notRemembered = new QSpinBox;
|
||||||
|
notRemembered->setRange(0, 100);
|
||||||
|
formLayout->addRow("Not remembered:", notRemembered);
|
||||||
|
|
||||||
|
auto* hard = new QSpinBox;
|
||||||
|
hard->setRange(0, 100);
|
||||||
|
formLayout->addRow("Hard:", hard);
|
||||||
|
|
||||||
|
auto* medium = new QSpinBox;
|
||||||
|
medium->setRange(0, 100);
|
||||||
|
formLayout->addRow("Medium:", medium);
|
||||||
|
|
||||||
|
auto* easy = new QSpinBox;
|
||||||
|
easy->setRange(0, 100);
|
||||||
|
formLayout->addRow("Easy:", easy);
|
||||||
|
|
||||||
|
auto* saveButton = new QPushButton("Save");
|
||||||
|
auto* mainLayout = new QVBoxLayout;
|
||||||
|
|
||||||
|
// TODO: make defaults and validate settings values
|
||||||
|
characterWrap->setValue(settings->value("characterWrap").toInt());
|
||||||
|
timezone->setValue(settings->value("timezone").toInt());
|
||||||
|
notRemembered->setValue(settings->value("notRemembered").toInt());
|
||||||
|
hard->setValue(settings->value("hard").toInt());
|
||||||
|
medium->setValue(settings->value("medium").toInt());
|
||||||
|
easy->setValue(settings->value("easy").toInt());
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
saveButton,
|
||||||
|
&QPushButton::clicked,
|
||||||
|
[characterWrap, timezone, notRemembered, hard, medium, easy]() {
|
||||||
|
settings->setValue("characterWrap", characterWrap->value());
|
||||||
|
settings->setValue("timezone", timezone->value());
|
||||||
|
settings->setValue("notRemembered", notRemembered->value());
|
||||||
|
settings->setValue("hard", hard->value());
|
||||||
|
settings->setValue("medium", medium->value());
|
||||||
|
settings->setValue("easy", easy->value());
|
||||||
|
});
|
||||||
|
|
||||||
|
mainLayout->addLayout(formLayout);
|
||||||
|
mainLayout->addWidget(saveButton);
|
||||||
|
|
||||||
|
settingsWindow->setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction *openSettings = menu->addAction("Settings");
|
||||||
|
QObject::connect(
|
||||||
|
openSettings,
|
||||||
|
&QAction::triggered,
|
||||||
|
[settingsWindow]() {
|
||||||
|
settingsWindow->show();
|
||||||
|
});
|
||||||
|
|
||||||
menuBar->addMenu(menu);
|
menuBar->addMenu(menu);
|
||||||
|
|
||||||
window.setMenuBar(menuBar);
|
window.setMenuBar(menuBar);
|
||||||
|
|||||||
Reference in New Issue
Block a user