From cf3fa88942926a0db72164ed1bcd1d2d4b59c125 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 24 Oct 2016 20:11:50 +0200 Subject: [PATCH] Require Qt 5.7 --- BUILDING.md | 8 ++++---- QupZilla.pro | 8 ++++---- README.md | 2 +- .../qtsingleapplication/qtlocalpeer.cpp | 2 +- src/lib/app/browserwindow.cpp | 2 -- src/lib/app/mainmenu.cpp | 6 ------ src/lib/tabwidget/tabbar.cpp | 2 -- src/lib/tabwidget/tabicon.cpp | 4 ---- src/lib/webengine/webpage.cpp | 19 ------------------- src/lib/webengine/webpage.h | 4 ---- src/lib/webengine/webview.cpp | 4 ---- src/lib/webtab/webtab.cpp | 10 ---------- 12 files changed, 10 insertions(+), 61 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index fc6544f0c..82dc66e98 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -16,18 +16,18 @@ General CONFIG += debug - QupZilla requires Qt (>= 5.6) and QtWebEngine (at least version included in Qt 5.6) + QupZilla requires Qt (>= 5.7) and QtWebEngine (at least version included in Qt 5.7) Microsoft Windows ---------------------------------------------------------------------------------- - You need Microsoft Visual C++ Compiler, Qt Libraries 5.6.0 or higher and openssl + You need Microsoft Visual C++ Compiler, Qt Libraries 5.7.0 or higher and openssl libraries. in order to build QupZilla. Linux / Unix ---------------------------------------------------------------------------------- - You need to have Qt 5 (>= 5.6) with QtWebEngine. + You need to have Qt 5 (>= 5.7) with QtWebEngine. Next compulsory requirement is OpenSSL (libcrypto). xcb libraries are also required unless you specify NO_X11 build option. @@ -46,7 +46,7 @@ MAC OS X You need to have Xcode from the Apple App Store installed in Applications, [Command Line Tools for the same Xcode version](https://developer.apple.com/), [Homebrew](http://brew.sh/), and `$ brew install openssl` for openssl. - Next compulsory requirement is Qt 5 (>= 5.6) with QtWebEngine. + Next compulsory requirement is Qt 5 (>= 5.7) with QtWebEngine. After successful compilation, you need to run macdeploy.sh script to correctly build the application bundle. You will do it with following command: diff --git a/QupZilla.pro b/QupZilla.pro index df6d1e01f..85fb838e0 100644 --- a/QupZilla.pro +++ b/QupZilla.pro @@ -6,12 +6,12 @@ # #------------------------------------------------- -lessThan(QT_VERSION, 5.6) { - error("QupZilla requires at least Qt 5.6!") +lessThan(QT_VERSION, 5.7) { + error("QupZilla requires at least Qt 5.7!") } -lessThan(QT.webengine.VERSION, 5.6) { - error("QupZilla requires at least QtWebEngine 5.6!") +lessThan(QT.webengine.VERSION, 5.7) { + error("QupZilla requires at least QtWebEngine 5.7!") } # Create plugins directory first on Mac / Linux diff --git a/README.md b/README.md index 96ef8e753..b20c1644c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ are using QtWebEngine. Compiling ---------------------------------------------------------------------------------------- -Before you start compiling, make sure that you have installed the Qt (>= 5.6) development libraries +Before you start compiling, make sure that you have installed the Qt (>= 5.7) development libraries and you have read the [BUILDING.md](https://github.com/QupZilla/qupzilla/blob/master/BUILDING.md) information. **Linux** diff --git a/src/lib/3rdparty/qtsingleapplication/qtlocalpeer.cpp b/src/lib/3rdparty/qtsingleapplication/qtlocalpeer.cpp index 56260257e..08b8de450 100644 --- a/src/lib/3rdparty/qtsingleapplication/qtlocalpeer.cpp +++ b/src/lib/3rdparty/qtsingleapplication/qtlocalpeer.cpp @@ -128,7 +128,7 @@ bool QtLocalPeer::isClient() } bool res = server->listen(socketName); -#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) +#if defined(Q_OS_UNIX) // ### Workaround if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { QFile::remove(QDir::cleanPath(QDir::tempPath()) + QLatin1Char('/') + socketName); diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 115d98137..1509642e3 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -625,7 +625,6 @@ void BrowserWindow::changeEncoding() void BrowserWindow::printPage() { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) QPrintDialog* dialog = new QPrintDialog(this); dialog->setOptions(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintShowPageSize); #ifndef Q_OS_WIN @@ -668,7 +667,6 @@ void BrowserWindow::printPage() }, dialog->printer()->pageLayout()); } } -#endif } void BrowserWindow::bookmarkPage() diff --git a/src/lib/app/mainmenu.cpp b/src/lib/app/mainmenu.cpp index 7cbf41f90..6896f2372 100644 --- a/src/lib/app/mainmenu.cpp +++ b/src/lib/app/mainmenu.cpp @@ -81,9 +81,7 @@ void MainMenu::initSuperMenu(QMenu* superMenu) const superMenu->addAction(m_actions[QSL("File/OpenFile")]); superMenu->addSeparator(); superMenu->addAction(m_actions[QSL("File/SendLink")]); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) superMenu->addAction(m_actions[QSL("File/Print")]); -#endif superMenu->addSeparator(); superMenu->addAction(m_actions[QSL("Edit/SelectAll")]); superMenu->addAction(m_actions[QSL("Edit/Find")]); @@ -531,13 +529,9 @@ void MainMenu::init() ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O"); ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W"); m_menuFile->addSeparator(); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S"); -#endif ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), ""); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P"); -#endif m_menuFile->addSeparator(); m_menuFile->addAction(m_actions[QSL("Standard/Quit")]); diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp index b621c2392..cb2fd95f3 100644 --- a/src/lib/tabwidget/tabbar.cpp +++ b/src/lib/tabwidget/tabbar.cpp @@ -351,9 +351,7 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event) } menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab())); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) menu.addAction(webTab->isMuted() ? tr("Un&mute Tab") : tr("&Mute Tab"), this, SLOT(muteTab())); -#endif menu.addSeparator(); menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs())); menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab())); diff --git a/src/lib/tabwidget/tabicon.cpp b/src/lib/tabwidget/tabicon.cpp index 87f928f60..53f1b6ad3 100644 --- a/src/lib/tabwidget/tabicon.cpp +++ b/src/lib/tabwidget/tabicon.cpp @@ -139,7 +139,6 @@ void TabIcon::paintEvent(QPaintEvent* event) void TabIcon::mousePressEvent(QMouseEvent *event) { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) qreal x = event->localPos().x(); qreal y = event->localPos().y(); // if audio icon is clicked - we don't propagate mouse press to the tab @@ -147,7 +146,4 @@ void TabIcon::mousePressEvent(QMouseEvent *event) m_tab->toggleMuted(); else QWidget::mousePressEvent(event); -#else - QWidget::mousePressEvent(event); -#endif } diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index eed422855..62d4fd825 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -113,12 +113,7 @@ QVariant WebPage::execJavaScript(const QString &scriptSource, quint32 worldId, i QVariant result; QTimer::singleShot(timeout, loop.data(), &QEventLoop::quit); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) runJavaScript(scriptSource, worldId, [loop, &result](const QVariant &res) { -#else - Q_UNUSED(worldId); - runJavaScript(scriptSource, [loop, &result](const QVariant &res) { -#endif if (loop && loop->isRunning()) { result = res; loop->quit(); @@ -143,22 +138,12 @@ void WebPage::runJavaScript(const QString &scriptSource, const QWebEngineCallbac void WebPage::runJavaScript(const QString &scriptSource, quint32 worldId) { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) QWebEnginePage::runJavaScript(scriptSource, worldId); -#else - Q_UNUSED(worldId); - QWebEnginePage::runJavaScript(scriptSource); -#endif } void WebPage::runJavaScript(const QString &scriptSource, quint32 worldId, const QWebEngineCallback &resultCallback) { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) QWebEnginePage::runJavaScript(scriptSource, worldId, resultCallback); -#else - Q_UNUSED(worldId); - QWebEnginePage::runJavaScript(scriptSource, resultCallback); -#endif } QPoint WebPage::mapToViewport(const QPoint &pos) const @@ -343,11 +328,7 @@ void WebPage::setupWebChannel() QWebChannel *channel = new QWebChannel(this); channel->registerObject(QSL("qz_object"), new ExternalJsObject(this)); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) setWebChannel(channel, SafeJsWorld); -#else - setWebChannel(channel); -#endif if (old) { delete old->registeredObjects().value(objectName); diff --git a/src/lib/webengine/webpage.h b/src/lib/webengine/webpage.h index 5bd91f900..0755610fa 100644 --- a/src/lib/webengine/webpage.h +++ b/src/lib/webengine/webpage.h @@ -38,12 +38,8 @@ class QUPZILLA_EXPORT WebPage : public QWebEnginePage Q_OBJECT public: enum JsWorld { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) // SafeJsWorld = QWebEngineScript::ApplicationWorld SafeJsWorld = QWebEngineScript::MainWorld -#else - SafeJsWorld = QWebEngineScript::MainWorld -#endif }; explicit WebPage(QObject* parent = 0); diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 982baf40c..273a00439 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -441,9 +441,7 @@ void WebView::copyLinkToClipboard() void WebView::savePageAs() { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) triggerPageAction(QWebEnginePage::SavePage); -#endif } void WebView::copyImageToClipboard() @@ -690,9 +688,7 @@ void WebView::createPageContextMenu(QMenu* menu) menu->addAction(pageAction(QWebEnginePage::Stop)); menu->addSeparator(); menu->addAction(QIcon::fromTheme("bookmark-new"), tr("Book&mark page"), this, SLOT(bookmarkLink())); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) menu->addAction(QIcon::fromTheme("document-save"), tr("&Save page as..."), this, SLOT(savePageAs())); -#endif menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy page link"), this, SLOT(copyLinkToClipboard()))->setData(url()); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, SLOT(sendPageByMail())); menu->addSeparator(); diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 9310f7387..7a02ffd9c 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -142,9 +142,7 @@ WebTab::WebTab(BrowserWindow* window) connect(m_webView, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged(QString))); -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) connect(m_webView->page(), &QWebEnginePage::recentlyAudibleChanged, tabIcon(), &TabIcon::updateAudioIcon); -#endif } TabbedWebView* WebTab::webView() const @@ -297,20 +295,12 @@ void WebTab::setPinned(bool state) bool WebTab::isMuted() const { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) return m_webView->page()->isAudioMuted(); -#else - return false; -#endif } void WebTab::setMuted(bool muted) { -#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) m_webView->page()->setAudioMuted(muted); -#else - Q_UNUSED(muted) -#endif } void WebTab::toggleMuted()