Fix bug when enter is pressed and add uninstall progress

This commit is contained in:
luiscuenca 2019-07-09 14:02:23 -07:00
parent 9f110cac13
commit c5156780ca
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D
3 changed files with 15 additions and 7 deletions

View file

@ -258,7 +258,9 @@ afx_msg void CLauncherDlg::OnNextClicked() {
startProcess(); startProcess();
} else if (_drawStep == DrawStep::DrawError) { } else if (_drawStep == DrawStep::DrawError) {
theApp._manager.restartLauncher(); theApp._manager.restartLauncher();
} else { } else if (_drawStep == DrawStep::DrawLoginLogin ||
_drawStep == DrawStep::DrawLoginErrorCred ||
_drawStep == DrawStep::DrawLoginErrorOrg) {
CString token; CString token;
CString username, password, orgname; CString username, password, orgname;
m_orgname.GetWindowTextW(orgname); m_orgname.GetWindowTextW(orgname);
@ -686,6 +688,8 @@ void CLauncherDlg::OnTimer(UINT_PTR nIDEvent) {
theApp._manager.addToLog(_T("Starting login")); theApp._manager.addToLog(_T("Starting login"));
setDrawDialog(DrawStep::DrawLoginLogin); setDrawDialog(DrawStep::DrawLoginLogin);
} }
} else if (theApp._manager.needsUninstall()) {
theApp._manager.updateProgress(LauncherManager::ProcessType::Uninstall, (float)_splashStep/100);
} }
_splashStep++; _splashStep++;
} else if (theApp._manager.shouldShutDown()) { } else if (theApp._manager.shouldShutDown()) {

View file

@ -152,21 +152,24 @@ BOOL LauncherManager::restartLauncher() {
void LauncherManager::updateProgress(ProcessType processType, float progress) { void LauncherManager::updateProgress(ProcessType processType, float progress) {
switch (processType) { switch (processType) {
case LauncherManager::DownloadContent: case ProcessType::Uninstall:
_progress = progress;
break;
case ProcessType::DownloadContent:
_progress = DOWNLOAD_CONTENT_INSTALL_WEIGHT * progress; _progress = DOWNLOAD_CONTENT_INSTALL_WEIGHT * progress;
break; break;
case LauncherManager::UnzipContent: case ProcessType::UnzipContent:
_progress = DOWNLOAD_CONTENT_INSTALL_WEIGHT + _progress = DOWNLOAD_CONTENT_INSTALL_WEIGHT +
EXTRACT_CONTENT_INSTALL_WEIGHT * progress; EXTRACT_CONTENT_INSTALL_WEIGHT * progress;
break; break;
case LauncherManager::DownloadApplication: case ProcessType::DownloadApplication:
_progress = !_shouldUpdate ? _progress = !_shouldUpdate ?
(DOWNLOAD_CONTENT_INSTALL_WEIGHT + (DOWNLOAD_CONTENT_INSTALL_WEIGHT +
EXTRACT_CONTENT_INSTALL_WEIGHT + EXTRACT_CONTENT_INSTALL_WEIGHT +
DOWNLOAD_APPLICATION_INSTALL_WEIGHT * progress) : DOWNLOAD_APPLICATION_INSTALL_WEIGHT * progress) :
DOWNLOAD_APPLICATION_UPDATE_WEIGHT * progress; DOWNLOAD_APPLICATION_UPDATE_WEIGHT * progress;
break; break;
case LauncherManager::UnzipApplication: case ProcessType::UnzipApplication:
_progress = !_shouldUpdate ? _progress = !_shouldUpdate ?
(DOWNLOAD_CONTENT_INSTALL_WEIGHT + (DOWNLOAD_CONTENT_INSTALL_WEIGHT +
EXTRACT_CONTENT_INSTALL_WEIGHT + EXTRACT_CONTENT_INSTALL_WEIGHT +

View file

@ -52,7 +52,8 @@ public:
DownloadContent, DownloadContent,
DownloadApplication, DownloadApplication,
UnzipContent, UnzipContent,
UnzipApplication UnzipApplication,
Uninstall
}; };
LauncherManager(); LauncherManager();
~LauncherManager(); ~LauncherManager();
@ -104,9 +105,9 @@ public:
void onZipExtracted(ProcessType type, int size); void onZipExtracted(ProcessType type, int size);
void onFileDownloaded(ProcessType type); void onFileDownloaded(ProcessType type);
float getProgress() { return _progress; } float getProgress() { return _progress; }
void updateProgress(ProcessType processType, float progress);
private: private:
void updateProgress(ProcessType processType, float progress);
ProcessType _currentProcess { ProcessType::DownloadApplication }; ProcessType _currentProcess { ProcessType::DownloadApplication };
CString _latestApplicationURL; CString _latestApplicationURL;
CString _latestVersion; CString _latestVersion;