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

[ui] fix progress display of network downloads

* Also fix a memory leak with the GRUB download buffer
This commit is contained in:
Pete Batard 2015-02-02 21:16:53 +00:00
parent b830c040d2
commit d1d16ce1c5
2 changed files with 25 additions and 15 deletions

View file

@ -1761,7 +1761,7 @@ void SetBoot(int fs, int bt)
static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static DWORD DeviceNum = 0, LastRefresh = 0; static DWORD DeviceNum = 0, LastRefresh = 0;
static BOOL first_log_display = TRUE, user_changed_label = FALSE; static BOOL first_log_display = TRUE, user_changed_label = FALSE, isMarquee = FALSE;
static ULONG ulRegister = 0; static ULONG ulRegister = 0;
static LPITEMIDLIST pidlDesktop = NULL; static LPITEMIDLIST pidlDesktop = NULL;
static MY_SHChangeNotifyEntry NotifyEntry; static MY_SHChangeNotifyEntry NotifyEntry;
@ -2280,7 +2280,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break; break;
case UM_PROGRESS_INIT: case UM_PROGRESS_INIT:
if (wParam == PBS_MARQUEE) { isMarquee = (wParam == PBS_MARQUEE);
if (isMarquee) {
progress_style = GetWindowLong(hProgress, GWL_STYLE); progress_style = GetWindowLong(hProgress, GWL_STYLE);
SetWindowLong(hProgress, GWL_STYLE, progress_style | PBS_MARQUEE); SetWindowLong(hProgress, GWL_STYLE, progress_style | PBS_MARQUEE);
SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0); SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0);
@ -2293,13 +2294,21 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break; break;
case UM_PROGRESS_EXIT: case UM_PROGRESS_EXIT:
if (isMarquee) {
// Remove marquee style if previously set // Remove marquee style if previously set
progress_style = GetWindowLong(hProgress, GWL_STYLE); progress_style = GetWindowLong(hProgress, GWL_STYLE);
SetWindowLong(hProgress, GWL_STYLE, progress_style & (~PBS_MARQUEE)); SetWindowLong(hProgress, GWL_STYLE, progress_style & (~PBS_MARQUEE));
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
SetTaskbarProgressState(TASKBAR_NORMAL);
SetTaskbarProgressValue(0, MAX_PROGRESS); SetTaskbarProgressValue(0, MAX_PROGRESS);
SendMessage(hProgress, PBM_SETPOS, 0, 0); SendMessage(hProgress, PBM_SETPOS, 0, 0);
} else if (!IS_ERROR(FormatStatus)) {
SetTaskbarProgressValue(MAX_PROGRESS, MAX_PROGRESS);
// This is the only way to achieve instantaneous progress transition to 100%
SendMessage(hProgress, PBM_SETRANGE, 0, ((MAX_PROGRESS+1)<<16) & 0xFFFF0000);
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000);
}
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
SetTaskbarProgressState(TASKBAR_NORMAL);
break; break;
case UM_FORMAT_COMPLETED: case UM_FORMAT_COMPLETED:
@ -2768,6 +2777,7 @@ out:
safe_free(locale_name); safe_free(locale_name);
safe_free(update.download_url); safe_free(update.download_url);
safe_free(update.release_notes); safe_free(update.release_notes);
safe_free(grub2_buf);
if (argv != NULL) { if (argv != NULL) {
for (i=0; i<argc; i++) safe_free(argv[i]); for (i=0; i<argc; i++) safe_free(argv[i]);
safe_free(argv); safe_free(argv);

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.0.589" CAPTION "Rufus 2.0.0.590"
FONT 8, "Segoe UI", 400, 0, 0x1 FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -157,7 +157,7 @@ END
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376 IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.0.589" CAPTION "Rufus 2.0.0.590"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376 IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | 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 2.0.0.589" CAPTION "Rufus 2.0.0.590"
FONT 8, "Segoe UI", 400, 0, 0x1 FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376 IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | 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 2.0.0.589" CAPTION "Rufus 2.0.0.590"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14 DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -671,8 +671,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,589 FILEVERSION 2,0,0,590
PRODUCTVERSION 2,0,0,589 PRODUCTVERSION 2,0,0,590
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -689,13 +689,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", "2.0.0.589" VALUE "FileVersion", "2.0.0.590"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2015 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", "2.0.0.589" VALUE "ProductVersion", "2.0.0.590"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"