#ifndef CUSTOMMESSAGEBOX_H
#define CUSTOMMESSAGEBOX_H

#include <QDialog>
#include <QPushButton>
#include <QLabel>
#include <QGSettings>
#include <kpushbutton.h>
using namespace kdk;
class CustomMessageBox : public QDialog {
    Q_OBJECT

public:
    enum MessageBoxButton {
        OkButton = 1,
        CancelButton = 2,
        CloseButton =3
    };

    explicit CustomMessageBox(QWidget *parent = nullptr);

    void setMessage(const QString &message);
    void setButtons(int buttons);

    int clickedButton() const;

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    void initLayout();
    void initConnect();
    void checkTheme();
    int getLableLineCount(QLabel *label);

private slots:
    void onOkClicked();
    void onCancelClicked();
    void changeTheme();

private:
    QLabel *messageLabel;
    QLabel *iconLabel;
    KPushButton *okButton;
    KPushButton *cancelButton;
    QPushButton *closeButton;
    int m_clickedButton;

    QGSettings *themeData = nullptr; // 监测主题

};

#endif // CUSTOMMESSAGEBOX_H
