diff --git a/icon.svg b/icon.svg
index 8c1fa09..4eae187 100644
--- a/icon.svg
+++ b/icon.svg
@@ -9,6 +9,9 @@
id="svg1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="icon.svg"
+ inkscape:export-filename="icon.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
@@ -24,9 +27,9 @@
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showguides="true"
- inkscape:zoom="0.64375976"
- inkscape:cx="342.51908"
- inkscape:cy="653.97067"
+ inkscape:zoom="0.84246729"
+ inkscape:cx="162.02409"
+ inkscape:cy="522.27547"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
diff --git a/main.cpp b/main.cpp
index 8ea9762..abfbb71 100644
--- a/main.cpp
+++ b/main.cpp
@@ -43,9 +43,17 @@ int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QTranslator translator;
- if(!translator.load(QLocale::system().name())) {
- translator.load("en_US");
+ QString lang = "en_US";
+
+ if (s.get_all_settings().contains("language")) {
+ lang = QString::fromStdString(s.get_all_settings()["language"]);
+ } else if (translator.load(QLocale::system().name())) {
+ lang = QLocale::system().name();
+ } else {
+ lang = QString::fromStdString("en_US");
}
+ translator.load(lang);
+
a.installTranslator(&translator);
MainWindow w;
w.update();
diff --git a/mainwindow.ui b/mainwindow.ui
index 5c5bad0..f4ebd1e 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -110,7 +110,7 @@
- 0
+ 10
0
80
26
diff --git a/settings/settings.cpp b/settings/settings.cpp
index d4f2513..bdfa92b 100644
--- a/settings/settings.cpp
+++ b/settings/settings.cpp
@@ -26,6 +26,7 @@ Settings::Settings(std::string path) {
"stores_modules_url":"https://foxarmy.org/checks-parser/modules/stores/",
"print_header": true,
"print_total": true,
+ "language":"en_US",
"output_order": {
"goods_name": {
"position":1,
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index d27f6bf..4c06072 100644
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -3,6 +3,8 @@
#include "ui_settingsdialog.h"
#include "utils/utils.h"
+#include
+
SettingsDialog::SettingsDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::settingsdialog),
settings(Settings(get_path_relative_to_home(
@@ -32,6 +34,9 @@ SettingsDialog::SettingsDialog(QWidget *parent)
ui->printHeaderCheckBox->setChecked(this->settings.get_all_settings()["print_header"]);
ui->printTotalCheckBox->setChecked(this->settings.get_all_settings()["print_total"]);
+
+ int index = ui->languageComboBox->findText(QString::fromStdString(this->settings.get_all_settings()["language"]));
+ ui->languageComboBox->setCurrentIndex(index);
}
SettingsDialog::~SettingsDialog() { delete ui; }
@@ -121,4 +126,14 @@ void SettingsDialog::on_buttonBox_accepted() { this->settings.flush(); }
void SettingsDialog::on_buttonBox_rejected() { this->close(); }
+void SettingsDialog::on_languageComboBox_currentTextChanged(const QString &changed) {
+ if (changed == QString::fromStdString(this->settings.get_all_settings()["language"])) return;
+ this->settings.get_all_settings()["language"] = changed.toStdString();
+
+ QMessageBox infoDialog;
+ infoDialog.setText(tr("You need to restart program to apply language changes"));
+ infoDialog.setIcon(QMessageBox::Information);
+ infoDialog.setWindowTitle(tr("Restart required"));
+ infoDialog.exec();
+}
diff --git a/settingsdialog.h b/settingsdialog.h
index 7eade0e..d3aceb6 100644
--- a/settingsdialog.h
+++ b/settingsdialog.h
@@ -52,6 +52,8 @@ private slots:
void on_buttonBox_rejected();
+ void on_languageComboBox_currentTextChanged(const QString &arg1);
+
private:
Ui::settingsdialog *ui;
};
diff --git a/settingsdialog.ui b/settingsdialog.ui
index c6379b8..a239e0f 100644
--- a/settingsdialog.ui
+++ b/settingsdialog.ui
@@ -7,7 +7,7 @@
0
0
599
- 727
+ 799
@@ -17,16 +17,16 @@
310
- 690
+ 740
251
32
- Qt::Orientation::Horizontal
+ Qt::Horizontal
- QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Save
+ QDialogButtonBox::Cancel|QDialogButtonBox::Save
@@ -35,7 +35,7 @@
10
0
541
- 661
+ 741
@@ -47,7 +47,7 @@
0
0
539
- 659
+ 739
@@ -56,16 +56,126 @@
0
0
531
- 651
+ 731
- -
-
+
-
+
+
+
+
+
+
+ -
+
+
+ Goods net weight position
+
+
+
+ -
+
+
+ -
+
+
+ Stores modules url
+
+
+
+ -
+
+
+ Goods quantity position
+
+
+
+ -
+
+
+ -
+
+
+ OFD modules url
+
+
+
+ -
+
+
+ Print header
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Goods quantity alias
+
+
+
+ -
+
+
+ OFD modules directory
+
+
+
+ -
+
+
+ -
+
+
+ Print total
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Goods net weight alias
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Goods total alias
+
+
-
+ -
+
+
+ -
+
+
+ -
+
+
-
@@ -73,6 +183,51 @@
+ -
+
+
+
+
+
+
+ -
+
+
+ Goods name alias
+
+
+
+ -
+
+
+ Goods price per unit position
+
+
+
+ -
+
+
+ Stores modules directory
+
+
+
+ -
+
+
+ Goods total position
+
+
+
+ -
+
+
+ Choose
+
+
+
+ -
+
+
-
@@ -87,159 +242,25 @@
- -
-
-
- -
-
+
-
+
- Print header
+ TextLabel
- -
-
-
- Goods net weight alias
-
-
-
- -
-
-
- Stores modules url
-
-
-
- -
-
-
- -
-
-
- Goods total alias
-
-
-
- -
-
-
- Goods name alias
-
-
-
- -
-
-
- -
-
-
- Goods quantity alias
-
-
-
- -
-
-
- Stores modules directory
-
-
-
- -
-
-
- -
-
-
- -
-
-
- OFD modules directory
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- Goods price per unit position
-
-
-
- -
-
-
- Goods net weight position
-
-
-
- -
-
-
- OFD modules url
-
-
-
- -
-
-
- -
-
-
- Goods total position
-
-
-
- -
-
-
- Goods quantity position
-
-
-
- -
-
-
- -
-
-
- -
-
-
- Choose
-
-
-
- -
-
-
- -
-
-
- Print total
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
+
-
+
+
-
+
+ en_US
+
+
+ -
+
+ ru_RU
+
+
diff --git a/translations/en_US.ts b/translations/en_US.ts
index dde4f5e..a6f47fb 100644
--- a/translations/en_US.ts
+++ b/translations/en_US.ts
@@ -308,6 +308,19 @@
Print total
+
+ SettingsDialog
+
+
+ You need to restart program to apply language changes
+ You need to restart program to apply language changes
+
+
+
+ Restart required
+ Restart required
+
+
SolveCaptchaDialog
@@ -334,88 +347,103 @@
Dialog
-
+
Goods name position
Goods name position
-
+
Goods price per unit alias
Goods price per unit alias
-
-
+
+ TextLabel
+ Language
+
+
+
+ en_US
+ en_US
+
+
+
+ ru_RU
+ ru_RU
+
+
+
+
Choose
Choose
-
+
Print header
Print header
-
+
Goods net weight alias
Goods net weight alias
-
+
Stores modules url
Stores modules url
-
+
Goods total alias
Goods total alias
-
+
Goods name alias
Goods name alias
-
+
Goods quantity alias
Goods quantity alias
-
+
Stores modules directory
Stores modules directory
-
+
OFD modules directory
OFD modules directory
-
+
Goods price per unit position
Goods price per unit position
-
+
Goods net weight position
Goods net weight position
-
+
OFD modules url
OFD modules url
-
+
Goods total position
Goods total position
-
+
Goods quantity position
Goods quantity position
-
+
Print total
Print total
diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts
index 5decfa3..cccbea1 100644
--- a/translations/ru_RU.ts
+++ b/translations/ru_RU.ts
@@ -304,6 +304,19 @@
Печатать Итого
+
+ SettingsDialog
+
+
+ You need to restart program to apply language changes
+ Требуется перезагрузить программу, чтобы применить изменения языка
+
+
+
+ Restart required
+ Требуется перезагрузка
+
+
SolveCaptchaDialog
@@ -330,88 +343,103 @@
Диалог
-
+
Goods name position
Позиция имени товара
-
+
Goods price per unit alias
Алиас цены товара
-
-
+
+ TextLabel
+ Язык
+
+
+
+ en_US
+ en_US
+
+
+
+ ru_RU
+ ru_RU
+
+
+
+
Choose
Выбрать
-
+
Print header
Печатать заголовок
-
+
Goods net weight alias
Алиас массы нетто товара
-
+
Stores modules url
URL модулей магазина
-
+
Goods total alias
Алиас всего за продукт
-
+
Goods name alias
Алиас имени товара
-
+
Goods quantity alias
Алиас количества товара
-
+
Stores modules directory
Директория модулей магазина
-
+
OFD modules directory
Директория модулей ОФД
-
+
Goods price per unit position
Позиция центы товара
-
+
Goods net weight position
Позиция массы нетто товара
-
+
OFD modules url
URL модулей ОФД
-
+
Goods total position
Позиция всего за товар
-
+
Goods quantity position
Позиция количества товара
-
+
Print total
Печатать Итого