1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef CONTEXTDIALOG_H
6#define CONTEXTDIALOG_H
7
8#include "common/widget/singlechoicebox.h"
9
10#include <QIcon>
11#include <QString>
12#include <QMessageBox>
13#include <QSet>
14
15#include <functional>
16#include <QObject>
17
18class ContextDialog final
19{
20 Q_DISABLE_COPY(ContextDialog)
21 ContextDialog() = delete;
22public:
23 static void okCancel(QString text,
24 QString title = "Warning",
25 QMessageBox::Icon icon = QMessageBox::Warning,
26 std::function<void(bool)> okCallBack = nullptr,
27 std::function<void(bool)> cancelCallBack = nullptr);
28
29 static void ok(QString text,
30 QString title = "Error",
31 QMessageBox::Icon icon = QMessageBox::Critical,
32 std::function<void(bool)> okCallBack = nullptr);
33
34 static void question(QString text,
35 QString title = "Question",
36 QMessageBox::Icon icon = QMessageBox::Question,
37 std::function<void(bool)> okCallBack = nullptr,
38 std::function<void(bool)> noCallBack = nullptr,
39 std::function<void(bool)> cancelCallBack = nullptr);
40
41 static void singleChoice(QSet<SingleChoiceBox::Info> infos,
42 QString windowTitle = "Infos Selection",
43 QString choiceTitle = "Single Choice",
44 std::function<void(const SingleChoiceBox::Info&)> okCallBack = nullptr,
45 std::function<void(const SingleChoiceBox::Info&)> cancelCallBack = nullptr);
46};
47
48#endif
49