Use Application::getExecutableName() instead of Config()["ExeName"]

This commit is contained in:
wmayer
2025-05-10 17:05:11 +02:00
committed by Ladislav Michl
parent 4f116d8de3
commit cda2b8cbdb
8 changed files with 17 additions and 18 deletions

View File

@@ -104,7 +104,7 @@ static bool inGuiMode()
static void displayInfo(const QString& msg, bool preformatted = true)
{
if (inGuiMode()) {
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString appName = QString::fromStdString(App::Application::getExecutableName());
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setWindowTitle(appName);
@@ -120,7 +120,7 @@ static void displayInfo(const QString& msg, bool preformatted = true)
static void displayCritical(const QString& msg, bool preformatted = true)
{
if (inGuiMode()) {
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString appName = QString::fromStdString(App::Application::getExecutableName());
QString title = QObject::tr("Initialization of %1 failed").arg(appName);
QString text = preformatted ? QStringLiteral("<pre>%1</pre>").arg(msg) : msg;
QMessageBox::critical(nullptr, title, text);
@@ -278,7 +278,7 @@ int main(int argc, char** argv)
catch (const Base::Exception& e) {
// Popup an own dialog box instead of that one of Windows
QApplication app(argc, argv);
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString appName = QString::fromStdString(App::Application::getExecutableName());
QString msg;
msg = QObject::tr(
"While initializing %1 the following exception occurred: '%2'\n\n"
@@ -312,7 +312,7 @@ int main(int argc, char** argv)
catch (...) {
// Popup an own dialog box instead of that one of Windows
QApplication app(argc, argv);
QString appName = QString::fromStdString(App::Application::Config()["ExeName"]);
QString appName = QString::fromStdString(App::Application::getExecutableName());
QString msg = QObject::tr(
"Unknown runtime error occurred while initializing %1.\n\n"
"Please contact the application's support team for more information.\n\n"
@@ -359,12 +359,12 @@ int main(int argc, char** argv)
std::cerr.rdbuf(oldcerr);
// Destruction phase ===========================================================
Base::Console().log("%s terminating...\n", App::Application::Config()["ExeName"].c_str());
Base::Console().log("%s terminating...\n", App::Application::getExecutableName().c_str());
// cleans up
App::Application::destruct();
Base::Console().log("%s completely terminated\n", App::Application::Config()["ExeName"].c_str());
Base::Console().log("%s completely terminated\n", App::Application::getExecutableName().c_str());
return 0;
}