Added "clear" button to filter bar
[quandoparte] / application / stationlistview.h
1 #ifndef STATIONLISTVIEW_H
2 #define STATIONLISTVIEW_H
3
4 #include <QMainWindow>
5 #include <QModelIndex>
6 #include <QGeoPositionInfoSource>
7
8 namespace Ui {
9     class StationListView;
10 }
11
12 class QActionGroup;
13 class QStringListModel;
14 class QSortFilterProxyModel;
15 class KeyPressForwarder;
16
17 class StationView;
18 class StationListModel;
19 class StationListProxyModel;
20
21 QTM_USE_NAMESPACE
22
23 class StationListView : public QMainWindow
24 {
25     Q_OBJECT
26
27     enum SortingMode {
28         NoSorting,
29         AlphaSorting,
30         DistanceSorting,
31         RecentUsageSorting
32     };
33
34 public:
35     explicit StationListView(StationListModel *model, QWidget *parent = 0);
36     ~StationListView();
37
38    void setSortingMode(SortingMode mode);
39    SortingMode sortingMode(void);
40
41 signals:
42     void stationSelected(const QString &);
43     void aboutTriggered(void);
44     void settingsChangeRequested(void);
45     void sortingModeChanged(SortingMode mode);
46
47 public slots:
48     void updatePosition(const QGeoPositionInfo &update);
49
50 private slots:
51     void showStation(const QModelIndex &index);
52     void handleFilterChanges(const QString &filter);
53     void handleSortingChange(QAction *action);
54
55     void handlefilterClearClick();
56
57     private:
58     Ui::StationListView *ui;
59     QActionGroup *viewSelectionGroup;
60     StationListModel *stationListModel;
61     StationListProxyModel *filterModel;
62     KeyPressForwarder *keyPressForwarder;
63     QGeoPositionInfoSource *positionInfoSource;
64     SortingMode m_sortingMode;
65 };
66
67 #endif // STATIONLISTVIEW_H