mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 06:35:41 +08:00
[Usability] Launcher in installer mode checks installation
Do not launch wizard if we just update swift (bug fixes)
This commit is contained in:
@@ -8,16 +8,17 @@
|
|||||||
|
|
||||||
#include "swiftlauncher.h"
|
#include "swiftlauncher.h"
|
||||||
#include "ui_swiftlauncher.h"
|
#include "ui_swiftlauncher.h"
|
||||||
|
#include "blackgui/overlaymessagesframe.h"
|
||||||
#include "blackgui/components/configurationwizard.h"
|
#include "blackgui/components/configurationwizard.h"
|
||||||
#include "blackgui/components/texteditdialog.h"
|
#include "blackgui/components/texteditdialog.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
#include "blackcore/context/contextapplicationproxy.h"
|
#include "blackcore/context/contextapplicationproxy.h"
|
||||||
#include "blackcore/setupreader.h"
|
#include "blackcore/setupreader.h"
|
||||||
|
#include "blacksound/audioutilities.h"
|
||||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||||
#include "blackcore/context/contextnetwork.h"
|
#include "blackcore/context/contextnetwork.h"
|
||||||
#include "blackmisc/network/networkutils.h"
|
#include "blackmisc/network/networkutils.h"
|
||||||
#include "blacksound/audioutilities.h"
|
|
||||||
#include "blackmisc/dbusserver.h"
|
#include "blackmisc/dbusserver.h"
|
||||||
#include "blackmisc/directoryutils.h"
|
#include "blackmisc/directoryutils.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
@@ -48,11 +49,14 @@ using namespace BlackSound;
|
|||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Db;
|
using namespace BlackMisc::Db;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
|
using namespace BlackMisc::Simulation::Data;
|
||||||
using namespace BlackMisc::Simulation::FsCommon;
|
using namespace BlackMisc::Simulation::FsCommon;
|
||||||
|
|
||||||
CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
||||||
QDialog(parent, CEnableForFramelessWindow::modeToWindowFlags(CEnableForFramelessWindow::WindowNormal)),
|
QDialog(parent, CEnableForFramelessWindow::modeToWindowFlags(CEnableForFramelessWindow::WindowNormal)),
|
||||||
CEnableForFramelessWindow(CEnableForFramelessWindow::WindowFrameless, true, "framelessMainWindow", this),
|
CEnableForFramelessWindow(CEnableForFramelessWindow::WindowFrameless, true, "framelessMainWindow", this),
|
||||||
|
CCentralMultiSimulatorModelSetCachesAware(),
|
||||||
CIdentifiable(this),
|
CIdentifiable(this),
|
||||||
ui(new Ui::CSwiftLauncher)
|
ui(new Ui::CSwiftLauncher)
|
||||||
{
|
{
|
||||||
@@ -77,10 +81,10 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished, Qt::QueuedConnection);
|
connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished, Qt::QueuedConnection);
|
||||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged, Qt::QueuedConnection);
|
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection);
|
|
||||||
connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection);
|
|
||||||
connect(ui->pb_LogDir, &QPushButton::released, sGui, &CGuiApplication::openStandardLogDirectory, Qt::QueuedConnection);
|
connect(ui->pb_LogDir, &QPushButton::released, sGui, &CGuiApplication::openStandardLogDirectory, Qt::QueuedConnection);
|
||||||
connect(ui->pb_DumpDir, &QPushButton::released, sGui, &CGuiApplication::openStandardCrashDumpDirectory, Qt::QueuedConnection);
|
connect(ui->pb_DumpDir, &QPushButton::released, sGui, &CGuiApplication::openStandardCrashDumpDirectory, Qt::QueuedConnection);
|
||||||
|
connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection);
|
||||||
|
connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection);
|
||||||
connect(ui->pb_FSXConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
|
connect(ui->pb_FSXConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
|
||||||
connect(ui->pb_P3DConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
|
connect(ui->pb_P3DConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
|
||||||
|
|
||||||
@@ -92,17 +96,73 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
m_checkTimer.setInterval(2500);
|
m_checkTimer.setInterval(2500);
|
||||||
m_checkTimer.start();
|
m_checkTimer.start();
|
||||||
|
|
||||||
// auto launch wizard nd other init parts
|
|
||||||
const QPointer<CSwiftLauncher> myself(this);
|
const QPointer<CSwiftLauncher> myself(this);
|
||||||
|
if (sGui->isInstallerOptionSet())
|
||||||
|
{
|
||||||
|
QTimer::singleShot(1000, this, [ = ]
|
||||||
|
{
|
||||||
|
if (!sGui || sGui->isShuttingDown() || !myself) { return; }
|
||||||
|
ui->fr_SwiftLauncherMain->showOverlayHTMLMessage("Checking installation!<br>One moment please ....");
|
||||||
|
this->raise();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// auto launch wizard and other init parts
|
||||||
QTimer::singleShot(2500, this, [ = ]
|
QTimer::singleShot(2500, this, [ = ]
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !myself) { return; }
|
if (!sGui || sGui->isShuttingDown() || !myself) { return; }
|
||||||
this->onCoreModeReleased();
|
this->onCoreModeReleased();
|
||||||
this->requestMacMicrophoneAccess();
|
this->requestMacMicrophoneAccess();
|
||||||
if (sGui->isInstallerOptionSet()) { myself->startWizard(); }
|
this->installerMode();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSwiftLauncher::installerMode()
|
||||||
|
{
|
||||||
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
|
if (!sGui->isInstallerOptionSet()) { return; }
|
||||||
|
|
||||||
|
bool runDialog = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const QDir dir = CDirectoryUtils::logDirectory();
|
||||||
|
if (!dir.exists()) { break; }
|
||||||
|
|
||||||
|
if (sGui && sGui->getSetupReader())
|
||||||
|
{
|
||||||
|
sGui->getSetupReader()->prefillCacheWithLocalResourceBootstrapFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const CSimulatorInfo &sim : CSimulatorInfo::allSimulatorsSet())
|
||||||
|
{
|
||||||
|
this->synchronizeCache(sim);
|
||||||
|
const int c = this->getCachedModelsCount(sim);
|
||||||
|
if (c > 0)
|
||||||
|
{
|
||||||
|
// we already have data
|
||||||
|
runDialog = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (false);
|
||||||
|
|
||||||
|
bool startWizard = true;
|
||||||
|
ui->fr_SwiftLauncherMain->closeOverlay();
|
||||||
|
|
||||||
|
if (runDialog)
|
||||||
|
{
|
||||||
|
const QMessageBox::StandardButton ret =
|
||||||
|
QMessageBox::question(this,
|
||||||
|
tr("swift configuration"),
|
||||||
|
tr("This installation directory already contains a swift configuration.\n"
|
||||||
|
"Do you want to use that one?"));
|
||||||
|
if (ret != QMessageBox::No) { startWizard = false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startWizard) { this->startWizard(); }
|
||||||
|
}
|
||||||
|
|
||||||
CSwiftLauncher::~CSwiftLauncher()
|
CSwiftLauncher::~CSwiftLauncher()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,13 @@
|
|||||||
#ifndef SWIFTLAUNCHER_H
|
#ifndef SWIFTLAUNCHER_H
|
||||||
#define SWIFTLAUNCHER_H
|
#define SWIFTLAUNCHER_H
|
||||||
|
|
||||||
#include "blackgui/overlaymessagesframe.h"
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
|
#include "blackgui/overlaymessagesframe.h"
|
||||||
#include "blackgui/mainwindowaccess.h"
|
#include "blackgui/mainwindowaccess.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackcore/data/launchersetup.h"
|
#include "blackcore/data/launchersetup.h"
|
||||||
#include "blackcore/coremodeenums.h"
|
#include "blackcore/coremodeenums.h"
|
||||||
|
#include "blackmisc/simulation/data/modelcaches.h"
|
||||||
#include "blackmisc/db/artifact.h"
|
#include "blackmisc/db/artifact.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ class CSwiftLauncher :
|
|||||||
public QDialog,
|
public QDialog,
|
||||||
public BlackGui::CEnableForFramelessWindow,
|
public BlackGui::CEnableForFramelessWindow,
|
||||||
public BlackGui::IMainWindowAccess,
|
public BlackGui::IMainWindowAccess,
|
||||||
|
public BlackMisc::Simulation::Data::CCentralMultiSimulatorModelSetCachesAware,
|
||||||
public BlackMisc::CIdentifiable
|
public BlackMisc::CIdentifiable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -211,6 +213,9 @@ private:
|
|||||||
//! Request MacOS microphone request
|
//! Request MacOS microphone request
|
||||||
void requestMacMicrophoneAccess();
|
void requestMacMicrophoneAccess();
|
||||||
|
|
||||||
|
//! Run in installer mode
|
||||||
|
void installerMode();
|
||||||
|
|
||||||
//! Command line
|
//! Command line
|
||||||
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
|
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user