- Hold ‘alt’ on launch to restore defaults, including launcher prefs.
void initNavCache()
{
- NavDataCache* cache = NavDataCache::instance();
+ NavDataCache* cache = NavDataCache::createInstance();
if (cache->isRebuildRequired()) {
QProgressDialog rebuildProgress("Initialising navigation data, this may take several minutes",
QString() /* cancel text */,
// avoid double Apple menu and other weirdness if both Qt and OSG
// try to initialise various Cocoa structures.
flightgear::WindowBuilder::setPoseAsStandaloneApp(false);
+
+ Qt::KeyboardModifiers mods = app->queryKeyboardModifiers();
+ if (mods & Qt::AltModifier) {
+ qWarning() << "Alt pressed during launch";
+
+ // wipe out our settings
+ QSettings settings;
+ settings.clear();
+
+
+ Options::sharedInstance()->addOption("restore-defaults", "");
+ }
}
}
bool
fgInitNav ()
{
- flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
- static bool doingRebuild = false;
- if (doingRebuild || cache->isRebuildRequired()) {
- doingRebuild = true;
- bool finished = cache->rebuild();
- if (!finished) {
- // sleep to give the rebuild thread more time
- SGTimeStamp::sleepForMSec(50);
- return false;
+ flightgear::NavDataCache* cache = flightgear::NavDataCache::instance();
+ static bool doingRebuild = false;
+
+ if (!cache) {
+ cache = flightgear::NavDataCache::createInstance();
+ doingRebuild = cache->isRebuildRequired();
+ }
+
+ if (doingRebuild) {
+ bool finished = cache->rebuild();
+ if (!finished) {
+ // sleep to give the rebuild thread more time
+ SGTimeStamp::sleepForMSec(50);
+ return false;
+ }
}
- }
// depend on when the NavCache was initialised, scenery paths may not
// have been setup. This is a safe place to consistently check the value,
d->airwayDatPath = SGPath(globals->get_fg_root());
d->airwayDatPath.append("Navaids/awy.dat.gz");
}
-
+
NavDataCache::~NavDataCache()
{
assert(static_instance == this);
static_instance = NULL;
d.reset();
}
+
+NavDataCache* NavDataCache::createInstance()
+{
+ static_instance = new NavDataCache;
+ return static_instance;
+}
NavDataCache* NavDataCache::instance()
{
- if (!static_instance) {
- static_instance = new NavDataCache;
- }
-
return static_instance;
}
// singleton accessor
static NavDataCache* instance();
+// static creator
+ static NavDataCache* createInstance();
+
SGPath path() const;
/**