#ifndef EXECDIALOG_H
#define EXECDIALOG_H

#include <QDialog>
#include <QMutex>
#include "inputchange.h"
namespace Ui {
class ExecDialog;
}

class ExecDialog : public QDialog
{
    Q_OBJECT
Q_SIGNALS:
    void content(QString);
    void result(QString);
public:
    static ExecDialog *instance();
public:
    ExecDialog(const ExecDialog*)=delete;
    ExecDialog *operator =(const ExecDialog*)=delete;
public:
    void init() {}
public:
    int information(QString, QString, bool next = false);
    void error(QString, QString, bool next = false);
    bool question(QString, QString, bool next = false);
    bool input(QString&, QString, QString, QString result);
    QPushButton* replayEnsure();
    QPushButton* replayCancel();
public slots:
    QString input(QString, QString, QString result = QString());
    void close();
protected:
    void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
    void keyPressEvent(QKeyEvent* event);
private:
    explicit ExecDialog(QWidget *parent = nullptr);
    ~ExecDialog();
private slots:
    void slotsTipsAgain(bool b);

private:
    QString            m_oTipTitle;
	QPushButton *m_oCancelBtn;
	QPushButton *m_oEnsureBtn;
    QString m_m_labelContent;
private:
    static ExecDialog *m_oInstance;
    static QMutex      m_oMutex;
    bool               m_bIsWayland;
private:
    Ui::ExecDialog *ui;
};
#define EXEC ExecDialog::instance()
#endif // EXECDIALOG_H
