summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2018-06-12 11:44:31 +0200
committerGoraf <22941576+Goraf@users.noreply.github.com>2018-06-12 11:44:31 +0200
commit9e03ccf552848ea74aee686d95b81914e136ce7b (patch)
tree2eb71586a894e136ed26eb228a33f2f3e1a97b8d /protocols/Gadu-Gadu
parent527c89ab4ce37f593a58c74675c44b829a0603c1 (diff)
Gadu-Gadu: conf options move to UI classes
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/res/resource.rc102
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp70
-rw-r--r--protocols/Gadu-Gadu/src/options.cpp55
-rw-r--r--protocols/Gadu-Gadu/src/options.h18
-rw-r--r--protocols/Gadu-Gadu/src/resource.h6
5 files changed, 156 insertions, 95 deletions
diff --git a/protocols/Gadu-Gadu/res/resource.rc b/protocols/Gadu-Gadu/res/resource.rc
index 15aba9a943..5d50b44139 100644
--- a/protocols/Gadu-Gadu/res/resource.rc
+++ b/protocols/Gadu-Gadu/res/resource.rc
@@ -18,6 +18,41 @@
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
#pragma code_page(1250)
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "..\\src\\resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Polish (Poland) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+
/////////////////////////////////////////////////////////////////////////////
//
// Icon
@@ -104,11 +139,13 @@ BEGIN
GROUPBOX "Conference policy",IDC_STATIC,4,2,298,66
LTEXT "if total participant count greater than:",IDC_STATIC,85,18,143,8
COMBOBOX IDC_GC_POLICY_TOTAL,11,15,70,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_GC_COUNT_TOTAL,234,15,35,14,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_GC_COUNT_TOTAL_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,258,15,11,13
LTEXT "if unknown participant count greater than:",IDC_STATIC,85,34,143,8
- EDITTEXT IDC_GC_COUNT_TOTAL,234,16,35,13,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_GC_POLICY_UNKNOWN,11,31,70,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_GC_COUNT_UNKNOWN,234,31,35,14,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_GC_COUNT_UNKNOWN_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,258,31,11,14
LTEXT "in other case",IDC_STATIC,85,50,143,8
- EDITTEXT IDC_GC_COUNT_UNKNOWN,234,32,35,13,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_GC_POLICY_DEFAULT,11,47,70,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
@@ -356,40 +393,43 @@ BEGIN
END
-#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
-// TEXTINCLUDE
+// DESIGNINFO
//
-1 TEXTINCLUDE
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
BEGIN
- "..\\src\\resource.h\0"
-END
+ IDD_OPT_GG_CONFERENCE, DIALOG
+ BEGIN
+ END
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\0"
-END
+ IDD_OPT_GG_ADVANCED, DIALOG
+ BEGIN
+ END
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
+ IDD_REMOVEACCOUNT, DIALOG
+ BEGIN
+ END
-#endif // APSTUDIO_INVOKED
+ IDD_CHPASS, DIALOG
+ BEGIN
+ END
+ IDD_IMAGE_RECV, DIALOG
+ BEGIN
+ END
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
+ IDD_IMAGE_SEND, DIALOG
+ BEGIN
+ END
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_OPT_GG_ADVANCED, DIALOG
+ IDD_CONFERENCE, DIALOG
+ BEGIN
+ END
+
+ IDD_ACCMGRUI, DIALOG
BEGIN
END
END
@@ -406,7 +446,17 @@ BEGIN
0
END
-#endif // Polish (Poland) resources
+IDD_OPT_GG_CONFERENCE AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+IDD_ACCMGRUI AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+#endif // English resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 22fe1dea3b..2f214dc9ce 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -482,69 +482,6 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
return FALSE;
}
-////////////////////////////////////////////////////////////////////////////////////////////
-// Proc: Conference options dialog
-//
-static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GaduProto *gg = (GaduProto *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- DWORD num;
-
- switch (msg) {
- case WM_INITDIALOG:
- gg = (GaduProto *)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
-
- TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL), 0);
-
- if (num = gg->getWord(GG_KEY_GC_COUNT_TOTAL, GG_KEYDEF_GC_COUNT_TOTAL))
- SetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, ditoa(num));
-
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN), 0);
-
- if (num = gg->getWord(GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN))
- SetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, ditoa(num));
-
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Allow"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ask"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Ignore"));
- SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_SETCURSEL, gg->getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT), 0);
- break;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_GC_COUNT_TOTAL || LOWORD(wParam) == IDC_GC_COUNT_UNKNOWN)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- char str[128];
-
- // Write groupchat policy
- gg->setWord(GG_KEY_GC_POLICY_TOTAL, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_TOTAL, CB_GETCURSEL, 0, 0));
- gg->setWord(GG_KEY_GC_POLICY_UNKNOWN, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_GETCURSEL, 0, 0));
- gg->setWord(GG_KEY_GC_POLICY_DEFAULT, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_GETCURSEL, 0, 0));
-
- GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, _countof(str));
- gg->setWord(GG_KEY_GC_COUNT_TOTAL, (WORD)atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, _countof(str));
- gg->setWord(GG_KEY_GC_COUNT_UNKNOWN, (WORD)atoi(str));
- }
- break;
- }
- return FALSE;
-}
-
////////////////////////////////////////////////////////////////////////////////
// Info Page : Data
struct GGDETAILSDLGDATA
@@ -770,14 +707,15 @@ int GaduProto::options_init(WPARAM wParam, LPARAM)
odp.pfnDlgProc = gg_genoptsdlgproc;
g_plugin.addOptions(wParam, &odp);
+ odp.pszTemplate = nullptr;
+
odp.szTab.w = LPGENW("Conference");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_CONFERENCE);
- odp.pfnDlgProc = gg_confoptsdlgproc;
+ odp.position = 1;
+ odp.pDialog = new GaduOptionsDlgConference(this);
g_plugin.addOptions(wParam, &odp);
odp.szTab.w = LPGENW("Advanced");
odp.position = 2;
- odp.pszTemplate = nullptr;
odp.pDialog = new GaduOptionsDlgAdvanced(this);
g_plugin.addOptions(wParam, &odp);
diff --git a/protocols/Gadu-Gadu/src/options.cpp b/protocols/Gadu-Gadu/src/options.cpp
index 9918d46bba..5abcd75209 100644
--- a/protocols/Gadu-Gadu/src/options.cpp
+++ b/protocols/Gadu-Gadu/src/options.cpp
@@ -13,11 +13,64 @@ GaduOptions::GaduOptions(PROTO_INTERFACE *proto) :
forwardPort(proto, "ForwardPort", 1550),
forwardHost(proto, "ForwardHost", L""),
serverHosts(proto, "ServerHosts", GG_KEYDEF_SERVERHOSTS)
+{}
+
+GaduOptionsDlgConference::GaduOptionsDlgConference(GaduProto *proto) :
+ GaduDlgBase(proto, IDD_OPT_GG_CONFERENCE),
+ cmbPolicyForAllChatParticipants(this, IDC_GC_POLICY_TOTAL),
+ edtNumberOfAllChatParticipants(this, IDC_GC_COUNT_TOTAL_SPIN),
+ cmbPolicyForUnknownChatParticipants(this, IDC_GC_POLICY_UNKNOWN),
+ edtNumberOfUnknownChatParticipants(this, IDC_GC_COUNT_UNKNOWN_SPIN),
+ cmbDefaultChatPolicy(this, IDC_GC_POLICY_DEFAULT)
{
+ CreateLink(cmbPolicyForAllChatParticipants, GG_KEY_GC_POLICY_TOTAL, DBVT_WORD, GG_KEYDEF_GC_POLICY_TOTAL);
+ CreateLink(edtNumberOfAllChatParticipants, GG_KEY_GC_COUNT_TOTAL, DBVT_WORD, GG_KEYDEF_GC_COUNT_TOTAL);
+
+ CreateLink(cmbPolicyForUnknownChatParticipants, GG_KEY_GC_POLICY_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_POLICY_UNKNOWN);
+ CreateLink(edtNumberOfUnknownChatParticipants, GG_KEY_GC_COUNT_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_COUNT_UNKNOWN);
+
+ CreateLink(cmbDefaultChatPolicy, GG_KEY_GC_POLICY_DEFAULT, DBVT_WORD, GG_KEYDEF_GC_POLICY_DEFAULT);
+}
+
+void GaduOptionsDlgConference::OnInitDialog()
+{
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Allow"), 0L);
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Ask"), 1L);
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Ignore"), 2L);
+ int listIndex = m_proto->getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL);
+ cmbPolicyForAllChatParticipants.SetCurSel(listIndex);
+
+ edtNumberOfAllChatParticipants.SetRange(250U);
+
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Allow"), 0L);
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ask"), 1L);
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ignore"), 2L);
+ listIndex = m_proto->getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN);
+ cmbPolicyForUnknownChatParticipants.SetCurSel(listIndex);
+
+ edtNumberOfUnknownChatParticipants.SetRange(250U);
+
+ cmbDefaultChatPolicy.AddString(TranslateT("Allow"), 0L);
+ cmbDefaultChatPolicy.AddString(TranslateT("Ask"), 1L);
+ cmbDefaultChatPolicy.AddString(TranslateT("Ignore"), 2L);
+ listIndex = m_proto->getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT);
+ cmbDefaultChatPolicy.SetCurSel(listIndex);
+}
+
+void GaduOptionsDlgConference::OnApply()
+{
+ int selectionIndex = cmbPolicyForAllChatParticipants.GetCurSel();
+ m_proto->setWord(GG_KEY_GC_POLICY_TOTAL, cmbPolicyForAllChatParticipants.GetItemData(selectionIndex));
+
+ selectionIndex = cmbPolicyForUnknownChatParticipants.GetCurSel();
+ m_proto->setWord(GG_KEY_GC_POLICY_UNKNOWN, cmbPolicyForUnknownChatParticipants.GetItemData(selectionIndex));
+
+ selectionIndex = cmbDefaultChatPolicy.GetCurSel();
+ m_proto->setWord(GG_KEY_GC_POLICY_DEFAULT, cmbDefaultChatPolicy.GetItemData(selectionIndex));
}
-GaduOptionsDlgAdvanced::GaduOptionsDlgAdvanced(GaduProto * proto) :
+GaduOptionsDlgAdvanced::GaduOptionsDlgAdvanced(GaduProto *proto) :
GaduDlgBase(proto, IDD_OPT_GG_ADVANCED),
chkAutoReconnect(this, IDC_ARECONNECT),
chkKeepConnectionAlive(this, IDC_KEEPALIVE),
diff --git a/protocols/Gadu-Gadu/src/options.h b/protocols/Gadu-Gadu/src/options.h
index 58e1de767e..4a58f042a5 100644
--- a/protocols/Gadu-Gadu/src/options.h
+++ b/protocols/Gadu-Gadu/src/options.h
@@ -24,6 +24,24 @@ struct GaduOptions
using GaduDlgBase = CProtoDlgBase<GaduProto>;
+class GaduOptionsDlgConference : public GaduDlgBase
+{
+private:
+ CCtrlCombo cmbPolicyForAllChatParticipants;
+ CCtrlSpin edtNumberOfAllChatParticipants;
+
+ CCtrlCombo cmbPolicyForUnknownChatParticipants;
+ CCtrlSpin edtNumberOfUnknownChatParticipants;
+
+ CCtrlCombo cmbDefaultChatPolicy;
+
+public:
+ GaduOptionsDlgConference(GaduProto *proto);
+
+ void OnInitDialog() override;
+ void OnApply() override;
+};
+
class GaduOptionsDlgAdvanced : public GaduDlgBase
{
private:
diff --git a/protocols/Gadu-Gadu/src/resource.h b/protocols/Gadu-Gadu/src/resource.h
index 212b35ec8a..3c79d81adb 100644
--- a/protocols/Gadu-Gadu/src/resource.h
+++ b/protocols/Gadu-Gadu/src/resource.h
@@ -102,6 +102,8 @@
#define IDC_DIRECTPORT_L 470
#define IDC_FORWARDHOST_L 471
#define IDC_FORWARDPORT_L 472
+#define IDC_GC_COUNT_TOTAL_SPIN 473
+#define IDC_GC_COUNT_UNKNOWN_SPIN 474
#define IDC_HEADERBAR 1001
#define IDC_SESSIONS 1002
#define IDC_SIGNOUTALL 1003
@@ -122,7 +124,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 473
+#define _APS_NEXT_CONTROL_VALUE 477
+#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif