mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 09:09:29 +01:00
Merge pull request #12042 from ccawley2011/clipboard
SDL/Qt: Implement clipboard support
This commit is contained in:
2 files changed
+9
No files matched your search
@@ -6,6 +6,7 @@
|
||||
// Currently supports: Android, Linux, Windows, Mac OSX
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
@@ -67,6 +68,8 @@ std::string System_GetProperty(SystemProperty prop) {
|
||||
#endif
|
||||
case SYSPROP_LANGREGION:
|
||||
return QLocale::system().name().toStdString();
|
||||
case SYSPROP_CLIPBOARD_TEXT:
|
||||
return QApplication::clipboard()->text().toStdString();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -122,6 +125,8 @@ void System_SendMessage(const char *command, const char *parameter) {
|
||||
} else if (!strcmp(command, "graphics_restart")) {
|
||||
// Should find a way to properly restart the app.
|
||||
qApp->exit(0);
|
||||
} else if (!strcmp(command, "setclipboardtext")) {
|
||||
QApplication::clipboard()->setText(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,8 @@ void System_SendMessage(const char *command, const char *parameter) {
|
||||
} else if (!strcmp(command, "graphics_restart")) {
|
||||
// Not sure how we best do this, but do a clean exit, better than being stuck in a bad state.
|
||||
g_QuitRequested = true;
|
||||
} else if (!strcmp(command, "setclipboardtext")) {
|
||||
SDL_SetClipboardText(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +209,8 @@ std::string System_GetProperty(SystemProperty prop) {
|
||||
}
|
||||
return "en_US";
|
||||
}
|
||||
case SYSPROP_CLIPBOARD_TEXT:
|
||||
return SDL_HasClipboardText() ? SDL_GetClipboardText() : "";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user