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 ItemModelSortController;
35 class ConnectivityManager;
36 class QAbstractItemModel;
37 class QSortFilterProxyModel;
39 class MainController : public QObject
43 MainController(MainWindow *main_window, Settings *settings, CinemaSchedule *cinema_schedule,
44 TheaterController *theater_controller, MovieController *movie_controller,
45 LocationController *location_controller, ActionController *action_controller,
46 ItemModelSortController *sort_controller, QThread *search_worker);
52 Q_SLOT void Search(Location location);
55 Q_SLOT void NetworkConnected();
56 Q_SLOT void NetworkDisconnected();
57 Q_SLOT void NetworkError();
59 Q_SLOT void SearchTheaters();
60 Q_SLOT void SearchMovies();
61 Q_SLOT void OpenAboutDialog();
62 void CancelTheaterSearch();
63 void CancelMovieSearch();
65 Q_SLOT void TheatersSearchStarted(int search_task_id);
66 Q_SLOT void TheatersSearchReply(int search_task_id, bool intermediate);
67 Q_SLOT void TheatersSearchError(int search_task_id);
68 Q_SLOT void TheatersSearchFinished(int search_task_id, bool success);
70 void SortTheaters(bool intermediate, const char *);
71 Q_SLOT void TheatersSortFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
72 Q_SLOT void TheatersSortErrorFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
73 void SetTheaterModel(QAbstractItemModel *model);
75 Q_SLOT void MoviesSearchStarted(int search_task_id);
76 Q_SLOT void MoviesSearchReply(int search_task_id, bool intermediate);
77 Q_SLOT void MoviesSearchError(int search_task_id);
78 Q_SLOT void MoviesSearchFinished(int search_task_id, bool success);
80 void SortMovies(bool intermediate, const char *);
81 Q_SLOT void MoviesSortFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
82 Q_SLOT void MoviesSortErrorFinished(QAbstractItemModel *model, int search_task_id, bool intermediate);
83 void SetMovieModel(QAbstractItemModel *model);
86 MainWindow *_main_window;
88 CinemaSchedule *_cinema_schedule;
89 TheaterController *_theater_controller;
90 MovieController *_movie_controller;
91 LocationController *_location_controller;
92 ActionController *_action_controller;
93 ItemModelSortController *_sort_controller;
94 QThread *_search_worker;
95 ConnectivityManager *_connectivity_manager;
96 int _current_theater_search_task_id;
97 int _current_movies_search_task_id;
98 TheaterModel *_theater_model;
99 MovieModel *_movie_model;
100 QSortFilterProxyModel *_theater_proxy_model;
101 QSortFilterProxyModel *_movie_proxy_model;
102 Settings _last_search_settings;
105 #endif // MAINCONTROLLER_H