mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +02:00
Fix bar draw and catch incomplete install
This commit is contained in:
parent
c5156780ca
commit
ec63684866
4 changed files with 24 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -630,4 +630,12 @@ BOOL LauncherManager::downloadContent() {
|
|||
BOOL LauncherManager::downloadApplication() {
|
||||
CString applicationURL = getLatestInterfaceURL();
|
||||
return downloadFile(ProcessType::DownloadApplication, applicationURL, _applicationZipPath);
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherManager::onCancel() {
|
||||
if (_currentProcess == ProcessType::UnzipApplication) {
|
||||
_latestVersion = _T("");
|
||||
_version = _T("");
|
||||
createConfigJSON();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in a new issue