a3a2cd6b54d781386290ed3e25a312657c62fbcd
[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         AlphaSorting,
29         DistanceSorting,
30         RecentUsageSorting
31     };
32
33 public:
34     explicit StationListView(StationListModel *model, QWidget *parent = 0);
35     ~StationListView();
36
37    void setSortingMode(SortingMode mode);
38    SortingMode sortingMode(void);
39
40 signals:
41     void stationSelected(const QString &);
42     void aboutTriggered(void);
43
44 public slots:
45     void updatePosition(const QGeoPositionInfo &update);
46
47 private slots:
48     void showSettings(void);
49     void showStation(const QModelIndex &index);
50     void handleFilterChanges(const QString &filter);
51     void handleSortingChange(const QAction *action);
52
53 private:
54     Ui::StationListView *ui;
55     QActionGroup *viewSelectionGroup;
56     StationListModel *stationListModel;
57     StationListProxyModel *filterModel;
58     KeyPressForwarder *keyPressForwarder;
59     SortingMode m_sortingMode;
60 };
61
62 #endif // STATIONLISTVIEW_H