From 497ff56438988d5dbfe4dbdfb8f107219ac3e57a Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Fri, 13 Jun 2025 22:15:24 +0200 Subject: [PATCH] fix: Use links to new documentation --- .../share/shared/bootstrap/bootstrap.json | 2 +- src/core/data/globalsetup.cpp | 15 +-------- src/core/data/globalsetup.h | 2 +- .../aircraftmodelsetvalidationdialog.cpp | 6 ---- .../aircraftmodelsetvalidationdialog.h | 4 --- .../aircraftmodelvalidationcomponent.cpp | 2 +- src/gui/components/configurationwizard.cpp | 8 +---- src/gui/components/configurationwizard.h | 4 --- .../components/dbownmodelsetformdialog.cpp | 6 ---- src/gui/components/dbownmodelsetformdialog.h | 4 --- .../interpolationlogdisplaydialog.cpp | 6 ---- .../interpolationlogdisplaydialog.h | 4 --- src/gui/components/legalinfocomponent.cpp | 2 +- src/gui/components/modelbrowserdialog.cpp | 6 ---- src/gui/components/modelbrowserdialog.h | 4 --- src/gui/components/updateinfodialog.cpp | 6 ---- src/gui/components/updateinfodialog.h | 4 --- src/gui/guiapplication.cpp | 33 ++----------------- src/gui/guiapplication.h | 8 +---- 19 files changed, 9 insertions(+), 117 deletions(-) diff --git a/resources/share/shared/bootstrap/bootstrap.json b/resources/share/shared/bootstrap/bootstrap.json index 2e37cd48d..933758bbd 100644 --- a/resources/share/shared/bootstrap/bootstrap.json +++ b/resources/share/shared/bootstrap/bootstrap.json @@ -6,7 +6,7 @@ }, "mappingMinimumVersion": "0.9.0", "onlineHelpUrl": { - "url": "https://datastore.swift-project.org/page/swifthelpdispatcher.html" + "url": "https://url.swift-project.org/" }, "predefinedServers": { "containerbase": [ diff --git a/src/core/data/globalsetup.cpp b/src/core/data/globalsetup.cpp index d7e05f28d..f7cc975c6 100644 --- a/src/core/data/globalsetup.cpp +++ b/src/core/data/globalsetup.cpp @@ -41,20 +41,7 @@ namespace swift::core::data const CUrl &CGlobalSetup::getSwiftSharedUrl() const { return m_sharedUrl; } CUrl CGlobalSetup::getDbHomePageUrl() const { return getDbRootDirectoryUrl().withAppendedPath("/page/index.php"); } - CUrl CGlobalSetup::getHelpPageUrl(const QString &context) const - { - // we display in the standard browser, - // so the user will realize if the URL does not work - CUrl url = m_onlineHelpUrl; - if (url.isEmpty()) { return url; } - - // context string something like "application.moreSpecific.evenMoreSpecific" - QString c = "client"; - if (QCoreApplication::instance()) { c = QCoreApplication::instance()->applicationName(); } - if (!context.isEmpty()) { c += "." + context; } - url.appendQuery("context", c); - return url; - } + CUrl CGlobalSetup::getHelpPageUrl() const { return m_onlineHelpUrl; } CUrl CGlobalSetup::getLegalDirectoryUrl() const { return getDbRootDirectoryUrl().withAppendedPath("/legal/"); } diff --git a/src/core/data/globalsetup.h b/src/core/data/globalsetup.h index 947a2ea72..6ff237744 100644 --- a/src/core/data/globalsetup.h +++ b/src/core/data/globalsetup.h @@ -111,7 +111,7 @@ namespace swift::core::data swift::misc::network::CUrl getVatsimFsdHttpUrl() const { return m_vatsimFsdHttpUrl; } //! Help page URL - swift::misc::network::CUrl getHelpPageUrl(const QString &context = {}) const; + swift::misc::network::CUrl getHelpPageUrl() const; //! Predefined servers const swift::misc::network::CServerList &getPredefinedServers() const { return m_predefinedServers; } diff --git a/src/gui/components/aircraftmodelsetvalidationdialog.cpp b/src/gui/components/aircraftmodelsetvalidationdialog.cpp index 9618d6c39..bb88ea958 100644 --- a/src/gui/components/aircraftmodelsetvalidationdialog.cpp +++ b/src/gui/components/aircraftmodelsetvalidationdialog.cpp @@ -32,10 +32,4 @@ namespace swift::gui::components this->setWindowTitle(QStringLiteral("Model validation for '%1'").arg(simulator.toQString(true))); CGuiApplication::modalWindowToFront(); } - - bool CAircraftModelSetValidationDialog::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } } // namespace swift::gui::components diff --git a/src/gui/components/aircraftmodelsetvalidationdialog.h b/src/gui/components/aircraftmodelsetvalidationdialog.h index 53a31fbd3..949b26afe 100644 --- a/src/gui/components/aircraftmodelsetvalidationdialog.h +++ b/src/gui/components/aircraftmodelsetvalidationdialog.h @@ -47,10 +47,6 @@ namespace swift::gui::components const swift::misc::simulation::CAircraftModelList &invalid, bool stopped, const swift::misc::CStatusMessageList &msgs); - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - private: QScopedPointer ui; }; diff --git a/src/gui/components/aircraftmodelvalidationcomponent.cpp b/src/gui/components/aircraftmodelvalidationcomponent.cpp index 4cec1915d..a62c0a8b2 100644 --- a/src/gui/components/aircraftmodelvalidationcomponent.cpp +++ b/src/gui/components/aircraftmodelvalidationcomponent.cpp @@ -222,7 +222,7 @@ namespace swift::gui::components void CAircraftModelValidationComponent::showHelp() { if (!sGui || sGui->isShuttingDown()) { return; } - sGui->showHelp(this); + sGui->showHelp("model_set_validation"); } void CAircraftModelValidationComponent::saveInvalidModels(const CAircraftModelList &models) const diff --git a/src/gui/components/configurationwizard.cpp b/src/gui/components/configurationwizard.cpp index fd308083e..c835eb184 100644 --- a/src/gui/components/configurationwizard.cpp +++ b/src/gui/components/configurationwizard.cpp @@ -54,7 +54,7 @@ namespace swift::gui::components connect(this, &QWizard::helpRequested, sGui, [=] { if (!myself) { return; } if (!sGui || sGui->isShuttingDown()) { return; } - sGui->showHelp(this); + sGui->showHelp("install"); }); this->setScreenGeometry(); @@ -71,12 +71,6 @@ namespace swift::gui::components return wizard && wizard->lastStepSkipped(); } - bool CConfigurationWizard::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } - void CConfigurationWizard::wizardCurrentIdChanged(int id) { const int previousId = m_previousId; diff --git a/src/gui/components/configurationwizard.h b/src/gui/components/configurationwizard.h index 2d7dece82..711d93cd6 100644 --- a/src/gui/components/configurationwizard.h +++ b/src/gui/components/configurationwizard.h @@ -50,10 +50,6 @@ namespace swift::gui::components //! Static version of CConfigurationWizard::lastStepSkipped static bool lastWizardStepSkipped(const QWizard *standardWizard); - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - private: //! The current page has changed void wizardCurrentIdChanged(int id); diff --git a/src/gui/components/dbownmodelsetformdialog.cpp b/src/gui/components/dbownmodelsetformdialog.cpp index f0bbda50f..d5ac96d4b 100644 --- a/src/gui/components/dbownmodelsetformdialog.cpp +++ b/src/gui/components/dbownmodelsetformdialog.cpp @@ -64,12 +64,6 @@ namespace swift::gui::components return QDialog::exec(); } - bool CDbOwnModelSetFormDialog::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } - void CDbOwnModelSetFormDialog::buttonClicked() { const QObject *sender = QObject::sender(); diff --git a/src/gui/components/dbownmodelsetformdialog.h b/src/gui/components/dbownmodelsetformdialog.h index 3184b2b98..02efb65c2 100644 --- a/src/gui/components/dbownmodelsetformdialog.h +++ b/src/gui/components/dbownmodelsetformdialog.h @@ -56,10 +56,6 @@ namespace swift::gui::components //! Exec and display simulator virtual int exec() override; - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - private: QScopedPointer ui; swift::misc::simulation::CAircraftModelList m_modelSet; diff --git a/src/gui/components/interpolationlogdisplaydialog.cpp b/src/gui/components/interpolationlogdisplaydialog.cpp index 9a496919d..50512a2fd 100644 --- a/src/gui/components/interpolationlogdisplaydialog.cpp +++ b/src/gui/components/interpolationlogdisplaydialog.cpp @@ -39,10 +39,4 @@ namespace swift::gui::components { ui->comp_InterpolationLogDisplay->setAirspaceMonitor(airspaceMonitor); } - - bool CInterpolationLogDisplayDialog::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } } // namespace swift::gui::components diff --git a/src/gui/components/interpolationlogdisplaydialog.h b/src/gui/components/interpolationlogdisplaydialog.h index 83942da0d..42c1e62e6 100644 --- a/src/gui/components/interpolationlogdisplaydialog.h +++ b/src/gui/components/interpolationlogdisplaydialog.h @@ -44,10 +44,6 @@ namespace swift::gui::components //! Set airspace monitor void setAirspaceMonitor(swift::core::CAirspaceMonitor *airspaceMonitor); - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - private: QScopedPointer ui; }; diff --git a/src/gui/components/legalinfocomponent.cpp b/src/gui/components/legalinfocomponent.cpp index a5a755e5e..ba192201b 100644 --- a/src/gui/components/legalinfocomponent.cpp +++ b/src/gui/components/legalinfocomponent.cpp @@ -56,7 +56,7 @@ namespace swift::gui::components { if (!sGui) { return; } const CGlobalSetup gs = sGui->getGlobalSetup(); - const CUrl url = gs.getHelpPageUrl("checklist"); + const CUrl url = gs.getHelpPageUrl().withAppendedPath("checklist"); ui->lbl_Tip->setText(QStringLiteral("Please read the checklist before your 1st flight") .arg(url.getFullUrl())); ui->lbl_Tip->setTextFormat(Qt::RichText); diff --git a/src/gui/components/modelbrowserdialog.cpp b/src/gui/components/modelbrowserdialog.cpp index fc3176505..afea73f83 100644 --- a/src/gui/components/modelbrowserdialog.cpp +++ b/src/gui/components/modelbrowserdialog.cpp @@ -19,12 +19,6 @@ namespace swift::gui::components // void; } - bool CModelBrowserDialog::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } - void CModelBrowserDialog::done(int r) { ui->comp_ModelBrowser->close(); diff --git a/src/gui/components/modelbrowserdialog.h b/src/gui/components/modelbrowserdialog.h index 045714990..0d4b0f0dd 100644 --- a/src/gui/components/modelbrowserdialog.h +++ b/src/gui/components/modelbrowserdialog.h @@ -29,10 +29,6 @@ namespace swift::gui::components //! Destructor virtual ~CModelBrowserDialog() override; - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - //! \copydoc QDialog::closeEvent virtual void done(int r) override; diff --git a/src/gui/components/updateinfodialog.cpp b/src/gui/components/updateinfodialog.cpp index 246af4cb9..0643ec32c 100644 --- a/src/gui/components/updateinfodialog.cpp +++ b/src/gui/components/updateinfodialog.cpp @@ -45,12 +45,6 @@ namespace swift::gui::components return r; } - bool CUpdateInfoDialog::event(QEvent *event) - { - if (CGuiApplication::triggerShowHelp(this, event)) { return true; } - return QDialog::event(event); - } - void CUpdateInfoDialog::onDontShowAgain(bool dontShowAgain) { m_setting.setAndSave(!dontShowAgain); } void CUpdateInfoDialog::selectionChanged() diff --git a/src/gui/components/updateinfodialog.h b/src/gui/components/updateinfodialog.h index fd7271a01..e5c7af1c4 100644 --- a/src/gui/components/updateinfodialog.h +++ b/src/gui/components/updateinfodialog.h @@ -37,10 +37,6 @@ namespace swift::gui::components //! \copydoc QDialog::exec virtual int exec() override; - protected: - //! \copydoc QObject::event - virtual bool event(QEvent *event) override; - private: QScopedPointer ui; swift::misc::CSetting m_setting { this }; //!< show again? diff --git a/src/gui/guiapplication.cpp b/src/gui/guiapplication.cpp index bc8383fdb..11b3e8ccb 100644 --- a/src/gui/guiapplication.cpp +++ b/src/gui/guiapplication.cpp @@ -851,43 +851,14 @@ namespace swift::gui Q_UNUSED(c) } - void CGuiApplication::showHelp(const QString &context) const + void CGuiApplication::showHelp(const QString &subpath) const { if (this->isShuttingDown()) { return; } const CGlobalSetup gs = this->getGlobalSetup(); - const CUrl helpPage = gs.getHelpPageUrl(context); - if (helpPage.isEmpty()) - { - CLogMessage(this).warning(u"No help page"); - return; - } + const CUrl helpPage = gs.getHelpPageUrl().withAppendedPath(subpath); QDesktopServices::openUrl(helpPage); } - void CGuiApplication::showHelp(const QObject *qObject) const - { - if (this->isShuttingDown()) { return; } - if (!qObject || qObject->objectName().isEmpty()) { this->showHelp(); } - else { this->showHelp(qObject->objectName()); } - } - - bool CGuiApplication::triggerShowHelp(const QWidget *widget, QEvent *event) - { - if (!widget) { return false; } - if (!event) { return false; } - const QEvent::Type t = event->type(); - if (t != QEvent::EnterWhatsThisMode) { return false; } - QWhatsThis::leaveWhatsThisMode(); - event->accept(); - if (!widget->isVisible()) { return true; } // ignore invisble ones - const QPointer wp(widget); - QTimer::singleShot(0, sGui, [=] { - if (!wp || !sGui || sGui->isShuttingDown()) { return; } - sGui->showHelp(widget); - }); - return true; - } - const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const { return m_styleSheetUtility; } QString CGuiApplication::getWidgetStyle() const diff --git a/src/gui/guiapplication.h b/src/gui/guiapplication.h index e7b0b4337..086f4bfe1 100644 --- a/src/gui/guiapplication.h +++ b/src/gui/guiapplication.h @@ -161,13 +161,7 @@ namespace swift::gui void addMenuHelp(QMenu &menu); //! Show help page (online help) - void showHelp(const QString &context = {}) const; - - //! Show help page (online help), use QObject::objectName as 2nd level context - void showHelp(const QObject *qObject) const; - - //! Static version used with dialogs - static bool triggerShowHelp(const QWidget *widget, QEvent *event); + void showHelp(const QString &subpath = {}) const; //! Style sheet handling const CStyleSheetUtility &getStyleSheetUtility() const;