2018-01-19 13:42:21 +00:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include "citra_qt/multiplayer/message.h"
|
|
|
|
|
|
|
|
namespace NetworkMessage {
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::USERNAME_NOT_VALID(
|
2018-01-19 13:42:21 +00:00
|
|
|
QT_TR_NOOP("Username is not valid. Must be 4 to 20 alphanumeric characters."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::ROOMNAME_NOT_VALID(
|
2018-01-19 13:42:21 +00:00
|
|
|
QT_TR_NOOP("Room name is not valid. Must be 4 to 20 alphanumeric characters."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::USERNAME_NOT_VALID_SERVER(
|
2018-11-02 12:17:25 +00:00
|
|
|
QT_TR_NOOP("Username is already in use or not valid. Please choose another."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::IP_ADDRESS_NOT_VALID(
|
|
|
|
QT_TR_NOOP("IP is not a valid IPv4 address."));
|
|
|
|
const ConnectionError ErrorManager::PORT_NOT_VALID(
|
|
|
|
QT_TR_NOOP("Port must be a number between 0 to 65535."));
|
|
|
|
const ConnectionError ErrorManager::GAME_NOT_SELECTED(QT_TR_NOOP(
|
2019-04-19 16:12:30 +01:00
|
|
|
"You must choose a Preferred Game to host a room. If you do not have any games in your game "
|
|
|
|
"list yet, add a game folder by clicking on the plus icon in the game list."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::NO_INTERNET(
|
2018-01-19 13:42:21 +00:00
|
|
|
QT_TR_NOOP("Unable to find an internet connection. Check your internet settings."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::UNABLE_TO_CONNECT(
|
2018-04-18 06:06:02 +01:00
|
|
|
QT_TR_NOOP("Unable to connect to the host. Verify that the connection settings are correct. If "
|
|
|
|
"you still cannot connect, contact the room host and verify that the host is "
|
|
|
|
"properly configured with the external port forwarded."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::ROOM_IS_FULL(
|
2018-04-20 08:34:37 +01:00
|
|
|
QT_TR_NOOP("Unable to connect to the room because it is already full."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::COULD_NOT_CREATE_ROOM(
|
2018-01-19 13:42:21 +00:00
|
|
|
QT_TR_NOOP("Creating a room failed. Please retry. Restarting Citra might be necessary."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::HOST_BANNED(
|
2018-01-19 13:42:21 +00:00
|
|
|
QT_TR_NOOP("The host of the room has banned you. Speak with the host to unban you "
|
|
|
|
"or try a different room."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::WRONG_VERSION(
|
2018-04-19 07:47:11 +01:00
|
|
|
QT_TR_NOOP("Version mismatch! Please update to the latest version of Citra. If the problem "
|
2018-04-18 06:06:02 +01:00
|
|
|
"persists, contact the room host and ask them to update the server."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::WRONG_PASSWORD(QT_TR_NOOP("Incorrect password."));
|
|
|
|
const ConnectionError ErrorManager::GENERIC_ERROR(
|
2018-04-19 07:47:11 +01:00
|
|
|
QT_TR_NOOP("An unknown error occured. If this error continues to occur, please open an issue"));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::LOST_CONNECTION(
|
|
|
|
QT_TR_NOOP("Connection to room lost. Try to reconnect."));
|
|
|
|
const ConnectionError ErrorManager::HOST_KICKED(
|
|
|
|
QT_TR_NOOP("You have been kicked by the room host."));
|
|
|
|
const ConnectionError ErrorManager::MAC_COLLISION(
|
2018-04-18 06:06:02 +01:00
|
|
|
QT_TR_NOOP("MAC address is already in use. Please choose another."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::CONSOLE_ID_COLLISION(QT_TR_NOOP(
|
2018-10-31 15:07:03 +00:00
|
|
|
"Your Console ID conflicted with someone else's in the room.\n\nPlease go to Emulation "
|
|
|
|
"> Configure > System to regenerate your Console ID."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::PERMISSION_DENIED(
|
2018-11-24 08:13:46 +00:00
|
|
|
QT_TR_NOOP("You do not have enough permission to perform this action."));
|
2020-02-29 23:48:58 +00:00
|
|
|
const ConnectionError ErrorManager::NO_SUCH_USER(QT_TR_NOOP(
|
2018-11-24 08:13:46 +00:00
|
|
|
"The user you are trying to kick/ban could not be found.\nThey may have left the room."));
|
2018-01-19 13:42:21 +00:00
|
|
|
|
|
|
|
static bool WarnMessage(const std::string& title, const std::string& text) {
|
|
|
|
return QMessageBox::Ok == QMessageBox::warning(nullptr, QObject::tr(title.c_str()),
|
|
|
|
QObject::tr(text.c_str()),
|
|
|
|
QMessageBox::Ok | QMessageBox::Cancel);
|
|
|
|
}
|
|
|
|
|
2020-02-29 23:48:58 +00:00
|
|
|
void ErrorManager::ShowError(const ConnectionError& e) {
|
|
|
|
QMessageBox::critical(nullptr, tr("Error"), tr(e.GetString().c_str()));
|
2018-01-19 13:42:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool WarnCloseRoom() {
|
|
|
|
return WarnMessage(
|
|
|
|
QT_TR_NOOP("Leave Room"),
|
|
|
|
QT_TR_NOOP("You are about to close the room. Any network connections will be closed."));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WarnDisconnect() {
|
|
|
|
return WarnMessage(
|
|
|
|
QT_TR_NOOP("Disconnect"),
|
|
|
|
QT_TR_NOOP("You are about to leave the room. Any network connections will be closed."));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NetworkMessage
|