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

criezy criezy at scummvm.org
Tue Aug 30 22:37:50 CEST 2016


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

Summary:
89ff116865 CONFIGURE: Fix missing space in message when checking for cloud support
7edc96803e CLOUD: Fix crash when trying to connect without entering a code first
1c0e4e8206 CLOUD: Disable the connect button initially as the code is empty
f490fb811a OSX: Implement clipboard support


Commit: 89ff116865dd3a1795f9b841c89e39be44bbe05b
    https://github.com/scummvm/scummvm/commit/89ff116865dd3a1795f9b841c89e39be44bbe05b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-08-30T21:37:34+01:00

Commit Message:
CONFIGURE: Fix missing space in message when checking for cloud support

Changed paths:
    configure



diff --git a/configure b/configure
index aa11d67..e74b748 100755
--- a/configure
+++ b/configure
@@ -4216,7 +4216,7 @@ define_in_config_if_yes "$_libcurl" "USE_LIBCURL"
 #
 # Check whether to build cloud integration support
 #
-echo_n "Cloud integration..."
+echo_n "Cloud integration... "
 if test "$_cloud" = "no"; then
 	echo "no"
 else


Commit: 7edc96803e5af76a8253a0f168590633ff43866f
    https://github.com/scummvm/scummvm/commit/7edc96803e5af76a8253a0f168590633ff43866f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-08-30T21:37:34+01:00

Commit Message:
CLOUD: Fix crash when trying to connect without entering a code first

Changed paths:
    gui/storagewizarddialog.cpp



diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp
index 60f31d1..8dcea1c 100644
--- a/gui/storagewizarddialog.cpp
+++ b/gui/storagewizarddialog.cpp
@@ -242,10 +242,12 @@ void StorageWizardDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
 			code += subcode;
 			code.deleteLastChar();
 		}
-		code.erase(code.size() - 3);
-		CloudMan.connectStorage(_storageId, code);
-		setResult(1);
-		close();
+		if (code.size() > 3) {
+			code.erase(code.size() - 3);
+			CloudMan.connectStorage(_storageId, code);
+			setResult(1);
+			close();
+		}
 		break;
 	}
 #ifdef USE_SDL_NET


Commit: 1c0e4e8206acfedebe00a928ec37efc1f203f4d1
    https://github.com/scummvm/scummvm/commit/1c0e4e8206acfedebe00a928ec37efc1f203f4d1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-08-30T21:37:34+01:00

Commit Message:
CLOUD: Disable the connect button initially as the code is empty

The connect button is enabled/disabled whenever the text in the
code widget is changed and it's validity assessed. But the initial
state was not correct.

Changed paths:
    gui/storagewizarddialog.cpp



diff --git a/gui/storagewizarddialog.cpp b/gui/storagewizarddialog.cpp
index 8dcea1c..ad00365 100644
--- a/gui/storagewizarddialog.cpp
+++ b/gui/storagewizarddialog.cpp
@@ -70,6 +70,9 @@ StorageWizardDialog::StorageWizardDialog(uint32 storageId):
 	_openUrlWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.OpenUrlButton", _("Open URL"), 0, kOpenUrlCmd);
 	_pasteCodeWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.PasteCodeButton", _("Paste"), _("Pastes clipboard contents into fields"), kPasteCodeCmd);
 	_connectWidget = new ButtonWidget(container, "GlobalOptions_Cloud_ConnectionWizard_Container.ConnectButton", _("Connect"), 0, kConnectCmd);
