diff --git a/src/musredit_qt5/musredit/CMakeLists.txt b/src/musredit_qt5/musredit/CMakeLists.txt index cfa6c3c4..bcb0b2b2 100644 --- a/src/musredit_qt5/musredit/CMakeLists.txt +++ b/src/musredit_qt5/musredit/CMakeLists.txt @@ -1,28 +1,12 @@ #--- musredit for Qt > 5.0 ---------------------------------------------------- #--- check if Qt5WebEngine or Qt5WebKit is present ---------------------------- -find_package(Qt5WebEngine QUIET) -find_package(Qt5WebKit QUIET) +#find_package(Qt5WebEngine QUIET) +#find_package(Qt5WebKit QUIET) set(qt_libs Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport) -set(Qt5NoWeb 0) -if (Qt5WebEngine_FOUND) - message("-- Qt5WebEngine is present.") - find_package(Qt5WebEngineWidgets QUIET CONFIG REQUIRED) - set(qt_libs ${qt_libs} Qt5::WebEngine Qt5::WebEngineWidgets) - # unset a potentially found Qt5Webkit - unset(Qt5WebKit_FOUND) -elseif (Qt5WebKit_FOUND) - message("-- Qt5WebKit is present.") - find_package(Qt5WebKitWidgets QUIET CONFIG REQUIRED) - set(qt_libs ${qt_libs} Qt5::WebKit Qt5::WebKitWidgets) -else (Qt5WebEngine_FOUND) - message("-- Neither Qt5WebEngine nor Qt5WebKit found.") - set(Qt5NoWeb 1) -endif (Qt5WebEngine_FOUND) set(musredit_src - PHelp.cpp PTextEdit.cpp PSubTextEdit.cpp PAdmin.cpp diff --git a/src/musredit_qt5/musredit/PGetAsymmetryRunBlockDialog.cpp b/src/musredit_qt5/musredit/PGetAsymmetryRunBlockDialog.cpp index 14d74570..7d6f2658 100644 --- a/src/musredit_qt5/musredit/PGetAsymmetryRunBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetAsymmetryRunBlockDialog.cpp @@ -31,8 +31,8 @@ #include #include #include - -#include "PHelp.h" +#include +#include #include "PGetAsymmetryRunBlockDialog.h" @@ -284,12 +284,14 @@ void PGetAsymmetryRunBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetFourierBlockDialog.cpp b/src/musredit_qt5/musredit/PGetFourierBlockDialog.cpp index 3e7650fd..2f76e66b 100644 --- a/src/musredit_qt5/musredit/PGetFourierBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetFourierBlockDialog.cpp @@ -33,8 +33,8 @@ #include #include #include - -#include "PHelp.h" +#include +#include #include "PGetFourierBlockDialog.h" @@ -132,12 +132,14 @@ void PGetFourierBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetFunctionsBlockDialog.cpp b/src/musredit_qt5/musredit/PGetFunctionsBlockDialog.cpp index ff144eb4..423942e4 100644 --- a/src/musredit_qt5/musredit/PGetFunctionsBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetFunctionsBlockDialog.cpp @@ -32,11 +32,11 @@ #include #include #include +#include +#include #include -#include "PHelp.h" - #include "PGetFunctionsBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -108,12 +108,14 @@ void PGetFunctionsBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp b/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp index f92114bb..3acf1306 100644 --- a/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp +++ b/src/musredit_qt5/musredit/PGetMusrFTOptionsDialog.cpp @@ -31,8 +31,9 @@ #include #include #include - -#include "PHelp.h" +#include +#include +#include #include "PGetMusrFTOptionsDialog.h" @@ -586,11 +587,13 @@ void PGetMusrFTOptionsDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { -#ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); -#else - PHelp *help = new PHelp(fHelpUrl); - help->show(); -#endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetNonMusrRunBlockDialog.cpp b/src/musredit_qt5/musredit/PGetNonMusrRunBlockDialog.cpp index 8c042fd9..4e91478c 100644 --- a/src/musredit_qt5/musredit/PGetNonMusrRunBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetNonMusrRunBlockDialog.cpp @@ -31,8 +31,9 @@ #include #include #include +#include +#include -#include "PHelp.h" #include "PGetNonMusrRunBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -156,12 +157,14 @@ void PGetNonMusrRunBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetParameterBlockDialog.cpp b/src/musredit_qt5/musredit/PGetParameterBlockDialog.cpp index 2cc64e4b..5e986ebb 100644 --- a/src/musredit_qt5/musredit/PGetParameterBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetParameterBlockDialog.cpp @@ -34,8 +34,9 @@ #include #include #include +#include +#include -#include "PHelp.h" #include "PGetParameterBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -219,12 +220,14 @@ void PGetParameterBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetPlotBlockDialog.cpp b/src/musredit_qt5/musredit/PGetPlotBlockDialog.cpp index ce10a31d..128f3a64 100644 --- a/src/musredit_qt5/musredit/PGetPlotBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetPlotBlockDialog.cpp @@ -33,8 +33,9 @@ #include #include #include +#include +#include -#include "PHelp.h" #include "PGetPlotBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -160,12 +161,14 @@ void PGetPlotBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetSingleHistoRunBlockDialog.cpp b/src/musredit_qt5/musredit/PGetSingleHistoRunBlockDialog.cpp index a28fe371..54a65a98 100644 --- a/src/musredit_qt5/musredit/PGetSingleHistoRunBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetSingleHistoRunBlockDialog.cpp @@ -32,8 +32,9 @@ #include #include #include +#include +#include -#include "PHelp.h" #include "PGetSingleHistoRunBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -282,12 +283,14 @@ void PGetSingleHistoRunBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetTheoryBlockDialog.cpp b/src/musredit_qt5/musredit/PGetTheoryBlockDialog.cpp index 8c4d05e6..d6bf5f3b 100644 --- a/src/musredit_qt5/musredit/PGetTheoryBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetTheoryBlockDialog.cpp @@ -32,10 +32,11 @@ #include #include #include +#include +#include #include -#include "PHelp.h" #include "PGetTheoryBlockDialog.h" //---------------------------------------------------------------------------------------------------- @@ -126,12 +127,14 @@ void PGetTheoryBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PGetTitleBlockDialog.cpp b/src/musredit_qt5/musredit/PGetTitleBlockDialog.cpp index 87956385..22ae3675 100644 --- a/src/musredit_qt5/musredit/PGetTitleBlockDialog.cpp +++ b/src/musredit_qt5/musredit/PGetTitleBlockDialog.cpp @@ -28,8 +28,9 @@ ***************************************************************************/ #include +#include +#include -#include "PHelp.h" #include "PGetTitleBlockDialog.h" //--------------------------------------------------------------------------- @@ -54,12 +55,14 @@ void PGetTitleBlockDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PHelp.cpp b/src/musredit_qt5/musredit/PHelp.cpp deleted file mode 100644 index 3cfe2057..00000000 --- a/src/musredit_qt5/musredit/PHelp.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** - - PHelp.cpp - - Author: Andreas Suter - e-mail: andreas.suter@psi.ch - -*****************************************************************************/ - -/*************************************************************************** - * Copyright (C) 2010-2019 by Andreas Suter * - * andreas.suter@psi.ch * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#ifdef HAVE_QT_WEB_ENGINE -#include -#endif -#ifdef HAVE_QT_WEB_KIT -#include -#endif -#ifdef HAVE_QT_NO_WEB -#include -#endif -#include - -#include - -#include "PHelp.h" - -//--------------------------------------------------------------------------- -/** - *

