diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-30 19:16:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-30 19:16:28 +0300 |
commit | 172ad46d5c457dda639376478e856a3c643635fa (patch) | |
tree | fcd8c5edf9c3263094c3c3ca48a41755f6d1e0a8 /protocols | |
parent | 71f29fec24a26a89daab816566a4ae114593e340 (diff) |
fixes #3312 (Telegram: унифицировать настройку статусов с ICQ)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/res/resource.rc | 14 | ||||
-rw-r--r-- | protocols/Telegram/src/options.cpp | 76 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 4 | ||||
-rw-r--r-- | protocols/Telegram/src/resource.h | 7 |
5 files changed, 105 insertions, 0 deletions
diff --git a/protocols/Telegram/res/resource.rc b/protocols/Telegram/res/resource.rc index 8e8936badf..fcbf34361b 100644 --- a/protocols/Telegram/res/resource.rc +++ b/protocols/Telegram/res/resource.rc @@ -90,6 +90,20 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,64,294,10
END
+IDD_OPTIONS_ADV DIALOGEX 0, 0, 310, 86
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "If a contact goes Offline, set this status instead and cache it for given timeout in seconds (0 - disabled)",IDC_STATIC,12,16,204,23
+ EDITTEXT IDC_DIFF1,221,13,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,12,11,14
+ COMBOBOX IDC_STATUS1,221,28,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "After that, set this status to a contact and move it offline after specified timeout in seconds (0 - disabled)",IDC_STATIC,12,49,204,23
+ EDITTEXT IDC_DIFF2,221,46,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,45,11,14
+ COMBOBOX IDC_STATUS2,221,61,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+END
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/Telegram/src/options.cpp b/protocols/Telegram/src/options.cpp index 5d2d6b83d5..af8c0c2545 100644 --- a/protocols/Telegram/src/options.cpp +++ b/protocols/Telegram/src/options.cpp @@ -58,6 +58,77 @@ public: };
/////////////////////////////////////////////////////////////////////////////////////////
+// Advanced options
+
+class CIcqOptionsAdv : public CProtoDlgBase<CTelegramProto>
+{
+ CCtrlEdit edtDiff1, edtDiff2;
+ CCtrlSpin spin1, spin2;
+ CCtrlCombo cmbStatus1, cmbStatus2;
+
+public:
+ CIcqOptionsAdv(CTelegramProto *ppro) :
+ CProtoDlgBase<CTelegramProto>(ppro, IDD_OPTIONS_ADV),
+ spin1(this, IDC_SPIN1, 32000),
+ spin2(this, IDC_SPIN2, 32000),
+ edtDiff1(this, IDC_DIFF1),
+ edtDiff2(this, IDC_DIFF2),
+ cmbStatus1(this, IDC_STATUS1),
+ cmbStatus2(this, IDC_STATUS2)
+ {
+ edtDiff1.OnChange = Callback(this, &CIcqOptionsAdv::onChange_Timeout1);
+ edtDiff2.OnChange = Callback(this, &CIcqOptionsAdv::onChange_Timeout2);
+
+ 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);
+ }
+ }
+
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ if (cmbStatus1.GetHwnd()) {
+ m_proto->m_iStatus1 = cmbStatus1.GetCurData();
+ m_proto->m_iStatus2 = cmbStatus2.GetCurData();
+ }
+
+ return true;
+ }
+
+ void onChange_Timeout1(CCtrlEdit *)
+ {
+ bool bEnabled = edtDiff1.GetInt() != 0;
+ spin2.Enable(bEnabled);
+ edtDiff2.Enable(bEnabled);
+ cmbStatus1.Enable(bEnabled);
+ cmbStatus2.Enable(bEnabled && edtDiff2.GetInt() != 0);
+ }
+
+ void onChange_Timeout2(CCtrlEdit *)
+ {
+ bool bEnabled = edtDiff2.GetInt() != 0;
+ cmbStatus2.Enable(bEnabled);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
INT_PTR CTelegramProto::SvcCreateAccMgrUI(WPARAM, LPARAM hwndParent)
{
@@ -78,5 +149,10 @@ int CTelegramProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.szTab.w = LPGENW("Account");
odp.pDialog = new COptionsDlg(this, IDD_OPTIONS, true);
g_plugin.addOptions(wParam, &odp);
+
+ odp.position = 2;
+ odp.szTab.w = LPGENW("Advanced");
+ odp.pDialog = new CIcqOptionsAdv(this);
+ g_plugin.addOptions(wParam, &odp);
return 0;
}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index fa9313c0be..715e511ea3 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -23,6 +23,10 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : m_arUsers(10, CompareUsers), m_arRequests(10, CompareRequests), m_szOwnPhone(this, "Phone"), + m_iStatus1(this, "Status1", ID_STATUS_AWAY), + m_iStatus2(this, "Status2", ID_STATUS_NA), + m_iTimeDiff1(this, "TimeDiff1", 600), + m_iTimeDiff2(this, "TimeDiff2", 600), m_wszDeviceName(this, "DeviceName", L"Miranda NG"), m_wszDefaultGroup(this, "DefaultGroup", L"Telegram"), m_bUsePopups(this, "UsePopups", true), diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index c88c6c9666..ba643520e5 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -226,6 +226,10 @@ public: CMOption<wchar_t*> m_wszDeviceName; // how do you see this session in Device List CMOption<bool> m_bHideGroupchats; // do not open chat windows on creation CMOption<bool> m_bUsePopups; + CMOption<uint32_t> m_iTimeDiff1; // set this status to m_iStatus1 after this interval of secs + CMOption<uint32_t> m_iStatus1; + CMOption<uint32_t> m_iTimeDiff2; // set this status to m_iStatus2 after this interval of secs + CMOption<uint32_t> m_iStatus2; // Processing Threads //////////////////////////////////////////////////////////////// diff --git a/protocols/Telegram/src/resource.h b/protocols/Telegram/src/resource.h index 9ea3641d02..5bd28839a5 100644 --- a/protocols/Telegram/src/resource.h +++ b/protocols/Telegram/src/resource.h @@ -6,12 +6,19 @@ #define IDD_ACCMGRUI 101
#define IDD_OPTIONS 102
#define IDI_PREMIUM 103
+#define IDD_OPTIONS_ADV 104
#define IDC_PHONE 1001
#define IDC_DEFGROUP 1002
#define IDC_HIDECHATS 1003
#define IDC_POPUPS 1004
#define IDC_DEFGROUP2 1004
#define IDC_DEVICE_NAME 1005
+#define IDC_DIFF1 1006
+#define IDC_DIFF2 1007
+#define IDC_SPIN1 1008
+#define IDC_SPIN2 1009
+#define IDC_STATUS1 1010
+#define IDC_STATUS2 1011
// Next default values for new objects
//
|