+		
+	// Initialy the code is empty, so disable the connect button
+	_connectWidget->setEnabled(false);
 
 	if (Cloud::CloudManager::couldUseLocalServer()) {
 		// hide fields and even the button if local webserver is on


Commit: f490fb811a64566e9f8d9471084c1b43c958d3c0
    https://github.com/scummvm/scummvm/commit/f490fb811a64566e9f8d9471084c1b43c958d3c0
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-08-30T21:37:34+01:00

Commit Message:
OSX: Implement clipboard support

There was already an implementation using SDL2 in the SDL backend,
but this way we have it available also when using the SDL 1.

Changed paths:
  A backends/platform/sdl/macosx/macosx_wrapper.h
  A backends/platform/sdl/macosx/macosx_wrapper.mm
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/module.mk



diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 7652c0d..c4e83dc 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -33,6 +33,7 @@
 #include "backends/platform/sdl/macosx/macosx.h"
 #include "backends/updates/macosx/macosx-updates.h"
 #include "backends/taskbar/macosx/macosx-taskbar.h"
+#include "backends/platform/sdl/macosx/macosx_wrapper.h"
 
 #include "common/archive.h"
 #include "common/config-manager.h"
@@ -106,7 +107,7 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
 }
 
 bool OSystem_MacOSX::hasFeature(Feature f) {
-	if (f == kFeatureDisplayLogFile)
+	if (f == kFeatureDisplayLogFile || f == kFeatureClipboardSupport)
 		return true;
 	return OSystem_POSIX::hasFeature(f);
 }
@@ -124,6 +125,14 @@ bool OSystem_MacOSX::displayLogFile() {
 	return err != noErr;
 }
 
+bool OSystem_MacOSX::hasTextInClipboard() {
+	return hasTextInClipboardMacOSX();
+}
+
+Common::String OSystem_MacOSX::getTextFromClipboard() {
+	return getTextFromClipboardMacOSX();
+}
+
 Common::String OSystem_MacOSX::getSystemLanguage() const {
 #if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
 	CFArrayRef availableLocalizations = CFBundleCopyBundleLocalizations(CFBundleGetMainBundle());
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 6905284..0c755cb 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -33,6 +33,9 @@ public:
 
 	virtual bool displayLogFile();
 
+	virtual bool hasTextInClipboard();
+	virtual Common::String getTextFromClipboard();
+
 	virtual Common::String getSystemLanguage() const;
 
 	virtual void init();
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.h b/backends/platform/sdl/macosx/macosx_wrapper.h
new file mode 100644
index 0000000..3b346fc
--- /dev/null
+++ b/backends/platform/sdl/macosx/macosx_wrapper.h
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PLATFORM_SDL_MACOSX_WRAPPER_H
+#define PLATFORM_SDL_MACOSX_WRAPPER_H
+
+#include <common/str.h>
+
+bool hasTextInClipboardMacOSX();
+Common::String getTextFromClipboardMacOSX();
+
+#endif
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
new file mode 100644
index 0000000..8ec9eac
--- /dev/null
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+// Disable symbol overrides so that we can use system headers.
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "backends/platform/sdl/macosx/macosx_wrapper.h"
+
+#include <AppKit/NSPasteboard.h>
+#include <Foundation/NSArray.h>
+
+bool hasTextInClipboardMacOSX() {
+	return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] != nil;
+}
+
+Common::String getTextFromClipboardMacOSX() {
+	if (!hasTextInClipboardMacOSX())
+		return Common::String();
+	// Note: on OS X 10.6 and above it is recommanded to use NSPasteboardTypeString rather than NSStringPboardType.
+	// But since we still target older version use NSStringPboardType.
+	NSPasteboard *pb = [NSPasteboard generalPasteboard];
+	NSString* str = [pb  stringForType:NSStringPboardType];
+	if (str == nil)
+		return Common::String();
+	// If the string cannot be represented using the requested encoding we get a null pointer below.
+	// This is fine as ScummVM would not know what to do with non-ASCII characters (although maybe
+	// we should use NSISOLatin1StringEncoding?).
+	return Common::String([str cStringUsingEncoding:NSASCIIStringEncoding]);
+}
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index 74dd506..84ce272 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -14,6 +14,7 @@ ifdef MACOSX
 MODULE_OBJS += \
 	macosx/macosx-main.o \
 	macosx/macosx.o \
+	macosx/macosx_wrapper.o \
 	macosx/appmenu_osx.o
 endif
 





More information about the Scummvm-git-logs mailing list