#include "mainwindow.h" #include "apiform.h" #include "utils.h" #include #include #include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QApplication::setStyle("Fusion"); 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."); } } catch (const std::exception &e) { QMessageBox::critical(nullptr, "Ошибка", "Произошла ошибка: " + QString::fromStdString(e.what())); return 1; } return a.exec(); }