Add a message overlay

This commit is contained in:
RipleyTom 2022-05-17 16:35:41 +02:00 committed by Megamouse
parent 3dc9a8b980
commit e68ffdbc81
11 changed files with 259 additions and 27 deletions

View file

@ -151,7 +151,19 @@ private:
case localized_string_id::CELL_SAVEDATA_DELETE: return tr("Delete this data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_SAVEDATA_LOAD: return tr("Load this data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_SAVEDATA_OVERWRITE: return tr("Do you want to overwrite the saved data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
case localized_string_id::RPCN_NO_ERROR: return tr("RPCN: No Error");
case localized_string_id::RPCN_ERROR_INVALID_INPUT: return tr("RPCN: Invalid Input (Wrong Host/Port)");
case localized_string_id::RPCN_ERROR_WOLFSSL: return tr("RPCN Connection Error: WolfSSL Error");
case localized_string_id::RPCN_ERROR_RESOLVE: return tr("RPCN Connection Error: Resolve Error");
case localized_string_id::RPCN_ERROR_CONNECT: return tr("RPCN Connection Error");
case localized_string_id::RPCN_ERROR_LOGIN_ERROR: return tr("RPCN Login Error: Identification Error");
case localized_string_id::RPCN_ERROR_ALREADY_LOGGED: return tr("RPCN Login Error: User Already Logged In");
case localized_string_id::RPCN_ERROR_INVALID_LOGIN: return tr("RPCN Login Error: Invalid Username");
case localized_string_id::RPCN_ERROR_INVALID_PASSWORD: return tr("RPCN Login Error: Invalid Password");
case localized_string_id::RPCN_ERROR_INVALID_TOKEN: return tr("RPCN Login Error: Invalid Token");
case localized_string_id::RPCN_ERROR_INVALID_PROTOCOL_VERSION: return tr("RPCN Misc Error: Protocol Version Error (outdated RPCS3?)");
case localized_string_id::RPCN_ERROR_UNKNOWN: return tr("RPCN: Unknown Error");
case localized_string_id::RPCN_SUCCESS_LOGGED_ON: return tr("Successfully logged on RPCN!");
case localized_string_id::INVALID: return tr("Invalid");
default: return tr("Unknown");
}

View file

@ -18,26 +18,6 @@
LOG_CHANNEL(rpcn_settings_log, "rpcn settings dlg");
const QString rpcn_state_to_qstr(rpcn::rpcn_state state)
{
switch (state)
{
case rpcn::rpcn_state::failure_no_failure: return QObject::tr("No Error");
case rpcn::rpcn_state::failure_input: return QObject::tr("Invalid Input");
case rpcn::rpcn_state::failure_wolfssl: return QObject::tr("WolfSSL Error");
case rpcn::rpcn_state::failure_resolve: return QObject::tr("Resolve Error");
case rpcn::rpcn_state::failure_connect: return QObject::tr("Connect Error");
case rpcn::rpcn_state::failure_id: return QObject::tr("Identification Error");
case rpcn::rpcn_state::failure_id_already_logged_in: return QObject::tr("Identification Error: User Already Logged In");
case rpcn::rpcn_state::failure_id_username: return QObject::tr("Identification Error: Invalid Username");
case rpcn::rpcn_state::failure_id_password: return QObject::tr("Identification Error: Invalid Password");
case rpcn::rpcn_state::failure_id_token: return QObject::tr("Identification Error: Invalid Token");
case rpcn::rpcn_state::failure_protocol: return QObject::tr("Protocol Version Error");
case rpcn::rpcn_state::failure_other: return QObject::tr("Unknown Error");
default: return QObject::tr("Unhandled rpcn state!");
}
}
bool validate_rpcn_username(const std::string& input)
{
if (input.length() < 3 || input.length() > 16)
@ -258,7 +238,7 @@ void rpcn_account_dialog::create_account()
if (auto result = rpcn->wait_for_connection(); result != rpcn::rpcn_state::failure_no_failure)
{
const QString error_message = tr("Failed to connect to RPCN server:\n%0").arg(rpcn_state_to_qstr(result));
const QString error_message = tr("Failed to connect to RPCN server:\n%0").arg(QString::fromStdString(rpcn::rpcn_state_to_string(result)));
QMessageBox::critical(this, tr("Error Connecting"), error_message, QMessageBox::Ok);
return;
}
@ -293,7 +273,7 @@ void rpcn_account_dialog::resend_token()
if (auto result = rpcn->wait_for_connection(); result != rpcn::rpcn_state::failure_no_failure)
{
const QString error_message = tr("Failed to connect to RPCN server:\n%0").arg(rpcn_state_to_qstr(result));
const QString error_message = tr("Failed to connect to RPCN server:\n%0").arg(QString::fromStdString(rpcn::rpcn_state_to_string(result)));
QMessageBox::critical(this, tr("Error Connecting"), error_message, QMessageBox::Ok);
return;
}
@ -436,13 +416,13 @@ rpcn_friends_dialog::rpcn_friends_dialog(QWidget* parent)
if (auto res = m_rpcn->wait_for_connection(); res != rpcn::rpcn_state::failure_no_failure)
{
const QString error_msg = tr("Failed to connect to RPCN:\n%0").arg(rpcn_state_to_qstr(res));
const QString error_msg = tr("Failed to connect to RPCN:\n%0").arg(QString::fromStdString(rpcn::rpcn_state_to_string(res)));
QMessageBox::warning(parent, tr("Error connecting to RPCN!"), error_msg, QMessageBox::Ok);
return;
}
if (auto res = m_rpcn->wait_for_authentified(); res != rpcn::rpcn_state::failure_no_failure)
{
const QString error_msg = tr("Failed to authentify to RPCN:\n%0").arg(rpcn_state_to_qstr(res));
const QString error_msg = tr("Failed to authentify to RPCN:\n%0").arg(QString::fromStdString(rpcn::rpcn_state_to_string(res)));
QMessageBox::warning(parent, tr("Error authentifying to RPCN!"), error_msg, QMessageBox::Ok);
return;
}