2018-01-19 14:42:21 +01:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-04-09 19:00:56 +02:00
|
|
|
#include <utility>
|
|
|
|
|
2018-01-19 14:42:21 +01:00
|
|
|
namespace NetworkMessage {
|
|
|
|
|
|
|
|
class ConnectionError {
|
|
|
|
|
|
|
|
public:
|
2018-04-09 19:00:56 +02:00
|
|
|
explicit ConnectionError(std::string str) : err(std::move(str)) {}
|
2018-01-19 14:42:21 +01:00
|
|
|
const std::string& GetString() const {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string err;
|
|
|
|
};
|
|
|
|
|
2018-11-02 13:17:25 +01:00
|
|
|
/// When the nickname is considered invalid by the client
|
2018-01-19 14:42:21 +01:00
|
|
|
extern const ConnectionError USERNAME_NOT_VALID;
|
|
|
|
extern const ConnectionError ROOMNAME_NOT_VALID;
|
2018-11-02 13:17:25 +01:00
|
|
|
/// When the nickname is considered invalid by the room server
|
|
|
|
extern const ConnectionError USERNAME_NOT_VALID_SERVER;
|
2018-01-19 14:42:21 +01:00
|
|
|
extern const ConnectionError IP_ADDRESS_NOT_VALID;
|
|
|
|
extern const ConnectionError PORT_NOT_VALID;
|
|
|
|
extern const ConnectionError NO_INTERNET;
|
|
|
|
extern const ConnectionError UNABLE_TO_CONNECT;
|
2018-04-20 09:34:37 +02:00
|
|
|
extern const ConnectionError ROOM_IS_FULL;
|
2018-01-19 14:42:21 +01:00
|
|
|
extern const ConnectionError COULD_NOT_CREATE_ROOM;
|
|
|
|
extern const ConnectionError HOST_BANNED;
|
|
|
|
extern const ConnectionError WRONG_VERSION;
|
|
|
|
extern const ConnectionError WRONG_PASSWORD;
|
|
|
|
extern const ConnectionError GENERIC_ERROR;
|
|
|
|
extern const ConnectionError LOST_CONNECTION;
|
2018-11-24 09:13:46 +01:00
|
|
|
extern const ConnectionError HOST_KICKED;
|
2018-01-19 14:42:21 +01:00
|
|
|
extern const ConnectionError MAC_COLLISION;
|
2018-10-31 16:07:03 +01:00
|
|
|
extern const ConnectionError CONSOLE_ID_COLLISION;
|
2018-11-24 09:13:46 +01:00
|
|
|
extern const ConnectionError PERMISSION_DENIED;
|
|
|
|
extern const ConnectionError NO_SUCH_USER;
|
2018-01-19 14:42:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows a standard QMessageBox with a error message
|
|
|
|
*/
|
|
|
|
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
|