mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
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 <neolit123@gmail.com>
This commit is contained in:
parent
f2911f64ba
commit
a8fbceac17
3 changed files with 11 additions and 4 deletions
|
@ -148,14 +148,18 @@ const char *monthname(int mon)
|
|||
*/
|
||||
bool imported = false;
|
||||
|
||||
static void print_version()
|
||||
bool version_printed = false;
|
||||
void print_version()
|
||||
{
|
||||
if (version_printed)
|
||||
return;
|
||||
printf("Subsurface v%s,\n", subsurface_git_version());
|
||||
printf("built with libdivecomputer v%s\n", dc_version(NULL));
|
||||
print_qt_versions();
|
||||
int git_maj, git_min, git_rev;
|
||||
git_libgit2_version(&git_maj, &git_min, &git_rev);
|
||||
printf("built with libgit2 %d.%d.%d\n", git_maj, git_min, git_rev);
|
||||
version_printed = true;
|
||||
}
|
||||
|
||||
void print_files()
|
||||
|
|
|
@ -19,6 +19,7 @@ void parse_argument(const char *arg);
|
|||
void free_prefs(void);
|
||||
void copy_prefs(struct preferences *src, struct preferences *dest);
|
||||
void print_files(void);
|
||||
void print_version(void);
|
||||
|
||||
extern char *settings_suffix;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue