summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src/Options.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2014-07-27 09:48:19 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2014-07-27 09:48:19 +0000
commit7197141db82f7519ed707962a03f265f576516af (patch)
treee9dc4b7e51ae3232a781da9e7a86ca83279d2859 /plugins/PluginUpdater/src/Options.cpp
parentc4a90717ac0b7813d24d30920f1fccab0e638162 (diff)
restoring Wishmaster's PluginUpdater commits
git-svn-id: http://svn.miranda-ng.org/main/trunk@9968 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Options.cpp')
-rw-r--r--plugins/PluginUpdater/src/Options.cpp90
1 files changed, 53 insertions, 37 deletions
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 11021ac371..9d7ff1eb32 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -44,24 +44,30 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
- DBVARIANT dbv;
- if ( db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
+
+ BYTE UpdateMode = db_get_b(NULL, MODNAME, "UpdateMode", UPDATE_MODE_STABLE);
+ if (UpdateMode == UPDATE_MODE_STABLE) {
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
}
+ else if (UpdateMode == UPDATE_MODE_TRUNK) {
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK));
+ CheckDlgButton(hwndDlg, IDC_TRUNK, TRUE);
+ }
+ else if (UpdateMode == UPDATE_MODE_TRUNK_SYMBOLS) {
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
+ CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, 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 if (!strcmp(dbv.pszVal, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS))
- CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, TRUE);
- else {
- CheckDlgButton(hwndDlg, IDC_CUSTOM, TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
+ CheckDlgButton(hwndDlg, IDC_CUSTOM, TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
+ DBVARIANT dbv;
+ if (!db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, dbv.pszVal);
+ db_free(&dbv);
}
- db_free(&dbv);
+ else
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
}
}
return TRUE;
@@ -87,10 +93,31 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case IDC_TRUNK_SYMBOLS:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
case IDC_TRUNK:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL_TRUNK));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
case IDC_STABLE:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
case IDC_CUSTOM:
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
+ {
+ DBVARIANT dbv;
+ if (!db_get_ts(NULL, MODNAME, "UpdateURL", &dbv)) {
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
+ }
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -146,21 +173,22 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
mir_forkthread(InitTimer, (void*)1);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE))
- db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
+ db_set_b(NULL, MODNAME, "UpdateMode", UPDATE_MODE_STABLE);
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK))
- db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK);
+ db_set_b(NULL, MODNAME, "UpdateMode", UPDATE_MODE_TRUNK);
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
- ptrA oldUrl( db_get_sa(NULL, MODNAME, "UpdateURL"));
- if (strcmp(oldUrl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS)) {
+ BYTE oldMode = db_get_b(NULL, MODNAME, "UpdateMode",0);
+ if(oldMode == UPDATE_MODE_TRUNK_SYMBOLS) {
opts.bForceRedownload = true;
db_set_b(NULL, MODNAME, "ForceRedownload", 1);
}
- db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL_TRUNK_SYMBOLS);
+ db_set_b(NULL, MODNAME, "UpdateMode", UPDATE_MODE_TRUNK_SYMBOLS);
} else {
char szUrl[100];
GetDlgItemTextA(hwndDlg, IDC_CUSTOMURL, szUrl, SIZEOF(szUrl));
db_set_s(NULL, MODNAME, "UpdateURL", szUrl);
+ db_set_b(NULL, MODNAME, "UpdateMode", UPDATE_MODE_CUSTOM);
}
}
break;
@@ -171,8 +199,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- char str[20] = {0}, str2[20] = {0};
-
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
@@ -180,18 +206,12 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Colors
if (PopupOptions.DefColors == byCOLOR_OWN) {
CheckDlgButton(hdlg, IDC_USEOWNCOLORS, BST_CHECKED);
- CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_UNCHECKED);
}
- if (PopupOptions.DefColors == byCOLOR_WINDOWS) {
- CheckDlgButton(hdlg, IDC_USEOWNCOLORS, BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
+ else if (PopupOptions.DefColors == byCOLOR_WINDOWS) {
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_CHECKED);
}
- if (PopupOptions.DefColors == byCOLOR_POPUP) {
- CheckDlgButton(hdlg, IDC_USEOWNCOLORS, BST_UNCHECKED);
+ else if (PopupOptions.DefColors == byCOLOR_POPUP) {
CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
- CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_UNCHECKED);
}
for (int i = 0; i < POPUPS; i++) {
SendDlgItemMessage(hdlg, (i+42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
@@ -213,6 +233,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Popups nitified
for (int i = 0; i < POPUPS; i++) {
+ char str[20] = {0}, str2[20] = {0};
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
@@ -222,12 +243,6 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
else if (i > 0)
EnableWindow(GetDlgItem(hdlg, (i+1024)), TRUE);
}
-
- EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
- return TRUE;
-
- case WM_SHOWWINDOW:
- EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
return TRUE;
case WM_COMMAND:
@@ -303,7 +318,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (int i = 0; i < POPUPS; i++) {
if ((!IsDlgButtonChecked(hdlg, (i+40071))) || (!IsWindowEnabled(GetDlgItem(hdlg, (i+40071)))))
continue;
- ShowPopup(0, Title, Text, i, 0);
+ ShowPopup(Title, Text, i);
}
}
break;
@@ -352,7 +367,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
//Text color
char szSetting[20] = {0};
DWORD ctlColor = 0;
- for (int i = 0; i <= POPUPS-1; i++) {
+ for (int i = 0; i < POPUPS; i++) {
ctlColor = SendDlgItemMessage(hdlg, (i+42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iBg", i);
@@ -373,6 +388,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (int i = 0; i < POPUPS; i++) {
+ char str[20] = {0}, str2[20] = {0};
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);