From f5221a8565f1b3ebff63f27ba2ab1c3cffeae761 Mon Sep 17 00:00:00 2001 From: Blake-Madden <66873089+Blake-Madden@users.noreply.github.com> Date: Sun, 18 Aug 2024 08:45:22 -0400 Subject: [PATCH] Make progress bar cancelable --- src/gui/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 03e012a..9158f6c 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -118,7 +118,7 @@ void I18NFrame::InitControls() //------------------------------------------------------ void I18NFrame::OnNew([[maybe_unused]] wxCommandEvent& event) { - std::wstring inputFolder = L"C:\\Users\\madin\\source\\wxWidgets\\samples"; + std::wstring inputFolder; // paths being ignored const auto excludedInfo = i18n_check::get_paths_files_to_exclude(inputFolder, std::vector{}); @@ -155,11 +155,12 @@ void I18NFrame::OnNew([[maybe_unused]] wxCommandEvent& event) wxNumberFormatter::ToString(fileCount, 0, wxNumberFormatter::Style::Style_NoTrailingZeroes | wxNumberFormatter::Style::Style_WithThousandsSep))); - if (!progressDlg.Update(currentFileIndex, - wxString::Format(_(L"Reviewing %s"), file.c_str()))) + if (!progressDlg.Update(currentFileIndex, wxString::Format(_(L"Reviewing %s..."), + wxFileName{ file }.GetFullName()))) { - return; + return false; } + return true; }); const std::wstringstream report = format_results(cpp, rc, po, filesThatShouldBeConvertedToUTF8,