From f4fcc93693a3c68b58cb305aaee412fa444499bc Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 25 May 2020 09:00:04 +0100 Subject: [PATCH] Deprecate WebKit Support .. The NOWEBKIT define is no longer required to build. We now only support building with Chromium QWebEngine --- src/Charts/LTMWindow.cpp | 17 ----- src/Charts/LTMWindow.h | 10 --- src/Charts/RideMapWindow.cpp | 79 ----------------------- src/Charts/RideMapWindow.h | 26 -------- src/Charts/RideSummaryWindow.cpp | 26 -------- src/Charts/RideSummaryWindow.h | 9 --- src/Cloud/OAuthDialog.cpp | 4 -- src/Cloud/OAuthDialog.h | 16 +---- src/Core/GcUpgrade.cpp | 23 ------- src/Core/GcUpgrade.h | 11 ---- src/Core/main.cpp | 8 --- src/Gui/GcCrashDialog.cpp | 28 --------- src/Gui/GcCrashDialog.h | 9 --- src/Gui/GcWindowRegistry.cpp | 5 -- src/Gui/MainWindow.h | 2 +- src/Train/WebPageWindow.cpp | 105 ------------------------------- src/Train/WebPageWindow.h | 31 --------- src/gcconfig.pri.in | 3 - src/src.pro | 55 ++++------------ 19 files changed, 13 insertions(+), 454 deletions(-) diff --git a/src/Charts/LTMWindow.cpp b/src/Charts/LTMWindow.cpp index 742277e8f..0ceb3b6a2 100644 --- a/src/Charts/LTMWindow.cpp +++ b/src/Charts/LTMWindow.cpp @@ -35,10 +35,8 @@ #include "HelpWhatsThis.h" #include "GcOverlayWidget.h" -#ifdef NOWEBKIT #include #include -#endif #include #include @@ -144,7 +142,6 @@ LTMWindow::LTMWindow(Context *context) : // the data table QFont defaultFont; // mainwindow sets up the defaults.. we need to apply -#ifdef NOWEBKIT dataSummary = new QWebEngineView(this); #if QT_VERSION >= 0x050800 // stop stealing focus! @@ -159,11 +156,6 @@ LTMWindow::LTMWindow(Context *context) : dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1); } dataSummary->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family()); -#else - dataSummary = new QWebView(this); - dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); - dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); -#endif dataSummary->setContentsMargins(0,0,0,0); dataSummary->page()->view()->setContentsMargins(0,0,0,0); dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -1267,20 +1259,11 @@ class GroupedData { void LTMWindow::refreshDataTable() { -#ifndef NOWEBKIT - // clear to force refresh - dataSummary->page()->mainFrame()->setHtml(""); -#endif - // get string QString summary = dataTable(true); // now set it -#ifdef NOWEBKIT dataSummary->page()->setHtml(summary); -#else - dataSummary->page()->mainFrame()->setHtml(summary); -#endif } // for storing curve data without using a curve diff --git a/src/Charts/LTMWindow.h b/src/Charts/LTMWindow.h index 1a01cb729..ab8bb583e 100644 --- a/src/Charts/LTMWindow.h +++ b/src/Charts/LTMWindow.h @@ -23,12 +23,7 @@ #include #include -#ifdef NOWEBKIT #include -#else -#include -#include -#endif #include #include "Context.h" #include "Season.h" @@ -258,12 +253,7 @@ class LTMWindow : public GcChartWindow QStackedWidget *stackWidget; // summary view -#ifdef NOWEBKIT QWebEngineView *dataSummary; -#else - QWebView *dataSummary; -#endif - // popup - the GcPane to display within // and the LTMPopup contents widdget diff --git a/src/Charts/RideMapWindow.cpp b/src/Charts/RideMapWindow.cpp index 718c26218..cb084cdbd 100644 --- a/src/Charts/RideMapWindow.cpp +++ b/src/Charts/RideMapWindow.cpp @@ -36,11 +36,9 @@ #include "TimeUtils.h" #include "HelpWhatsThis.h" -#ifdef NOWEBKIT #include #include #include -#endif // overlay helper #include "TabView.h" @@ -122,14 +120,10 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont layout->setContentsMargins(2,0,2,2); setChartLayout(layout); -#ifdef NOWEBKIT view = new QWebEngineView(this); #if QT_VERSION >= 0x050800 // stop stealing focus! view->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false); -#endif -#else - view = new QWebView(); #endif view->setPage(new mapWebPage()); view->setContentsMargins(0,0,0,0); @@ -142,7 +136,6 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont view->setWhatsThis(help->getWhatsThisText(HelpWhatsThis::ChartRides_Map)); webBridge = new MapWebBridge(context, this); -#ifdef NOWEBKIT // file: MyWebEngineView.cpp, MyWebEngineView extends QWebEngineView QWebChannel *channel = new QWebChannel(view->page()); @@ -152,7 +145,6 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont // register QObjects to be exposed to JavaScript channel->registerObject(QStringLiteral("webBridge"), webBridge); -#endif // put a helper on the screen for mouse over intervals... overlayIntervals = new IntervalSummaryWindow(context); @@ -162,9 +154,6 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont // connects // connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); -#ifndef NOWEBKIT - connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(updateFrame())); -#endif connect(context, SIGNAL(rideChanged(RideItem*)), this, SLOT(forceReplot())); connect(context, SIGNAL(intervalsChanged()), webBridge, SLOT(intervalsChanged())); @@ -347,11 +336,7 @@ void RideMapWindow::loadRide() { createHtml(); -#ifdef NOWEBKIT view->page()->setHtml(currentPage); -#else - view->page()->mainFrame()->setHtml(currentPage); -#endif } void RideMapWindow::updateFrame() @@ -362,11 +347,6 @@ void RideMapWindow::updateFrame() webBridge = new MapWebBridge(context, this); connect(context, SIGNAL(intervalsChanged()), webBridge, SLOT(intervalsChanged())); connect(context, SIGNAL(intervalSelected()), webBridge, SLOT(intervalsChanged())); - -#ifndef NOWEBKIT - view->page()->mainFrame()->addToJavaScriptWindowObject("webBridge", webBridge); -#endif - } void RideMapWindow::createHtml() @@ -421,22 +401,16 @@ void RideMapWindow::createHtml() currentPage += QString(" \n").arg(gkey->text()); } -#ifdef NOWEBKIT currentPage += QString("\n"); -#endif currentPage += QString(""); @@ -461,14 +435,8 @@ void RideMapWindow::createHtml() // b) allow local manipulation. This makes the UI // considerably more 'snappy' "function drawRoute() {\n" -#ifdef NOWEBKIT // load the GPS co-ordinates " webBridge.getLatLons(0, drawRouteForLatLons);\n" -#else - // load the GPS co-ordinates - " var latlons = webBridge.getLatLons(0);\n" // interval "0" is the entire route - " drawRouteForLatLons(latlons);\n" -#endif "}\n" "\n"); @@ -545,11 +513,7 @@ void RideMapWindow::createHtml() currentPage += QString("function drawIntervals() { \n" // how many to draw? -#ifdef NOWEBKIT " webBridge.intervalCount(drawIntervalsCount);\n" -#else - " drawIntervalsCount(webBridge.intervalCount());\n" -#endif "}\n" "function drawIntervalsCount(intervals) { \n" @@ -572,11 +536,7 @@ void RideMapWindow::createHtml() " }\n" " while (intervals > 0) {\n" -#ifdef NOWEBKIT " webBridge.getLatLons(intervals, drawInterval);\n" -#else - " drawInterval(webBridge.getLatLons(intervals));\n" -#endif " intervals--;\n" " }\n" "}\n"); @@ -869,11 +829,7 @@ RideMapWindow::drawShadedRoute() .arg(styleoptions == "" ? 0.5f : 1.0f); } -#ifdef NOWEBKIT view->page()->runJavaScript(code); -#else - view->page()->mainFrame()->evaluateJavaScript(code); -#endif } } @@ -893,11 +849,7 @@ RideMapWindow::clearTempInterval() { "}\n" ); } -#ifdef NOWEBKIT view->page()->runJavaScript(code); -#else - view->page()->mainFrame()->evaluateJavaScript(code); -#endif } void @@ -967,12 +919,7 @@ RideMapWindow::drawTempInterval(IntervalItem *current) { } else if (mapCombo->currentIndex() == GOOGLE) { code += QString("}\n" ); } -#ifdef NOWEBKIT view->page()->runJavaScript(code); -#else - view->page()->mainFrame()->evaluateJavaScript(code); -#endif - overlayIntervals->intervalSelected(); } @@ -1029,11 +976,7 @@ RideMapWindow::createMarkers() "var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });" "marker.setMap(map); }").arg(points[0]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[0]->lon,0,'g',GPS_COORD_TO_STRING); } - #ifdef NOWEBKIT view->page()->runJavaScript(code); - #else - view->page()->mainFrame()->evaluateJavaScript(code); - #endif } else { // start / finish markers QString marker = "qrc:images/maps/cycling.png"; @@ -1051,11 +994,7 @@ RideMapWindow::createMarkers() "var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });" "marker.setMap(map); }").arg(points[0]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[0]->lon,0,'g',GPS_COORD_TO_STRING).arg(marker); } - #ifdef NOWEBKIT view->page()->runJavaScript(code); - #else - view->page()->mainFrame()->evaluateJavaScript(code); - #endif if (mapCombo->currentIndex() == OSM) { code = QString("{ var latlng = new L.LatLng(%1,%2);" "var image = new L.icon({iconUrl:'qrc:images/maps/finish.png'});" @@ -1067,11 +1006,7 @@ RideMapWindow::createMarkers() "var marker = new google.maps.Marker({ icon: image, animation: google.maps.Animation.DROP, position: latlng });" "marker.setMap(map); }").arg(points[points.count()-1]->lat,0,'g',GPS_COORD_TO_STRING).arg(points[points.count()-1]->lon,0,'g',GPS_COORD_TO_STRING); } - #ifdef NOWEBKIT view->page()->runJavaScript(code); - #else - view->page()->mainFrame()->evaluateJavaScript(code); - #endif } // @@ -1129,12 +1064,7 @@ RideMapWindow::createMarkers() "marker.setMap(map);" "}").arg(rfp->lat,0,'g',GPS_COORD_TO_STRING).arg(rfp->lon,0,'g',GPS_COORD_TO_STRING).arg(marker); } - #ifdef NOWEBKIT view->page()->runJavaScript(code); - #else - view->page()->mainFrame()->evaluateJavaScript(code); - #endif - } stoplat=stoplon=stoptime=0; } @@ -1181,12 +1111,7 @@ RideMapWindow::createMarkers() .arg(interval) ; } - #ifdef NOWEBKIT view->page()->runJavaScript(code); - #else - view->page()->mainFrame()->evaluateJavaScript(code); - #endif - interval++; } @@ -1237,11 +1162,7 @@ void RideMapWindow::zoomInterval(IntervalItem *which) .arg(maxLon,0,'g',GPS_COORD_TO_STRING); } -#ifdef NOWEBKIT view->page()->runJavaScript(code); -#else - view->page()->mainFrame()->evaluateJavaScript(code); -#endif } // quick diag, used to debug code only diff --git a/src/Charts/RideMapWindow.h b/src/Charts/RideMapWindow.h index 3f137e2e5..1fc617d09 100644 --- a/src/Charts/RideMapWindow.h +++ b/src/Charts/RideMapWindow.h @@ -35,15 +35,8 @@ #include -#ifdef NOWEBKIT #include #include -#else -#include -#include -#include -#include -#endif class QMouseEvent; class RideItem; @@ -57,20 +50,9 @@ class SmallPlot; // trick the maps api into ignoring gestures by // pretending to be chrome. see: http://developer.qt.nokia.com/forums/viewthread/1643/P15 -#ifdef NOWEBKIT class mapWebPage : public QWebEnginePage { }; -#else -class mapWebPage : public QWebPage -{ -#if 0 - virtual QString userAgentForUrl(const QUrl&) const { - return "Mozilla/5.0"; - } -#endif -}; -#endif class MapWebBridge : public QObject { @@ -140,10 +122,7 @@ class RideMapWindow : public GcChartWindow RideMapWindow(Context *, int mapType); virtual ~RideMapWindow(); -#ifdef NOWEBKIT QWebEngineView *browser() { return view; } -#endif - // set/get properties int mapType() const { return mapCombo->currentIndex(); } @@ -206,12 +185,7 @@ class RideMapWindow : public GcChartWindow Context *context; QVBoxLayout *layout; -#ifdef NOWEBKIT QWebEngineView *view; -#else - QWebView *view; -#endif - MapWebBridge *webBridge; RideMapWindow(); // default ctor diff --git a/src/Charts/RideSummaryWindow.cpp b/src/Charts/RideSummaryWindow.cpp index 64ac4cb9e..81297efb1 100644 --- a/src/Charts/RideSummaryWindow.cpp +++ b/src/Charts/RideSummaryWindow.cpp @@ -91,15 +91,11 @@ RideSummaryWindow::RideSummaryWindow(Context *context, bool ridesummary) : vlayout->setSpacing(0); vlayout->setContentsMargins(10,10,10,10); -#ifdef NOWEBKIT rideSummary = new QWebEngineView(this); #if QT_VERSION >= 0x050800 // stop stealing focus! rideSummary->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false); #endif -#else - rideSummary = new QWebView(this); -#endif rideSummary->setContentsMargins(0,0,0,0); rideSummary->page()->view()->setContentsMargins(0,0,0,0); @@ -164,7 +160,6 @@ RideSummaryWindow::configChanged(qint32) defaultFont.fromString(appsettings->value(NULL, GC_FONT_DEFAULT, QFont().toString()).toString()); defaultFont.setPointSize(appsettings->value(NULL, GC_FONT_DEFAULT_SIZE, 10).toInt()); -#ifdef NOWEBKIT #ifdef Q_OS_MAC rideSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1); #else @@ -180,14 +175,6 @@ RideSummaryWindow::configChanged(qint32) } #endif rideSummary->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family()); -#else -#ifdef Q_OS_MAC - rideSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); -#else - rideSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+2); -#endif - rideSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); -#endif force = true; refresh(); @@ -348,22 +335,14 @@ RideSummaryWindow::refresh() } } -#ifdef NOWEBKIT rideSummary->page()->setHtml(htmlCompareSummary()); -#else - rideSummary->page()->mainFrame()->setHtml(htmlCompareSummary()); -#endif } else { // NOT COMPARE MODE - NORMAL MODE // if we're summarising a ride but have no ride to summarise if (ridesummary && !myRideItem) { setSubTitle(tr("Summary")); -#ifdef NOWEBKIT rideSummary->page()->setHtml(GCColor::css(ridesummary)); -#else - rideSummary->page()->mainFrame()->setHtml(GCColor::css(ridesummary)); -#endif return; } @@ -388,12 +367,7 @@ RideSummaryWindow::refresh() specification.setFilterSet(fs); } -#ifdef NOWEBKIT rideSummary->page()->setHtml(htmlSummary()); -#else - rideSummary->page()->mainFrame()->setHtml(htmlSummary()); -#endif - setUpdatesEnabled(true); // ready to update now } } diff --git a/src/Charts/RideSummaryWindow.h b/src/Charts/RideSummaryWindow.h index a56553697..80df01243 100644 --- a/src/Charts/RideSummaryWindow.h +++ b/src/Charts/RideSummaryWindow.h @@ -24,13 +24,8 @@ #include -#ifdef NOWEBKIT #include #include -#else -#include -#include -#endif #include #if QT_VERSION >= 0x050000 @@ -124,11 +119,7 @@ class RideSummaryWindow : public GcChartWindow static QString addTooltip(QString name, QString tooltip); // adds html tooltip Context *context; -#ifdef NOWEBKIT QWebEngineView *rideSummary; -#else - QWebView *rideSummary; -#endif RideItem *_connected; bool justloaded; diff --git a/src/Cloud/OAuthDialog.cpp b/src/Cloud/OAuthDialog.cpp index 36e2b06b8..2e6de64e2 100644 --- a/src/Cloud/OAuthDialog.cpp +++ b/src/Cloud/OAuthDialog.cpp @@ -77,15 +77,11 @@ OAuthDialog::OAuthDialog(Context *context, OAuthSite site, CloudService *service setLayout(layout); - #if defined(NOWEBKIT) || (QT_VERSION > 0x050000 && defined(Q_OS_MAC)) view = new QWebEngineView(); view->setZoomFactor(dpiXFactor); #if (QT_VERSION >= 0x050600) view->page()->profile()->cookieStore()->deleteAllCookies(); #endif - #else - view = new QWebView(); - #endif view->setContentsMargins(0,0,0,0); view->page()->view()->setContentsMargins(0,0,0,0); diff --git a/src/Cloud/OAuthDialog.h b/src/Cloud/OAuthDialog.h index 02cae448b..308d66356 100644 --- a/src/Cloud/OAuthDialog.h +++ b/src/Cloud/OAuthDialog.h @@ -27,28 +27,18 @@ #include #include #include -#ifndef NOWEBKIT -#include -#include -#include -#endif // QUrl split into QUrlQuerty in QT5 #if QT_VERSION > 0x050000 #include #endif -// QWebEngine if on Mac, -or- we don't have webkit -#if defined(NOWEBKIT) || ((QT_VERSION > 0x050000) && defined(Q_OS_MAC)) + #include #include #include #include #include -#if (QT_VERSION >= 0x050600) #include -#endif -#endif - class OAuthDialog : public QDialog { @@ -96,11 +86,7 @@ private: QVBoxLayout *layout; // QUrl split into QUrlQuerty in QT5 -#if defined(NOWEBKIT) || ((QT_VERSION > 0x050000) && defined(Q_OS_MAC)) QWebEngineView *view; -#else - QWebView *view; -#endif QNetworkAccessManager* manager; diff --git a/src/Core/GcUpgrade.cpp b/src/Core/GcUpgrade.cpp index af963e98f..2b3b92770 100644 --- a/src/Core/GcUpgrade.cpp +++ b/src/Core/GcUpgrade.cpp @@ -943,7 +943,6 @@ GcUpgradeLogDialog::GcUpgradeLogDialog(QDir homeDir) : QDialog(NULL, Qt::Dialog) QFont defaultFont; -#ifdef NOWEBKIT report = new QWebEngineView(this); report->setContentsMargins(0,0,0,0); report->page()->view()->setContentsMargins(0,0,0,0); @@ -953,17 +952,6 @@ GcUpgradeLogDialog::GcUpgradeLogDialog(QDir homeDir) : QDialog(NULL, Qt::Dialog) report->setAcceptDrops(false); report->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1); report->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family()); -#else - report = new QWebView(this); - report->setContentsMargins(0,0,0,0); - report->page()->view()->setContentsMargins(0,0,0,0); - report->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - report->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - report->setContextMenuPolicy(Qt::NoContextMenu); - report->setAcceptDrops(false); - report->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); - report->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); -#endif connect(report, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClickedSlot(QUrl))); @@ -990,13 +978,7 @@ GcUpgradeLogDialog::GcUpgradeLogDialog(QDir homeDir) : QDialog(NULL, Qt::Dialog) // the cyclist... reportText += QString("

