Reorder startup sequence to display debug information early

This commit is contained in:
Jonathan White 2021-04-04 09:03:48 -04:00
parent 80809ace67
commit ed0ece304d

View File

@ -96,6 +96,14 @@ int main(int argc, char** argv)
return EXIT_SUCCESS;
}
// Show debug information and then exit
if (parser.isSet(debugInfoOption)) {
QTextStream out(stdout, QIODevice::WriteOnly);
QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo());
out << debugInfo << endl;
return EXIT_SUCCESS;
}
// Process config file options early
if (parser.isSet(configOption) || parser.isSet(localConfigOption)) {
Config::createConfigFromFile(parser.value(configOption), parser.value(localConfigOption));
@ -111,15 +119,6 @@ int main(int argc, char** argv)
return EXIT_SUCCESS;
}
// Apply the configured theme before creating any GUI elements
app.applyTheme();
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
#endif
Application::bootstrap();
if (!Crypto::init()) {
QString error = QObject::tr("Fatal error while testing the cryptographic functions.");
error.append("\n");
@ -128,14 +127,14 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
// Displaying the debugging informations must be done after Crypto::init,
// to make sure we know which libgcrypt version is used.
if (parser.isSet(debugInfoOption)) {
QTextStream out(stdout, QIODevice::WriteOnly);
QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo());
out << debugInfo << endl;
return EXIT_SUCCESS;
}
// Apply the configured theme before creating any GUI elements
app.applyTheme();
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
#endif
Application::bootstrap();
MainWindow mainWindow;