From 3621594213a24503436653ff202c27255f32cc8a Mon Sep 17 00:00:00 2001 From: xcfrg <30675315+xcfrg@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:33:04 -0400 Subject: [PATCH] feat: add log upload confirmation --- launcher/ui/pages/instance/LogPage.cpp | 13 +++++++++++++ launcher/ui/pages/instance/OtherLogsPage.cpp | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/launcher/ui/pages/instance/LogPage.cpp b/launcher/ui/pages/instance/LogPage.cpp index b66c6cc7..9f287ef2 100644 --- a/launcher/ui/pages/instance/LogPage.cpp +++ b/launcher/ui/pages/instance/LogPage.cpp @@ -12,6 +12,7 @@ #include "ui/GuiUtil.h" #include "ui/ColorCache.h" +#include "ui/dialogs/CustomMessageBox.h" #include @@ -238,6 +239,18 @@ void LogPage::on_btnPaste_clicked() if(!m_model) return; + auto response = CustomMessageBox::selectable( + this, + tr("Log upload"), + tr("Are you sure you want to upload a log file?"), + QMessageBox::Warning, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No + )->exec(); + + if (response != QMessageBox::Yes) + return; + //FIXME: turn this into a proper task and move the upload logic out of GuiUtil! m_model->append( MessageLevel::Launcher, diff --git a/launcher/ui/pages/instance/OtherLogsPage.cpp b/launcher/ui/pages/instance/OtherLogsPage.cpp index 0131c5c1..2218d4ae 100644 --- a/launcher/ui/pages/instance/OtherLogsPage.cpp +++ b/launcher/ui/pages/instance/OtherLogsPage.cpp @@ -21,6 +21,7 @@ #include "ui/GuiUtil.h" #include "RecursiveFileSystemWatcher.h" +#include "ui/dialogs/CustomMessageBox.h" #include #include #include @@ -179,6 +180,18 @@ void OtherLogsPage::on_btnReload_clicked() void OtherLogsPage::on_btnPaste_clicked() { + auto response = CustomMessageBox::selectable( + this, + tr("Log upload"), + tr("Are you sure you want to upload a log file?"), + QMessageBox::Warning, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No + )->exec(); + + if (response != QMessageBox::Yes) + return; + GuiUtil::uploadPaste(ui->text->toPlainText(), this); }