Use web view defs provided by qtutilities

This commit is contained in:
Martchus 2017-03-14 23:00:26 +01:00
parent 8fc2b834ea
commit 039f64584e
4 changed files with 54 additions and 20 deletions

View File

@ -4,6 +4,7 @@
#include "./attachmentsedit.h"
#include "./entertargetdialog.h"
#include "./fileinfomodel.h"
#include "./webviewincludes.h"
#include "../application/settings.h"
#include "../application/targetlevelmodel.h"
@ -41,12 +42,6 @@
#include <QCheckBox>
#include <QTreeView>
#include <QtConcurrent>
#if defined(TAGEDITOR_NO_WEBVIEW)
#elif defined(TAGEDITOR_USE_WEBENGINE)
# include <QWebEngineView>
#else
# include <QWebView>
#endif
#include <functional>
#include <algorithm>
@ -593,7 +588,7 @@ void TagEditorWidget::initInfoView()
m_infoModel->deleteLater();
m_infoModel = nullptr;
}
m_infoWebView = new WEB_VIEW_PROVIDER(m_ui->tagSplitter);
m_infoWebView = new TAGEDITOR_WEB_VIEW(m_ui->tagSplitter);
m_infoWebView->setAcceptDrops(false);
m_infoWebView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_infoWebView, &QWidget::customContextMenuRequested, this, &TagEditorWidget::showInfoWebViewContextMenu);

View File

@ -2,6 +2,7 @@
#define TAGEDITORWIDGET_H
#include "./previousvaluehandling.h"
#include "./webviewdefs.h"
#include <tagparser/mediafileinfo.h>
@ -10,21 +11,9 @@
#include <functional>
#if defined(TAGEDITOR_NO_WEBVIEW)
#elif defined(TAGEDITOR_USE_WEBENGINE)
# define WEB_VIEW_PROVIDER QWebEngineView
#elif defined(TAGEDITOR_USE_WEBKIT)
# define WEB_VIEW_PROVIDER QWebView
#else
# error "Macro for WebView provider not specified."
#endif
QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
QT_FORWARD_DECLARE_CLASS(QMenu)
QT_FORWARD_DECLARE_CLASS(QTreeView)
#ifndef TAGEDITOR_NO_WEBVIEW
QT_FORWARD_DECLARE_CLASS(WEB_VIEW_PROVIDER)
#endif
namespace Media {
DECLARE_ENUM_CLASS(TagType, unsigned int);
@ -137,7 +126,7 @@ private:
QMenu *m_removeTagMenu;
QMenu *m_changeTargetMenu;
#ifndef TAGEDITOR_NO_WEBVIEW
WEB_VIEW_PROVIDER *m_infoWebView;
TAGEDITOR_WEB_VIEW *m_infoWebView;
#endif
FileInfoModel *m_infoModel;
QTreeView *m_infoTreeView;

30
gui/webviewdefs.h Normal file
View File

@ -0,0 +1,30 @@
// Created via CMake from template webviewdefs.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_WEB_VIEW_DEFINES
#define TAGEDITOR_WEB_VIEW_DEFINES
#include <QtGlobal>
#if defined(TAGEDITOR_USE_WEBENGINE)
# define TAGEDITOR_WEB_VIEW QWebEngineView
# define TAGEDITOR_WEB_PAGE QWebEnginePage
#elif defined(TAGEDITOR_USE_WEBKIT)
# define TAGEDITOR_WEB_VIEW QWebView
# define TAGEDITOR_WEB_PAGE QWebPage
# define TAGEDITOR_WEB_FRAME QWebFrame
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for web view provider present."
#endif
#ifdef TAGEDITOR_WEB_VIEW
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_WEB_VIEW)
#endif
#ifdef TAGEDITOR_WEB_PAGE
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_WEB_PAGE)
#endif
#ifdef TAGEDITOR_WEB_FRAME
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_WEB_FRAME)
#endif
#endif // TAGEDITOR_WEB_VIEW_DEFINES

20
gui/webviewincludes.h Normal file
View File

@ -0,0 +1,20 @@
// Created via CMake from template webviewincludes.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_WEB_VIEW_INCLUDES
#define TAGEDITOR_WEB_VIEW_INCLUDES
#include <QtGlobal>
#if defined(TAGEDITOR_USE_WEBENGINE)
# include <QWebEngineView>
# include <QWebEnginePage>
#elif defined(TAGEDITOR_USE_WEBKIT)
# include <QWebView>
# include <QWebPage>
# include <QWebFrame>
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for web view provider present."
#endif
#endif // TAGEDITOR_WEB_VIEW_INCLUDES