Mantid
Loading...
Searching...
No Matches
MessageHandler.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8
9#include <QMessageBox>
10
11#include <cassert>
12#include <string>
13
15
16void MessageHandler::giveUserCritical(const std::string &prompt, const std::string &title) {
17 QMessageBox::critical(nullptr, QString::fromStdString(title), QString::fromStdString(prompt), QMessageBox::Ok,
18 QMessageBox::Ok);
19}
20
21void MessageHandler::giveUserWarning(const std::string &prompt, const std::string &title) {
22 QMessageBox::warning(nullptr, QString::fromStdString(title), QString::fromStdString(prompt), QMessageBox::Ok,
23 QMessageBox::Ok);
24}
25void MessageHandler::giveUserInfo(const std::string &prompt, const std::string &title) {
26 QMessageBox::information(nullptr, QString::fromStdString(title), QString::fromStdString(prompt), QMessageBox::Ok,
27 QMessageBox::Ok);
28}
29
30bool MessageHandler::askUserOkCancel(const std::string &prompt, const std::string &title) {
31 auto reply = QMessageBox::question(nullptr, QString::fromStdString(title), QString::fromStdString(prompt),
32 QMessageBox::Ok | QMessageBox::Cancel);
33 return (reply == QMessageBox::Ok);
34}
35} // namespace MantidQt::MantidWidgets
bool askUserOkCancel(const std::string &prompt, const std::string &title) override
void giveUserWarning(const std::string &prompt, const std::string &title) override
void giveUserCritical(const std::string &prompt, const std::string &title) override
void giveUserInfo(const std::string &prompt, const std::string &title) override