diff options
author | George Hazan <george.hazan@gmail.com> | 2023-07-31 14:23:12 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-07-31 14:23:12 +0300 |
commit | 706efa68cdcf9470362b98bf1a4b23f9aef74e4d (patch) | |
tree | ed53c836a0760e51ca07f627a2b2100fc2745d96 /plugins/TabSRMM/src | |
parent | 2a1a54d04cde0d40c2e59e91de9b6bf1fe040df8 (diff) |
code cleaning
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/userprefs.cpp | 37 |
2 files changed, 16 insertions, 23 deletions
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 293b4a0aec..1288c0c4e0 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -774,7 +774,7 @@ public: logOpts.AddOption(pwszSection, LPGENW("RTL is default text direction"), m_flags, MWF_LOG_RTL);
logOpts.AddOption(pwszSection, LPGENW("Use normal templates (uncheck to use simple templates if your template set supports them)"), m_flags, MWF_LOG_NORMALTEMPLATES);
- auto *pwszSection = LPGENW("Message log options");
+ pwszSection = LPGENW("Message log options");
logOpts.AddOption(pwszSection, LPGENW("Log status changes"), g_plugin.bLogStatusChanges);
logOpts.AddOption(pwszSection, LPGENW("Automatically copy selected text"), g_plugin.bAutoCopy);
logOpts.AddOption(pwszSection, LPGENW("Place a separator in the log after a window lost its foreground status"), g_plugin.bUseDividers);
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index f57df61ef9..944474d85a 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -177,12 +177,12 @@ public: // ALWAYS mask dat->dwFlags with MWF_LOG_ALL to only affect real flag bits and
// ignore temporary bits.
-static struct _checkboxes
+struct
{
UINT uId;
UINT uFlag;
}
-checkboxes[] = {
+static checkboxes[] = {
{ IDC_UPREFS_GRID, MWF_LOG_GRID },
{ IDC_UPREFS_SHOWICONS, MWF_LOG_SHOWICONS },
{ IDC_UPREFS_SHOWSYMBOLS, MWF_LOG_SYMBOLS },
@@ -196,7 +196,6 @@ checkboxes[] = { { IDC_UPREFS_BBCODE, MWF_LOG_BBCODE },
{ IDC_UPREFS_RTL, MWF_LOG_RTL },
{ IDC_UPREFS_NORMALTEMPLATES, MWF_LOG_NORMALTEMPLATES },
- { 0, 0 },
};
int CMsgDialog::LoadLocalFlags()
@@ -211,8 +210,8 @@ int CMsgDialog::LoadLocalFlags() else
m_dwFlags |= (dwGlobal & MWF_LOG_ALL);
- for (int i = 0; checkboxes[i].uId; i++) {
- uint32_t maskval = checkboxes[i].uFlag;
+ for (auto &it : checkboxes) {
+ uint32_t maskval = it.uFlag;
if (dwMask & maskval)
m_dwFlags = (dwLocal & maskval) ? m_dwFlags | maskval : m_dwFlags & ~maskval;
}
@@ -243,20 +242,16 @@ public: bool OnInitDialog() override
{
- uint32_t dwLocalFlags, dwLocalMask, maskval;
+ uint32_t dwLocalFlags = M.GetDword(m_hContact, "mwflags", 0);
+ uint32_t dwLocalMask = M.GetDword(m_hContact, "mwmask", 0);
- dwLocalFlags = M.GetDword(m_hContact, "mwflags", 0);
- dwLocalMask = M.GetDword(m_hContact, "mwmask", 0);
-
- int i = 0;
- while (checkboxes[i].uId) {
- maskval = checkboxes[i].uFlag;
+ for (auto &it : checkboxes) {
+ uint32_t maskval = it.uFlag;
if (dwLocalMask & maskval)
- CheckDlgButton(m_hwnd, checkboxes[i].uId, (dwLocalFlags & maskval) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, it.uId, (dwLocalFlags & maskval) ? BST_CHECKED : BST_UNCHECKED);
else
- CheckDlgButton(m_hwnd, checkboxes[i].uId, BST_INDETERMINATE);
- i++;
+ CheckDlgButton(m_hwnd, it.uId, BST_INDETERMINATE);
}
if (M.GetByte("logstatuschanges", 0) == M.GetByte(m_hContact, "logstatuschanges", 0))
@@ -268,20 +263,18 @@ public: bool OnApply() override
{
- uint32_t dwMask = 0, dwFlags = 0, maskval;
+ uint32_t dwMask = 0, dwFlags = 0;
- int i = 0;
- while (checkboxes[i].uId) {
- maskval = checkboxes[i].uFlag;
+ for (auto &it : checkboxes) {
+ uint32_t maskval = it.uFlag;
- int state = IsDlgButtonChecked(m_hwnd, checkboxes[i].uId);
+ int state = IsDlgButtonChecked(m_hwnd, it.uId);
if (state != BST_INDETERMINATE) {
dwMask |= maskval;
dwFlags = (state == BST_CHECKED) ? (dwFlags | maskval) : (dwFlags & ~maskval);
}
- i++;
}
-
+
int state = IsDlgButtonChecked(m_hwnd, IDC_UPREFS_LOGSTATUS);
if (state != BST_INDETERMINATE)
db_set_b(m_hContact, SRMSGMOD_T, "logstatuschanges", (uint8_t)state);
|