summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/filterwidget.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-09-26 11:40:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-09-29 16:14:31 -0700
commit7337ff386bf80fe9116c117e01abbb32651fd7db (patch)
tree4566d988d9a1799284b86228b4dae6a534e1c4e7 /desktop-widgets/filterwidget.h
parent068194b2e5936915e503292f07f5c0e913e113c3 (diff)
downloadsubsurface-7337ff386bf80fe9116c117e01abbb32651fd7db.tar.gz
cleanup: rename FilterWidget2 to FilterWidget
The name "FilterWidget2" is historical and has no meaning anymore, since the current version has little to nothing to do with the "second" version of the widget. Rename the class and source files accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/filterwidget.h')
-rw-r--r--desktop-widgets/filterwidget.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/desktop-widgets/filterwidget.h b/desktop-widgets/filterwidget.h
new file mode 100644
index 000000000..9a9777c08
--- /dev/null
+++ b/desktop-widgets/filterwidget.h
@@ -0,0 +1,58 @@
+#ifndef FILTERWIDGET_H
+#define FILTERWIDGET_H
+
+#include <vector>
+#include <memory>
+
+#include "ui_filterwidget.h"
+#include "core/divefilter.h"
+#include "qt-models/filterconstraintmodel.h"
+
+class FilterConstraintWidget;
+class QMenu;
+class QHideEvent;
+class QShowEvent;
+
+class FilterWidget : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit FilterWidget(QWidget *parent = 0);
+ ~FilterWidget();
+
+protected:
+ void hideEvent(QHideEvent *event) override;
+ void showEvent(QShowEvent *event) override;
+
+private slots:
+ void clearFilter();
+ void closeFilter();
+ void filterChanged();
+ void constraintAdded(const QModelIndex &parent, int first, int last);
+ void constraintRemoved(const QModelIndex &parent, int first, int last);
+ void constraintChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
+ void constraintsReset();
+ void updatePresetMenu();
+ void presetClicked(const QModelIndex &index);
+ void presetSelected(const QItemSelection &selected, const QItemSelection &);
+ void on_addSetButton_clicked();
+
+private:
+ bool ignoreSignal;
+ bool presetModified;
+ Ui::FilterWidget ui;
+ FilterConstraintModel constraintModel;
+ void addConstraint(filter_constraint_type type);
+ std::vector<std::unique_ptr<FilterConstraintWidget>> constraintWidgets;
+ FilterData createFilterData() const;
+ void updateFilter();
+ void setFilterData(const FilterData &filterData);
+ void loadPreset(int index);
+ void selectPreset(int i);
+ void clearFilterData();
+ std::unique_ptr<QMenu> loadFilterPresetMenu;
+ int selectedPreset() const; // returns -1 of no preset is selected
+ void updatePresetLabel();
+};
+
+#endif