1 /* 2 * Copyright 2012, 2013 Thomas Schöps, Kai Pastor 3 * 4 * This file is part of OpenOrienteering. 5 * 6 * OpenOrienteering is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * OpenOrienteering is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with OpenOrienteering. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 21 #ifndef OPENORIENTEERING_HOME_SCREEN_CONTROLLER_H 22 #define OPENORIENTEERING_HOME_SCREEN_CONTROLLER_H 23 24 #include "main_window_controller.h" 25 26 #include <QObject> 27 28 namespace OpenOrienteering { 29 30 class AbstractHomeScreenWidget; 31 class MainWindow; 32 33 34 /** 35 * The controller of the OpenOrienteering Mapper home screen. 36 * The OpenOrienteering Mapper home screen is shown when no document is open, 37 * for example after the program is started for the first time. 38 */ 39 class HomeScreenController : public MainWindowController 40 { 41 Q_OBJECT 42 public: 43 /** Creates a new HomeScreenController. */ 44 HomeScreenController(); 45 46 /** Destroys the HomeScreenController and its children. */ 47 ~HomeScreenController() override; 48 49 /** The home screen widgets do not use a status bar. */ 50 bool statusBarVisible() override; 51 52 /** Activates the HomeScreenController for the given main window. */ 53 void attach(MainWindow* window) override; 54 55 /** Detaches the HomeScreenController from its main window. */ 56 void detach() override; 57 58 public slots: 59 /** (Re-)reads the settings. */ 60 void readSettings(); 61 62 /** Clears the application's list of recently opened files. */ 63 void clearRecentFiles(); 64 65 /** Sets whether to open the most recently used file on startup. */ 66 void setOpenMRUFile(bool state); 67 68 /** Sets the visibility of the tip-of-the-day to state. */ 69 void setTipsVisible(bool state); 70 71 /** Moves to the tip following the current tip-of-the-day. */ 72 void goToPreviousTip(); 73 74 /** Moves to the tip preceding the current tip-of-the-day. */ 75 void goToNextTip(); 76 77 /** Moves to the tip-of-the-day given by index. */ 78 void goToTip(int index); 79 80 protected: 81 /** The widget owned and controlled by this HomeScreenController. */ 82 AbstractHomeScreenWidget* widget; 83 84 /** The index of the tip-of-the-day currently displayed. */ 85 int current_tip; 86 }; 87 88 89 } // namespace OpenOrienteering 90 91 #endif 92