1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "messagebox.h"
6
7#include <QMessageBox>
8#include <QApplication>
9#include <QWidget>
10
11namespace Internal {
12
13namespace {
14
15QWidget *message(QMessageBox::Icon icon, const QString &title, const QString &desciption)
16{
17 QMessageBox *messageBox = new QMessageBox(icon,
18 title,
19 desciption,
20 QMessageBox::Ok/*,
21 dialogParent()*/);
22
23 messageBox->setAttribute(Qt::WA_DeleteOnClose);
24 messageBox->setModal(true);
25 messageBox->show();
26 return messageBox;
27}
28}
29
30QWidget *warning(const QString &title, const QString &desciption)
31{
32 return message(QMessageBox::Warning, title, desciption);
33}
34
35QWidget *information(const QString &title, const QString &desciption)
36{
37 return message(QMessageBox::Information, title, desciption);
38}
39
40QWidget *critical(const QString &title, const QString &desciption)
41{
42 return message(QMessageBox::Critical, title, desciption);
43}
44}
45