From 155c35110f9ecd41b7f8c209c8407c3080b42d1e Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sat, 16 Aug 2025 23:34:50 -0700 Subject: [PATCH] Clean up TabReplay ui --- cockatrice/src/client/tabs/tab_replays.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/client/tabs/tab_replays.cpp b/cockatrice/src/client/tabs/tab_replays.cpp index 83863cae8..c7989370a 100644 --- a/cockatrice/src/client/tabs/tab_replays.cpp +++ b/cockatrice/src/client/tabs/tab_replays.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -542,7 +543,15 @@ void TabReplays::getReplayCodeFinished(const Response &r, const CommandContainer const Response_ReplayGetCode &resp = r.GetExtension(Response_ReplayGetCode::ext); QString code = QString::fromStdString(resp.replay_code()); - QMessageBox::information(this, tr("Success"), code); + + QMessageBox msgBox; + msgBox.setText(tr("Got replay code.")); + msgBox.setInformativeText(code); + msgBox.setStandardButtons(QMessageBox::Ok); + QPushButton *copyToClipboardButton = msgBox.addButton(tr("Copy to clipboard"), QMessageBox::ActionRole); + connect(copyToClipboardButton, &QPushButton::clicked, this, [code] { QApplication::clipboard()->setText(code); }); + msgBox.setDefaultButton(copyToClipboardButton); + msgBox.exec(); } void TabReplays::actSubmitReplayCode() @@ -565,10 +574,14 @@ void TabReplays::actSubmitReplayCode() void TabReplays::submitReplayCodeFinished(const Response &r, const CommandContainer & /*commandContainer*/) { switch (r.response_code()) { - case Response::RespOk: - QMessageBox::information(this, tr("Success"), tr("Replay code found. Replay was added.")); + case Response::RespOk: { + QMessageBox msgBox; + msgBox.setText(tr("Replay code found.")); + msgBox.setInformativeText(tr("Replay was added, or you already had access to it.")); + msgBox.exec(); break; - case Response_ResponseCode_RespNameNotFound: + } + case Response::RespNameNotFound: QMessageBox::warning(this, tr("Failed"), tr("Code not found.")); break; case Response::RespFunctionNotAllowed: