2021-12-01 15:12:38 +08:00
|
|
|
#include "messageboxutils.h"
|
|
|
|
#include "gsettingswrapper.h"
|
2022-02-15 16:51:03 +08:00
|
|
|
#include "../common/mydefine.h"
|
2021-12-01 15:12:38 +08:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QIcon>
|
|
|
|
|
2022-02-15 16:51:03 +08:00
|
|
|
void MessageBoxUtils::QMESSAGE_BOX_INFORMATION(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
|
|
|
{
|
|
|
|
QMessageBox box(q_parent);
|
|
|
|
|
|
|
|
box.setIcon(QMessageBox::Information);
|
|
|
|
box.setWindowTitle(typelabel);
|
|
|
|
box.setText(message);
|
|
|
|
box.setStandardButtons(QMessageBox::Ok);
|
|
|
|
box.setButtonText(QMessageBox::Ok, label);
|
|
|
|
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
|
|
box.setWindowIcon(titleIcon);
|
|
|
|
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
|
|
|
box.exec();
|
|
|
|
}
|
|
|
|
|
2021-12-01 15:12:38 +08:00
|
|
|
void MessageBoxUtils::QMESSAGE_BOX_WARNING(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
|
|
|
{
|
|
|
|
QMessageBox box(q_parent);
|
|
|
|
|
|
|
|
box.setIcon(QMessageBox::Warning);
|
|
|
|
box.setWindowTitle(typelabel);
|
|
|
|
box.setText(message);
|
|
|
|
box.setStandardButtons(QMessageBox::Ok);
|
|
|
|
box.setButtonText(QMessageBox::Ok, label);
|
2022-02-15 16:51:03 +08:00
|
|
|
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
|
|
box.setWindowIcon(titleIcon);
|
|
|
|
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
2021-12-01 15:12:38 +08:00
|
|
|
box.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MessageBoxUtils::QMESSAGE_BOX_WARNING_CANCEL(QWidget *q_parent, const QString &typelabel, const QString &message, const QString &label_yes, const QString &label_no)
|
|
|
|
{
|
|
|
|
QMessageBox box(q_parent);
|
|
|
|
|
2022-02-15 16:51:03 +08:00
|
|
|
box.setIcon(QMessageBox::Question);
|
2021-12-01 15:12:38 +08:00
|
|
|
box.setWindowTitle(typelabel);
|
|
|
|
box.setText(message);
|
|
|
|
box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
|
|
|
box.setButtonText(QMessageBox::Ok, label_yes);
|
|
|
|
box.setButtonText(QMessageBox::Cancel, label_no);
|
2022-02-15 16:51:03 +08:00
|
|
|
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
|
|
box.setWindowIcon(titleIcon);
|
|
|
|
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
2021-12-01 15:12:38 +08:00
|
|
|
if (box.exec() != QMessageBox::Ok)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MessageBoxUtils::QMESSAGE_BOX_CRITICAL(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
|
|
|
{
|
|
|
|
QMessageBox box(q_parent);
|
|
|
|
box.setIcon(QMessageBox::Critical);
|
|
|
|
box.setWindowTitle(typelabel);
|
|
|
|
box.setText(message);
|
|
|
|
box.setStandardButtons(QMessageBox::Ok);
|
|
|
|
box.setButtonText(QMessageBox::Ok, label);
|
2022-02-15 16:51:03 +08:00
|
|
|
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
|
|
box.setWindowIcon(titleIcon);
|
|
|
|
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
2021-12-01 15:12:38 +08:00
|
|
|
box.exec();
|
|
|
|
}
|