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);
}
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()
{
m_selectedAircraft = m_aircraftHistory->mostRecent();
@ -467,8 +484,14 @@ void LauncherController::setEnvironmentSummary(QStringList environmentSummary)
void LauncherController::fly()
{
doRun();
qApp->exit(1);
if (m_inAppMode) {
doApply();
m_keepRunningInAppMode = false;
m_appModeResult = true;
} else {
doRun();
qApp->exit(1);
}
}
QStringList LauncherController::combinedSummary() const

View file

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

View file

@ -116,42 +116,20 @@ LauncherMainWindow::~LauncherMainWindow()
bool LauncherMainWindow::execInApp()
{
#if 0
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;
m_controller->setInAppMode();
show();
while (m_runInApp) {
while (m_controller->keepRunningInAppMode()) {
qApp->processEvents();
}
return m_accepted;
#endif
return m_controller->inAppResult();
}
#if 0
void LauncherMainWindow::onApply()
{
m_controller->doApply();
saveSettings();
m_accepted = true;
m_runInApp = false;
}
#endif
void LauncherMainWindow::onQuit()
{
if (m_inAppMode) {
m_runInApp = false;
} else {
qApp->exit(-1);
}
qApp->exit(-1);
}
void LauncherMainWindow::onRestoreDefaults()

View file

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