From 05b674306d5cfbfa521150195ad9560b3d9689cb Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 28 Feb 2015 22:22:38 +0100 Subject: [PATCH] Fixed issue #2441: A way to disable the sound that is played on errors Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 4 ++++ src/Changelog.txt | 3 +++ src/Resources/TortoiseProcENG.rc | 35 ++++++++++++++++--------------- src/TortoiseProc/GitProgressList.cpp | 11 ++++++---- src/TortoiseProc/ProgressDlg.cpp | 5 +++-- src/TortoiseProc/Settings/SetDialogs2.cpp | 9 +++++++- src/TortoiseProc/Settings/SetDialogs2.h | 4 +++- src/TortoiseProc/SyncDlg.cpp | 5 +++-- src/TortoiseProc/resource.h | 1 + 9 files changed, 50 insertions(+), 27 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index dd786fb50..8436edcd1 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -3704,6 +3704,10 @@ msgstr "" msgid "Directory:" msgstr "" +#. Resource IDs: (1796) +msgid "Disable sounds" +msgstr "" + #. Resource IDs: (195) msgid "Disable this option if you have really big working trees and experience\r\ntoo much disk access when browsing the working tree." msgstr "" diff --git a/src/Changelog.txt b/src/Changelog.txt index dfdb35891..f66aba2be 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -1,6 +1,9 @@ = Release 1.8.14.0 = Released: Unreleased +== Features == + * Fixed issue #2441: A way to disable the sound that is played on errors + == Bug Fixes == * Fixed issue #2427: "Submodule of Project: " cannot be localized * Fixed issue #2432: MessageBox buttons cannot be localized diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 392243301..2a41f90e0 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -723,38 +723,39 @@ BEGIN CONTROL "Always show long format",IDC_DESCRIBEALWAYSLONG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,186,120,10 END -IDD_SETTINGSDIALOGS2 DIALOGEX 0, 0, 301, 231 +IDD_SETTINGSDIALOGS2 DIALOGEX 0, 0, 301, 244 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "General::Dialogs 2" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Misc",IDC_STATIC,7,8,287,108 + GROUPBOX "Misc",IDC_STATIC,7,8,287,122 LTEXT "&Autoclose Git.exe dialog:",IDC_STATIC,14,16,85,16,SS_CENTERIMAGE COMBOBOX IDC_AUTOCLOSECOMBO,107,18,177,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Use recycle bin when reverting",IDC_USERECYCLEBIN, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,34,270,10 CONTROL "Confirm to kill running git process",IDC_CONFIRMKILLPROCESS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,121,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,270,10 CONTROL "Randomize Sync Dialog startup position",IDC_SYNCDIALOGRANDOMPOS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,141,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,270,10 CONTROL "Hide unchanged refs in Ref Compare List",IDC_REFCOMPAREHIDEUNCHANGED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,73,193,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,73,270,10 CONTROL "Show git.exe execution timings and timestamp",IDC_PROGRESSDLG_SHOW_TIMES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,87,193,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,87,270,10 CONTROL "Sort tag list in reversed order",IDC_SORTTAGSREVERSED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,101,135,10 - GROUPBOX "Commit",IDC_COMMITGROUP,7,121,287,103 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,101,270,10 + CONTROL "Disable sounds",IDC_NOSOUNDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,115,270,10 + GROUPBOX "Commit",IDC_COMMITGROUP,7,134,287,103 CONTROL "&Use auto-completion of file paths and keywords",IDC_AUTOCOMPLETION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,133,271,10 - LTEXT "&Timeout in seconds to stop the auto-completion parsing",IDC_AUTOCOMPLETIONTIMEOUTLABEL,14,149,231,8,SS_NOTIFY - EDITTEXT IDC_AUTOCOMPLETIONTIMEOUT,252,148,31,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT - LTEXT "Max. items to keep in the log message history",IDC_MAXHISTORYLABEL,14,166,226,8,SS_NOTIFY - EDITTEXT IDC_MAXHISTORY,252,163,31,14,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,145,271,10 + LTEXT "&Timeout in seconds to stop the auto-completion parsing",IDC_AUTOCOMPLETIONTIMEOUTLABEL,14,161,231,8,SS_NOTIFY + EDITTEXT IDC_AUTOCOMPLETIONTIMEOUT,252,161,31,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT + LTEXT "Max. items to keep in the log message history",IDC_MAXHISTORYLABEL,14,179,226,8,SS_NOTIFY + EDITTEXT IDC_MAXHISTORY,252,176,31,14,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "Select items automatically",IDC_SELECTFILESONCOMMIT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,180,238,10 - CONTROL "Strip lines starting with ""#"" in commit message",IDC_STRIPCOMMENTEDLINES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,193,270,10 - LTEXT "Further options for the commit dialog are on Dialogs 3 page.",IDC_STATIC,14,207,270,9 + CONTROL "Strip lines starting with ""#"" in commit message",IDC_STRIPCOMMENTEDLINES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,206,270,10 + LTEXT "Further options for the commit dialog are on Dialogs 3 page.",IDC_STATIC,14,219,270,9 END IDD_RESOLVE DIALOGEX 0, 0, 289, 154 @@ -2409,7 +2410,7 @@ BEGIN VERTGUIDE, 272 VERTGUIDE, 284 TOPMARGIN, 7 - BOTTOMMARGIN, 224 + BOTTOMMARGIN, 237 END IDD_RESOLVE, DIALOG diff --git a/src/TortoiseProc/GitProgressList.cpp b/src/TortoiseProc/GitProgressList.cpp index 139f1034b..339e7c974 100644 --- a/src/TortoiseProc/GitProgressList.cpp +++ b/src/TortoiseProc/GitProgressList.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // Copyright (C) 2003-2008 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -388,20 +388,23 @@ void CGitProgressList::ReportUserCanceled() void CGitProgressList::ReportError(const CString& sError) { - PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); + if (CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE) == FALSE) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); ReportString(sError, CString(MAKEINTRESOURCE(IDS_ERR_ERROR)), m_Colors.GetColor(CColors::Conflict)); m_bErrorsOccurred = true; } void CGitProgressList::ReportWarning(const CString& sWarning) { - PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ALIAS_ID | SND_ASYNC); + if (CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE) == FALSE) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ALIAS_ID | SND_ASYNC); ReportString(sWarning, CString(MAKEINTRESOURCE(IDS_WARN_WARNING)), m_Colors.GetColor(CColors::Conflict)); } void CGitProgressList::ReportNotification(const CString& sNotification) { - PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ALIAS_ID | SND_ASYNC); + if (CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE) == FALSE) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ALIAS_ID | SND_ASYNC); ReportString(sNotification, CString(MAKEINTRESOURCE(IDS_WARN_NOTE))); } diff --git a/src/TortoiseProc/ProgressDlg.cpp b/src/TortoiseProc/ProgressDlg.cpp index 48a7e8ce4..ca4a96d78 100644 --- a/src/TortoiseProc/ProgressDlg.cpp +++ b/src/TortoiseProc/ProgressDlg.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -395,7 +395,8 @@ LRESULT CProgressDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam) else err.Format(_T("\r\n\r\n%s\r\n"), log); InsertColorText(this->m_Log, err, RGB(255,0,0)); - PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); + if (CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE) == FALSE) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); } else { if (m_pTaskbarList) diff --git a/src/TortoiseProc/Settings/SetDialogs2.cpp b/src/TortoiseProc/Settings/SetDialogs2.cpp index 1dd815217..4bbe98aab 100644 --- a/src/TortoiseProc/Settings/SetDialogs2.cpp +++ b/src/TortoiseProc/Settings/SetDialogs2.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // Copyright (C) 2003-2008 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -38,6 +38,7 @@ CSetDialogs2::CSetDialogs2() , m_dwMaxHistory(25) , m_bAutoSelect(TRUE) , m_bShowGitexeTimings(TRUE) + , m_bNoSounds(FALSE) { m_regAutoCloseGitProgress = CRegDWORD(_T("Software\\TortoiseGit\\AutoCloseGitProgress")); m_regUseRecycleBin = CRegDWORD(_T("Software\\TortoiseGit\\RevertWithRecycleBin"), TRUE); @@ -61,6 +62,8 @@ CSetDialogs2::CSetDialogs2() m_bStripCommentedLines = (BOOL)(DWORD)m_regStripCommentedLines; m_regShowGitexeTimings = CRegDWORD(_T("Software\\TortoiseGit\\ShowGitexeTimings"), TRUE); m_bShowGitexeTimings = (BOOL)(DWORD)m_regShowGitexeTimings; + m_regNoSounds = CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE); + m_bNoSounds = (BOOL)(DWORD)m_regNoSounds; } CSetDialogs2::~CSetDialogs2() @@ -84,6 +87,7 @@ void CSetDialogs2::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_SELECTFILESONCOMMIT, m_bAutoSelect); DDX_Check(pDX, IDC_STRIPCOMMENTEDLINES, m_bStripCommentedLines); DDX_Check(pDX, IDC_PROGRESSDLG_SHOW_TIMES, m_bShowGitexeTimings); + DDX_Check(pDX, IDC_NOSOUNDS, m_bNoSounds); } BEGIN_MESSAGE_MAP(CSetDialogs2, ISettingsPropPage) @@ -99,6 +103,7 @@ BEGIN_MESSAGE_MAP(CSetDialogs2, ISettingsPropPage) ON_BN_CLICKED(IDC_SELECTFILESONCOMMIT, OnChange) ON_BN_CLICKED(IDC_STRIPCOMMENTEDLINES, OnChange) ON_BN_CLICKED(IDC_PROGRESSDLG_SHOW_TIMES, OnChange) + ON_BN_CLICKED(IDC_NOSOUNDS, OnChange) END_MESSAGE_MAP() // CSetDialogs2 message handlers @@ -115,6 +120,7 @@ BOOL CSetDialogs2::OnInitDialog() AdjustControlSize(IDC_SELECTFILESONCOMMIT); AdjustControlSize(IDC_STRIPCOMMENTEDLINES); AdjustControlSize(IDC_PROGRESSDLG_SHOW_TIMES); + AdjustControlSize(IDC_NOSOUNDS); EnableToolTips(); @@ -180,6 +186,7 @@ BOOL CSetDialogs2::OnApply() Store(m_bAutoSelect, m_regAutoSelect); Store(m_bStripCommentedLines, m_regStripCommentedLines); Store(m_bShowGitexeTimings, m_regShowGitexeTimings); + Store(m_bNoSounds, m_regNoSounds); SetModified(FALSE); return ISettingsPropPage::OnApply(); diff --git a/src/TortoiseProc/Settings/SetDialogs2.h b/src/TortoiseProc/Settings/SetDialogs2.h index f216dd3f0..b6c0a8193 100644 --- a/src/TortoiseProc/Settings/SetDialogs2.h +++ b/src/TortoiseProc/Settings/SetDialogs2.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2011-2014 - TortoiseGit +// Copyright (C) 2011-2015 - TortoiseGit // Copyright (C) 2003-2008, 2013 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -79,4 +79,6 @@ private: BOOL m_bStripCommentedLines; CRegDWORD m_regShowGitexeTimings; BOOL m_bShowGitexeTimings; + CRegDWORD m_regNoSounds; + BOOL m_bNoSounds; }; diff --git a/src/TortoiseProc/SyncDlg.cpp b/src/TortoiseProc/SyncDlg.cpp index fcd35f0d7..a9f65a560 100644 --- a/src/TortoiseProc/SyncDlg.cpp +++ b/src/TortoiseProc/SyncDlg.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2014 - TortoiseGit +// Copyright (C) 2008-2015 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -1237,7 +1237,8 @@ LRESULT CSyncDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam) CString err; err.Format(_T("\r\n\r\n%s (%lu ms @ %s)\r\n"), log, tickSpent, strEndTime); CProgressDlg::InsertColorText(this->m_ctrlCmdOut, err, RGB(255,0,0)); - PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); + if (CRegDWORD(_T("Software\\TortoiseGit\\NoSounds"), FALSE) == FALSE) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID | SND_ASYNC); } else { diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 0bb0c2a3f..ab5dfe590 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1513,6 +1513,7 @@ #define IDC_EDIT_PUSHURL 1794 #define IDC_SORTTAGSREVERSED 1795 #define IDC_STATIC_FORCE 1796 +#define IDC_NOSOUNDS 1796 #define IDC_OPENCERT 1797 #define IDC_ERRORDESC 1798 #define IDC_ERROR 1799 -- 2.11.4.GIT