SVN checkout 11/12/2010
[monav:monav.git] / client / mapview.h
1 /*
2 Copyright 2010  Christian Vetter veaac.fdirct@gmail.com
3
4 This file is part of MoNav.
5
6 MoNav is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MoNav is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with MoNav.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef MAPVIEW_H
21 #define MAPVIEW_H
22
23 #include "generalsettingsdialog.h"
24 #include "interfaces/irouter.h"
25 #include "overlaywidget.h"
26
27 #include <QDialog>
28 #include <QMenu>
29
30 namespace Ui {
31          class MapView;
32 }
33
34 class MapView : public QDialog {
35         Q_OBJECT
36 public:
37         MapView( QWidget *parent = 0 );
38         ~MapView();
39
40         enum Mode {
41                 Source, Target, POI, NoSelection
42         };
43
44         static int selectPlaces( QVector< UnsignedCoordinate > places, QWidget* p = NULL );
45         static bool selectStreet( UnsignedCoordinate* result, QVector< int >segmentLength, QVector< UnsignedCoordinate > coordinates, QWidget* p = NULL );
46
47 protected slots:
48         void magnify();
49
50         void mouseClicked( ProjectedCoordinate clickPos );
51
52         void nextPlace();
53         void previousPlace();
54
55         void showContextMenu( QPoint globalPos );
56
57         void settingsGeneral();
58         void settingsRenderer();
59         void settingsRouter();
60         void settingsGPSLookup();
61         void settingsAddressLookup();
62         void settingsGPS();
63         void settingsDataDirectory();
64
65         void gotoSource();
66         void gotoGPS();
67         void gotoTarget();
68         void gotoBookmark();
69         void gotoAddress();
70
71         void sourceByBookmark();
72         void sourceByAddress();
73         void sourceByGPS();
74
75         void targetByBookmark();
76         void targetByAddress();
77
78         void addZoom();
79         void substractZoom();
80
81         void bookmarks();
82
83         void setModeSourceSelection();
84         void setModeTargetSelection();
85         void setModePOISelection();
86         void setModeNoSelection();
87         void toogleLocked();
88
89         void gotoMenu();
90         void toolsMenu();
91         void settingsMenu();
92         void sourceMenu();
93         void targetMenu();
94         //void waypointMenu();
95         //void addWaypoint();
96
97         void showInstructions();
98
99         void dataLoaded();
100         void instructionsChanged();
101
102 protected:
103
104         void connectSlots();
105         void setupMenu();
106         void setPlaces( QVector< UnsignedCoordinate > p );
107         void setEdges( QVector< int > segmentLength, QVector< UnsignedCoordinate > coordinates );
108         void resizeIcons();
109
110         virtual void resizeEvent( QResizeEvent* event );
111
112 #ifdef Q_WS_MAEMO_5
113         void grabZoomKeys( bool grab );
114         void keyPressEvent( QKeyEvent* event );
115 #endif
116
117         Ui::MapView *m_ui;
118
119         int m_maxZoom;
120         QVector< UnsignedCoordinate > m_places;
121         int m_place;
122         UnsignedCoordinate m_selected;
123         int m_virtualZoom;
124
125         bool m_fixed;
126
127         OverlayWidget* m_targetOverlay;
128         OverlayWidget* m_sourceOverlay;
129         OverlayWidget* m_gotoOverlay;
130         OverlayWidget* m_toolsOverlay;
131         OverlayWidget* m_settingsOverlay;
132
133         Mode m_mode;
134         GeneralSettingsDialog::MenuMode m_menuMode;
135         int m_iconSize;
136         int m_defaultIconSize;
137         bool m_customIconSize;
138
139         QMenu* m_targetMenu;
140         QMenu* m_sourceMenu;
141         QMenu* m_gotoMenu;
142         QMenu* m_toolsMenu;
143         QMenu* m_settingsMenu;
144
145         QAction* m_gotoGPSAction;
146         QAction* m_gotoSourceAction;
147         QAction* m_gotoTargetAction;
148         QAction* m_gotoBookmarkAction;
149         QAction* m_gotoAddressAction;
150
151         QAction* m_sourceByTapAction;
152         QAction* m_sourceByBookmarkAction;
153         QAction* m_sourceByAddressAction;
154         QAction* m_sourceByGPS;
155
156         QAction* m_targetByTapAction;
157         QAction* m_targetByBookmarkAction;
158         QAction* m_targetByAddressAction;
159
160         QAction* m_bookmarkAction;
161         QAction* m_magnifyAction;
162         QAction* m_modeSourceAction;
163         QAction* m_modeTargetAction;
164         QAction* m_mapViewAction;
165
166         QAction* m_settingsGeneral;
167         QAction* m_settingsGPSLookup;
168         QAction* m_settingsRenderer;
169         QAction* m_settingsRouter;
170         QAction* m_settingsAddressLookup;
171         QAction* m_settingsGPS;
172         QAction* m_settingsDataDirectory;
173 };
174
175 #endif // MAPVIEW_H