[Scummvm-git-logs] scummvm master -> ccd0fec217a828f94c8216781c013ddec26b08ea

sev- noreply at scummvm.org
Sat Jun 15 22:46:50 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ccd0fec217 GUI: UX improvements to the IntegrityDialog


Commit: ccd0fec217a828f94c8216781c013ddec26b08ea
    https://github.com/scummvm/scummvm/commit/ccd0fec217a828f94c8216781c013ddec26b08ea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-06-16T00:46:27+02:00

Commit Message:
GUI: UX improvements to the IntegrityDialog

Now it at least shows the progress bar but the current approach
is hackish: we do a forced full redraw and huge files are not
updating mid-way

Changed paths:
    gui/integrity-dialog.cpp


diff --git a/gui/integrity-dialog.cpp b/gui/integrity-dialog.cpp
index d82df7de2a5..9428c0e7ca5 100644
--- a/gui/integrity-dialog.cpp
+++ b/gui/integrity-dialog.cpp
@@ -40,7 +40,8 @@ namespace GUI {
 enum {
 	kResponseCmd = 'IDRC',
 	kCopyEmailCmd = 'IDCE',
-	kCleanupCmd = 'IDCl'
+	kCleanupCmd = 'IDCl',
+	kDownloadProgressCmd = 'DLPg',
 };
 
 struct ResultFormat {
@@ -64,6 +65,7 @@ struct ChecksumDialogState {
 
 	int totalSize;
 	int calculatedSize;
+	uint32 lastUpdate;
 
 	Common::String endpoint;
 	Common::Path gamePath;
@@ -76,6 +78,7 @@ struct ChecksumDialogState {
 	ChecksumDialogState() {
 		state = kChecksumStateNone;
 		totalSize = calculatedSize = 0;
+		lastUpdate = 0;
 		dialog = nullptr;
 	}
 } static *g_checksum_state;
@@ -132,8 +135,6 @@ IntegrityDialog::IntegrityDialog(Common::String endpoint, Common::String domain)
 		g_checksum_state->platform = ConfMan.get("platform", domain);
 		g_checksum_state->language = ConfMan.get("language", domain);
 		calculateTotalSize(g_checksum_state->gamePath);
-
-		sendJSON();
 	} else {
 		g_checksum_state->dialog = this;
 
@@ -182,7 +183,6 @@ void IntegrityDialog::setState(ProcessState state) {
 		_percentLabel->setVisible(false);
 		_calcSizeLabel->setVisible(false);
 		_progressBar->setVisible(false);
-
 		break;
 
 	case kResponseReceived:
@@ -217,6 +217,12 @@ void IntegrityDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
 		close();
 		break;
 	}
+	case kDownloadProgressCmd:
+		if (!_close) {
+			refreshWidgets();
+			g_gui.redrawFull();
+		}
+		break;
 	case kCopyEmailCmd: {
 		g_system->openUrl(g_result->emailLink);
 		break;
@@ -233,6 +239,9 @@ void IntegrityDialog::handleTickle() {
 		return;
 	}
 
+	if (g_checksum_state->state == kChecksumStateCalculating)
+		sendJSON();
+
 	int32 progress = getCalculationProgress();
 	if (_progressBar->getValue() != progress) {
 		refreshWidgets();
@@ -369,6 +378,11 @@ Common::Array<Common::StringArray> IntegrityDialog::generateChecksums(Common::Pa
 
 			g_checksum_state->calculatedSize += file.size();
 
+			if (g_system->getMillis() > g_checksum_state->lastUpdate + 500) {
+				g_checksum_state->lastUpdate = g_system->getMillis();
+				sendCommand(kDownloadProgressCmd, 0);
+			}
+
 			file.close();
 			fileChecksums.push_back(fileChecksum);
 		}




More information about the Scummvm-git-logs mailing list