Constructor. - * - * \param url help url - */ -PHelp::PHelp(const QString &url, const bool isDarkTheme) : - fDarkTheme(isDarkTheme) -{ - fProgress = 0; - - QString iconName(""); - if (fDarkTheme) - iconName = QString(":/icons/musrfit-help-dark.svg"); - else - iconName = QString(":/icons/musrfit-help-plain.svg"); - setWindowIcon( QIcon( QPixmap(iconName) ) ); - - QNetworkProxyFactory::setUseSystemConfiguration(true); - -#ifdef HAVE_QT_WEB_ENGINE - fView = new QWebEngineView(this); -#endif -#ifdef HAVE_QT_WEB_KIT - fView = new QWebView(this); -#endif -#ifdef HAVE_QT_NO_WEB - fView = new QPlainTextEdit(this); -#endif -#ifndef HAVE_QT_NO_WEB - fView->load(QUrl(url)); - connect(fView, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); - connect(fView, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); - connect(fView, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); - connect(fView, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); -#else - fView->setPlainText("Within the current setup there is NO Help available."); - fView->appendPlainText("The necessary Qt web libs where not found when setting up musredit."); - fView->setReadOnly(true); -#endif - - fLocationEdit = new QLineEdit(this); - fLocationEdit->setSizePolicy(QSizePolicy::Expanding, fLocationEdit->sizePolicy().verticalPolicy()); - connect(fLocationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); - - QToolBar *toolBar = addToolBar(tr("Navigation")); -#ifdef HAVE_QT_WEB_ENGINE - toolBar->addAction(fView->pageAction(QWebEnginePage::Back)); - toolBar->addAction(fView->pageAction(QWebEnginePage::Forward)); - toolBar->addAction(fView->pageAction(QWebEnginePage::Reload)); - toolBar->addAction(fView->pageAction(QWebEnginePage::Stop)); -#endif -#ifdef HAVE_QT_WEB_KIT - toolBar->addAction(fView->pageAction(QWebPage::Back)); - toolBar->addAction(fView->pageAction(QWebPage::Forward)); - toolBar->addAction(fView->pageAction(QWebPage::Reload)); - toolBar->addAction(fView->pageAction(QWebPage::Stop)); -#endif - toolBar->addWidget(fLocationEdit); - - QMenu *exitMenu = menuBar()->addMenu(tr("&File")); - exitMenu->addAction("&Exit", this, SLOT(done()), QKeySequence(tr("Ctrl+Q"))); - - setCentralWidget(fView); - setUnifiedTitleAndToolBarOnMac(true); - setMinimumSize(800, 700); -} - -//--------------------------------------------------------------------------- -/** - *

Destructor - */ -PHelp::~PHelp() -{ - if (fView) { - delete fView; - fView = 0; - } - - if (fLocationEdit) { - delete fLocationEdit; - fLocationEdit = 0; - } -} - -//--------------------------------------------------------------------------- -/** - *

Called on exit (SLOT). Closes the web-browser help GUI. - */ -void PHelp::done() -{ - close(); -} - -//--------------------------------------------------------------------------- -/** - *

Called after an url is loaded (SLOT). Adjusts the url address. - */ -void PHelp::adjustLocation() -{ -#ifndef HAVE_QT_NO_WEB - fLocationEdit->setText(fView->url().toString()); -#endif -} - -//--------------------------------------------------------------------------- -/** - *

Called when the url address in the line edit changed (SLOT). Will execute - * the load of the new url. - */ -void PHelp::changeLocation() -{ - QUrl url = QUrl(fLocationEdit->text()); -#ifndef HAVE_QT_NO_WEB - fView->load(url); - fView->setFocus(); -#endif -} - -//--------------------------------------------------------------------------- -/** - *

Called when the title changed (SLOT). Will change the window title according - * to the state of the web-browser. - */ -void PHelp::adjustTitle() -{ -#ifndef HAVE_QT_NO_WEB - if (fProgress <= 0 || fProgress >= 100) - setWindowTitle(fView->title()); - else - setWindowTitle(QString("%1 (%2%)").arg(fView->title()).arg(fProgress)); -#endif -} - -//--------------------------------------------------------------------------- -/** - *

Adjusts the progess value while loading an url. Also calls adjustTitle(). - */ -void PHelp::setProgress(int p) -{ - fProgress = p; - adjustTitle(); -} - -//--------------------------------------------------------------------------- -/** - *

Ajusts the title when an url has been loaded. - */ -void PHelp::finishLoading(bool) -{ - fProgress = 100; - adjustTitle(); -} - -//--------------------------------------------------------------------------- -// end -//--------------------------------------------------------------------------- diff --git a/src/musredit_qt5/musredit/PHelp.h b/src/musredit_qt5/musredit/PHelp.h deleted file mode 100644 index 19a276cc..00000000 --- a/src/musredit_qt5/musredit/PHelp.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - - PHelp.h - - Author: Andreas Suter - e-mail: andreas.suter@psi.ch - -*****************************************************************************/ - -/*************************************************************************** - * Copyright (C) 2010-2019 by Andreas Suter * - * andreas.suter@psi.ch * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _PHELP_H_ -#define _PHELP_H_ - -#include - -#ifdef HAVE_QT_WEB_ENGINE -class QWebEngineView; -#endif -#ifdef HAVE_QT_WEB_KIT -class QWebView; -#endif -QT_BEGIN_NAMESPACE -class QLineEdit; -QT_END_NAMESPACE - -//------------------------------------------------------------------------- -/** - *

Class providing the help interface for the user. It opens the wiki docu - * pages such that a user has the chance to read. - */ -class PHelp : public QMainWindow -{ - Q_OBJECT - - public: - PHelp(const QString &url, const bool isDarkTheme=false); - virtual ~PHelp(); - - protected slots: - void done(); - void adjustLocation(); - void changeLocation(); - void adjustTitle(); - void setProgress(int p); - void finishLoading(bool); - - private: - bool fDarkTheme; -#ifdef HAVE_QT_WEB_ENGINE - QWebEngineView *fView; ///< web viewer -#endif -#ifdef HAVE_QT_WEB_KIT - QWebView *fView; ///< web viewer -#endif -#ifdef HAVE_QT_NO_WEB - QPlainTextEdit *fView; ///< dialog stating that there is NO web viewer -#endif - QLineEdit *fLocationEdit; ///< url address line edit - int fProgress; ///< progress value (0-100) while loading an url -}; - -#endif // _PHELP_H_ diff --git a/src/musredit_qt5/musredit/PMsr2DataDialog.cpp b/src/musredit_qt5/musredit/PMsr2DataDialog.cpp index 94a4f89c..45785f6a 100644 --- a/src/musredit_qt5/musredit/PMsr2DataDialog.cpp +++ b/src/musredit_qt5/musredit/PMsr2DataDialog.cpp @@ -32,8 +32,8 @@ #include #include #include - -#include "PHelp.h" +#include +#include #include "PMsr2DataDialog.h" @@ -224,12 +224,14 @@ void PMsr2DataDialog::helpContent() if (fHelpUrl.isEmpty()) { QMessageBox::information(this, "**INFO**", "Will eventually show a help window"); } else { - #ifdef _WIN32GCC - QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!"); - #else - PHelp *help = new PHelp(fHelpUrl); - help->show(); - #endif // _WIN32GCC + bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fHelpUrl); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } } diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp index fe9ccc55..79fd75e1 100644 --- a/src/musredit_qt5/musredit/PTextEdit.cpp +++ b/src/musredit_qt5/musredit/PTextEdit.cpp @@ -58,11 +58,13 @@ #include #include #include +#include +#include +#include #include #include "PTextEdit.h" -#include "PHelp.h" #include "PSubTextEdit.h" #include "PAdmin.h" #include "PFindDialog.h" @@ -2961,8 +2963,14 @@ void PTextEdit::mupp() */ void PTextEdit::helpContents() { - PHelp *help = new PHelp(fAdmin->getHelpUrl("main"), fDarkMenuIcon); - help->show(); + bool ok = QDesktopServices::openUrl(QUrl(fAdmin->getHelpUrl("main"), QUrl::TolerantMode)); + if (!ok) { + QString msg = QString("

Sorry: Couldn't open default web-browser for the help.
Please try: musrfit docu in your web-browser.").arg(fAdmin->getHelpUrl("main")); + QMessageBox::critical( nullptr, + tr("Fatal Error"), + msg, + tr("Quit") ); + } } //----------------------------------------------------------------------------------------------------