1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] improve download dialog handling for new versions

* Prevent closing of the dialog during download
* Fix behaviour of the Abort button
This commit is contained in:
Pete Batard 2014-11-01 01:38:40 +00:00
parent 356b0ddaff
commit 02697a025a
3 changed files with 17 additions and 11 deletions

View file

@ -24,7 +24,7 @@
// Number of concurrent localization messages (i.e. messages we can concurrently // Number of concurrent localization messages (i.e. messages we can concurrently
// reference at the same time). Must be a power of 2. // reference at the same time). Must be a power of 2.
#define LOC_MESSAGE_NB 16 #define LOC_MESSAGE_NB 32
#define LOC_MESSAGE_SIZE 2048 #define LOC_MESSAGE_SIZE 2048
#define LOC_HTAB_SIZE 1031 // Using a prime speeds up the hash table init #define LOC_HTAB_SIZE 1031 // Using a prime speeds up the hash table init

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329 IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 1.4.11.526" CAPTION "Rufus 1.4.11.527"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.11.526" CAPTION "Rufus 1.4.11.527"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -428,8 +428,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,11,526 FILEVERSION 1,4,11,527
PRODUCTVERSION 1,4,11,526 PRODUCTVERSION 1,4,11,527
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -446,13 +446,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.11.526" VALUE "FileVersion", "1.4.11.527"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.11.526" VALUE "ProductVersion", "1.4.11.527"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1223,9 +1223,11 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
case IDCLOSE: case IDCLOSE:
case IDCANCEL: case IDCANCEL:
reset_localization(IDD_NEW_VERSION); if (download_status != 1) {
safe_free(filepath); reset_localization(IDD_NEW_VERSION);
EndDialog(hDlg, LOWORD(wParam)); safe_free(filepath);
EndDialog(hDlg, LOWORD(wParam));
}
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
case IDC_WEBSITE: case IDC_WEBSITE:
ShellExecuteA(hDlg, "open", RUFUS_URL, NULL, NULL, SW_SHOWNORMAL); ShellExecuteA(hDlg, "open", RUFUS_URL, NULL, NULL, SW_SHOWNORMAL);
@ -1234,8 +1236,10 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
switch(download_status) { switch(download_status) {
case 1: // Abort case 1: // Abort
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED;
download_status = 0;
break; break;
case 2: // Launch newer version and close this one case 2: // Launch newer version and close this one
Sleep(1000); // Add a delay on account of antivirus scanners
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi)); memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si); si.cb = sizeof(si);
@ -1268,11 +1272,13 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
} }
break; break;
case UM_PROGRESS_INIT: case UM_PROGRESS_INIT:
EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
SetWindowTextU(GetDlgItem(hDlg, IDC_DOWNLOAD), lmprintf(MSG_038));
FormatStatus = 0; FormatStatus = 0;
download_status = 1; download_status = 1;
SetWindowTextU(GetDlgItem(hDlg, IDC_DOWNLOAD), lmprintf(MSG_038));
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
case UM_PROGRESS_EXIT: case UM_PROGRESS_EXIT:
EnableWindow(GetDlgItem(hDlg, IDCANCEL), TRUE);
if (wParam) { if (wParam) {
SetWindowTextU(GetDlgItem(hDlg, IDC_DOWNLOAD), lmprintf(MSG_039)); SetWindowTextU(GetDlgItem(hDlg, IDC_DOWNLOAD), lmprintf(MSG_039));
download_status = 2; download_status = 2;