2015-03-07 23:52:03 +00:00
|
|
|
// QtLauncher.hxx - GUI launcher dialog using Qt5
|
|
|
|
//
|
|
|
|
// Written by James Turner, started December 2014.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014 James Turner <zakalawe@mac.com>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
#ifndef FG_QTLAUNCHER_HXX
|
|
|
|
#define FG_QTLAUNCHER_HXX
|
2014-12-26 12:20:51 +00:00
|
|
|
|
2015-10-16 01:05:17 +00:00
|
|
|
namespace flightgear
|
2014-12-26 12:20:51 +00:00
|
|
|
{
|
Split flightgear::initApp() to make it usable even without FGGlobals initialized
- Add an optional argument to flightgear::initApp(): doInitQSettings.
This argument defaults to true, preserving initApp()'s behavior in
this respect. If this argument is set to false, FGGlobals doesn't have
to be initialized.
- New function flightgear::initQSettings(), called by
flightgear::initApp() when its 'doInitQSettings' argument is true.
This allows initializing the QSettings exactly when it is needed.
- New function flightgear::checkKeyboardModifiersForSettingFGRoot().
The code it contains used to be run from initApp(), which is
undesirable because:
1) initApp() is not only called at FG initialization (fgMainInit()),
but also from QtMessageBox(), from QtFileDialog::exec() and twice
from Options::setupRoot(). However, checking the Alt and Shift
modifiers to set 'fg-root' in QSettings to the special value
"!ask" only makes sense in fgMainInit(), not in these other
places.
2) This code relies on the QSettings to be set up, and therefore on
FGGlobals. Thus, freeing initApp() of its dependency on FGGlobals
requires splitting this keyboard modifiers checking code out of
initApp().
2016-12-26 20:45:44 +00:00
|
|
|
// Only requires FGGlobals to be initialized if 'doInitQSettings' is true.
|
|
|
|
// Safe to call several times.
|
|
|
|
void initApp(int& argc, char** argv, bool doInitQSettings = true);
|
2017-06-07 15:25:19 +00:00
|
|
|
|
|
|
|
// ensures Qt-related resources are cleaned up. Avoids crashes on shutdown
|
|
|
|
// if QPA assets are hanging around. (With the XCB QPA plugin especially)
|
|
|
|
void shutdownQtApp();
|
|
|
|
|
Split flightgear::initApp() to make it usable even without FGGlobals initialized
- Add an optional argument to flightgear::initApp(): doInitQSettings.
This argument defaults to true, preserving initApp()'s behavior in
this respect. If this argument is set to false, FGGlobals doesn't have
to be initialized.
- New function flightgear::initQSettings(), called by
flightgear::initApp() when its 'doInitQSettings' argument is true.
This allows initializing the QSettings exactly when it is needed.
- New function flightgear::checkKeyboardModifiersForSettingFGRoot().
The code it contains used to be run from initApp(), which is
undesirable because:
1) initApp() is not only called at FG initialization (fgMainInit()),
but also from QtMessageBox(), from QtFileDialog::exec() and twice
from Options::setupRoot(). However, checking the Alt and Shift
modifiers to set 'fg-root' in QSettings to the special value
"!ask" only makes sense in fgMainInit(), not in these other
places.
2) This code relies on the QSettings to be set up, and therefore on
FGGlobals. Thus, freeing initApp() of its dependency on FGGlobals
requires splitting this keyboard modifiers checking code out of
initApp().
2016-12-26 20:45:44 +00:00
|
|
|
// Requires FGGlobals to be initialized. Safe to call several times.
|
|
|
|
void initQSettings();
|
|
|
|
|
|
|
|
// Set 'fg-root' in QSettings to the special value "!ask" if either Alt or
|
|
|
|
// Shift is pressed. Return true in this case, false otherwise.
|
|
|
|
bool checkKeyboardModifiersForSettingFGRoot();
|
2014-12-26 12:20:51 +00:00
|
|
|
|
2015-10-16 01:05:17 +00:00
|
|
|
bool runLauncherDialog();
|
2014-12-26 12:20:51 +00:00
|
|
|
|
2015-10-16 01:05:17 +00:00
|
|
|
bool runInAppLauncherDialog();
|
2017-02-20 00:19:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief restartTheApp quit the application and relaunch it, passing the
|
|
|
|
* --launcher flag explicitly.
|
|
|
|
*/
|
|
|
|
void restartTheApp();
|
|
|
|
|
|
|
|
void launcherSetSceneryPaths();
|
2015-10-16 01:05:17 +00:00
|
|
|
}
|
2015-03-07 23:52:03 +00:00
|
|
|
|
|
|
|
#endif // of FG_QTLAUNCHER_HXX
|