summaryrefslogtreecommitdiff
path: root/plugins/Watrack_MPD
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-11-30 08:12:35 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-11-30 08:13:39 +0300
commit4c1b34caa7f00625b944b58ec9d69f4670cc4595 (patch)
treeb0c3273f13ecfbea37594fdeeb515a8e3cdd2d8f /plugins/Watrack_MPD
parent6532896923fdf6e3d3b341ce21153b913fcda3dc (diff)
watrack_mpd: options ported to new ui api
Diffstat (limited to 'plugins/Watrack_MPD')
-rwxr-xr-xplugins/Watrack_MPD/src/options.cpp71
-rwxr-xr-xplugins/Watrack_MPD/src/stdafx.h1
2 files changed, 26 insertions, 46 deletions
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp
index 13313079d0..b615ee3826 100755
--- a/plugins/Watrack_MPD/src/options.cpp
+++ b/plugins/Watrack_MPD/src/options.cpp
@@ -16,66 +16,45 @@
#include "stdafx.h"
-static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
+class COptWaMpdDlg : public CDlgBase
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- SetDlgItemInt(hwndDlg, IDC_PORT, db_get_w(NULL, szModuleName, "Port", 6600), FALSE);
+public:
+ COptWaMpdDlg() : CDlgBase(hInst, IDD_OPT_WA_MPD),
+ edit_PORT(this, IDC_PORT), edit_SERVER(this, IDC_SERVER), edit_PASSWORD(this, IDC_PASSWORD)
+ {}
+ virtual void OnInitDialog() override
+ {
+ edit_PORT.SetInt(db_get_w(NULL, szModuleName, "Port", 6600));
wchar_t *tmp = UniGetContactSettingUtf(NULL, szModuleName, "Server", L"127.0.0.1");
- SetDlgItemText(hwndDlg, IDC_SERVER, tmp);
+ edit_SERVER.SetText(tmp);
mir_free(tmp);
tmp = UniGetContactSettingUtf(NULL, szModuleName, "Password", L"");
- SetDlgItemText(hwndDlg, IDC_PASSWORD, tmp);
+ edit_PASSWORD.SetText(tmp);
mir_free(tmp);
- return TRUE;
- }
-
-
- case WM_COMMAND:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
-
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->code)
- {
-
- case PSN_APPLY:
- {
- wchar_t szText[256];
- db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, FALSE));
- gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, nullptr, FALSE);
- GetDlgItemText(hwndDlg, IDC_SERVER, szText, _countof(szText));
- db_set_ws(NULL, szModuleName, "Server", szText);
- mir_wstrcpy(gbHost, szText);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, _countof(szText));
- db_set_ws(NULL, szModuleName, "Password", szText);
- mir_wstrcpy(gbPassword, szText);
- return TRUE;
- }
- }
- }
- break;
- }
+ }
+ virtual void OnApply() override
+ {
+ db_set_w(NULL, szModuleName, "Port", (WORD)edit_PORT.GetInt());
+ gbPort = edit_PORT.GetInt();
+ db_set_ws(NULL, szModuleName, "Server", edit_SERVER.GetText());
+ mir_wstrcpy(gbHost, edit_SERVER.GetText());
+ db_set_ws(NULL, szModuleName, "Password", edit_PASSWORD.GetText());
+ mir_wstrcpy(gbPassword, edit_PASSWORD.GetText());
+ }
+private:
+ CCtrlSpin edit_PORT;
+ CCtrlEdit edit_SERVER, edit_PASSWORD;
+};
- return FALSE;
-}
int WaMpdOptInit(WPARAM wParam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WA_MPD);
odp.szTitle.w = LPGENW("Winamp Track");
odp.szGroup.w = LPGENW("Plugins");
odp.szTab.w = LPGENW("Watrack MPD");
odp.flags=ODPF_BOLDGROUPS|ODPF_UNICODE;
- odp.pfnDlgProc = DlgProcWaMpdOpts;
+ odp.pDialog = new COptWaMpdDlg();
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/Watrack_MPD/src/stdafx.h b/plugins/Watrack_MPD/src/stdafx.h
index 914126d34d..c9a6a3f014 100755
--- a/plugins/Watrack_MPD/src/stdafx.h
+++ b/plugins/Watrack_MPD/src/stdafx.h
@@ -24,6 +24,7 @@
#include <m_utils.h>
#include <m_options.h>
#include <m_langpack.h>
+#include <m_gui.h>
#include <m_music.h>