diff --git a/src/blackgui/components/configurationwizard.cpp b/src/blackgui/components/configurationwizard.cpp index 663103c43..c804a2a28 100644 --- a/src/blackgui/components/configurationwizard.cpp +++ b/src/blackgui/components/configurationwizard.cpp @@ -23,6 +23,7 @@ namespace BlackGui ui->wp_CopyCaches->setConfigComponent(ui->comp_CopyCaches); ui->wp_CopySettings->setConfigComponent(ui->comp_CopySettings); ui->wp_Simulator->setConfigComponent(ui->comp_Simulator); + ui->wp_XSwiftBus->setConfigComponent(ui->comp_XSwiftBus); ui->wp_DataLoad->setConfigComponent(ui->comp_DataLoad); ui->wp_Hotkeys->setConfigComponent(ui->comp_Hotkeys); ui->comp_Hotkeys->registerDummyPttEntry(); diff --git a/src/blackgui/components/configurationwizard.h b/src/blackgui/components/configurationwizard.h index d7b88c14c..c641f3724 100644 --- a/src/blackgui/components/configurationwizard.h +++ b/src/blackgui/components/configurationwizard.h @@ -35,6 +35,7 @@ namespace BlackGui CopySettings, CopyCaches, ConfigSimulator, + XSwiftBus, DataLoad, ConfigHotkeys }; diff --git a/src/blackgui/components/configurationwizard.ui b/src/blackgui/components/configurationwizard.ui index 2fd5c4564..00c7579a4 100644 --- a/src/blackgui/components/configurationwizard.ui +++ b/src/blackgui/components/configurationwizard.ui @@ -130,7 +130,45 @@ + + + XSwiftBus + + + Install XSwiftBus (X-Plane only) + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + Data loading + + + Caches model and ICAO data + 4 @@ -231,6 +269,18 @@
blackgui/components/settingshotkeycomponent.h
1 + + BlackGui::Components::CInstallXSwiftBusComponent + QFrame +
blackgui/components/installxswiftbuscomponent.h
+ 1 +
+ + BlackGui::Components::CInstallXSwiftBusWizardPage + QWizardPage +
blackgui/components/installxswiftbuscomponent.h
+ 1 +
diff --git a/src/blackgui/components/distributioninfocomponent.cpp b/src/blackgui/components/distributioninfocomponent.cpp index afa61c03e..7fcc811ee 100644 --- a/src/blackgui/components/distributioninfocomponent.cpp +++ b/src/blackgui/components/distributioninfocomponent.cpp @@ -9,11 +9,12 @@ #include "distributioninfocomponent.h" #include "ui_distributioninfocomponent.h" -#include "blackconfig/buildconfig.h" +#include "installxswiftbusdialog.h" #include "blackgui/guiapplication.h" #include "blackmisc/network/networkutils.h" #include "blackmisc/db/distributionlist.h" #include "blackmisc/logmessage.h" +#include "blackconfig/buildconfig.h" using namespace BlackConfig; using namespace BlackCore::Application; @@ -35,15 +36,20 @@ namespace BlackGui ui->lbl_NewVersionUrl->setOpenExternalLinks(true); // use version signal as trigger for completion - connect(sGui, &CGuiApplication::distributionInfoAvailable, this, &CDistributionInfoComponent::ps_loadedDistributionInfo); - const int time = this->m_distributionInfo.get().isEmpty() ? 10 * 1000 : 500; - QTimer::singleShot(time, this, [ = ] + if (!m_distributionInfo.get().isEmpty()) { - // use this as timeout failover with cached data - if (m_distributionsLoaded) { return; } - this->ps_loadedDistributionInfo(true); - }); + // we have at least cached data: + // in case CGuiApplication::distributionInfoAvailable never comes/was already sent + QTimer::singleShot(10 * 1000, this, [ = ] + { + // use this as timeout failover with cached data + if (m_distributionsLoaded) { return; } + this->ps_loadedDistributionInfo(true); + }); + } + connect(sGui, &CGuiApplication::distributionInfoAvailable, this, &CDistributionInfoComponent::ps_loadedDistributionInfo); connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CDistributionInfoComponent::ps_loadSetup); + connect(ui->pb_InstallXSwiftBus, &QPushButton::pressed, this, &CDistributionInfoComponent::ps_installXSwiftBusDialog); } CDistributionInfoComponent::~CDistributionInfoComponent() @@ -71,13 +77,16 @@ namespace BlackGui void CDistributionInfoComponent::ps_loadedDistributionInfo(bool success) { - ui->pb_CheckForUpdates->setToolTip(""); if (!success) { + m_distributionsLoaded = false; + ui->pb_CheckForUpdates->setToolTip(""); CLogMessage(this).warning("Loading setup or distribution information failed"); return; } + // only emit once + if (m_distributionsLoaded) { return; } m_distributionsLoaded = true; this->ps_channelChanged(); ui->pb_CheckForUpdates->setToolTip(sApp->getLastSuccesfulDistributionUrl()); @@ -91,12 +100,22 @@ namespace BlackGui this->ps_loadedDistributionInfo(true); } + void CDistributionInfoComponent::ps_installXSwiftBusDialog() + { + if (!m_installXSwiftBusDialog) + { + m_installXSwiftBusDialog.reset(new CInstallXSwiftBusDialog(this)); + m_installXSwiftBusDialog->setModal(true); + } + m_installXSwiftBusDialog->show(); + } + void CDistributionInfoComponent::saveSettings() { const QString channel = ui->cb_Channels->currentText(); const QString currentPlatform = ui->cb_Platforms->currentText(); const QStringList settings({ channel, currentPlatform }); - const CStatusMessage m = this->m_distributionSettings.setAndSave(settings); + const CStatusMessage m = m_distributionSettings.setAndSave(settings); if (m.isFailure()) { CLogMessage(this).preformatted(m); @@ -152,7 +171,7 @@ namespace BlackGui ui->lbl_NewVersionInfo->setText("Nothing new"); ui->lbl_NewVersionInfo->setStyleSheet("background-color: green"); ui->lbl_NewVersionUrl->clear(); - this->m_newVersionAvailable.clear(); + m_newVersionAvailable.clear(); const QString currentPlatform = ui->cb_Platforms->currentText(); if (!currentPlatform.isEmpty()) @@ -170,7 +189,7 @@ namespace BlackGui ui->lbl_NewVersionInfo->setText("New version!"); ui->lbl_NewVersionInfo->setToolTip("New version '" + latestVersionStr + "'"); ui->lbl_NewVersionInfo->setStyleSheet("background-color: red"); - this->m_newVersionAvailable = latestVersionStr; + m_newVersionAvailable = latestVersionStr; } if (!downloadUrl.isEmpty()) diff --git a/src/blackgui/components/distributioninfocomponent.h b/src/blackgui/components/distributioninfocomponent.h index 0d4056a4c..31958036e 100644 --- a/src/blackgui/components/distributioninfocomponent.h +++ b/src/blackgui/components/distributioninfocomponent.h @@ -22,6 +22,8 @@ namespace BlackGui { namespace Components { + class CInstallXSwiftBusDialog; + /** * Update info (distributions etc.) */ @@ -68,8 +70,12 @@ namespace BlackGui //! Cache values have been changed void ps_changedDistributionCache(); + //! Install XSwiftBus dialog + void ps_installXSwiftBusDialog(); + private: QScopedPointer ui; + QScopedPointer m_installXSwiftBusDialog; //!< dialog, install XSwiftXBus bool m_distributionsLoaded = false; //!< distribution info loaded QString m_newVersionAvailable; //!< new version number if any BlackMisc::Db::CDistribution m_currentDistribution; //!< current distribution diff --git a/src/blackgui/components/distributioninfocomponent.ui b/src/blackgui/components/distributioninfocomponent.ui index 179458773..9ecacc864 100644 --- a/src/blackgui/components/distributioninfocomponent.ui +++ b/src/blackgui/components/distributioninfocomponent.ui @@ -7,7 +7,7 @@ 0 0 307 - 90 + 106
@@ -32,16 +32,6 @@ 0 - - - - This version: - - - - - - @@ -56,6 +46,13 @@ + + + + This version: + + + @@ -63,6 +60,16 @@ + + + + + + + Platform: + + + @@ -70,37 +77,44 @@ - - - - - - - Platform: - - - - + check again - + + + + Nothing new - + URL goes here + + + + install + + + + + + + XSwiftBus (XPlane only): + + +
diff --git a/src/blackgui/components/installxswiftbusdialog.cpp b/src/blackgui/components/installxswiftbusdialog.cpp new file mode 100644 index 000000000..858bbad88 --- /dev/null +++ b/src/blackgui/components/installxswiftbusdialog.cpp @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "installxswiftbusdialog.h" +#include "ui_installxswiftbusdialog.h" + +namespace BlackGui +{ + namespace Components + { + CInstallXSwiftBusDialog::CInstallXSwiftBusDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::CInstallXSwiftBusDialog) + { + ui->setupUi(this); + } + + CInstallXSwiftBusDialog::~CInstallXSwiftBusDialog() + { } + } // ns +} // ns diff --git a/src/blackgui/components/installxswiftbusdialog.h b/src/blackgui/components/installxswiftbusdialog.h new file mode 100644 index 000000000..a4f54d601 --- /dev/null +++ b/src/blackgui/components/installxswiftbusdialog.h @@ -0,0 +1,42 @@ +/* Copyright (C) 2017 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_COMPONENTS_INSTALLXSWIFTBUSDIALOG_H +#define BLACKGUI_COMPONENTS_INSTALLXSWIFTBUSDILAOG_H + +#include + +namespace Ui { class CInstallXSwiftBusDialog; } +namespace BlackGui +{ + namespace Components + { + /** + * CInstallXSwiftBusComponent as dialog + */ + class CInstallXSwiftBusDialog : public QDialog + { + Q_OBJECT + + public: + //! Constructor + explicit CInstallXSwiftBusDialog(QWidget *parent = nullptr); + + //! Dtor + virtual ~CInstallXSwiftBusDialog(); + + private: + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/installxswiftbusdialog.ui b/src/blackgui/components/installxswiftbusdialog.ui new file mode 100644 index 000000000..f842bc5f6 --- /dev/null +++ b/src/blackgui/components/installxswiftbusdialog.ui @@ -0,0 +1,93 @@ + + + CInstallXSwiftBusDialog + + + + 0 + 0 + 600 + 350 + + + + + 600 + 350 + + + + Install XSwiftBus dialog + + + + 2 + + + 2 + + + 2 + + + 9 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + BlackGui::Components::CInstallXSwiftBusComponent + QFrame +
blackgui/components/installxswiftbuscomponent.h
+ 1 +
+
+ + + + bb_Dialog + accepted() + CInstallXSwiftBusDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + bb_Dialog + rejected() + CInstallXSwiftBusDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +