Merge https://vcs.maemo.org/git/movie-schedule
[movie-schedule] / src / control / locationcontroller.h
1 // Copyright 2010 Jochen Becher
2 //
3 // This file is part of MovieSchedule.
4 //
5 // MovieSchedule is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // MovieSchedule is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with MovieSchedule.  If not, see <http://www.gnu.org/licenses/>.
17
18 #ifndef LOCATIONCONTROLLER_H
19 #define LOCATIONCONTROLLER_H
20
21 #include "data/location.h"
22
23 #include <QObject>
24
25 class MainWindow;
26 class Settings;
27
28 class LocationController : public QObject
29 {
30     Q_OBJECT
31 public:
32     explicit LocationController(MainWindow *main_window, Settings *settings);
33
34 public:
35     Q_SLOT void OpenLocationDialog();
36
37     void CancelAllGpsSearchs();
38
39 public:
40     Q_SIGNAL void Search(Location location);
41
42 private:
43     Q_SLOT void SearchLocationFromCityDatabase(Location location);
44     Q_SLOT void SearchLocation(Location location);
45     Q_SLOT void SearchGPS();
46     Q_SLOT void CancelLocation();
47     Location CleanLocation(const Location &location);
48     void RememberLocation(const Location &location);
49
50     Q_SLOT void GpsSearchStarted(int search_task_id);
51     Q_SLOT void GpsPositionUpdate(int search_task_id);
52     Q_SLOT void GpsSearchForTownStarted(int search_task_id);
53     Q_SLOT void GpsTownUpdate(int search_task_id, QString town);
54     Q_SLOT void GpsSearchError(int search_task_id);
55     Q_SLOT void GpsSearchFinished(int search_task_id, bool success);
56
57 private:
58     MainWindow *_main_window;
59     Settings *_settings;
60     int _active_search_task_id;
61 };
62
63 #endif // LOCATIONCONTROLLER_H