#ifndef FILEFILTERRULES_H
#define FILEFILTERRULES_H

#include <QDialog>
#include <QMutex>
#include <QPoint>
#include <QPushButton>

namespace Ui {
class FileFilterRules;
}

class FileFilterRules : public QDialog
{
    Q_OBJECT
signals:
    void hidden(bool);
    void broken(bool);
    void repleace(bool);
    void rangeAll(bool);
public:
    static FileFilterRules *instance();
public:
    void init(void *data = nullptr);
    void destroy() { delete this; }
    void show();
    void updatePosition(QPoint);
    bool isWayland() { return m_bIsWayland; }
public slots:
    void slotclose();
public:
    FileFilterRules(const FileFilterRules*)=delete;
    FileFilterRules *operator =(const FileFilterRules *)=delete;
protected:
    void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
    explicit FileFilterRules(QWidget *parent = nullptr);
    ~FileFilterRules();
    void uiAdjust();
private slots:
    void slotscancel();
    void slotsensure();
private:
    static FileFilterRules *m_oInstance;
    static QMutex           m_oMutex;
    QPoint                  m_oPosition;
    QPushButton *m_oEnsureBtn;
    QPushButton *m_oCancelBtn;
    bool m_ishidden;
    bool m_isbroken;
    bool m_isrepleace;
    bool m_bIsWayland; //是否为wayland环境
private:
    Ui::FileFilterRules *ui;
};
#define FILTERRULES FileFilterRules::instance()
#endif // FILEFILTERRULES_H
