Mantid
Loading...
Searching...
No Matches
qt
widgets
common
src
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 +
7
#include "
MantidQtWidgets/Common/MessageHandler.h
"
8
9
#include <QMessageBox>
10
11
#include <cassert>
12
#include <string>
13
14
namespace
MantidQt::MantidWidgets
{
15
16
void
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
21
void
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
}
25
void
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
30
bool
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
MessageHandler.h
MantidQt::MantidWidgets::MessageHandler::askUserOkCancel
bool askUserOkCancel(const std::string &prompt, const std::string &title) override
Definition
MessageHandler.cpp:30
MantidQt::MantidWidgets::MessageHandler::giveUserWarning
void giveUserWarning(const std::string &prompt, const std::string &title) override
Definition
MessageHandler.cpp:21
MantidQt::MantidWidgets::MessageHandler::giveUserCritical
void giveUserCritical(const std::string &prompt, const std::string &title) override
Definition
MessageHandler.cpp:16
MantidQt::MantidWidgets::MessageHandler::giveUserInfo
void giveUserInfo(const std::string &prompt, const std::string &title) override
Definition
MessageHandler.cpp:25
MantidQt::MantidWidgets
Definition
AddWorkspaceDialog.h:19
Generated by
1.9.8