aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs/ExportMrPackDialog.cpp
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-03-18 12:21:13 +0000
committerTheKodeToad <TheKodeToad@proton.me>2023-03-18 12:24:18 +0000
commitddca838e46d2d147cbc5965be31895dd73676c79 (patch)
tree529cb0c1f96596a078efa75e38a809515d5aaa41 /launcher/ui/dialogs/ExportMrPackDialog.cpp
parent2cc9b0df068ace61c60217973d4d66412cb53968 (diff)
downloadPrismLauncher-ddca838e46d2d147cbc5965be31895dd73676c79.tar.gz
PrismLauncher-ddca838e46d2d147cbc5965be31895dd73676c79.tar.bz2
PrismLauncher-ddca838e46d2d147cbc5965be31895dd73676c79.zip
Info and error dialogs
TODO: is there a better approach? Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/dialogs/ExportMrPackDialog.cpp')
-rw-r--r--launcher/ui/dialogs/ExportMrPackDialog.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/launcher/ui/dialogs/ExportMrPackDialog.cpp b/launcher/ui/dialogs/ExportMrPackDialog.cpp
index 03238ec4..8a49f314 100644
--- a/launcher/ui/dialogs/ExportMrPackDialog.cpp
+++ b/launcher/ui/dialogs/ExportMrPackDialog.cpp
@@ -17,6 +17,8 @@
*/
#include "ExportMrPackDialog.h"
+#include "Application.h"
+#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/ProgressDialog.h"
#include "ui_ExportMrPackDialog.h"
@@ -82,6 +84,20 @@ void ExportMrPackDialog::done(int result)
ModrinthPackExportTask task(ui->name->text(), ui->version->text(), ui->summary->text(), instance, output,
[this](const QString& path) { return proxy->blockedPaths().covers(path); });
+
+ connect(&task, &Task::failed,
+ [this](const QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); });
+
+ connect(&task, &Task::succeeded, [this, &task]() {
+ QStringList warnings = task.warnings();
+ if (warnings.count() > 0)
+ CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
+ });
+ connect(&task, &Task::aborted, [this] {
+ CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)
+ ->show();
+ });
+
ProgressDialog progress(this);
progress.setSkipButton(true, tr("Abort"));
if (progress.execWithTask(&task) != QDialog::Accepted)