2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2014-11-19 11:48:40 +01:00
|
|
|
|
|
|
|
|
#include "messagebox.h"
|
|
|
|
|
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
2014-11-25 11:26:56 +01:00
|
|
|
#include "icore.h"
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
2014-11-19 11:48:40 +01:00
|
|
|
namespace AsynchronousMessageBox {
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2016-12-14 09:04:29 +01:00
|
|
|
QWidget *message(QMessageBox::Icon icon, const QString &title, const QString &desciption)
|
2014-11-19 11:48:40 +01:00
|
|
|
{
|
2014-11-25 11:26:56 +01:00
|
|
|
QMessageBox *messageBox = new QMessageBox(icon,
|
2014-11-19 11:48:40 +01:00
|
|
|
title,
|
|
|
|
|
desciption,
|
|
|
|
|
QMessageBox::Ok,
|
2014-11-25 11:26:56 +01:00
|
|
|
Core::ICore::dialogParent());
|
2014-11-19 11:48:40 +01:00
|
|
|
|
|
|
|
|
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
messageBox->setModal(true);
|
|
|
|
|
messageBox->show();
|
2016-12-14 09:04:29 +01:00
|
|
|
return messageBox;
|
2014-11-19 11:48:40 +01:00
|
|
|
}
|
2014-11-25 11:26:56 +01:00
|
|
|
}
|
2014-11-19 11:48:40 +01:00
|
|
|
|
2016-12-14 09:04:29 +01:00
|
|
|
QWidget *warning(const QString &title, const QString &desciption)
|
2014-11-25 11:26:56 +01:00
|
|
|
{
|
2016-12-14 09:04:29 +01:00
|
|
|
return message(QMessageBox::Warning, title, desciption);
|
2014-11-19 11:48:40 +01:00
|
|
|
}
|
2014-11-25 11:26:56 +01:00
|
|
|
|
2016-12-14 09:04:29 +01:00
|
|
|
QWidget *information(const QString &title, const QString &desciption)
|
2014-11-25 11:26:56 +01:00
|
|
|
{
|
2016-12-14 09:04:29 +01:00
|
|
|
return message(QMessageBox::Information, title, desciption);
|
2014-11-25 11:26:56 +01:00
|
|
|
}
|
|
|
|
|
|
2016-12-14 09:04:29 +01:00
|
|
|
QWidget *critical(const QString &title, const QString &desciption)
|
2014-11-25 11:26:56 +01:00
|
|
|
{
|
2016-12-14 09:04:29 +01:00
|
|
|
return message(QMessageBox::Critical, title, desciption);
|
2014-11-25 11:26:56 +01:00
|
|
|
}
|
|
|
|
|
|
2014-11-19 11:48:40 +01:00
|
|
|
}
|
2016-12-14 09:04:29 +01:00
|
|
|
}
|