diff --git a/launchers/win32/Launcher.rc b/launchers/win32/Launcher.rc index 6e59b0731c..eb72dced4c 100644 --- a/launchers/win32/Launcher.rc +++ b/launchers/win32/Launcher.rc @@ -93,7 +93,7 @@ EXSTYLE WS_EX_APPWINDOW FONT 10, "MS Shell Dlg", 400, 0, 0x0 BEGIN CONTROL "",IDC_VOXEL,"Static",SS_BLACKRECT,65,3,174,123, NOT WS_VISIBLE - CONTROL "", IDC_PROGRESS, "Static", SS_BLACKRECT, 35, 165, 239, 5, NOT WS_VISIBLE + CONTROL "", IDC_PROGRESS, "Static", SS_BLACKRECT, 35, 170, 239, 4, NOT WS_VISIBLE EDITTEXT IDC_ORGNAME,44,68,219,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | NOT WS_BORDER EDITTEXT IDC_USERNAME,44,95,219,12,ES_AUTOHSCROLL | NOT WS_VISIBLE | NOT WS_BORDER EDITTEXT IDC_PASSWORD,44,122,219,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE | NOT WS_BORDER diff --git a/launchers/win32/LauncherDlg.cpp b/launchers/win32/LauncherDlg.cpp index cb9583f26e..1b6b16d303 100644 --- a/launchers/win32/LauncherDlg.cpp +++ b/launchers/win32/LauncherDlg.cpp @@ -143,6 +143,8 @@ BOOL CLauncherDlg::PreTranslateMessage(MSG* pMsg) { } else if (pMsg->wParam == VK_RETURN) { OnNextClicked(); return TRUE; + } else if (pMsg->wParam == VK_ESCAPE) { + theApp._manager.onCancel(); } break; case WM_LBUTTONDOWN: @@ -347,14 +349,16 @@ void CLauncherDlg::drawProgress(CHwndRenderTarget* pRenderTarget, float progress auto size = pRenderTarget->GetPixelSize(); if (progress == 0.0f) { return; - } + } else { + progress = min(1.0f, progress); + } CRect winRec; - CD2DRectF bkCircleRect1 = CD2DRectF(0,0,(float)size.height, (float)size.height); - progress = min(1.0f, progress); - CD2DRectF bkCircleRect2 = CD2DRectF((float)size.width * progress - (float)size.height, 0, - (float)size.width * progress, (float)size.height); - CD2DRectF bkRect = CD2DRectF(0.5f*(float)size.height, 0, - (float)size.width*progress - 0.5f*(float)size.height, (float)size.height); + float fullHeight = (float)size.height; + float halfHeight = 0.5f * (float)size.height; + CD2DRectF bkCircleRect1 = CD2DRectF(0.0f, 0.0f, fullHeight, fullHeight); + float progPos = halfHeight + (float)(size.width - size.height) * progress; + CD2DRectF bkCircleRect2 = CD2DRectF(progPos - halfHeight, 0.0f, progPos + halfHeight, fullHeight); + CD2DRectF bkRect = CD2DRectF(halfHeight, 0.0f, progPos, fullHeight); CD2DEllipse bkCircle1 = CD2DEllipse(bkCircleRect1); CD2DEllipse bkCircle2 = CD2DEllipse(bkCircleRect2); CD2DSolidColorBrush brush(pRenderTarget, color); @@ -639,8 +643,8 @@ BOOL CLauncherDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) } void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) { - const int CONSOLE_MAX_SHUTDOWN_TRY_COUNT = 10; - const int CONSOLE_DELTATIME_BETWEEN_TRYS = 10; + + if (theApp._manager.hasFailed() && _drawStep != DrawStep::DrawError) { theApp._manager.saveErrorLog(); prepareProcess(DrawStep::DrawError); diff --git a/launchers/win32/LauncherManager.cpp b/launchers/win32/LauncherManager.cpp index 066ec46318..baf42c7be9 100644 --- a/launchers/win32/LauncherManager.cpp +++ b/launchers/win32/LauncherManager.cpp @@ -630,4 +630,12 @@ BOOL LauncherManager::downloadContent() { BOOL LauncherManager::downloadApplication() { CString applicationURL = getLatestInterfaceURL(); return downloadFile(ProcessType::DownloadApplication, applicationURL, _applicationZipPath); -} \ No newline at end of file +} + +void LauncherManager::onCancel() { + if (_currentProcess == ProcessType::UnzipApplication) { + _latestVersion = _T(""); + _version = _T(""); + createConfigJSON(); + } +} diff --git a/launchers/win32/LauncherManager.h b/launchers/win32/LauncherManager.h index 44730ec8d7..cb707e0a14 100644 --- a/launchers/win32/LauncherManager.h +++ b/launchers/win32/LauncherManager.h @@ -106,6 +106,7 @@ public: void onFileDownloaded(ProcessType type); float getProgress() { return _progress; } void updateProgress(ProcessType processType, float progress); + void onCancel(); private: ProcessType _currentProcess { ProcessType::DownloadApplication };