#ifndef FILTERDIALOG_H
#define FILTERDIALOG_H

#include "ui_filterdialog.h"

class FilterDialog: public QDialog, private Ui::FilterDialog
{
	Q_OBJECT
public:
	explicit FilterDialog(QWidget *parent = 0);

	struct Filter {
		Filter() {}
		Filter(const QVariant & v);
		QVariant toVariant() const;
		bool filterFile(const QString & path) const {return filterLogic(files_show, files_hide, path);}
		bool filterDir(const QString & path) const {return filterLogic(dirs_show, dirs_hide, path);}
		QStringList files_show;
		QStringList files_hide;
		QStringList dirs_show;
		QStringList dirs_hide;
	private:
		bool filterLogic(const QStringList & fshow, const QStringList & fhide, const QString & path) const;
	};

	Filter filter() const;
	void setFilter(const Filter & f);

protected:
	void changeEvent(QEvent *e);

	QStringList getFilters(QLineEdit * le) const;
	void setFilters(QLineEdit * le, QStringList f);

};

#endif // FILTERDIALOG_H
