Correctly separate webengine-only code.

This commit is contained in:
Martin Rotter 2017-07-20 12:36:56 +02:00
parent e41dbbfe41
commit 15e83ebd8f
3 changed files with 17 additions and 1 deletions

View File

@ -62,13 +62,16 @@
FormMain::FormMain(QWidget *parent, Qt::WindowFlags f)
: QMainWindow(parent, f), m_ui(new Ui::FormMain) {
m_ui->setupUi(this);
#if defined(USE_WEBENGINE)
m_adblockIcon = new AdBlockIcon(this);
m_adblockIconAction = m_adblockIcon->menuAction();
m_adblockIconAction->setObjectName(QSL("m_adblockIconAction"));
m_ui->m_menuTools->addAction(m_adblockIconAction);
#endif
m_ui->setupUi(this);
qApp->setMainForm(this);
// Add these actions to the list of actions of the main window.

View File

@ -49,7 +49,9 @@
Application::Application(const QString &id, int &argc, char **argv)
: QtSingleApplication(id, argc, argv),
#if defined(USE_WEBENGINE)
m_urlInterceptor(new NetworkUrlInterceptor(this)),
#endif
m_feedReader(nullptr),
m_updateFeedsLock(nullptr), m_userActions(QList<QAction*>()), m_mainForm(nullptr),
m_trayIcon(nullptr), m_settings(nullptr), m_system(nullptr), m_skins(nullptr),
@ -322,9 +324,11 @@ SystemTrayIcon *Application::trayIcon() {
return m_trayIcon;
}
#if defined(USE_WEBENGINE)
NetworkUrlInterceptor *Application::urlIinterceptor() {
return m_urlInterceptor;
}
#endif
void Application::showTrayIcon() {
qDebug("Showing tray icon.");

View File

@ -47,7 +47,10 @@ class QAction;
class Mutex;
class QWebEngineDownloadItem;
class FeedReader;
#if defined(USE_WEBENGINE)
class NetworkUrlInterceptor;
#endif
class Application : public QtSingleApplication {
Q_OBJECT
@ -80,7 +83,10 @@ class Application : public QtSingleApplication {
FormMain *mainForm();
QWidget *mainFormWidget();
SystemTrayIcon *trayIcon();
#if defined(USE_WEBENGINE)
NetworkUrlInterceptor *urlIinterceptor();
#endif
QString getTempFolderPath();
QString getDocumentsFolderPath();
@ -158,7 +164,10 @@ class Application : public QtSingleApplication {
// action will be allowed to lock for reading.
QScopedPointer<Mutex> m_updateFeedsLock;
#if defined(USE_WEBENGINE)
NetworkUrlInterceptor *m_urlInterceptor;
#endif
QList<QAction*> m_userActions;
FormMain *m_mainForm;
SystemTrayIcon *m_trayIcon;