[Scummvm-git-logs] scummvm branch-2-7-0-android -> 5751768dc51e959d3bcc62bea6eb78b12b0575ee

sev- noreply at scummvm.org
Sun Mar 26 22:30:51 UTC 2023


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

Summary:
87d94e921f BASE: Fix --logfile command line option
d71accf00d GUI: Reflect command line override for the log path
5751768dc5 GUI: Process empty log path and gracefully process unreadable paths


Commit: 87d94e921f653bc2257d413c034fc11615f2500e
    https://github.com/scummvm/scummvm/commit/87d94e921f653bc2257d413c034fc11615f2500e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-27T00:30:26+02:00

Commit Message:
BASE: Fix --logfile command line option

It was plainly not functional. We were never passing it to backend

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 20fd0fafe84..6f71cdc2c8d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1888,6 +1888,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	// Finally, store the command line settings into the config manager.
 	static const char * const sessionSettings[] = {
 		"config",
+		"logfile",
 		"initial-cfg",
 		"fullscreen",
 		"gfx-mode",


Commit: d71accf00d92bdcfd492280ddfea74e4a4eeaceb
    https://github.com/scummvm/scummvm/commit/d71accf00d92bdcfd492280ddfea74e4a4eeaceb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-27T00:30:33+02:00

Commit Message:
GUI: Reflect command line override for the log path

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


diff --git a/gui/options.cpp b/gui/options.cpp
index f75abff2003..2e77c1a3b9e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2493,7 +2493,19 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
 		configPathWidget->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
 
 	Common::U32String logPath = g_system->getDefaultLogFileName();
-	new StaticTextWidget(boss, prefix + "LogPath", _("ScummVM log path: ") + logPath, logPath);
+	bool colorOverride = false;
+
+	if (ConfMan.hasKey("logfile")) {
+		logPath = ConfMan.get("logfile");
+
+		if (ConfMan.isKeyTemporary("logfile"))
+			colorOverride = true;
+	}
+	_logPath = new StaticTextWidget(boss, prefix + "LogPath", _("ScummVM log path: ") + logPath, logPath);
+
+	if (colorOverride)
+		_logPath->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
+
 	new ButtonWidget(boss, prefix + "ViewButton", _("View"), Common::U32String(), kViewLogCmd);
 
 	Common::U32String browserPath = _("<default>");
@@ -3244,7 +3256,14 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
 
 		break;
 	case kViewLogCmd: {
-		TextViewerDialog viewer(g_system->getDefaultLogFileName());
+		Common::String logPath;
+
+		if (ConfMan.hasKey("logfile"))
+			logPath = ConfMan.get("logfile");
+		else
+			logPath = g_system->getDefaultLogFileName();
+
+		TextViewerDialog viewer(logPath);
 		viewer.runModal();
 		g_gui.scheduleTopDialogRedraw();
 		break;
diff --git a/gui/options.h b/gui/options.h
index 25e5d46aa39..b1e7ccf3856 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -286,6 +286,7 @@ protected:
 #endif
 	StaticTextWidget *_browserPath;
 	ButtonWidget	 *_browserPathClearButton;
+	StaticTextWidget *_logPath;
 
 	void addPathsControls(GuiObject *boss, const Common::String &prefix, bool lowres);
 


Commit: 5751768dc51e959d3bcc62bea6eb78b12b0575ee
    https://github.com/scummvm/scummvm/commit/5751768dc51e959d3bcc62bea6eb78b12b0575ee
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-27T00:30:39+02:00

Commit Message:
GUI: Process empty log path and gracefully process unreadable paths

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


diff --git a/gui/options.cpp b/gui/options.cpp
index 2e77c1a3b9e..5b0e45fa6fc 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2506,7 +2506,10 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
 	if (colorOverride)
 		_logPath->setFontColor(ThemeEngine::FontColor::kFontColorOverride);
 
-	new ButtonWidget(boss, prefix + "ViewButton", _("View"), Common::U32String(), kViewLogCmd);
+	ButtonWidget *viewButton = new ButtonWidget(boss, prefix + "ViewButton", _("View"), Common::U32String(), kViewLogCmd);
+
+	if (logPath.empty())
+		viewButton->setEnabled(false);
 
 	Common::U32String browserPath = _("<default>");
 	if (ConfMan.hasKey("browser_lastpath"))
diff --git a/gui/textviewer.cpp b/gui/textviewer.cpp
index 30e54c17a98..460644c3dce 100644
--- a/gui/textviewer.cpp
+++ b/gui/textviewer.cpp
@@ -75,6 +75,12 @@ bool TextViewerDialog::loadFile(Common::String &fname) {
 
 	Common::SeekableReadStream *stream = file.createReadStream();
 
+	if (!stream) {
+		warning("TextViewerDialog::loadFile(): Cannot load file %s", fname.c_str());
+
+		return false;
+	}
+
 	warning("TextViewerDialog::loadFile(): File size is: %ld", stream->size());
 
 	_linesArray.clear();




More information about the Scummvm-git-logs mailing list