Adapt to qtutilities 6
This commit is contained in:
parent
1392eaebcf
commit
d3aed9cb74
|
@ -14,7 +14,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||||
use_cpp_utilities()
|
use_cpp_utilities()
|
||||||
|
|
||||||
# find qtutilities
|
# 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})
|
list(APPEND CMAKE_MODULE_PATH ${QT_UTILITIES_MODULE_DIRS})
|
||||||
|
|
||||||
# find repoindex
|
# find repoindex
|
||||||
|
|
|
@ -7,7 +7,6 @@ set(META_GUI_OPTIONAL false)
|
||||||
set(WIDGETS_HEADER_FILES
|
set(WIDGETS_HEADER_FILES
|
||||||
mainwindow.h
|
mainwindow.h
|
||||||
webpage.h
|
webpage.h
|
||||||
webviewprovider.h
|
|
||||||
)
|
)
|
||||||
set(WIDGETS_SRC_FILES
|
set(WIDGETS_SRC_FILES
|
||||||
main.cpp
|
main.cpp
|
||||||
|
@ -24,7 +23,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||||
use_cpp_utilities()
|
use_cpp_utilities()
|
||||||
|
|
||||||
# find qtutilities
|
# 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()
|
use_qt_utilities()
|
||||||
|
|
||||||
# find repoindex
|
# find repoindex
|
||||||
|
@ -40,9 +39,9 @@ set(TARGET_SUFFIX "-gui")
|
||||||
# include modules to apply configuration
|
# include modules to apply configuration
|
||||||
include(BasicConfig)
|
include(BasicConfig)
|
||||||
include(QtGuiConfig)
|
include(QtGuiConfig)
|
||||||
|
include(QtWebViewProviderConfig)
|
||||||
include(QtConfig)
|
include(QtConfig)
|
||||||
include(WindowsResources)
|
include(WindowsResources)
|
||||||
include(WebViewProviderConfig)
|
|
||||||
include(AppTarget)
|
include(AppTarget)
|
||||||
include(ShellCompletion)
|
include(ShellCompletion)
|
||||||
include(ConfigHeader)
|
include(ConfigHeader)
|
||||||
|
|
|
@ -53,6 +53,7 @@ bool MainWindow::event(QEvent *event)
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
} case QEvent::MouseButtonPress: {
|
} case QEvent::MouseButtonPress: {
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
switch(mouseEvent->button()) {
|
switch(mouseEvent->button()) {
|
||||||
|
@ -86,7 +87,7 @@ void MainWindow::showInfoWebViewContextMenu(const QPoint &)
|
||||||
if(!m_contextMenu) {
|
if(!m_contextMenu) {
|
||||||
m_contextMenu = new QMenu(this);
|
m_contextMenu = new QMenu(this);
|
||||||
auto *reloadAction = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), tr("Reload UI"), m_contextMenu);
|
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);
|
m_copyAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy"), m_contextMenu);
|
||||||
connect(m_copyAction, &QAction::triggered, this, &MainWindow::copyInfoWebViewSelection);
|
connect(m_copyAction, &QAction::triggered, this, &MainWindow::copyInfoWebViewSelection);
|
||||||
auto *updateAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-download")), tr("Update sync-databases"), m_contextMenu);
|
auto *updateAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-download")), tr("Update sync-databases"), m_contextMenu);
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include "./webviewprovider.h"
|
#include "./gui/webviewdefs.h"
|
||||||
|
#include "./gui/webviewincludes.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#ifdef REPOINDEX_USE_WEBENGINE
|
|
||||||
# include <QWebEngineView>
|
|
||||||
#else
|
|
||||||
# include <QWebView>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace RepoIndex {
|
namespace RepoIndex {
|
||||||
|
|
||||||
|
@ -29,7 +25,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Manager *m_manager;
|
Manager *m_manager;
|
||||||
WEB_VIEW_PROVIDER m_webView;
|
REPOINDEX_WEB_VIEW m_webView;
|
||||||
QMenu *m_contextMenu;
|
QMenu *m_contextMenu;
|
||||||
QAction *m_copyAction;
|
QAction *m_copyAction;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace RepoIndex {
|
namespace RepoIndex {
|
||||||
|
|
||||||
WebPage::WebPage(WEB_VIEW_PROVIDER *view) :
|
WebPage::WebPage(REPOINDEX_WEB_VIEW *view) :
|
||||||
WEB_PAGE_PROVIDER(view),
|
REPOINDEX_WEB_PAGE(view),
|
||||||
m_view(view)
|
m_view(view)
|
||||||
{
|
{
|
||||||
#ifdef REPOINDEX_USE_WEBENGINE
|
#ifdef REPOINDEX_USE_WEBENGINE
|
||||||
|
@ -30,12 +30,12 @@ WebPage::WebPage(WEB_VIEW_PROVIDER *view) :
|
||||||
#else
|
#else
|
||||||
connect(this->mainFrame(), &QWebFrame::urlChanged, this, &WebPage::delegateToExternalBrowser);
|
connect(this->mainFrame(), &QWebFrame::urlChanged, this, &WebPage::delegateToExternalBrowser);
|
||||||
#endif
|
#endif
|
||||||
m_view = new WEB_VIEW_PROVIDER;
|
m_view = new REPOINDEX_WEB_VIEW;
|
||||||
m_view->setPage(this);
|
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)
|
Q_UNUSED(type)
|
||||||
return new WebPage;
|
return new WebPage;
|
||||||
|
|
|
@ -1,35 +1,28 @@
|
||||||
#ifndef WEBPAGE_H
|
#ifndef WEBPAGE_H
|
||||||
#define WEBPAGE_H
|
#define WEBPAGE_H
|
||||||
|
|
||||||
#include "./webviewprovider.h"
|
#include "./gui/webviewdefs.h"
|
||||||
|
#include "./gui/webviewincludes.h"
|
||||||
#ifdef REPOINDEX_USE_WEBENGINE
|
|
||||||
# include <QWebEnginePage>
|
|
||||||
#else
|
|
||||||
# include <QWebPage>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(WEB_VIEW_PROVIDER)
|
|
||||||
|
|
||||||
namespace RepoIndex {
|
namespace RepoIndex {
|
||||||
|
|
||||||
class WebPage : public WEB_PAGE_PROVIDER
|
class WebPage : public REPOINDEX_WEB_PAGE
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
WebPage(WEB_VIEW_PROVIDER *view = nullptr);
|
WebPage(REPOINDEX_WEB_VIEW *view = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void openUrlExternal(const QUrl &url);
|
void openUrlExternal(const QUrl &url);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WEB_PAGE_PROVIDER *createWindow(WebWindowType type);
|
REPOINDEX_WEB_PAGE *createWindow(WebWindowType type);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void delegateToExternalBrowser(const QUrl &url);
|
void delegateToExternalBrowser(const QUrl &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WEB_VIEW_PROVIDER *m_view;
|
REPOINDEX_WEB_VIEW *m_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
|
@ -59,7 +59,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||||
use_cpp_utilities()
|
use_cpp_utilities()
|
||||||
|
|
||||||
# find qtutilities
|
# 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()
|
use_qt_utilities()
|
||||||
|
|
||||||
# include modules to apply configuration
|
# include modules to apply configuration
|
||||||
|
|
|
@ -91,7 +91,7 @@ DatabaseError AlpmDatabase::loadDescriptions(QList<QPair<QString, QList<QByteArr
|
||||||
}
|
}
|
||||||
} else if(pathInfo.isFile()) {
|
} else if(pathInfo.isFile()) {
|
||||||
if(lastModified) {
|
if(lastModified) {
|
||||||
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toTime_t());
|
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toSecsSinceEpoch());
|
||||||
}
|
}
|
||||||
KTar tar(databasePath());
|
KTar tar(databasePath());
|
||||||
const KArchiveDirectory *dbDir;
|
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;
|
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to create/write output file." << endl;
|
||||||
removeBusyFlag();
|
removeBusyFlag();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
} default:
|
} default:
|
||||||
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
|
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
|
||||||
if(filesDatabase && reply->error() == QNetworkReply::ContentNotFoundError) {
|
if(filesDatabase && reply->error() == QNetworkReply::ContentNotFoundError) {
|
||||||
|
@ -324,7 +325,6 @@ void AlpmDatabase::databaseDownloadFinished()
|
||||||
} else {
|
} else {
|
||||||
removeBusyFlag();
|
removeBusyFlag();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue