From a8fbceac17784d67779cee97c556395e43af359e Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 15 Nov 2017 23:55:42 +0200 Subject: subsurface-startup: expose print_version() in the header The Windows auto-verbose + log file creation if starting from a non-terminal has the problem that the print_version() call is never made becase 'verbose' is updated programatically in windows.c and not by the user (by passing -v). To work around the issue: - move the windows console creation call before *everything* else - then immediatelly install the message handler - then see if 'verbose' is set and explicitly call print_version() print_version() now also has a flag (version_printed), to avoid printing the version multiple times, if the user decided to add an extra -v to the Desktop shortcut. Signed-off-by: Lubomir I. Ivanov --- subsurface-desktop-main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'subsurface-desktop-main.cpp') diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index 58da1fa43..5b8424487 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -33,18 +33,20 @@ static void messageHandler(QtMsgType type, const QMessageLogContext &ctx, const int main(int argc, char **argv) { + subsurface_console_init(); + qInstallMessageHandler(messageHandler); + if (verbose) /* print the version if the Win32 console_init() code enabled verbose. */ + print_version(); + int i; bool no_filenames = true; QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); - qInstallMessageHandler(messageHandler); QApplication *application = new QApplication(argc, argv); (void)application; QStringList files; QStringList importedFiles; QStringList arguments = QCoreApplication::arguments(); - subsurface_console_init(); - const char *default_directory = system_default_directory(); const char *default_filename = system_default_filename(); subsurface_mkdir(default_directory); -- cgit v1.2.3-70-g09d2