blob: 812495c72dd5e4035886b4f5f599ae35064d4d95 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// 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 IP_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
|