2024-11-24 09:48:52 +00:00
|
|
|
#include "mainwindow.h"
|
2025-01-07 22:13:48 +00:00
|
|
|
#include "apiform.h"
|
|
|
|
#include "utils.h"
|
2024-11-24 09:48:52 +00:00
|
|
|
|
|
|
|
#include <QApplication>
|
2025-01-07 22:13:48 +00:00
|
|
|
#include <QCoreApplication>
|
2024-11-24 09:48:52 +00:00
|
|
|
#include <QLocale>
|
|
|
|
#include <QTranslator>
|
2025-01-07 22:13:48 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QMessageBox>
|
2024-12-16 08:38:04 +00:00
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
2025-01-07 22:13:48 +00:00
|
|
|
try {
|
|
|
|
QTranslator translator;
|
|
|
|
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
|
|
|
for (const QString &locale : uiLanguages) {
|
|
|
|
const QString baseName = "FemaSoftware_" + QLocale(locale).name();
|
|
|
|
if (translator.load(":/i18n/" + baseName)) {
|
|
|
|
a.installTranslator(&translator);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiForm *apiForm = new ApiForm();
|
|
|
|
apiForm->exec();
|
|
|
|
|
|
|
|
if (!utils::API_URL.isEmpty()) {
|
|
|
|
MainWindow *mainWindow = new MainWindow();
|
|
|
|
mainWindow->show();
|
|
|
|
} else {
|
|
|
|
throw std::runtime_error("Invalid API URL or parameters.");
|
2024-11-24 09:48:52 +00:00
|
|
|
}
|
2025-01-07 22:13:48 +00:00
|
|
|
|
|
|
|
} catch (const std::exception &e) {
|
|
|
|
QMessageBox::critical(nullptr, "Ошибка", "Произошла ошибка: " + QString::fromStdString(e.what()));
|
|
|
|
return 1;
|
2024-11-24 09:48:52 +00:00
|
|
|
}
|
2025-01-07 22:13:48 +00:00
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
return a.exec();
|
|
|
|
}
|