1 /*
2  * Copyright (C) 2006-2019 Christopho, Solarus - http://www.solarus-games.org
3  *
4  * Solarus is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Solarus is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef SOLARUS_GUI_MAIN_WINDOW_H
18 #define SOLARUS_GUI_MAIN_WINDOW_H
19 
20 #include "solarus/gui/gui_common.h"
21 #include "solarus/gui/quest_runner.h"
22 #include "ui_main_window.h"
23 
24 namespace SolarusGui {
25 
26 /**
27  * @brief Main window of the Solarus GUI.
28  */
29 class SOLARUS_GUI_API MainWindow : public QMainWindow {
30   Q_OBJECT
31 
32 public:
33 
34   explicit MainWindow(QWidget* parent = nullptr);
35 
36   void initialize_geometry_on_screen();
37 
38 protected:
39 
40   void closeEvent(QCloseEvent* event) override;
41   void dragEnterEvent(QDragEnterEvent* event) override;
42   void dropEvent(QDropEvent* event) override;
43 
44 private slots:
45 
46   void on_action_add_quest_triggered();
47   void on_action_remove_quest_triggered();
48   void on_action_exit_triggered();
49   void on_action_play_quest_triggered();
50   void on_action_stop_quest_triggered();
51   void on_action_fullscreen_triggered();
52   void on_action_force_software_triggered();
53   void on_action_zoom_x1_triggered();
54   void on_action_zoom_x2_triggered();
55   void on_action_zoom_x3_triggered();
56   void on_action_zoom_x4_triggered();
57   void on_action_about_triggered();
58 
59   void selected_quest_changed();
60   void update_run_quest();
61 
62   void setting_changed_in_quest(const QString& key, const QVariant& value);
63   void set_zoom_requested(int zoom);
64 
65 private:
66 
67   void update_title();
68   bool confirm_close();
69   void initialize_menus();
70   void update_menus();
71   void update_fullscreen_action();
72   void update_force_software_action();
73   bool add_quest(QString quest_path);
74 
75   Ui::MainWindow ui;         /**< The widgets. */
76   QuestRunner quest_runner;  /**< The quest executor. */
77 
78 };
79 
80 }
81 
82 #endif
83