diff --git a/gui/tageditorwidget.cpp b/gui/tageditorwidget.cpp index 0c27c67..4ae1dbf 100644 --- a/gui/tageditorwidget.cpp +++ b/gui/tageditorwidget.cpp @@ -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 #include #include -#if defined(TAGEDITOR_NO_WEBVIEW) -#elif defined(TAGEDITOR_USE_WEBENGINE) -# include -#else -# include -#endif #include #include @@ -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); diff --git a/gui/tageditorwidget.h b/gui/tageditorwidget.h index 7f34e78..9f265db 100644 --- a/gui/tageditorwidget.h +++ b/gui/tageditorwidget.h @@ -2,6 +2,7 @@ #define TAGEDITORWIDGET_H #include "./previousvaluehandling.h" +#include "./webviewdefs.h" #include @@ -10,21 +11,9 @@ #include -#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; diff --git a/gui/webviewdefs.h b/gui/webviewdefs.h new file mode 100644 index 0000000..3742bbb --- /dev/null +++ b/gui/webviewdefs.h @@ -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 + +#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 diff --git a/gui/webviewincludes.h b/gui/webviewincludes.h new file mode 100644 index 0000000..e01ebae --- /dev/null +++ b/gui/webviewincludes.h @@ -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 + +#if defined(TAGEDITOR_USE_WEBENGINE) +# include +# include +#elif defined(TAGEDITOR_USE_WEBKIT) +# include +# include +# include +#elif !defined(TAGEDITOR_NO_WEBVIEW) +# error "No definition for web view provider present." +#endif + +#endif // TAGEDITOR_WEB_VIEW_INCLUDES