diff options
author | George Hazan <ghazan@miranda.im> | 2023-02-23 15:51:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-02-23 15:51:56 +0300 |
commit | 67ce0ffd1f87f1f68ddad6b1fbae64bdd0041d97 (patch) | |
tree | 5392eae171bd1e38e414002e2ad5065b529b6cd8 /protocols/Telegram | |
parent | 531cb8c96f0234b71fb005089973d50cb531d5e6 (diff) |
same for Telegram
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/options.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/protocols/Telegram/src/options.cpp b/protocols/Telegram/src/options.cpp index 5f8719da69..6a9b917109 100644 --- a/protocols/Telegram/src/options.cpp +++ b/protocols/Telegram/src/options.cpp @@ -55,7 +55,7 @@ public: CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&iCount, (LPARAM)&pList);
for (int i = 0; i < iCount; i++) {
- int countryCode = pList[i].id;
+ unsigned countryCode = pList[i].id;
int idx = cmbCountry.AddString(TranslateW(_A2T(pList[i].szName).get()), countryCode);
if (countryCode == m_proto->m_iCountry)
cmbCountry.SetCurSel(idx);
@@ -117,24 +117,23 @@ public: edtDiff1.OnChange = Callback(this, &CAdvOptionsDlg::onChange_Timeout1);
edtDiff2.OnChange = Callback(this, &CAdvOptionsDlg::onChange_Timeout2);
+ spin1.OnChange = Callback(this, &CAdvOptionsDlg::onChange_Spin1);
+ spin2.OnChange = Callback(this, &CAdvOptionsDlg::onChange_Spin2);
+
CreateLink(spin1, ppro->m_iTimeDiff1);
CreateLink(spin2, ppro->m_iTimeDiff2);
}
bool OnInitDialog() override
{
- if (cmbStatus1.GetHwnd()) {
- for (uint32_t iStatus = ID_STATUS_OFFLINE; iStatus <= ID_STATUS_MAX; iStatus++) {
- int idx = cmbStatus1.AddString(Clist_GetStatusModeDescription(iStatus, 0));
- cmbStatus1.SetItemData(idx, iStatus);
- if (iStatus == m_proto->m_iStatus1)
- cmbStatus1.SetCurSel(idx);
-
- idx = cmbStatus2.AddString(Clist_GetStatusModeDescription(iStatus, 0));
- cmbStatus2.SetItemData(idx, iStatus);
- if (iStatus == m_proto->m_iStatus2)
- cmbStatus2.SetCurSel(idx);
- }
+ for (uint32_t iStatus = ID_STATUS_OFFLINE; iStatus <= ID_STATUS_MAX; iStatus++) {
+ int idx = cmbStatus1.AddString(Clist_GetStatusModeDescription(iStatus, 0), iStatus);
+ if (iStatus == m_proto->m_iStatus1)
+ cmbStatus1.SetCurSel(idx);
+
+ idx = cmbStatus2.AddString(Clist_GetStatusModeDescription(iStatus, 0), iStatus);
+ if (iStatus == m_proto->m_iStatus2)
+ cmbStatus2.SetCurSel(idx);
}
return true;
@@ -142,27 +141,39 @@ public: bool OnApply() override
{
- if (cmbStatus1.GetHwnd()) {
- m_proto->m_iStatus1 = cmbStatus1.GetCurData();
- m_proto->m_iStatus2 = cmbStatus2.GetCurData();
- }
-
+ m_proto->m_iStatus1 = cmbStatus1.GetCurData();
+ m_proto->m_iStatus2 = cmbStatus2.GetCurData();
return true;
}
- void onChange_Timeout1(CCtrlEdit *)
+ void onChange_Value1(int val)
{
- bool bEnabled = edtDiff1.GetInt() != 0;
+ bool bEnabled = val != 0;
spin2.Enable(bEnabled);
edtDiff2.Enable(bEnabled);
cmbStatus1.Enable(bEnabled);
- cmbStatus2.Enable(bEnabled && edtDiff2.GetInt() != 0);
+ cmbStatus2.Enable(bEnabled && spin2.GetPosition() != 0);
+ }
+
+ void onChange_Timeout1(CCtrlEdit *)
+ {
+ onChange_Value1(edtDiff1.GetInt());
+ }
+
+ void onChange_Spin1(CCtrlEdit *)
+ {
+ onChange_Value1(spin1.GetPosition());
}
void onChange_Timeout2(CCtrlEdit *)
{
cmbStatus2.Enable(edtDiff1.GetInt() != 0 && edtDiff2.GetInt() != 0);
}
+
+ void onChange_Spin2(CCtrlEdit *)
+ {
+ cmbStatus2.Enable(spin1.GetPosition() != 0 && spin2.GetPosition() != 0);
+ }
};
/////////////////////////////////////////////////////////////////////////////////////////
|