From df1536b00473e18e2911911c5ec323a01c7f070b Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 6 Jun 2016 17:23:07 +0000 Subject: 2 radiobuttons changed to 1 checkbutton for platform change git-svn-id: http://svn.miranda-ng.org/main/trunk@16929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/res/Resource.rc | 38 ++++++++++----- plugins/PluginUpdater/src/DlgUpdate.cpp | 29 +++++++++--- plugins/PluginUpdater/src/Options.cpp | 71 ++++++++++++++++++++++------- plugins/PluginUpdater/src/PluginUpdater.cpp | 6 ++- plugins/PluginUpdater/src/resource.h | 9 ++-- plugins/PluginUpdater/src/stdafx.h | 2 - 6 files changed, 112 insertions(+), 43 deletions(-) (limited to 'plugins') diff --git a/plugins/PluginUpdater/res/Resource.rc b/plugins/PluginUpdater/res/Resource.rc index 70e4cd34c7..aa357cbdd6 100644 --- a/plugins/PluginUpdater/res/Resource.rc +++ b/plugins/PluginUpdater/res/Resource.rc @@ -27,11 +27,16 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_MENU ICON "menu.ico" + IDI_OK ICON "btnOk.ico" + IDI_CANCEL ICON "btnClose.ico" + IDI_INFO ICON "info.ico" + IDI_PLGLIST ICON "PlgList.ico" + ///////////////////////////////////////////////////////////////////////////// // // Dialog @@ -52,7 +57,7 @@ BEGIN PUSHBUTTON "Select &none",IDC_SELNONE,175,218,60,14,NOT WS_TABSTOP END -IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 236 +IDD_OPT_UPDATENOTIFY DIALOGEX 0, 0, 301, 237 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -70,17 +75,15 @@ BEGIN CONTROL "Silent mode",IDC_SILENTMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,72,267,10 CONTROL "Backup database before update (requires Db_autobackups plugin)",IDC_BACKUP, "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,86,272,10 - GROUPBOX "Files source",IDC_STATIC,2,115,285,96 - CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,128,199,10 - CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,143,199,10 + GROUPBOX "Files source",IDC_STATIC,2,104,285,106 + CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,117,267,10 + CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,132,267,10 CONTROL "Development version with debug symbols",IDC_TRUNK_SYMBOLS, - "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,158,199,10 - CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,173,267,10 - EDITTEXT IDC_CUSTOMURL,12,187,267,16,ES_AUTOHSCROLL | WS_DISABLED - GROUPBOX "Platform",IDC_STATIC,212,122,58,40 - CONTROL "x86", IDC_X86, "Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 217, 131, 28, 10 - CONTROL "x64", IDC_X64, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 217, 146, 28, 10 - CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,213,267,15,NOT WS_VISIBLE + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,147,267,10 + CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,162,267,10 + EDITTEXT IDC_CUSTOMURL,12,176,267,16,ES_AUTOHSCROLL | WS_DISABLED + CTEXT "Some component(s) was updated.\nYou need to restart your Miranda to apply installed updates.",IDC_NEEDRESTARTLABEL,11,214,267,15,NOT WS_VISIBLE + CONTROL "Change platform",IDC_CHANGE_PLATFORM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,197,212,10 END IDD_POPUP DIALOGEX 0, 0, 316, 174 @@ -181,7 +184,7 @@ BEGIN VERTGUIDE, 11 VERTGUIDE, 278 VERTGUIDE, 286 - BOTTOMMARGIN, 228 + BOTTOMMARGIN, 229 END IDD_POPUP, DIALOG @@ -211,6 +214,17 @@ BEGIN END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT_UPDATENOTIFY AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // Russian (Russia) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index f81db0c705..98256b7e56 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -128,12 +128,6 @@ static void ApplyUpdates(void *param) db_set_ts(NULL, "CList", "TitleText", _T("Miranda NG")); #endif - opts.bForceRedownload = false; - db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD); - - opts.bChangePlatform = false; - db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM); - db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5); if (opts.bBackup) @@ -144,10 +138,31 @@ static void ApplyUpdates(void *param) PostMessage(hDlg, WM_CLOSE, 0, 0); if (rc == IDYES) #if MIRANDA_VER >= 0x0A00 - CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0); + if (opts.bChangePlatform) { + TCHAR mirstartpath[MAX_PATH]; +#ifdef _WIN64 + mir_sntprintf(mirstartpath, _T("%s\\miranda32.exe"), tszMirandaPath); +#else + mir_sntprintf(mirstartpath, _T("%s\\miranda64.exe"), tszMirandaPath); +#endif + CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, (LPARAM)mirstartpath); + } + else + CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0); #else CallFunctionAsync(RestartMe, 0); #endif + + opts.bForceRedownload = false; + db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD); + + opts.bChangePlatform = false; + db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM); + + TCHAR mirandaPath[MAX_PATH]; + GetModuleFileName(NULL, mirandaPath, _countof(mirandaPath)); + db_set_ts(NULL, MODNAME, "OldBin", mirandaPath); + } static void ResizeVert(HWND hDlg, int yy) diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index fd5f5f9ae7..6c2b44395d 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -145,11 +145,20 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url); } - #ifdef _WIN64 - CheckDlgButton(hwndDlg, IDC_X64, BST_CHECKED); - #else - CheckDlgButton(hwndDlg, IDC_X86, BST_CHECKED); - #endif + { + BOOL bIsWow64 = FALSE; +#ifdef _WIN64 + SetDlgItemText(hwndDlg, IDC_CHANGE_PLATFORM, TranslateT("Change platform to x86")); +#else + SetDlgItemText(hwndDlg, IDC_CHANGE_PLATFORM, TranslateT("Change platform to x64")); + IsWow64Process(GetCurrentProcess(), &bIsWow64); + if (!bIsWow64) + ShowWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), SW_HIDE); +#endif + } + if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE); + } return TRUE; case WM_COMMAND: @@ -175,19 +184,28 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_TRUNK_SYMBOLS: EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE); - mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS); + if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_OPP_BITS); + else + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS); SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_TRUNK: EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE); - mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS); + if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_OPP_BITS); + else + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS); SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_STABLE: EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE); - mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS); + if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_OPP_BITS); + else + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS); SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -213,14 +231,35 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; - case IDC_X86: - case IDC_X64: - CheckDlgButton(hwndDlg, IDC_STABLE, BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CUSTOM, BST_UNCHECKED); - mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), LOWORD(wParam) == IDC_CHANGE_PLATFORM ? DEFAULT_OPP_BITS : DEFAULT_BITS); - SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + case IDC_CHANGE_PLATFORM: + if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) { + if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_OPP_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_OPP_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_OPP_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + } + else { + if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL), DEFAULT_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK), DEFAULT_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) { + mir_sntprintf(defurl, _T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS), DEFAULT_BITS); + SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl); + } + } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 50d98c1904..b58d7a8e78 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -70,7 +70,11 @@ extern "C" __declspec(dllexport) int Load(void) InitServices(); #endif - + ptrT oldbin(db_get_tsa(NULL, MODNAME, "OldBin")); + if (oldbin) { + SafeDeleteFile(oldbin); + db_unset(NULL, MODNAME, "OldBin"); + } db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0); DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath); diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h index e92da5db28..1c36dbb44e 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 ..\res\Resource.rc +// Used by d:\Miranda_orig\plugins\PluginUpdater\res\Resource.rc // #define IDD_UPDATE 101 #define IDD_OPT_UPDATENOTIFY 102 @@ -50,8 +50,7 @@ #define IDC_SILENTMODE 1047 #define IDC_NEEDRESTARTLABEL 1048 #define IDC_BACKUP 1049 -#define IDC_X86 1050 -#define IDC_X64 1051 +#define IDC_CHANGE_PLATFORM 1052 #define IDC_MSG_BOXES 40071 #define IDC_ERRORS 40072 #define IDC_INFO_MESSAGES 40073 @@ -69,9 +68,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 117 +#define _APS_NEXT_RESOURCE_VALUE 118 #define _APS_NEXT_COMMAND_VALUE 40075 -#define _APS_NEXT_CONTROL_VALUE 1052 +#define _APS_NEXT_CONTROL_VALUE 1053 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 9efc5b88a1..0a97be2de0 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -117,13 +117,11 @@ extern struct PlugOptions #define DEFAULT_OPP_BITS 32 #define OLD_FILENAME FILENAME_X64 #define NEW_FILENAME FILENAME_X32 - #define IDC_CHANGE_PLATFORM IDC_X86 #else #define DEFAULT_BITS 32 #define DEFAULT_OPP_BITS 64 #define OLD_FILENAME FILENAME_X32 #define NEW_FILENAME FILENAME_X64 - #define IDC_CHANGE_PLATFORM IDC_X64 #endif #define PLUGIN_INFO_URL _T("http://miranda-ng.org/p/%s") -- cgit v1.2.3