From 5e64645f8c037b482c5f75d48300ccdac92ebb02 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Oct 2012 12:57:17 +0000 Subject: - update URL moved to the options dialog; git-svn-id: http://svn.miranda-ng.org/main/trunk@1742 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Common.h | 3 ++- plugins/PluginUpdater/src/Options.cpp | 37 +++++++++++++++++++++++++++++++++++ plugins/PluginUpdater/src/resource.h | 11 +++++++---- 3 files changed, 46 insertions(+), 5 deletions(-) (limited to 'plugins/PluginUpdater/src') diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 110e32234d..adb92c447f 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -97,7 +97,8 @@ struct PlugOptions #define DEFAULT_PERIOD 1 #define DEFAULT_PERIODMEASURE 1 -#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%" +#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%" +#define DEFAULT_UPDATE_URL_TRUNK "http://miranda-ng.org/distr/x%platform%" #define IDINFO 3 #define IDDOWNLOAD 4 diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index d710de7124..422502cbaf 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -34,6 +34,8 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + DBVARIANT dbv; + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -56,6 +58,24 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure); CheckDlgButton(hwndDlg, IDC_UPDATEICONS, opts.bUpdateIcons); + + EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE); + if ( DBGetContactSettingString(NULL, MODNAME, "UpdateURL", &dbv)) { + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL)); + CheckDlgButton(hwndDlg, IDC_STABLE, TRUE); + } + else { + SetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, dbv.pszVal); + if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL)) + CheckDlgButton(hwndDlg, IDC_STABLE, TRUE); + else if ( !strcmp(dbv.pszVal, DEFAULT_UPDATE_URL_TRUNK)) + CheckDlgButton(hwndDlg, IDC_TRUNK, TRUE); + else { + CheckDlgButton(hwndDlg, IDC_CUSTOM, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE); + } + db_free(&dbv); + } return TRUE; case WM_COMMAND: @@ -79,6 +99,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA } break; + case IDC_TRUNK: + case IDC_STABLE: + case IDC_CUSTOM: + EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM)); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + case IDC_PERIODMEASURE: if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -127,6 +154,16 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA DBWriteContactSettingDword(NULL, MODNAME, "Period", opts.Period); opts.bUpdateIcons = IsDlgButtonChecked(hwndDlg, IDC_UPDATEICONS); DBWriteContactSettingByte(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons); + + if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE)) + db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL); + else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) + db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK); + else { + char szUrl[100]; + GetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, szUrl, SIZEOF(szUrl)); + db_set_s(NULL, MODNAME, "UpdateURL", szUrl); + } } break; } diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h index aa0c81abbf..2f940e3fee 100644 --- a/plugins/PluginUpdater/src/resource.h +++ b/plugins/PluginUpdater/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by D:\Myranda\plugins\PluginUpdater\res\Resource.rc +// Used by C:\Myranda\plugins\PluginUpdater\res\Resource.rc // #define IDI_MENU 101 #define IDD_UPDATE 102 @@ -48,7 +48,10 @@ #define IDC_PERIOD 1038 #define IDC_PERIODSPIN 1039 #define IDC_PERIODMEASURE 1040 -#define IDC_EDIT1 1042 +#define IDC_CUSTOMURL 1042 +#define IDC_STABLE 1043 +#define IDC_TRUNK 1044 +#define IDC_CUSTOM 1045 #define IDC_MSG_BOXES 40071 #define IDC_ERRORS 40072 #define IDC_INFO_MESSAGES 40073 @@ -63,12 +66,12 @@ #define IDC_PROGR_DLG_BG 42074 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40075 -#define _APS_NEXT_CONTROL_VALUE 1043 +#define _APS_NEXT_CONTROL_VALUE 1044 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3