Minor fix for another change in Google's movie pages and a fix in
[movie-schedule] / src / ui / mainwindow.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 MAINWINDOW_H
19 #define MAINWINDOW_H
20
21 #include "abstractmainwindow.h"
22 #include "data/location.h"
23 #include "data/cinemakey.h"
24 #include "data/moviekey.h"
25 #include "data/settings.h"
26
27 #include <QModelIndex>
28
29 class CinemaSchedule;
30 class Cinema;
31 class Movie;
32 class QAbstractItemModel;
33 class QMenu;
34 class QAction;
35
36 namespace Ui {
37     class MainWindow;
38 }
39
40 class MainWindow : public AbstractMainWindow {
41     Q_OBJECT
42 public:
43     explicit MainWindow(const CinemaSchedule *cinema_schedule, QWidget *parent = 0);
44     ~MainWindow();
45
46 public:
47     Q_SLOT void SetOrientation(Settings::OrientationMode orientation);
48     Q_SLOT void SetLocation(Location location);
49     Q_SLOT void SetTheaterModel(QAbstractItemModel *);
50     Q_SLOT void SetMovieModel(QAbstractItemModel *);
51     Q_SLOT void SetError(QString error_text);
52
53 public:
54     Q_SIGNAL void SearchTheaters();
55     Q_SIGNAL void SearchMovies();
56     Q_SIGNAL void OpenLocationDialog();
57     Q_SIGNAL void OpenOptionsDialog();
58     Q_SIGNAL void OpenAboutDialog();
59     Q_SIGNAL void TheaterSelected(CinemaKey);
60     Q_SIGNAL void MovieSelected(MovieKey);
61     Q_SIGNAL void CallTheaterByPhone(CinemaKey);
62     Q_SIGNAL void FindRouteToTheater(CinemaKey);
63     Q_SIGNAL void SearchTheaterInWeb(CinemaKey);
64     Q_SIGNAL void SearchMovieInWeb(MovieKey);
65
66 private:
67     Q_SLOT void TheaterClicked(QModelIndex);
68     Q_SLOT void TheaterContextMenuRequested(const QPoint &);
69     Q_SLOT void MovieClicked(QModelIndex);
70     Q_SLOT void MovieContextMenuRequested(const QPoint &);
71     Q_SLOT void CallTheaterByPhone();
72     Q_SLOT void FindRouteToTheater();
73     Q_SLOT void SearchTheaterInWeb();
74     Q_SLOT void SearchMovieInWeb();
75
76 protected:
77     void changeEvent(QEvent *e);
78
79 private:
80     CinemaKey GetCinema(const QModelIndex &index);
81     MovieKey GetMovie(const QModelIndex &index);
82     void ShowContextMenu(const Cinema *, const QPoint &pos);
83     void ShowContextMenu(const Movie *, const QPoint &pos);
84
85 private:
86     Ui::MainWindow *ui;
87     const CinemaSchedule *_cinema_schedule;
88     QMenu *_theater_context_menu;
89     QMenu *_movie_context_menu;
90     QAction *_theater_phone_call;
91     QAction *_theater_find_route;
92     QAction *_theater_search_web;
93     QAction *_movie_search_web;
94     Location _location;
95     QAbstractItemModel *_theater_model;
96     QAbstractItemModel *_movie_model;
97 };
98
99 #endif // MAINWINDOW_H