diff options
author | Sky <git@bunnies.cc> | 2013-10-29 12:40:09 +0000 |
---|---|---|
committer | Sky <git@bunnies.cc> | 2013-10-29 12:40:09 +0000 |
commit | b0ef429786bef64799d43f1ac502c139bbde8dc5 (patch) | |
tree | b419161990d382edd0033b097880e044de4f75c7 /gui/mainwindow.cpp | |
parent | e7e03c2b542b1cceda63628dd7ca6fa9c875cfd2 (diff) | |
download | MultiMC-b0ef429786bef64799d43f1ac502c139bbde8dc5.tar MultiMC-b0ef429786bef64799d43f1ac502c139bbde8dc5.tar.gz MultiMC-b0ef429786bef64799d43f1ac502c139bbde8dc5.tar.lz MultiMC-b0ef429786bef64799d43f1ac502c139bbde8dc5.tar.xz MultiMC-b0ef429786bef64799d43f1ac502c139bbde8dc5.zip |
Add selectable message box helper, use it, make login GUI error label selectable
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r-- | gui/mainwindow.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5d3c52b5..b2fdbe16 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -50,6 +50,7 @@ #include "gui/consolewindow.h" #include "gui/instancesettings.h" #include "gui/platform.h" +#include "gui/CustomMessageBox.h" #include "logic/lists/InstanceList.h" #include "logic/lists/MinecraftVersionList.h" @@ -281,20 +282,26 @@ void MainWindow::on_actionAddInstance_triggered() return; case InstanceFactory::InstExists: + { errorMsg += "An instance with the given directory name already exists."; - QMessageBox::warning(this, "Error", errorMsg); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; + } case InstanceFactory::CantCreateDir: + { errorMsg += "Failed to create the instance directory."; - QMessageBox::warning(this, "Error", errorMsg); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; + } default: + { errorMsg += QString("Unknown instance loader error %1").arg(error); - QMessageBox::warning(this, "Error", errorMsg); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); break; } + } } void MainWindow::on_actionChangeInstIcon_triggered() @@ -387,9 +394,10 @@ void MainWindow::on_actionDeleteInstance_triggered() { if (m_selectedInstance) { - int response = QMessageBox::question( - this, "CAREFUL", QString("This is permanent! Are you sure?\nAbout to delete: ") + - m_selectedInstance->name()); + auto response = CustomMessageBox::selectable(this, tr("CAREFUL"), + tr("This is permanent! Are you sure?\nAbout to delete: ") + + m_selectedInstance->name(), + QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec(); if (response == QMessageBox::Yes) { m_selectedInstance->nuke(); @@ -626,7 +634,7 @@ void MainWindow::onGameUpdateComplete() void MainWindow::onGameUpdateError(QString error) { - QMessageBox::warning(this, "Error updating instance", error); + CustomMessageBox::selectable(this, tr("Error updating instance"), error, QMessageBox::Warning)->show(); } void MainWindow::launchInstance(BaseInstance *instance, LoginResponse response) @@ -695,9 +703,9 @@ void MainWindow::on_actionMakeDesktopShortcut_triggered() QStringList() << "-dl" << QDir::currentPath() << "test", name, "application-x-octet-stream"); - QMessageBox::warning( - this, tr("Not useful"), - tr("A Dummy Shortcut was created. it will not do anything productive")); + CustomMessageBox::selectable(this, tr("Not useful"), + tr("A Dummy Shortcut was created. it will not do anything productive"), + QMessageBox::Warning)->show(); } // BrowserDialog @@ -718,11 +726,11 @@ void MainWindow::on_actionChangeInstMCVersion_triggered() { if (m_selectedInstance->versionIsCustom()) { - auto result = QMessageBox::warning( - this, tr("Are you sure?"), - tr("This will remove any library/version customization you did previously. " - "This includes things like Forge install and similar."), - QMessageBox::Ok, QMessageBox::Abort); + auto result = CustomMessageBox::selectable(this, tr("Are you sure?"), + tr("This will remove any library/version customization you did previously. " + "This includes things like Forge install and similar."), + QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Abort)->exec(); + if (result != QMessageBox::Ok) return; } @@ -853,10 +861,12 @@ void MainWindow::checkSetDefaultJava() java = std::dynamic_pointer_cast<JavaVersion>(vselect.selectedVersion()); else { - QMessageBox::warning(this, tr("Invalid version selected"), - tr("You didn't select a valid Java version, so MultiMC will " - "select the default. " - "You can change this in the settings dialog.")); + CustomMessageBox::selectable(this, tr("Invalid version selected"), + tr("You didn't select a valid Java version, so MultiMC will " + "select the default. " + "You can change this in the settings dialog."), + QMessageBox::Warning)->show(); + JavaUtils ju; java = ju.GetDefaultJava(); } |