1
0
Fork 0

Launcher: fix Windows build

This commit is contained in:
James Turner 2018-06-23 17:55:39 +01:00
parent 1bf52662ae
commit c38e820756
4 changed files with 38 additions and 34 deletions

View file

@ -147,6 +147,23 @@ void LauncherController::initQML()
PreviewImageItem::setGlobalNetworkAccess(netAccess); PreviewImageItem::setGlobalNetworkAccess(netAccess);
} }
void LauncherController::setInAppMode()
{
m_inAppMode = true;
m_keepRunningInAppMode = true;
m_appModeResult = true;
}
bool LauncherController::keepRunningInAppMode() const
{
return m_keepRunningInAppMode;
}
bool LauncherController::inAppResult() const
{
return m_appModeResult;
}
void LauncherController::restoreSettings() void LauncherController::restoreSettings()
{ {
m_selectedAircraft = m_aircraftHistory->mostRecent(); m_selectedAircraft = m_aircraftHistory->mostRecent();
@ -467,8 +484,14 @@ void LauncherController::setEnvironmentSummary(QStringList environmentSummary)
void LauncherController::fly() void LauncherController::fly()
{ {
doRun(); if (m_inAppMode) {
qApp->exit(1); doApply();
m_keepRunningInAppMode = false;
m_appModeResult = true;
} else {
doRun();
qApp->exit(1);
}
} }
QStringList LauncherController::combinedSummary() const QStringList LauncherController::combinedSummary() const

View file

@ -162,6 +162,10 @@ public:
AircraftType aircraftType() const AircraftType aircraftType() const
{ return m_aircraftType; } { return m_aircraftType; }
void setInAppMode();
bool keepRunningInAppMode() const;
bool inAppResult() const;
signals: signals:
void selectedAircraftChanged(QUrl selectedAircraft); void selectedAircraftChanged(QUrl selectedAircraft);
@ -233,6 +237,10 @@ private:
RecentLocationsModel* m_locationHistory = nullptr; RecentLocationsModel* m_locationHistory = nullptr;
QTimer* m_subsystemIdleTimer = nullptr; QTimer* m_subsystemIdleTimer = nullptr;
bool m_inAppMode = false;
bool m_keepRunningInAppMode = false;
bool m_appModeResult = true;
}; };
#endif // LAUNCHERCONTROLLER_HXX #endif // LAUNCHERCONTROLLER_HXX

View file

@ -116,42 +116,20 @@ LauncherMainWindow::~LauncherMainWindow()
bool LauncherMainWindow::execInApp() bool LauncherMainWindow::execInApp()
{ {
#if 0 m_controller->setInAppMode();
m_inAppMode = true;
m_ui->addOnsButton->hide();
m_ui->settingsButton->hide();
disconnect(m_ui->flyButton, SIGNAL(clicked()), this, SLOT(onRun()));
connect(m_ui->flyButton, SIGNAL(clicked()), this, SLOT(onApply()));
m_runInApp = true;
show(); show();
while (m_runInApp) { while (m_controller->keepRunningInAppMode()) {
qApp->processEvents(); qApp->processEvents();
} }
return m_accepted; return m_controller->inAppResult();
#endif
} }
#if 0
void LauncherMainWindow::onApply()
{
m_controller->doApply();
saveSettings();
m_accepted = true;
m_runInApp = false;
}
#endif
void LauncherMainWindow::onQuit() void LauncherMainWindow::onQuit()
{ {
if (m_inAppMode) { qApp->exit(-1);
m_runInApp = false;
} else {
qApp->exit(-1);
}
} }
void LauncherMainWindow::onRestoreDefaults() void LauncherMainWindow::onRestoreDefaults()

View file

@ -54,7 +54,6 @@ private slots:
void onRestoreDefaults(); void onRestoreDefaults();
// void onViewCommandLine();
void onQuit(); void onQuit();
@ -64,10 +63,6 @@ private slots:
private: private:
LauncherController* m_controller; LauncherController* m_controller;
bool m_inAppMode = false;
bool m_runInApp = false;
bool m_accepted = false;
}; };
#endif // of LAUNCHER_MAIN_WINDOW_HXX #endif // of LAUNCHER_MAIN_WINDOW_HXX