#ifndef VIEWFILTERFILES_H
#define VIEWFILTERFILES_H

#include "src/model/filefiltermodel.h"

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

namespace Ui {
class ViewFilterFiles;
}

class ViewFilterFiles : public QDialog
{
    Q_OBJECT
signals:
    void delNode(int);
    void recovery(QList<void *> hiddens, QList<void *> brokens, QList<void *> replaces);
public:
    static ViewFilterFiles *instance();
public:
    void init() {}
    void destroy() { delete this; }
    void updatePosition(QPoint);
public:
    ViewFilterFiles(const ViewFilterFiles*)=delete;
    ViewFilterFiles *operator =(const ViewFilterFiles *)=delete;
public:
    bool filtered();
    int currentIndex();
    QList<void *> recoveryHiddenData(int, int);
    QList<void *> recoveryBrokenData(int, int);
    QList<void *> recoveryRepleaceData(int, int);
public slots:
    void show();
    void newFilterRoot(void *);
    void filterHidden(int, void *);
    void filterBroken(int, void *);
    void repleace(int, void *);
    void updateIndex(int);
    void deleteNode(int);
private slots:
    void slotsSelectionChanged();
    void slotsRecovery();
protected:
    void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
    explicit ViewFilterFiles(QWidget *parent = nullptr);
    ~ViewFilterFiles();
private:
    void check();
private:
    FileFilterModel        *m_oModel;
private:
    static ViewFilterFiles *m_oInstance;
    static QMutex           m_oMutex;
    QPoint                  m_oPosition;
    bool                    m_bIsWayland;
private:
    Ui::ViewFilterFiles *ui;
};
#define VIEWFILTERFILE ViewFilterFiles::instance()
#endif // VIEWFILTERFILES_H