Cyclist: \"%1\"


").arg(home.root().dirName()); - -#ifdef NOWEBKIT report->page()->setHtml(reportText); -#else - report->page()->mainFrame()->setHtml(reportText); -#endif - } void @@ -1044,13 +1026,8 @@ GcUpgradeLogDialog::append(QString text, int level) { reportText += QString("%1
").arg(text); } -#ifdef NOWEBKIT report->page()->setHtml(reportText); //XXX WEBENGINE report->page()->setScrollBarValue(Qt::Vertical, report->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)); -#else - report->page()->mainFrame()->setHtml(reportText); - report->page()->mainFrame()->setScrollBarValue(Qt::Vertical, report->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)); -#endif this->repaint(); QApplication::processEvents(); diff --git a/src/Core/GcUpgrade.h b/src/Core/GcUpgrade.h index 991b9b6d8..8210e55ca 100644 --- a/src/Core/GcUpgrade.h +++ b/src/Core/GcUpgrade.h @@ -23,15 +23,8 @@ #include "Athlete.h" #include -#ifdef NOWEBKIT #include #include -#else -#include -#include -#include -#endif - // Build ID History // @@ -140,11 +133,7 @@ class GcUpgradeLogDialog : public QDialog private: -#ifdef NOWEBKIT QWebEngineView *report; -#else - QWebView *report; -#endif AthleteDirectoryStructure home; QString reportText; QPushButton *proceedButton; diff --git a/src/Core/main.cpp b/src/Core/main.cpp index a92a2b3b8..e26f807b8 100644 --- a/src/Core/main.cpp +++ b/src/Core/main.cpp @@ -33,9 +33,6 @@ #include #include #include -#ifndef NOWEBKIT -#include -#endif #include #include "ChooseCyclistDialog.h" #ifdef GC_WANT_HTTP @@ -760,11 +757,6 @@ main(int argc, char *argv[]) // reset QSettings (global & Athlete) appsettings->clearGlobalAndAthletes(); -#ifndef NOWEBKIT - // clear web caches (stop warning of WebKit leaks) - QWebSettings::clearMemoryCaches(); -#endif - } while (restarting); delete application; diff --git a/src/Gui/GcCrashDialog.cpp b/src/Gui/GcCrashDialog.cpp index 16965a481..ae3dd2140 100644 --- a/src/Gui/GcCrashDialog.cpp +++ b/src/Gui/GcCrashDialog.cpp @@ -130,7 +130,6 @@ GcCrashDialog::GcCrashDialog(QDir homeDir) : QDialog(NULL, Qt::Dialog), home(hom QFont defaultFont; // mainwindow sets up the defaults.. we need to apply -#ifdef NOWEBKIT report = new QWebEngineView(this); report->setContentsMargins(0,0,0,0); report->page()->view()->setContentsMargins(0,0,0,0); @@ -138,15 +137,6 @@ GcCrashDialog::GcCrashDialog(QDir homeDir) : QDialog(NULL, Qt::Dialog), home(hom report->setAcceptDrops(false); report->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1); report->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family()); -#else - report = new QWebView(this); - report->setContentsMargins(0,0,0,0); - report->page()->view()->setContentsMargins(0,0,0,0); - report->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - report->setAcceptDrops(false); - report->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); - report->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); -#endif layout->addWidget(report); @@ -249,11 +239,6 @@ QString GcCrashDialog::versionHTML() vlc = libvlc_get_version(); #endif - // -- WEBKIT --- - QString webkit = "yes"; - #ifdef NOWEBKIT - webkit = "none"; - #endif #ifdef GC_HAVE_SAMPLERATE QString src = QString(src_get_version()).mid(14,6); #else @@ -304,7 +289,6 @@ QString GcCrashDialog::versionHTML() "SSL%15" "R%16" "Python%18" - "WEBKIT%17" "LMFIT7.0" "LEVMAR%19" "GSL%20" @@ -337,7 +321,6 @@ QString GcCrashDialog::versionHTML() #else .arg("none") #endif - .arg(webkit) #ifdef GC_HAVE_PYTHON .arg(QString("%1 [%2]").arg(python ? python->version.split(" ").at(0) : QString("none")).arg(PythonEmbed::buildVersion())) #else @@ -492,11 +475,7 @@ GcCrashDialog::setHTML() } text += ""; -#ifdef NOWEBKIT report->page()->setHtml(text); -#else - report->page()->mainFrame()->setHtml(text); -#endif } void @@ -511,14 +490,7 @@ GcCrashDialog::saveAs() out.setCodec("UTF-8"); if (file.open(QIODevice::WriteOnly)) { - // write the texts -#ifdef NOWEBKIT - //TODO WEBENGINE out << report->page()->mainFrame()->toPlainText(); -#else - out << report->page()->mainFrame()->toPlainText(); -#endif - file.close(); } } diff --git a/src/Gui/GcCrashDialog.h b/src/Gui/GcCrashDialog.h index 2f9abb59d..916b50d35 100644 --- a/src/Gui/GcCrashDialog.h +++ b/src/Gui/GcCrashDialog.h @@ -21,12 +21,7 @@ #include #include -#ifdef NOWEBKIT #include -#else -#include -#include -#endif #include #include "Athlete.h" @@ -48,11 +43,7 @@ class GcCrashDialog : public QDialog void saveAs(); private: -#ifdef NOWEBKIT QWebEngineView *report; -#else - QWebView *report; -#endif bool newFilesInQuarantine; QStringList files; }; diff --git a/src/Gui/GcWindowRegistry.cpp b/src/Gui/GcWindowRegistry.cpp index 23d24aea2..b60435d33 100644 --- a/src/Gui/GcWindowRegistry.cpp +++ b/src/Gui/GcWindowRegistry.cpp @@ -223,14 +223,9 @@ GcWindowRegistry::newGcWindow(GcWinID id, Context *context) case GcWindowTypes::RealtimePlot: returning = new RealtimePlotWindow(context); break; case GcWindowTypes::SpinScanPlot: returning = new SpinScanPlotWindow(context); break; case GcWindowTypes::WorkoutPlot: returning = new WorkoutPlotWindow(context); break; -#ifdef NOWEBKIT case GcWindowTypes::MapWindow: case GcWindowTypes::StreetViewWindow: returning = new GcChartWindow(context); break; -#else - case GcWindowTypes::MapWindow: returning = new MapWindow(context); break; - case GcWindowTypes::StreetViewWindow: returning = new StreetViewWindow(context); break; -#endif // old maps (GoogleMap and BingMap) replaced by RideMapWindow case GcWindowTypes::GoogleMap: id=GcWindowTypes::RideMapWindow; returning = new RideMapWindow(context, RideMapWindow::GOOGLE); break; // new GoogleMapControl(context); case GcWindowTypes::BingMap: id=GcWindowTypes::RideMapWindow; returning = new RideMapWindow(context, RideMapWindow::OSM); break; //returning = new BingMap(context); diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index ee1700bfc..50d1f9252 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -41,7 +41,7 @@ #include #endif -#if defined(NOWEBKIT) && defined(WIN32) +#if defined(WIN32) // Macro to avoid Code Duplication in multiple files // QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list # define SKIP_QTWE_CACHE \ diff --git a/src/Train/WebPageWindow.cpp b/src/Train/WebPageWindow.cpp index 20aea3730..c14a51965 100644 --- a/src/Train/WebPageWindow.cpp +++ b/src/Train/WebPageWindow.cpp @@ -36,11 +36,9 @@ #include "Library.h" #include "ErgFile.h" -#ifdef NOWEBKIT #include #include #include -#endif // overlay helper #include "TabView.h" @@ -48,7 +46,6 @@ #include "IntervalSummaryWindow.h" #include -#ifdef NOWEBKIT #include #include #include @@ -84,7 +81,6 @@ class WebSchemeHandler : public QWebEngineUrlSchemeHandler QWebEngineView *view; }; -#endif // declared in main, we only want to use it to get QStyle extern QApplication *application; @@ -138,7 +134,6 @@ WebPageWindow::WebPageWindow(Context *context) : GcChartWindow(context), context layout->setContentsMargins(2,0,2,2); setChartLayout(layout); -#ifdef NOWEBKIT view = new QWebEngineView(this); connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); @@ -167,10 +162,6 @@ WebPageWindow::WebPageWindow(Context *context) : GcChartWindow(context), context view->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true); view->settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); -#else - view = new QWebView(); - connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); -#endif view->setPage(new simpleWebPage()); view->setContentsMargins(0,0,0,0); view->page()->view()->setContentsMargins(0,0,0,0); @@ -188,14 +179,8 @@ WebPageWindow::WebPageWindow(Context *context) : GcChartWindow(context), context configChanged(CONFIG_APPEARANCE); // intercept downloads -#ifdef NOWEBKIT connect(view->page()->profile(), SIGNAL(downloadRequested(QWebEngineDownloadItem*)), this, SLOT(downloadRequested(QWebEngineDownloadItem*))); connect(view->page(), SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString))); -#else - view->page()->setForwardUnsupportedContent(true); - connect(view->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(download(QNetworkRequest))); - connect(view->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(unsupportedContent(QNetworkReply*))); -#endif } WebPageWindow::~WebPageWindow() @@ -218,13 +203,8 @@ WebPageWindow::configChanged(qint32) void WebPageWindow::forceReplot() { -#ifdef NOWEBKIT view->setZoomFactor(dpiXFactor); view->setUrl(QUrl(customUrl->text())); -#else - view->page()->mainFrame()->load(QUrl(customUrl->text())); - //qDebug()<<"load page"<text(); -#endif } void @@ -234,24 +214,15 @@ WebPageWindow::userUrl() QRegExp hasscheme("^[^:]*://.*"); QString url = rCustomUrl->text(); if (!hasscheme.exactMatch(url)) url = "http://" + url; -#ifdef NOWEBKIT view->setZoomFactor(dpiXFactor); view->setUrl(QUrl(url)); -#else - view->page()->mainFrame()->load(QUrl(url)); - //qDebug()<<"load page"<text(); -#endif } void WebPageWindow::loadFinished(bool ok) { QString string; -#ifdef NOWEBKIT if (ok) string = view->url().toString(); -#else - if (ok) string = view->page()->mainFrame()->url().toString(); -#endif rCustomUrl->setText(string); } @@ -287,7 +258,6 @@ WebPageWindow::event(QEvent *event) return QWidget::event(event); } -#ifdef NOWEBKIT void WebPageWindow::downloadRequested(QWebEngineDownloadItem *item) { @@ -346,78 +316,3 @@ WebPageWindow::linkHovered(QString) { //qDebug()<<"hovering over:" << link; } -#else -// downloads requested ... -void -WebPageWindow::download(const QNetworkRequest &request) -{ - //qDebug()<<"Download Requested: "<rawHeader("Content-Disposition"))) { - - QString filename = filenameRegEx.cap(1); - //qDebug()<<"Unsupported Content: "<url()<append(reply->readAll()); - } - return; -} - -void -WebPageWindow::readyRead() -{ - QNetworkReply *reply = static_cast(QObject::sender()); - buffers.value(reply)->append(reply->readAll()); -} - -void -WebPageWindow::readFileCompleted() -{ - //qDebug()<<"WebPageWindow::readFileCompleted\n"; - - QNetworkReply *reply = static_cast(QObject::sender()); - - //qDebug()<<"WebPageWindow::reply" << buffers.value(reply)->constData(); - - // process it then ........ - QString name = QString("%1/%2") - .arg(const_cast(context->athlete->directoryStructure())->temp().absolutePath()) - .arg(filenames.at(0)); - - QFile readme(name); - - if (readme.open(QFile::ReadWrite)) { - - filenames.clear(); - filenames << name; - - // save the file away - readme.write(*buffers.value(reply), buffers.value(reply)->length()); - readme.close(); - - // now process it - RideImportWizard *dialog = new RideImportWizard(filenames, context); - dialog->process(); // do it! - } - - // clean up - delete buffers.value(reply); - buffers.remove(reply); -} -#endif diff --git a/src/Train/WebPageWindow.h b/src/Train/WebPageWindow.h index 5edca134a..25e1f152b 100644 --- a/src/Train/WebPageWindow.h +++ b/src/Train/WebPageWindow.h @@ -33,15 +33,8 @@ #include #include -#ifdef NOWEBKIT #include #include -#else -#include -#include -#include -#include -#endif class QMouseEvent; class RideItem; @@ -55,21 +48,10 @@ class SmallPlot; // trick the maps api into ignoring gestures by // pretending to be chrome. see: http://developer.qt.nokia.com/forums/viewthread/1643/P15 -#ifdef NOWEBKIT class QWebEngineDownloadItem; class simpleWebPage : public QWebEnginePage { }; -#else -class simpleWebPage : public QWebPage -{ -#if 0 - virtual QString userAgentForUrl(const QUrl&) const { - return "Mozilla/5.0"; - } -#endif -}; -#endif class WebPageWindow : public GcChartWindow { @@ -98,18 +80,10 @@ class WebPageWindow : public GcChartWindow void forceReplot(); void configChanged(qint32); -#ifdef NOWEBKIT void downloadProgress(qint64, qint64); void downloadFinished(); void downloadRequested(QWebEngineDownloadItem*); void linkHovered(QString); -#else - // getting data - void readyRead(); // a readFile operation has work to do - void readFileCompleted(); - void download(const QNetworkRequest &request); - void unsupportedContent(QNetworkReply * reply); -#endif private: Context *context; @@ -127,12 +101,7 @@ class WebPageWindow : public GcChartWindow QLineEdit *rCustomUrl; QPushButton *rButton; -#ifdef NOWEBKIT QWebEngineView *view; -#else - QWebView *view; -#endif - WebPageWindow(); // default ctor bool firstShow; diff --git a/src/gcconfig.pri.in b/src/gcconfig.pri.in index 367f1fa3b..895ac1416 100644 --- a/src/gcconfig.pri.in +++ b/src/gcconfig.pri.in @@ -8,9 +8,6 @@ #CONFIG += debug #CONFIG += release -# Uncomment when WebKit is not available (e.g. QT >= 5.6) -#DEFINES += NOWEBKIT - # Uncomment below if you want an R chart # You will need R installed along with the Rcpp and RInside # packages. There is an R script in the `util' directory that diff --git a/src/src.pro b/src/src.pro index 3502801ba..8baed0fab 100644 --- a/src/src.pro +++ b/src/src.pro @@ -30,53 +30,15 @@ TARGET = GoldenCheetah CONFIG(debug, debug|release) { QMAKE_CXXFLAGS += -DGC_DEBUG } -###====================================================== -### QT MODULES [we officially support QT4.8.6+ or QT5.8+] -###====================================================== +###======================================================================== +### QT5.14.2 officially supported which mandates c++11 support in toolchain +###======================================================================== # always -QT += xml sql network svg +QT += xml sql network svg widgets concurrent serialport multimedia multimediawidgets \ + webengine webenginecore webenginewidgets webchannel positioning +CONFIG += c++11 -lessThan(QT_MAJOR_VERSION, 5) { - - ## QT4 specific modules - QT += webkit - - ## NOWEBKIT is only supported in QT5 - contains(DEFINES, NOWEBKIT) { - message("Info: NOWEBKIT is only supported on QT > 5") - DEFINES -= NOWEBKIT - } - -} else { - - ## QT5 modules we use - QT += widgets concurrent serialport multimedia multimediawidgets - - ## Always add debug information for Windows, MSVC - win32-msvc* { CONFIG += force_debug_info } - - ## If building with QT5 there is experimental suport for building - ## with WebEngine now that WebKit is deprecated in QT 5.6 - ## It brings in a LOT of dependencies ! - contains(DEFINES, NOWEBKIT) { - QT += webengine webenginecore webenginewidgets webchannel positioning - CONFIG += c++11 - - } else { - - # On 5.5 or earlier we can still use WebKit - QT += webkitwidgets - } - macx { - - ## need mac extras and clang++ needs to know which stdlib to link with - QT += macextras webengine webenginecore webenginewidgets positioning - - } else { - - } -} ###======================================================================= ### Directory Structure - Split into subdirs to be more manageable @@ -125,8 +87,11 @@ win32-msvc* { # we need windows kit 8.2 or higher with MSVC, offer default location isEmpty(WINKIT_INSTALL) WINKIT_INSTALL= "C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64" LIBS += -L$${WINKIT_INSTALL} -lGdi32 -lUser32 + CONFIG += force_debug_info + } else { + # gnu toolchain wants math libs LIBS += -lm @@ -153,6 +118,8 @@ win32 { } macx { + # Mac native widget support + QT += macextras # we have our own plist QMAKE_INFO_PLIST = ./Resources/mac/Info.plist.app