1 // Copyright 2010 Jochen Becher
3 // This file is part of MovieSchedule.
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.
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.
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/>.
18 #ifndef MAINCONTROLLER_H
19 #define MAINCONTROLLER_H
21 #include "data/location.h"
22 #include "data/settings.h"
28 class TheaterController;
29 class MovieController;
30 class LocationController;
31 class ActionController;
32 class SettingsController;
33 class ItemModelSortController;
36 class ConnectivityManager;
37 class QAbstractItemModel;
38 class QSortFilterProxyModel;
40 class MainController : public QObject
44 MainController(MainWindow *main_window, Settings *settings, CinemaSchedule *cinema_schedule,
45 TheaterController *theater_controller, MovieController *movie_controller,
46 LocationController *location_controller, ActionController *action_controller,
47 SettingsController *settings_controller,
48 ItemModelSortController *sort_controller, QThread *search_worker);
54 Q_SLOT void Search(Location location);
57 Q_SLOT void NetworkConnected();
58 Q_SLOT void NetworkDisconnected();
59 Q_SLOT void NetworkError();
61 Q_SLOT void SettingsChanged(const Settings &settings);
63 Q_SLOT void SearchTheaters();
64 Q_SLOT void SearchMovies();
65 Q_SLOT void OpenAboutDialog();
66 void CancelTheaterSearch();
67 void CancelMovieSearch();
69 Q_SLOT void TheatersSearchStarted(int search_task_id);
70 Q_SLOT void TheatersSearchReply(int search_task_id, bool intermediate);
71 Q_SLOT void TheatersSearchError(int search_task_id);
72 Q_SLOT void TheatersSearchFinished(int search_task_id, bool success);
74 void SortTheaters(bool intermediate, const char *);
75 Q_SLOT void TheatersSortFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
76 Q_SLOT void TheatersSortErrorFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
77 void SetTheaterModel(QAbstractItemModel *model);
79 Q_SLOT void MoviesSearchStarted(int search_task_id);
80 Q_SLOT void MoviesSearchReply(int search_task_id, bool intermediate);
81 Q_SLOT void MoviesSearchError(int search_task_id);
82 Q_SLOT void MoviesSearchFinished(int search_task_id, bool success);
84 void SortMovies(bool intermediate, const char *);
85 Q_SLOT void MoviesSortFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
86 Q_SLOT void MoviesSortErrorFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
87 void SetMovieModel(QAbstractItemModel *model);
90 MainWindow *_main_window;
92 CinemaSchedule *_cinema_schedule;
93 TheaterController *_theater_controller;
94 MovieController *_movie_controller;
95 LocationController *_location_controller;
96 ActionController *_action_controller;
97 SettingsController *_settings_controller;
98 ItemModelSortController *_sort_controller;
99 QThread *_search_worker;
100 ConnectivityManager *_connectivity_manager;
101 int _current_theater_search_task_id;
102 int _current_movies_search_task_id;
103 TheaterModel *_theater_model;
104 MovieModel *_movie_model;
105 QSortFilterProxyModel *_theater_proxy_model;
106 QSortFilterProxyModel *_movie_proxy_model;
107 Settings _last_search_settings;
110 #endif // MAINCONTROLLER_H