diff --git a/src/catalog.cpp b/src/catalog.cpp index 748aee0a86..ae924908e7 100644 --- a/src/catalog.cpp +++ b/src/catalog.cpp @@ -2092,7 +2092,9 @@ Catalog::ValidationResults Catalog::DoValidate(const wxString& po_file) i->ClearIssue(); res.errors = (int)err.size(); - res.warnings = QAChecker::GetFor(*this)->Check(*this); + + if (Config::ShowWarnings()) + res.warnings = QAChecker::GetFor(*this)->Check(*this); for ( GettextErrors::const_iterator i = err.begin(); i != err.end(); ++i ) { diff --git a/src/configuration.h b/src/configuration.h index 780e56e65a..99a7036ae5 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -64,6 +64,9 @@ class Config static ::MergeBehavior MergeBehavior(); static void MergeBehavior(::MergeBehavior b); + static bool ShowWarnings() { return Read("/show_warnings", true); } + static void ShowWarnings(bool show) { Write("/show_warnings", show); } + private: template static T Read(const std::string& key, T defval) diff --git a/src/edframe.cpp b/src/edframe.cpp index bfb4a04036..c63603595d 100644 --- a/src/edframe.cpp +++ b/src/edframe.cpp @@ -302,6 +302,7 @@ BEGIN_EVENT_TABLE(PoeditFrame, wxFrame) EVT_MENU (XRCID("menu_purge_deleted"), PoeditFrame::OnPurgeDeleted) EVT_MENU (XRCID("menu_fuzzy"), PoeditFrame::OnFuzzyFlag) EVT_MENU (XRCID("menu_ids"), PoeditFrame::OnIDsFlag) + EVT_MENU (XRCID("menu_warnings"), PoeditFrame::OnToggleWarnings) EVT_MENU (XRCID("sort_by_order"), PoeditFrame::OnSortByFileOrder) EVT_MENU (XRCID("sort_by_source"), PoeditFrame::OnSortBySource) EVT_MENU (XRCID("sort_by_translation"), PoeditFrame::OnSortByTranslation) @@ -514,6 +515,7 @@ PoeditFrame::PoeditFrame() : m_toolbar = MainToolbar::Create(this); GetMenuBar()->Check(XRCID("menu_ids"), m_displayIDs); + GetMenuBar()->Check(XRCID("menu_warnings"), Config::ShowWarnings()); if (wxConfigBase::Get()->ReadBool("/statusbar_shown", true)) CreateStatusBar(1, wxST_SIZEGRIP); @@ -1950,6 +1952,33 @@ void PoeditFrame::OnIDsFlag(wxCommandEvent&) m_list->SetDisplayLines(m_displayIDs); } +void PoeditFrame::OnToggleWarnings(wxCommandEvent& e) +{ + bool enable = (bool)e.GetInt(); + Config::ShowWarnings(enable); + + // refresh display of items in the window: + if (m_catalog) + { + m_catalog->Validate(); + if (m_list && m_list->sortOrder().errorsFirst) + m_list->Sort(); + } + + if (!enable) + { + wxWindowPtr err(new wxMessageDialog + ( + this, + _("Warnings have been disabled."), + "Poedit", + wxOK + )); + err->SetExtendedMessage(_("If you disabled the warnings because of excessive false positives, please consider sending a sample file to help@poedit.net to help improve them.")); + err->ShowWindowModalThenDo([err](int){}); + } +} + void PoeditFrame::OnCopyFromSingular(wxCommandEvent&) { m_editingArea->CopyFromSingular(); diff --git a/src/edframe.h b/src/edframe.h index cad378e558..3ac7ca97f1 100644 --- a/src/edframe.h +++ b/src/edframe.h @@ -282,6 +282,7 @@ class PoeditFrame : public PoeditFrameBase void OnRightClick(wxCommandEvent& event); void OnFuzzyFlag(wxCommandEvent& event); void OnIDsFlag(wxCommandEvent& event); + void OnToggleWarnings(wxCommandEvent& event); void OnCopyFromSource(wxCommandEvent& event); void OnCopyFromSingular(wxCommandEvent& event); void OnClearTranslation(wxCommandEvent& event); diff --git a/src/resources/menus.xrc b/src/resources/menus.xrc index 83cb020edc..17ea6004d6 100644 --- a/src/resources/menus.xrc +++ b/src/resources/menus.xrc @@ -156,8 +156,13 @@ - - + + + 1 + + + + 1 @@ -216,8 +221,8 @@ - - + + diff --git a/src/resources/toolbar.xrc b/src/resources/toolbar.xrc index cc524ae606..201d9f6777 100644 --- a/src/resources/toolbar.xrc +++ b/src/resources/toolbar.xrc @@ -29,8 +29,8 @@ Save catalog - - + + @@ -42,7 +42,8 @@ - + + Update catalog - synchronize it with sources diff --git a/src/wx/main_toolbar.cpp b/src/wx/main_toolbar.cpp index 86f3d08e2d..c975df600b 100644 --- a/src/wx/main_toolbar.cpp +++ b/src/wx/main_toolbar.cpp @@ -80,7 +80,7 @@ class WXMainToolbar : public MainToolbar } else { - tool->SetLabel(_("Update")); + tool->SetLabel(MSW_OR_OTHER(_("Update from code"), _("Update from Code"))); tool->SetShortHelp(_("Update catalog - synchronize it with sources")); m_tb->SetToolNormalBitmap(m_idUpdate, wxArtProvider::GetBitmap("poedit-update", wxART_TOOLBAR)); #ifdef __WXMSW__