mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +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
|
FONT 10, "MS Shell Dlg", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
CONTROL "",IDC_VOXEL,"Static",SS_BLACKRECT,65,3,174,123, NOT WS_VISIBLE
|
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_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_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
|
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) {
|
} else if (pMsg->wParam == VK_RETURN) {
|
||||||
OnNextClicked();
|
OnNextClicked();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else if (pMsg->wParam == VK_ESCAPE) {
|
||||||
|
theApp._manager.onCancel();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
@ -347,14 +349,16 @@ void CLauncherDlg::drawProgress(CHwndRenderTarget* pRenderTarget, float progress
|
||||||
auto size = pRenderTarget->GetPixelSize();
|
auto size = pRenderTarget->GetPixelSize();
|
||||||
if (progress == 0.0f) {
|
if (progress == 0.0f) {
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
progress = min(1.0f, progress);
|
||||||
}
|
}
|
||||||
CRect winRec;
|
CRect winRec;
|
||||||
CD2DRectF bkCircleRect1 = CD2DRectF(0,0,(float)size.height, (float)size.height);
|
float fullHeight = (float)size.height;
|
||||||
progress = min(1.0f, progress);
|
float halfHeight = 0.5f * (float)size.height;
|
||||||
CD2DRectF bkCircleRect2 = CD2DRectF((float)size.width * progress - (float)size.height, 0,
|
CD2DRectF bkCircleRect1 = CD2DRectF(0.0f, 0.0f, fullHeight, fullHeight);
|
||||||
(float)size.width * progress, (float)size.height);
|
float progPos = halfHeight + (float)(size.width - size.height) * progress;
|
||||||
CD2DRectF bkRect = CD2DRectF(0.5f*(float)size.height, 0,
|
CD2DRectF bkCircleRect2 = CD2DRectF(progPos - halfHeight, 0.0f, progPos + halfHeight, fullHeight);
|
||||||
(float)size.width*progress - 0.5f*(float)size.height, (float)size.height);
|
CD2DRectF bkRect = CD2DRectF(halfHeight, 0.0f, progPos, fullHeight);
|
||||||
CD2DEllipse bkCircle1 = CD2DEllipse(bkCircleRect1);
|
CD2DEllipse bkCircle1 = CD2DEllipse(bkCircleRect1);
|
||||||
CD2DEllipse bkCircle2 = CD2DEllipse(bkCircleRect2);
|
CD2DEllipse bkCircle2 = CD2DEllipse(bkCircleRect2);
|
||||||
CD2DSolidColorBrush brush(pRenderTarget, color);
|
CD2DSolidColorBrush brush(pRenderTarget, color);
|
||||||
|
@ -639,8 +643,8 @@ BOOL CLauncherDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
|
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) {
|
if (theApp._manager.hasFailed() && _drawStep != DrawStep::DrawError) {
|
||||||
theApp._manager.saveErrorLog();
|
theApp._manager.saveErrorLog();
|
||||||
prepareProcess(DrawStep::DrawError);
|
prepareProcess(DrawStep::DrawError);
|
||||||
|
|
|
@ -631,3 +631,11 @@ BOOL LauncherManager::downloadApplication() {
|
||||||
CString applicationURL = getLatestInterfaceURL();
|
CString applicationURL = getLatestInterfaceURL();
|
||||||
return downloadFile(ProcessType::DownloadApplication, applicationURL, _applicationZipPath);
|
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);
|
void onFileDownloaded(ProcessType type);
|
||||||
float getProgress() { return _progress; }
|
float getProgress() { return _progress; }
|
||||||
void updateProgress(ProcessType processType, float progress);
|
void updateProgress(ProcessType processType, float progress);
|
||||||
|
void onCancel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProcessType _currentProcess { ProcessType::DownloadApplication };
|
ProcessType _currentProcess { ProcessType::DownloadApplication };
|
||||||
|
|
Loading…
Reference in a new issue