mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
some non functional tests
This commit is contained in:
@@ -98,7 +98,6 @@ Mdem *editMdem;
|
||||
QLabel *membaseLabel;
|
||||
QLabel *mdemLabel;
|
||||
QLabel *lastPracticeLabel;
|
||||
|
||||
QMainWindow *trainWindow;
|
||||
|
||||
void showBacklabels(Mdem *mdem) {
|
||||
@@ -115,17 +114,15 @@ void showBacklabels(Mdem *mdem) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string outputMdem(std::vector<Question*> questions, time_t time = 0) {
|
||||
std::string outputMdem(
|
||||
std::vector<Question*> questions,
|
||||
time_t time = 0,
|
||||
const int wrap_width = 80,
|
||||
const int timezoneOffset = 0
|
||||
) {
|
||||
std::stringstream ss;
|
||||
|
||||
int wrap_width = 80;
|
||||
if (settings->contains(SETTING_CHARACTER_WRAP)) {
|
||||
wrap_width = settings->value(SETTING_CHARACTER_WRAP).toInt();
|
||||
}
|
||||
|
||||
if (time > 0) {
|
||||
auto timezoneOffset = settings->value(SETTING_TIMEZONE).toInt();
|
||||
/*time = time + 3600 * timezoneOffset;*/
|
||||
std::tm* tm = std::localtime(&time);
|
||||
char buffer[100];
|
||||
std::strftime(buffer, sizeof(buffer), "%d.%m.%Y %H\\:%M", tm);
|
||||
@@ -342,9 +339,13 @@ Mdem* makeMdem() {
|
||||
[mdem]() {
|
||||
editMdem = mdem;
|
||||
if (mdem->question) {
|
||||
int wrap_width = 80;
|
||||
if (settings->contains(SETTING_CHARACTER_WRAP)) {
|
||||
wrap_width = settings->value(SETTING_CHARACTER_WRAP).toInt();
|
||||
}
|
||||
editor->setText(
|
||||
QString::fromStdString(
|
||||
outputMdem(std::vector<Question*>{mdem->question})
|
||||
outputMdem(std::vector<Question*>{mdem->question}, 0, wrap_width)
|
||||
)
|
||||
);
|
||||
editorWindow->show();
|
||||
@@ -771,7 +772,21 @@ void saveMdem() {
|
||||
|
||||
auto filename = getFilename(currentMdem);
|
||||
std::ofstream out(currentMdem);
|
||||
out << outputMdem(currentMdemBuffer->questions, currentMdemBuffer->trainedAt);
|
||||
|
||||
int wrap_width = 80;
|
||||
if (settings->contains(SETTING_CHARACTER_WRAP)) {
|
||||
wrap_width = settings->value(SETTING_CHARACTER_WRAP).toInt();
|
||||
}
|
||||
int timezoneOffset = 0;
|
||||
if (settings->contains(SETTING_TIMEZONE)) {
|
||||
timezoneOffset = settings->value(SETTING_TIMEZONE).toInt();
|
||||
}
|
||||
out << outputMdem(
|
||||
currentMdemBuffer->questions,
|
||||
currentMdemBuffer->trainedAt,
|
||||
wrap_width,
|
||||
timezoneOffset
|
||||
);
|
||||
updateMdemInfo(getFilename(currentMdem), false);
|
||||
end = std::chrono::high_resolution_clock::now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user