Skip to content

Commit

Permalink
RMG: make update check not an error message box
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Feb 1, 2025
1 parent 85b4daa commit e0925e5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Source/RMG/UserInterface/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#endif // NETPLAY
#include "UserInterface/EventFilter.hpp"
#include "Utilities/QtKeyToSdl2Key.hpp"
#include "Utilities/QtMessageBox.hpp"
#include "OnScreenDisplay.hpp"
#include "Callbacks.hpp"
#include "VidExt.hpp"
Expand Down Expand Up @@ -1464,7 +1465,7 @@ void MainWindow::on_networkAccessManager_Finished(QNetworkReply* reply)
{
if (!this->ui_SilentUpdateCheck)
{
this->showErrorMessage("You're already on the latest version");
Utilities::QtMessageBox::Info(this, "You're already on the latest version");
}
return;
}
Expand Down
25 changes: 22 additions & 3 deletions Source/RMG/Utilities/QtMessageBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
*/
#include "QtMessageBox.hpp"

#include <QAbstractButton>
#include <QMessageBox>

using namespace Utilities;

void QtMessageBox::Error(QWidget* parent, QString text, QString details)
//
// Internal Functions
//

static void show_messagebox(QMessageBox::Icon icon, QString title, QWidget* parent, QString text, QString details)
{
QMessageBox msgBox(parent->isVisible() ? parent : parent->parentWidget());
msgBox.setIcon(QMessageBox::Icon::Critical);
msgBox.setWindowTitle("Error");
msgBox.setIcon(icon);
msgBox.setWindowTitle(title);
msgBox.setText(text);
msgBox.setDetailedText(details);
msgBox.addButton(QMessageBox::Ok);
Expand All @@ -38,3 +43,17 @@ void QtMessageBox::Error(QWidget* parent, QString text, QString details)
msgBox.exec();
}

//
// Exported Functions
//

void QtMessageBox::Info(QWidget* parent, QString text, QString details)
{
show_messagebox(QMessageBox::Icon::Information, "Information", parent, text, details);
}

void QtMessageBox::Error(QWidget* parent, QString text, QString details)
{
show_messagebox(QMessageBox::Icon::Critical, "Error", parent, text, details);
}

2 changes: 2 additions & 0 deletions Source/RMG/Utilities/QtMessageBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace Utilities
{
namespace QtMessageBox
{
void Info(QWidget* parent, QString text, QString details = "");

void Error(QWidget* parent, QString text, QString details = "");
}
} // namespace Utilities
Expand Down

0 comments on commit e0925e5

Please sign in to comment.