summaryrefslogtreecommitdiff
path: root/src/yuzu/multiplayer/message.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-07-25 18:31:45 -0400
committerGitHub <noreply@github.com>2022-07-25 18:31:45 -0400
commit1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2 (patch)
tree999411f1ca76390654d1034c6d0bd2c47c3f101c /src/yuzu/multiplayer/message.h
parent1bcde9dd9879fc2677695e9283f2fe1d68c935b2 (diff)
parenta41baaa181f30229d3552caa69135be978c1ddb5 (diff)
Merge pull request #8541 from FearlessTobi/multiplayer-part1
yuzu, network: Add room service and UI configuration
Diffstat (limited to 'src/yuzu/multiplayer/message.h')
-rw-r--r--src/yuzu/multiplayer/message.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/yuzu/multiplayer/message.h b/src/yuzu/multiplayer/message.h
new file mode 100644
index 000000000..eb5c8d1be
--- /dev/null
+++ b/src/yuzu/multiplayer/message.h
@@ -0,0 +1,64 @@
+// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <utility>
+
+namespace NetworkMessage {
+
+class ConnectionError {
+
+public:
+ explicit ConnectionError(std::string str) : err(std::move(str)) {}
+ const std::string& GetString() const {
+ return err;
+ }
+
+private:
+ std::string err;
+};
+
+class ErrorManager : QObject {
+ Q_OBJECT
+public:
+ /// When the nickname is considered invalid by the client
+ static const ConnectionError USERNAME_NOT_VALID;
+ static const ConnectionError ROOMNAME_NOT_VALID;
+ /// When the nickname is considered invalid by the room server
+ static const ConnectionError USERNAME_NOT_VALID_SERVER;
+ static const ConnectionError IP_ADDRESS_NOT_VALID;
+ static const ConnectionError PORT_NOT_VALID;
+ static const ConnectionError GAME_NOT_SELECTED;
+ static const ConnectionError NO_INTERNET;
+ static const ConnectionError UNABLE_TO_CONNECT;
+ static const ConnectionError ROOM_IS_FULL;
+ static const ConnectionError COULD_NOT_CREATE_ROOM;
+ static const ConnectionError HOST_BANNED;
+ static const ConnectionError WRONG_VERSION;
+ static const ConnectionError WRONG_PASSWORD;
+ static const ConnectionError GENERIC_ERROR;
+ static const ConnectionError LOST_CONNECTION;
+ static const ConnectionError HOST_KICKED;
+ static const ConnectionError MAC_COLLISION;
+ static const ConnectionError CONSOLE_ID_COLLISION;
+ static const ConnectionError PERMISSION_DENIED;
+ static const ConnectionError NO_SUCH_USER;
+ /**
+ * Shows a standard QMessageBox with a error message
+ */
+ static void ShowError(const ConnectionError& e);
+};
+/**
+ * Show a standard QMessageBox with a warning message about leaving the room
+ * return true if the user wants to close the network connection
+ */
+bool WarnCloseRoom();
+
+/**
+ * Show a standard QMessageBox with a warning message about disconnecting from the room
+ * return true if the user wants to disconnect
+ */
+bool WarnDisconnect();
+
+} // namespace NetworkMessage