From d3aed9cb74ee1e1c7c8ad1305fb88a6abaf727d1 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 10 Jun 2019 15:39:56 +0200 Subject: [PATCH] Adapt to qtutilities 6 --- cli/CMakeLists.txt | 2 +- gui/CMakeLists.txt | 5 ++--- gui/mainwindow.cpp | 3 ++- gui/mainwindow.h | 10 +++------- gui/webpage.cpp | 8 ++++---- gui/webpage.h | 19 ++++++------------- gui/webviewprovider.h | 9 --------- lib/CMakeLists.txt | 2 +- lib/alpm/alpmdatabase.cpp | 4 ++-- 9 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 gui/webviewprovider.h diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 150c7e1..2e91a59 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -14,7 +14,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities() # find qtutilities -find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) +find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.0.0 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${QT_UTILITIES_MODULE_DIRS}) # find repoindex diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 7689e03..b8c122f 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -7,7 +7,6 @@ set(META_GUI_OPTIONAL false) set(WIDGETS_HEADER_FILES mainwindow.h webpage.h - webviewprovider.h ) set(WIDGETS_SRC_FILES main.cpp @@ -24,7 +23,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities() # find qtutilities -find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) +find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.0.0 REQUIRED) use_qt_utilities() # find repoindex @@ -40,9 +39,9 @@ set(TARGET_SUFFIX "-gui") # include modules to apply configuration include(BasicConfig) include(QtGuiConfig) +include(QtWebViewProviderConfig) include(QtConfig) include(WindowsResources) -include(WebViewProviderConfig) include(AppTarget) include(ShellCompletion) include(ConfigHeader) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c2c2dda..49ef487 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -53,6 +53,7 @@ bool MainWindow::event(QEvent *event) default: ; } + break; } case QEvent::MouseButtonPress: { QMouseEvent *mouseEvent = static_cast(event); switch(mouseEvent->button()) { @@ -86,7 +87,7 @@ void MainWindow::showInfoWebViewContextMenu(const QPoint &) if(!m_contextMenu) { m_contextMenu = new QMenu(this); auto *reloadAction = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), tr("Reload UI"), m_contextMenu); - connect(reloadAction, &QAction::triggered, &m_webView, &WEB_VIEW_PROVIDER::reload); + connect(reloadAction, &QAction::triggered, &m_webView, &REPOINDEX_WEB_VIEW::reload); m_copyAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), m_contextMenu); connect(m_copyAction, &QAction::triggered, this, &MainWindow::copyInfoWebViewSelection); auto *updateAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-download")), tr("Update sync-databases"), m_contextMenu); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 3d31483..ecd8863 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -1,14 +1,10 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include "./webviewprovider.h" +#include "./gui/webviewdefs.h" +#include "./gui/webviewincludes.h" #include -#ifdef REPOINDEX_USE_WEBENGINE -# include -#else -# include -#endif namespace RepoIndex { @@ -29,7 +25,7 @@ private slots: private: Manager *m_manager; - WEB_VIEW_PROVIDER m_webView; + REPOINDEX_WEB_VIEW m_webView; QMenu *m_contextMenu; QAction *m_copyAction; }; diff --git a/gui/webpage.cpp b/gui/webpage.cpp index 16fea5d..a320e96 100644 --- a/gui/webpage.cpp +++ b/gui/webpage.cpp @@ -14,8 +14,8 @@ namespace RepoIndex { -WebPage::WebPage(WEB_VIEW_PROVIDER *view) : - WEB_PAGE_PROVIDER(view), +WebPage::WebPage(REPOINDEX_WEB_VIEW *view) : + REPOINDEX_WEB_PAGE(view), m_view(view) { #ifdef REPOINDEX_USE_WEBENGINE @@ -30,12 +30,12 @@ WebPage::WebPage(WEB_VIEW_PROVIDER *view) : #else connect(this->mainFrame(), &QWebFrame::urlChanged, this, &WebPage::delegateToExternalBrowser); #endif - m_view = new WEB_VIEW_PROVIDER; + m_view = new REPOINDEX_WEB_VIEW; m_view->setPage(this); } } -WEB_PAGE_PROVIDER *WebPage::createWindow(WEB_PAGE_PROVIDER::WebWindowType type) +REPOINDEX_WEB_PAGE *WebPage::createWindow(REPOINDEX_WEB_PAGE::WebWindowType type) { Q_UNUSED(type) return new WebPage; diff --git a/gui/webpage.h b/gui/webpage.h index 49f1168..e2f69c4 100644 --- a/gui/webpage.h +++ b/gui/webpage.h @@ -1,35 +1,28 @@ #ifndef WEBPAGE_H #define WEBPAGE_H -#include "./webviewprovider.h" - -#ifdef REPOINDEX_USE_WEBENGINE -# include -#else -# include -#endif - -QT_FORWARD_DECLARE_CLASS(WEB_VIEW_PROVIDER) +#include "./gui/webviewdefs.h" +#include "./gui/webviewincludes.h" namespace RepoIndex { -class WebPage : public WEB_PAGE_PROVIDER +class WebPage : public REPOINDEX_WEB_PAGE { Q_OBJECT public: - WebPage(WEB_VIEW_PROVIDER *view = nullptr); + WebPage(REPOINDEX_WEB_VIEW *view = nullptr); public slots: void openUrlExternal(const QUrl &url); protected: - WEB_PAGE_PROVIDER *createWindow(WebWindowType type); + REPOINDEX_WEB_PAGE *createWindow(WebWindowType type); private slots: void delegateToExternalBrowser(const QUrl &url); private: - WEB_VIEW_PROVIDER *m_view; + REPOINDEX_WEB_VIEW *m_view; }; } diff --git a/gui/webviewprovider.h b/gui/webviewprovider.h deleted file mode 100644 index 9bd3e95..0000000 --- a/gui/webviewprovider.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WEB_VIEW_PROVIDER -#ifdef REPOINDEX_USE_WEBENGINE -# define WEB_VIEW_PROVIDER QWebEngineView -# define WEB_PAGE_PROVIDER QWebEnginePage -#else -# define WEB_VIEW_PROVIDER QWebView -# define WEB_PAGE_PROVIDER QWebPage -#endif -#endif diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 231f3a7..9890cb7 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -59,7 +59,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities() # find qtutilities -find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) +find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.0.0 REQUIRED) use_qt_utilities() # include modules to apply configuration diff --git a/lib/alpm/alpmdatabase.cpp b/lib/alpm/alpmdatabase.cpp index cd53c15..48019f4 100644 --- a/lib/alpm/alpmdatabase.cpp +++ b/lib/alpm/alpmdatabase.cpp @@ -91,7 +91,7 @@ DatabaseError AlpmDatabase::loadDescriptions(QListerrorString().toLocal8Bit().data() << endl; if(filesDatabase && reply->error() == QNetworkReply::ContentNotFoundError) { @@ -324,7 +325,6 @@ void AlpmDatabase::databaseDownloadFinished() } else { removeBusyFlag(); } - break; } }