Skip to content

Commit

Permalink
Merge branch 'master' into master_fork_travis
Browse files Browse the repository at this point in the history
  • Loading branch information
c72578 committed Jul 10, 2018
2 parents 3b44f51 + 770551f commit 0521278
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
3 changes: 3 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename T>
static T Read(const std::string& key, T defval)
Expand Down
29 changes: 29 additions & 0 deletions src/edframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<wxMessageDialog> 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 [email protected] to help improve them."));
err->ShowWindowModalThenDo([err](int){});
}
}

void PoeditFrame::OnCopyFromSingular(wxCommandEvent&)
{
m_editingArea->CopyFromSingular();
Expand Down
1 change: 1 addition & 0 deletions src/edframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 9 additions & 4 deletions src/resources/menus.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,13 @@
<object class="wxMenu" name="menu_view">
<label>_View</label>
<object class="wxMenuItem" name="menu_ids">
<label platform="win">Display entry _IDs</label>
<label platform="unix|mac">Display Entry _IDs</label>
<label platform="win">Show string _ID</label>
<label platform="unix|mac">Show String _ID</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="menu_warnings">
<label platform="win">Show warnings</label>
<label platform="unix|mac">Show Warnings</label>
<checkable>1</checkable>
</object>
<object class="separator"/>
Expand Down Expand Up @@ -216,8 +221,8 @@
<label>C_atalog</label>
<style>wxMENU_TEAROFF</style>
<object class="wxMenuItem" name="menu_update_from_src">
<label platform="win">_Update from sources</label>
<label platform="unix|mac">_Update from Sources</label>
<label platform="win">_Update from source code</label>
<label platform="unix|mac">_Update from Source Code</label>
</object>
<object class="wxMenuItem" name="menu_update_from_pot">
<label platform="win">Update from _POT file…</label>
Expand Down
7 changes: 4 additions & 3 deletions src/resources/toolbar.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<label>Save</label>
<tooltip>Save catalog</tooltip>
</object>
<object class="separator" platform="unix"/>
<object class="separator" platform="win"/>

<object class="separator" platform="unix|win"/>

<object class="tool" name="menu_validate">
<bitmap stock_id="poedit-validate"/>
Expand All @@ -42,7 +42,8 @@
<object class="tool" name="toolbar_update">
<bitmap stock_id="poedit-update"/>
<bitmap2 platform="win" stock_id="poedit-update@disabled"/>
<label>Update</label>
<label platform="win">Update from code</label>
<label platform="mac|unix">Update from Code</label>
<tooltip>Update catalog - synchronize it with sources</tooltip>
</object>

Expand Down
2 changes: 1 addition & 1 deletion src/wx/main_toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit 0521278

Please sign in to comment.