| 1 | // QtLauncher.hxx - GUI launcher dialog using Qt5 |
| 2 | // |
| 3 | // Written by James Turner, started December 2014. |
| 4 | // |
| 5 | // SPDX-FileCopyrightText: 2014 James Turner |
| 6 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <string> |
| 11 | #include <vector> |
| 12 | |
| 13 | class SGPath; |
| 14 | |
| 15 | namespace flightgear |
| 16 | { |
| 17 | // Only requires FGGlobals to be initialized if 'doInitQSettings' is true. |
| 18 | // Safe to call several times. |
| 19 | void initApp(int& argc, char** argv, bool doInitQSettings = true); |
| 20 | |
| 21 | // ensures Qt-related resources are cleaned up. Avoids crashes on shutdown |
| 22 | // if QPA assets are hanging around. (With the XCB QPA plugin especially) |
| 23 | void shutdownQtApp(); |
| 24 | |
| 25 | // Requires FGGlobals to be initialized. Safe to call several times. |
| 26 | void initQSettings(); |
| 27 | |
| 28 | // Set 'fg-root' in QSettings to the special value "!ask" if either Alt or |
| 29 | // Shift is pressed. Return true in this case, false otherwise. |
| 30 | bool checkKeyboardModifiersForSettingFGRoot(); |
| 31 | |
| 32 | bool runLauncherDialog(); |
| 33 | |
| 34 | bool runInAppLauncherDialog(); |
| 35 | |
| 36 | enum LockFileDialogResult |
| 37 | { |
| 38 | LockFileContinue, |
| 39 | LockFileReset, |
| 40 | LockFileQuit |
| 41 | }; |
| 42 | |
| 43 | LockFileDialogResult showLockFileDialog(); |
| 44 | |
| 45 | /** |
| 46 | * @brief restartTheApp quit the application and relaunch it, passing the |
| 47 | * --launcher flag explicitly. |
| 48 | */ |
| 49 | void restartTheApp(); |
| 50 | |
| 51 | /** |
| 52 | @ brief helper to re-open the launcher once FLightGear exits cleanly |
| 53 | */ |
| 54 | void startLaunchOnExit(const std::vector<std::string>& originalCommandLine); |
| 55 | |
| 56 | void launcherSetSceneryPaths(); |
| 57 | |
| 58 | enum class SetupRootReason { |
| 59 | DefaultRootInvalid, |
| 60 | ExplicitRootInvalid, |
| 61 | ManualChoiceRequested |
| 62 | }; |
| 63 | |
| 64 | bool showSetupRootDialog(SetupRootReason r); |
| 65 | |
| 66 | bool showUpdateRootDialog(SetupRootReason r); |
| 67 | |
| 68 | |
| 69 | enum class SetupRootResult { |
| 70 | RestoredOk, |
| 71 | UserExit, |
| 72 | UserSelected, |
| 73 | UseDefault, |
| 74 | UpdateRequired, |
| 75 | ExitDueToReadOnly, |
| 76 | }; |
| 77 | |
| 78 | SetupRootResult restoreUserSelectedRoot(SGPath& path); |
| 79 | } // of namespace flightgear |
| 80 |