mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 23:42:15 -07:00
Better failure messages
This commit is contained in:
parent
21f0058dc0
commit
b975fa6135
1 changed files with 21 additions and 8 deletions
|
|
@ -532,12 +532,17 @@ void TabReplays::actGetReplayCode()
|
||||||
void TabReplays::getReplayCodeFinished(const Response &r, const CommandContainer & /*commandContainer*/)
|
void TabReplays::getReplayCodeFinished(const Response &r, const CommandContainer & /*commandContainer*/)
|
||||||
{
|
{
|
||||||
if (r.response_code() == Response::RespFunctionNotAllowed) {
|
if (r.response_code() == Response::RespFunctionNotAllowed) {
|
||||||
QMessageBox::warning(this, tr("Failed"), tr("This server does not support replay sharing."));
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
|
msgBox.setText(tr("Failed to get code"));
|
||||||
|
msgBox.setInformativeText(
|
||||||
|
tr("Either this server does not support replay sharing, or does not permit replay sharing for you."));
|
||||||
|
msgBox.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.response_code() != Response::RespOk) {
|
if (r.response_code() != Response::RespOk) {
|
||||||
QMessageBox::warning(this, tr("Failed"), tr("Could not get replay code."));
|
QMessageBox::warning(this, tr("Failed"), tr("Could not get replay code"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +550,7 @@ void TabReplays::getReplayCodeFinished(const Response &r, const CommandContainer
|
||||||
QString code = QString::fromStdString(resp.replay_code());
|
QString code = QString::fromStdString(resp.replay_code());
|
||||||
|
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("Got replay code."));
|
msgBox.setText(tr("Got replay code"));
|
||||||
msgBox.setInformativeText(code);
|
msgBox.setInformativeText(code);
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
QPushButton *copyToClipboardButton = msgBox.addButton(tr("Copy to clipboard"), QMessageBox::ActionRole);
|
QPushButton *copyToClipboardButton = msgBox.addButton(tr("Copy to clipboard"), QMessageBox::ActionRole);
|
||||||
|
|
@ -557,7 +562,8 @@ void TabReplays::getReplayCodeFinished(const Response &r, const CommandContainer
|
||||||
void TabReplays::actSubmitReplayCode()
|
void TabReplays::actSubmitReplayCode()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QString code = QInputDialog::getText(this, tr("Add replay by code"), tr("Replay code"), QLineEdit::Normal, "", &ok);
|
QString code =
|
||||||
|
QInputDialog::getText(this, tr("Look up replay by code"), tr("Replay code"), QLineEdit::Normal, "", &ok);
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -576,17 +582,24 @@ void TabReplays::submitReplayCodeFinished(const Response &r, const CommandContai
|
||||||
switch (r.response_code()) {
|
switch (r.response_code()) {
|
||||||
case Response::RespOk: {
|
case Response::RespOk: {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(tr("Replay code found."));
|
msgBox.setIcon(QMessageBox::Information);
|
||||||
|
msgBox.setText(tr("Replay code found"));
|
||||||
msgBox.setInformativeText(tr("Replay was added, or you already had access to it."));
|
msgBox.setInformativeText(tr("Replay was added, or you already had access to it."));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Response::RespNameNotFound:
|
case Response::RespNameNotFound:
|
||||||
QMessageBox::warning(this, tr("Failed"), tr("Code not found."));
|
QMessageBox::warning(this, tr("Failed"), tr("Replay code not found"));
|
||||||
break;
|
break;
|
||||||
case Response::RespFunctionNotAllowed:
|
case Response::RespFunctionNotAllowed: {
|
||||||
QMessageBox::warning(this, tr("Failed"), tr("This server does not support replay sharing."));
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
|
msgBox.setText(tr("Failed to submit code"));
|
||||||
|
msgBox.setInformativeText(
|
||||||
|
tr("Either this server does not support replay sharing, or does not permit replay sharing for you."));
|
||||||
|
msgBox.exec();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
QMessageBox::warning(this, tr("Failed"), tr("Unexpected error"));
|
QMessageBox::warning(this, tr("Failed"), tr("Unexpected error"));
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue