Skip to content

Commit d2a4a1b

Browse files
committed
ability to use the updated QtWebKit of annulen
1 parent 6f017ef commit d2a4a1b

File tree

6 files changed

+146
-46
lines changed

6 files changed

+146
-46
lines changed

CREDITS.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ https://github.com/richmoore/qt-examples/tree/master/sitespecificbrowser
3737
https://github.com/OtterBrowser/otter-browser/blob/master/src/modules/backends/web/qtwebengine/QtWebEnginePage.cpp
3838
https://github.com/OtterBrowser/otter-browser/blob/master/src/modules/backends/web/qtwebengine/QtWebEnginePage.h
3939
https://github.com/NixOS/nixpkgs/issues/16327
40-
https://github.com/OSGeo/proj.4/blob/master/appveyor.yml
40+
https://github.com/annulen/webkit
4141

4242
http://qt-project.org/doc/qt-4.8/qwebhistory.html
4343
http://qt-project.org/doc/qt-4.8/qdir.html
@@ -243,7 +243,3 @@ https://github.com/github/linguist#overrides
243243

244244
## Travis CI
245245
http://stackoverflow.com/questions/25737062/travis-ci-for-a-qt5-project
246-
247-
## AppVeyor
248-
https://www.appveyor.com/docs/build-environment/#qt
249-
https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/nmake-fatal-error-u1077

REQUIREMENTS.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ Perl Executing Browser - Requirements
22
--------------------------------------------------------------------------------
33

44
## Compile-Time Requirements
5-
The only compile-time requirement of PEB is a GCC-based Qt development bundle version 5.2 or any later version.
5+
The only Linux and Macintosh compile-time requirement of PEB is a GCC-based Qt development bundle version 5.2 or any later version.
6+
7+
The source code of PEB is not MSVC-compatible and PEB can not be compiled using any MSVC-based Windows version of Qt. This means that:
8+
1. PEB Windows binaries can be compiled only by a GCC-based Qt development bundle.
9+
2. Only ``QtWebKit`` can be used by a Windows binary of PEB.
10+
``QtWebEngine`` is included only in the MSVC-based Qt development bundles.
11+
3. Updated ``QtWebKit`` headers and libraries have to be manually added from the
12+
[QtWebKit repository of Konstantin Tokarev (annulen)](https://github.com/annulen/webkit/releases) for all Qt versions higher than 5.5.
613

714
Compiled and tested successfully using:
815
* [Qt Creator 3.0.0 and Qt 5.2.0](http://download.qt.io/archive/qt/5.2/5.2.0/) on 32-bit Debian and 32-bit Windows XP
@@ -19,8 +26,28 @@ qmake -qt=qt5
1926
make
2027
```
2128

22-
If you want to change the Macintosh binary type, edit the ``src/peb.pro`` project file before compiling the binary.
29+
## Compile-Time Settings
30+
All compile-time settings require editing the ``src/peb.pro`` project file according to the following instructions.
31+
32+
* QtWebKit Use
33+
To use ```QtWebKit``` or ```QtWebEngine``` depending on the Qt version, which is the default setting:
34+
35+
```QMake
36+
ANNULEN_QTWEBKIT = 0
37+
```
38+
39+
The default web engine for Qt versions up to 5.5.x is ```QtWebKit```.
40+
The default web engine for Qt versions 5.6.x or higher is ```QtWebEngine```.
41+
42+
To use [an updated QtWebKit version from the repository of Konstantin Tokarev (annulen)](https://github.com/annulen/webkit/releases) with a Qt version higher than 5.5:
43+
44+
```QMake
45+
# ANNULEN_QTWEBKIT = 1
46+
```
47+
48+
Setting ```ANNULEN_QTWEBKIT``` to ```1``` has no effect on Qt versions 5.5 or lower.
2349

50+
* Macintosh Bundle
2451
To make a bundle-less binary, which is the default setting:
2552

2653
```QMake

resources/app/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,15 @@ <h2>Perl Executing Browser</h2>
264264

265265
<div class="row">
266266
<div class="col-lg-12 introduction">
267-
<a href="https://github.com/ddmitov/perl-executing-browser">Perl Executing Browser (PEB)</a> is an HTML5 user interface for <a href="https://www.perl.org/">Perl 5</a> desktop applications. It runs local Perl 5 scripts as child processes with no server or execution timeout and is implemented as a C++ executable based on the <a href="https://www.qt.io/">Qt 5</a> libraries.
267+
<a href="https://github.com/ddmitov/perl-executing-browser">Perl Executing Browser (PEB)</a> is an HTML5 user interface for <a href="https://www.perl.org/">Perl 5</a> desktop applications. By default it runs local Perl 5 scripts as child processes with no server or execution timeout and is implemented as a C++ executable based on the <a href="https://www.qt.io/">Qt 5</a> libraries.
268268
</div>
269269
</div>
270270

271271
<br>
272272

273273
<div class="row">
274274
<div class="col-lg-12 introduction">
275-
Inspired by <a href="http://electron.atom.io/">Electron</a> and <a href="http://nwjs.io/">NW.js</a>, PEB is another reuse of web technologies in desktop applications with Perl doing the heavy lifting. In contrast to Electron and NW.js, PEB does not depend on <a href="https://nodejs.org/en/">Node.js</a>, always runs JavaScript in a sandbox and blocks cross-origin requests.
275+
Inspired by <a href="http://electron.atom.io/">Electron</a> and <a href="http://nwjs.io/">NW.js</a>, PEB is another reuse of web technologies in desktop applications with Perl doing the heavy lifting. In contrast to Electron and NW.js, PEB does not depend on <a href="https://nodejs.org/en/">Node.js</a> and always runs JavaScript in a sandbox.
276276
</div>
277277
</div>
278278

src/main-window.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919

2020
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
2121
#include "webkit-main-window.h"
22-
#else
22+
#endif
23+
24+
#if QT_VERSION > QT_VERSION_CHECK(5, 5, 0)
25+
#if ANNULEN_QTWEBKIT == 0
2326
#include "webengine-main-window.h"
2427
#endif
2528

29+
#if ANNULEN_QTWEBKIT == 1
30+
#include "webkit-main-window.h"
31+
#endif
32+
#endif
33+
2634
// ==============================
2735
// MAIN WINDOW CLASS CONSTRUCTOR:
2836
// ==============================

src/main.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@
2626

2727
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
2828
#include "webkit-main-window.h"
29-
#else
29+
#endif
30+
31+
#if QT_VERSION > QT_VERSION_CHECK(5, 5, 0)
32+
#if ANNULEN_QTWEBKIT == 0
3033
#include "webengine-main-window.h"
3134
#endif
3235

36+
#if ANNULEN_QTWEBKIT == 1
37+
#include "webkit-main-window.h"
38+
#endif
39+
#endif
40+
3341
// ==============================
3442
// MESSAGE HANDLER FOR REDIRECTING
3543
// PROGRAM MESSAGES TO A LOG FILE:
@@ -247,11 +255,13 @@ int main(int argc, char **argv)
247255
SLOT(setMainWindowTitleSlot(QString)));
248256

249257
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
250-
// Signal and slot for fullscreen video:
251-
QObject::connect(mainWindow.webViewWidget->page(),
252-
SIGNAL(fullScreenRequested(QWebEngineFullScreenRequest)),
253-
&mainWindow,
254-
SLOT(qGoFullscreen(QWebEngineFullScreenRequest)));
258+
if (ANNULEN_QTWEBKIT == 0) {
259+
// Signal and slot for fullscreen video:
260+
QObject::connect(mainWindow.webViewWidget->page(),
261+
SIGNAL(fullScreenRequested(QWebEngineFullScreenRequest)),
262+
&mainWindow,
263+
SLOT(qGoFullscreen(QWebEngineFullScreenRequest)));
264+
}
255265
#endif
256266

257267
// Signal and slot for closing the main window:

src/peb.pro

Lines changed: 89 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,43 @@ greaterThan (QT_MAJOR_VERSION, 4) {
2323
message ("Qt Header files: $$[QT_INSTALL_HEADERS]")
2424
message ("Qt Libraries: $$[QT_INSTALL_LIBS]")
2525

26+
##########################################################
27+
# QTWEBKIT USE
28+
# Updated QtWebKit headers and libraries for
29+
# Qt versions 5.6 or higher can be downloaded from:
30+
# https://github.com/annulen/webkit/releases
31+
32+
# To use QtWebKit or QtWebEngine depending on the Qt version:
33+
# ANNULEN_QTWEBKIT = 0
34+
# QtWebKit is the default web engine for Qt versions up to 5.5.x and
35+
# QtWebEngine is the default web engine for Qt versions 5.6.x or higher
36+
37+
# To use the updated QtWebKit version of Konstantin Tokarev (annulen) with
38+
# a Qt version higher than 5.5:
39+
# ANNULEN_QTWEBKIT = 1
40+
41+
# ANNULEN_QTWEBKIT = 1
42+
# has no effect on Qt versions 5.5 or lower.
43+
##########################################################
44+
45+
ANNULEN_QTWEBKIT = 1
46+
47+
DEFINES += "ANNULEN_QTWEBKIT=$$ANNULEN_QTWEBKIT"
48+
49+
##########################################################
50+
# MACINTOSH BUNDLE
51+
52+
# To make a bundle-less binary:
53+
# BUNDLE = 0
54+
# CONFIG -= app_bundle
55+
# By default bundle-less binary is compiled.
56+
57+
# To make a bundled binary (peb.app):
58+
# BUNDLE = 1
59+
# CONFIG += app_bundle
60+
##########################################################
61+
2662
macx {
27-
##########################################################
28-
# MACINTOSH-SPECIFIC SETTING:
29-
# To make a bundle-less binary:
30-
# BUNDLE = 0
31-
# CONFIG -= app_bundle
32-
# By default bundle-less binary is compiled.
33-
# To make a bundled binary (peb.app):
34-
# BUNDLE = 1
35-
# CONFIG += app_bundle
36-
##########################################################
3763
BUNDLE = 0
3864
CONFIG -= app_bundle
3965

@@ -49,8 +75,6 @@ greaterThan (QT_MAJOR_VERSION, 4) {
4975
ICON = resources/icons/camel.icns
5076
}
5177

52-
##########################################################
53-
5478
# Binary basics:
5579
CONFIG += release
5680
TEMPLATE = app
@@ -68,14 +92,26 @@ greaterThan (QT_MAJOR_VERSION, 4) {
6892
}
6993

7094
greaterThan (QT_MINOR_VERSION, 5) {
71-
QT += widgets webenginewidgets
95+
equals (QTWEBKIT, 0) {
96+
QT += widgets webenginewidgets
97+
}
98+
99+
equals (QTWEBKIT, 1) {
100+
QT += widgets webkitwidgets
101+
}
72102
}
73103

74104
# Printing support:
75105
lessThan (QT_MINOR_VERSION, 6) {
76106
QT += printsupport
77107
}
78108

109+
greaterThan (QT_MINOR_VERSION, 5) {
110+
equals (QTWEBKIT, 1) {
111+
QT += printsupport
112+
}
113+
}
114+
79115
lessThan (QT_MINOR_VERSION, 6) {
80116
# Source files:
81117
SOURCES += \
@@ -98,24 +134,47 @@ greaterThan (QT_MAJOR_VERSION, 4) {
98134
}
99135

100136
greaterThan (QT_MINOR_VERSION, 5) {
101-
# Source files:
102-
SOURCES += \
103-
main.cpp \
104-
file-reader.cpp \
105-
main-window.cpp \
106-
port-scanner.cpp \
107-
script-handler.cpp \
108-
webengine-page.cpp \
109-
webengine-view.cpp
137+
equals (QTWEBKIT, 0) {
138+
# Source files:
139+
SOURCES += \
140+
main.cpp \
141+
file-reader.cpp \
142+
main-window.cpp \
143+
port-scanner.cpp \
144+
script-handler.cpp \
145+
webengine-page.cpp \
146+
webengine-view.cpp
147+
148+
# Header files:
149+
HEADERS += \
150+
file-reader.h \
151+
port-scanner.h \
152+
script-handler.h \
153+
webengine-main-window.h \
154+
webengine-page.h \
155+
webengine-view.h
156+
}
110157

111-
# Header files:
112-
HEADERS += \
113-
file-reader.h \
114-
port-scanner.h \
115-
script-handler.h \
116-
webengine-main-window.h \
117-
webengine-page.h \
118-
webengine-view.h
158+
equals (QTWEBKIT, 1) {
159+
# Source files:
160+
SOURCES += \
161+
main.cpp \
162+
file-reader.cpp \
163+
main-window.cpp \
164+
port-scanner.cpp \
165+
script-handler.cpp \
166+
webkit-page.cpp \
167+
webkit-view.cpp
168+
169+
# Header files:
170+
HEADERS += \
171+
file-reader.h \
172+
port-scanner.h \
173+
script-handler.h \
174+
webkit-main-window.h \
175+
webkit-page.h \
176+
webkit-view.h
177+
}
119178
}
120179

121180
# Resources:

0 commit comments

Comments
 (0)