[Scummvm-git-logs] scummvm master -> 5128dbb1a0db4b913765f3de864c1a9c3590f002

bluegr noreply at scummvm.org
Sat Nov 8 14:26:58 UTC 2025


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

Summary:
5128dbb1a0 GUI: EMSCRIPTEN: Add option to download file opened in TextViewer


Commit: 5128dbb1a0db4b913765f3de864c1a9c3590f002
    https://github.com/scummvm/scummvm/commit/5128dbb1a0db4b913765f3de864c1a9c3590f002
Author: Christian Kündig (christian at kuendig.info)
Date: 2025-11-08T16:26:54+02:00

Commit Message:
GUI: EMSCRIPTEN: Add option to download file opened in TextViewer

Changed paths:
    gui/textviewer.cpp
    gui/textviewer.h


diff --git a/gui/textviewer.cpp b/gui/textviewer.cpp
index 0a7b4404b27..24df3e83c64 100644
--- a/gui/textviewer.cpp
+++ b/gui/textviewer.cpp
@@ -30,6 +30,9 @@
 #include "gui/ThemeEval.h"
 #include "gui/textviewer.h"
 #include "gui/widgets/scrollbar.h"
+#ifdef EMSCRIPTEN
+#include "backends/platform/sdl/emscripten/emscripten.h"
+#endif
 
 namespace GUI {
 
@@ -52,6 +55,9 @@ TextViewerDialog::TextViewerDialog(const Common::Path &fname)
 	// I18N: Close dialog button
 	_closeButton = new ButtonWidget(this, 0, 0, 1, 1, _("Close"), Common::U32String(), kCloseCmd);
 
+#ifdef EMSCRIPTEN
+	_downloadButton = new ButtonWidget(this, 0, 0, 1, 1, _("Download"), Common::U32String(), kDownloadFileCmd);
+#endif
 	_currentPos = 0;
 	_scrollLine = _linesPerPage - 1;
 
@@ -132,6 +138,11 @@ void TextViewerDialog::reflowLayout() {
 	_closeButton->setPos(_w - bW - padR, _h - buttonOffset);
 	_closeButton->setSize(bW, bH);
 
+#ifdef EMSCRIPTEN
+	_downloadButton->setPos(_w - 2 * bW - 2 * padR, _h - buttonOffset);
+	_downloadButton->setSize(bW, bH);
+#endif
+
 	// Calculate depending values
 	_lineWidth = (_w - scrollbarWidth - _padX * 2) / _charWidth;
 	_linesPerPage = (_h - _padY * 2 - buttonOffset) / _lineHeight;
@@ -195,6 +206,11 @@ void TextViewerDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 d
 	case kCloseCmd:
 		close();
 		break;
+#ifdef EMSCRIPTEN
+	case kDownloadFileCmd: 
+		dynamic_cast<OSystem_Emscripten *>(g_system)->exportFile(_fname);
+		break; 
+#endif
 	default:
 		return;
 	}
diff --git a/gui/textviewer.h b/gui/textviewer.h
index 15fa3455623..d08026010e0 100644
--- a/gui/textviewer.h
+++ b/gui/textviewer.h
@@ -35,6 +35,11 @@ namespace GUI {
 
 class ButtonWidget;
 class ScrollBarWidget;
+#ifdef EMSCRIPTEN
+enum {
+	kDownloadFileCmd = 'dlfc',
+};
+#endif 
 
 class TextViewerDialog : public Dialog {
 private:
@@ -51,6 +56,9 @@ private:
 
 	ScrollBarWidget *_scrollBar;
 	ButtonWidget *_closeButton;
+#ifdef EMSCRIPTEN
+	ButtonWidget *_downloadButton;
+#endif
 
 	Common::Path _fname;
 	const Graphics::Font *_font = nullptr;




More information about the Scummvm-git-logs mailing list