Adapt to qtutilities 6

This commit is contained in:
Martchus 2019-06-10 15:39:56 +02:00
parent 1392eaebcf
commit d3aed9cb74
9 changed files with 21 additions and 41 deletions

View File

@ -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

View File

@ -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)

View File

@ -53,6 +53,7 @@ bool MainWindow::event(QEvent *event)
default:
;
}
break;
} case QEvent::MouseButtonPress: {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(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);

View File

@ -1,14 +1,10 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "./webviewprovider.h"
#include "./gui/webviewdefs.h"
#include "./gui/webviewincludes.h"
#include <QMainWindow>
#ifdef REPOINDEX_USE_WEBENGINE
# include <QWebEngineView>
#else
# include <QWebView>
#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;
};

View File

@ -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;

View File

@ -1,35 +1,28 @@
#ifndef WEBPAGE_H
#define WEBPAGE_H
#include "./webviewprovider.h"
#ifdef REPOINDEX_USE_WEBENGINE
# include <QWebEnginePage>
#else
# include <QWebPage>
#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;
};
}

View File

@ -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

View File

@ -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

View File

@ -91,7 +91,7 @@ DatabaseError AlpmDatabase::loadDescriptions(QList<QPair<QString, QList<QByteArr
}
} else if(pathInfo.isFile()) {
if(lastModified) {
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toTime_t());
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toSecsSinceEpoch());
}
KTar tar(databasePath());
const KArchiveDirectory *dbDir;
@ -315,6 +315,7 @@ void AlpmDatabase::databaseDownloadFinished()
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to create/write output file." << endl;
removeBusyFlag();
}
break;
} default:
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
if(filesDatabase && reply->error() == QNetworkReply::ContentNotFoundError) {
@ -324,7 +325,6 @@ void AlpmDatabase::databaseDownloadFinished()
} else {
removeBusyFlag();
}
break;
}
}