From 7c4484881d802a4b4c4d72d7e5330953a9fd5c4f Mon Sep 17 00:00:00 2001 From: Matlo Date: Thu, 10 Mar 2016 21:23:29 +0100 Subject: [PATCH] Improve log file generation #372 --- launcher/gimx-launcher.cpp | 16 ++++++++++++++++ launcher/gimx-launcher.h | 1 + 2 files changed, 17 insertions(+) diff --git a/launcher/gimx-launcher.cpp b/launcher/gimx-launcher.cpp index 33e4642c..4973d89f 100644 --- a/launcher/gimx-launcher.cpp +++ b/launcher/gimx-launcher.cpp @@ -1262,6 +1262,8 @@ void launcherFrame::OnButtonStartClick(wxCommandEvent& event) MyProcess *process = new MyProcess(this, command); + startTime = wxGetUTCTime(); + if(!wxExecute(command, wxEXEC_ASYNC | wxEXEC_NOHIDE, process)) { wxMessageBox( _("can't start gimx!"), _("Error"), wxICON_ERROR); @@ -1294,6 +1296,20 @@ void launcherFrame::OnProcessTerminated(wxProcess *process, int status) wxExecute(wxT("xdg-open ") + gimxLogDir + wxT(LOG_FILE), wxEXEC_ASYNC, NULL); #endif } + else + { + long int endTime = wxGetUTCTime(); + if(endTime - startTime < 5) + { + int answer = wxMessageBox(_("GIMX ran less than 5 seconds. Would you like to generate a log report?"), _("Confirm"), wxYES_NO | wxCANCEL); + if (answer == wxYES) + { + ProcessOutputChoice->SetSelection(ProcessOutputChoice->FindString(_("log file"))); + wxCommandEvent event; + OnButtonStartClick(event); + } + } + } SetFocus(); } diff --git a/launcher/gimx-launcher.h b/launcher/gimx-launcher.h index d18f204d..3c71d802 100644 --- a/launcher/gimx-launcher.h +++ b/launcher/gimx-launcher.h @@ -181,6 +181,7 @@ class launcherFrame: public wxFrame wxLocale* locale; bool started; + long startTime; wxString userDir; wxString gimxConfigDir;