Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial Qt WebEngine support #1542

Open
wants to merge 121 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
2c26265
Extract ArticleView::clearPageSelection()
vedgy Jul 6, 2022
60ee640
Remove `_=0;` after a call to removeAllRanges()
vedgy Jul 6, 2022
50c863b
Call QNetworkReply::setFinished() before emitting finished()
vedgy Jun 2, 2022
f485f75
Set QNetworkReply's url to the request's url
vedgy Jun 11, 2022
9dd5a46
Print JavaScript console messages as warnings
vedgy Jun 6, 2022
06eb2cc
Don't attempt to select a nonexistent article
vedgy Jul 5, 2022
51f1f5a
Extract caseSensitivityFindFlags()
vedgy Jul 8, 2022
411fb46
Connect to QWebPage's linkClicked() signal instead of QWebView's
vedgy Jul 8, 2022
3ad5c1b
Don't call QWebView::pageAction() repeatedly
vedgy Jul 8, 2022
3cbdd8c
Reduce nesting in MainWindow::on_saveArticle_triggered()
vedgy Aug 12, 2022
efb94bd
Document ResourceToSaveHandler class
vedgy Sep 26, 2022
5910831
Save Article regexes: deduplicate, make static and const
vedgy Sep 27, 2022
fdb4dbb
Save Article: remove an argument and a regex capture
vedgy Sep 27, 2022
d62f2d2
Save Article: use QSet's hash instead of QCryptographicHash
vedgy Sep 29, 2022
affd716
Save Article: use Resource struct instead of a pair
vedgy Sep 29, 2022
487fb82
Save Article: find and process custom resource links recursively
vedgy Oct 8, 2022
b7dfe75
Move JavaScript code from article_maker.cc to blocking.js
vedgy Jun 2, 2022
a1463b4
Beautify JavaScript code
vedgy Jun 2, 2022
299159a
JavaScript: get rid of single-line conditionals
vedgy Jul 15, 2022
92ecc5d
JavaScript: add missing and remove redundant semicolon
vedgy Jun 2, 2022
87c6a7e
JavaScript: move overIframeId variable closer to its uses
vedgy Jun 2, 2022
52a6855
JavaScript: fix Qt Creator's warnings
vedgy Jun 2, 2022
af8476f
JavaScript: use `const` instead of `var` where possible
vedgy Jun 4, 2022
e41c348
gdExpandOptPart(): deduplicate code
vedgy Jun 4, 2022
a336331
gdExpandOptPart(): support any number of dictionaries
vedgy Jun 4, 2022
4f81d6d
JavaScript: mark local variables with `const` or `var`
vedgy Jun 4, 2022
d7aab89
gdMakeArticleActive(): deduplicate prepending 'gdfrom-'
vedgy Jun 5, 2022
3d732f8
Remove redundant type="text/javascript" attribute
vedgy Jun 5, 2022
9830fff
JavaScript: prefix all global names with "gd"
vedgy Jul 15, 2022
8f6cb30
JavaScript: declare variables once
vedgy Jun 6, 2022
d9eebf9
ArticleViewJsProxy: Q_INVOKABLE => slot
vedgy Aug 6, 2022
49d8b53
Don't call gdCheckArticlesNumber() from C++ code
vedgy Jun 6, 2022
42a8ecb
Store loadedPageHasSound as ArticleView's data member
vedgy Jun 6, 2022
5524cc8
Store a copy of gdAudioLinks as ArticleView's data member
vedgy Jun 7, 2022
184dec0
Store a copy of gdCurrentArticle as ArticleView's data member
vedgy Jun 6, 2022
0e3709f
Print a warning when JavaScript sends invalid active article ID
vedgy Jul 16, 2022
40a292a
Reduce communication between JavaScript and C++
vedgy Jun 8, 2022
17b0476
Print a warning when invalid article ID is set as current
vedgy Jul 17, 2022
08683da
Store a copy of gdArticleContents as ArticleView's data member
vedgy Jun 8, 2022
9bc23ef
Remove unused function ArticleView::showAnticipation()
vedgy Jul 29, 2022
cc374d1
selectCurrentArticle: don't pass current article to JavaScript
vedgy Jul 22, 2022
3257e69
Extract and optimize MainWindow::appendToFoundInDictsList()
vedgy Jul 31, 2022
8bacd99
Check isScrollTo( id ) once
vedgy Aug 3, 2022
13721d6
Emit activeArticleChanged() only if there was a change
vedgy Aug 3, 2022
91f4a07
Extract expandFrames() from ArticleView::loadFinished()
vedgy Aug 6, 2022
baaeccc
Extract ArticleView::initCurrentArticleAndScroll()
vedgy Aug 6, 2022
ada6a9e
Extract scrollToGdAnchor() from ArticleView::loadFinished()
vedgy Aug 6, 2022
98c41a7
Don't wait for QWebView::loadFinished() to update the UI
vedgy Jul 28, 2022
241c39c
Don't override user choice when a page finishes loading
vedgy Jul 31, 2022
531a8c1
Allow building against Qt WebEngine
vedgy Jul 15, 2022
2d85942
Set "gico" MIME type to "image/png"
vedgy Jun 11, 2022
d8faa2b
Differentiate WebKit and WebEngine versions in About dialog
vedgy Jul 3, 2022
ece72f0
WebEngine-specific: prevent main window title flashes
vedgy Jul 3, 2022
f379f7c
WebEngine-specific: display topmost articles ASAP
vedgy Jul 4, 2022
c1ad25d
WebEngine-specific: allow opening URL with a fragment in a new tab
vedgy Jul 23, 2022
6578159
Eliminate gdlookup://localhost/bullet.gif errors
vedgy Aug 8, 2022
5cc28b6
Forward-declare ArticleMaker to speed up incremental compilation
vedgy Jul 24, 2022
66c007e
Extract CssAppender::appendFile()
vedgy Jul 24, 2022
d9396c7
Extract CssAppender::appendCode()
vedgy Jul 24, 2022
050d2eb
Remove redundant type="text/css" attribute
vedgy Jul 24, 2022
8fd3cfe
WebEngine-specific: find and set page background color
vedgy Jul 24, 2022
e7a336e
Don't set ArticleWebView's URL to about:blank in setupUi()
vedgy Jul 25, 2022
6c15b10
Make ArticleView::canGo* const
vedgy Jul 25, 2022
f58441d
Update Back and Forward buttons on fragment navigation
vedgy Jul 25, 2022
36e54f0
Update Back and Forward buttons earlier
vedgy Aug 7, 2022
599f5dd
WebEngine-specific: scroll to URL fragment earlier
vedgy Aug 12, 2022
569bc41
WebEngine-specific: set persistent data and cache paths
vedgy Aug 1, 2022
39a5138
WebEngine-specific: synchronize current article updates
vedgy Aug 12, 2022
47d548b
WebEngine-specific: forbid navigating to initial blank page
vedgy Aug 5, 2022
7b22726
Simplify ArticleWebView::mouseReleaseEvent()
vedgy Aug 21, 2022
cef4d43
WebEngine-specific: port most mouse&keyboard actions in articles
vedgy Aug 21, 2022
5b5da7e
Extract appendGdMakeArticleActiveOn()
vedgy Aug 28, 2022
4497300
WebEngine-specific: make article active on middle button click
vedgy Aug 28, 2022
d9e1fef
WebKit-specific: don't attempt to select a word on a scrollbar
vedgy Aug 29, 2022
91ff9a1
WebEngine-specific: port double click in article view
vedgy Aug 29, 2022
a2cb2f0
ArticleView: reduce the scope of a variable and make it const
vedgy Aug 30, 2022
b1ccb88
WebEngine-specific: sanitize selected text on double-click
vedgy Sep 1, 2022
73f1569
Extract createGdlookupUrl()
vedgy Sep 2, 2022
421bb8f
Extract ArticleView::showDefinition(phrase, url)
vedgy Sep 2, 2022
787e7d7
WebEngine-specific: make Ctrl+Mouse Wheel zooming consistent
vedgy Sep 1, 2022
0ad74df
WebEngine-specific: add repeated zooming comment and TODO
vedgy Sep 2, 2022
05ea56d
WebEngine-specific: work around poor streaming device support
vedgy Sep 10, 2022
84db7eb
Cancel data request in ArticleResourceReply::close()
vedgy Sep 11, 2022
02d91be
WebEngine-specific: fail URL request job on async network error
vedgy Sep 11, 2022
71cf316
WebEngine-specific: add off-the-record web profile option
vedgy Sep 17, 2022
4a4a8f4
WebEngine-specific: add/expand TODO comments
vedgy Sep 14, 2022
ffab512
Move embedded expand-optional-parts CSS code into a file
vedgy Sep 17, 2022
894dcff
Reference style sheets via <link> instead of embedding them
vedgy Oct 5, 2022
d29db74
Download local file resources while saving complete article
vedgy Oct 9, 2022
f24a2a0
Add support for qrc:// URL scheme
vedgy Sep 19, 2022
953629f
Replace all usages of qrcx://localhost with qrc://
vedgy Sep 30, 2022
ceee606
Add a comment and deprecation->removal TODO for qrcx
vedgy Sep 19, 2022
9a43a7d
WebEngine-specific: port Save Article action
vedgy Sep 19, 2022
5548ef7
Save Article: add gdpicture:// URL scheme support
vedgy Sep 30, 2022
9616d12
Eliminate JavaScript errors in complete saved articles
vedgy Oct 1, 2022
30f2f50
WebEngine-specific: optimize finding page background color
vedgy Aug 11, 2022
446f55b
WebEngine-specific: make off-the-record web profile the default
vedgy Oct 27, 2022
1ebf0ff
WebEngine-specific: disable useless repeated zooming workaround
vedgy Oct 27, 2022
8e054c9
Hide ftsSearchFrame before navigating to a non-FTS-search page
vedgy Oct 28, 2022
36868cc
WebEngine-specific: hide searchFrame after saving web history state
vedgy Oct 28, 2022
a42212c
WebEngine-specific: hide searchFrame only if the word changes
vedgy Oct 28, 2022
33c16b3
WebKit-specific: save article inspector geometry on exit
vedgy Oct 30, 2022
7f65207
ArticleView: eliminate const_cast
vedgy Oct 31, 2022
04e55fc
WebEngine-specific: port article inspector (developer tools)
vedgy Oct 30, 2022
fcf4f77
Extract Folding::prepareToEmbedRTL()
vedgy Nov 1, 2022
e952e78
MainWindow::updateWindowTitle: don't adjust str if unused
vedgy Nov 1, 2022
e226237
Make ArticleView::getTitle() const
vedgy Nov 1, 2022
ac4d2a8
WebEngine-specific: set developer tools view title
vedgy Nov 1, 2022
7070599
Update description of the Qt WebEngine section in README.md
vedgy Nov 2, 2022
0abe8dc
Support activating an article while it is being loaded
vedgy Nov 8, 2022
1735441
WebKit-specific: reorder scrollToGdAnchor() and unsetCursor()
vedgy Nov 11, 2022
b028219
WebEngine-specific: port [un]setting web view cursor
vedgy Nov 11, 2022
12ce427
Extract ExtLineEdit::scaledForButtonPixmap()
vedgy Nov 11, 2022
7afd14f
ExtLineEdit: remove unused data member and function
vedgy Nov 11, 2022
930fad8
Display an indicator while a page is loading
vedgy Nov 11, 2022
da9c684
WebEngine-specific: look for QQuickWidget child of QWebEngineView
vedgy Nov 28, 2022
b21fee6
WebEngine-specific: share SelectWordBySingleClick script
vedgy Dec 6, 2022
06cba4e
WebEngine-specific: don't cache MDX video in a temporary directory
vedgy Mar 16, 2023
597fac4
Introduce maxZoomFactor and minZoomFactor constants
vedgy May 19, 2023
814b3bf
Increase minimum ArticleView zoom factor from 0.1 to 0.3
vedgy May 19, 2023
2fbca0a
Fuzzy-compare zoom factors
vedgy May 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ If you have problem building with Qt5 Multimedia or experience GStreamer run-tim

qmake "CONFIG+=no_qtmultimedia_player"

### Building with Qt WebEngine instead of Qt WebKit

The Qt WebEngine-based version of GoldenDict is fresh and has not been comprehensively tested. Some aspects work better than
in the Qt WebKit-based version, but there are downsides and not yet implemented features documented in the description of
[this pull request](https://github.com/goldendict/goldendict/pull/1542).

Make sure your Qt version is 5.15.2 or later, replace `libqt5webkit5-dev` with `qtwebengine5-dev` in the dependency list
of the [Installing External Deps on Ubuntu Linux for Qt5](#installing-external-deps-on-ubuntu-linux-for-qt5) section
and pass `"CONFIG+=use_qtwebengine"` to `qmake` in order to build this version:

qmake "CONFIG+=use_qtwebengine"

<b>NB:</b> All additional settings for `qmake` that you need must be combined in one `qmake` launch, for example:

qmake "CONFIG+=zim_support" "CONFIG+=no_extra_tiff_handler" "CONFIG+=no_ffmpeg_player"
Expand All @@ -113,7 +125,8 @@ To build GoldenDict with Visual Studio take one of next library packs and unpack

To create project files for Visual Studio you can pass `"-tp vc"` option to `qmake`.

Note: In Qt 5.6.0 and later the `Webkit` module was removed from official release builds. You should build it from sources to compile GoldenDict.
Note: In Qt 5.6.0 and later the `Webkit` module was removed from official release builds.
You should build it from sources to compile the Qt WebKit version of GoldenDict.


## Installation
Expand Down
10 changes: 8 additions & 2 deletions about.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ About::About( QWidget * parent ): QDialog( parent )
QString compilerVersion = QLatin1String( "GCC " ) + QLatin1String( __VERSION__ );
#endif

ui.qtVersion->setText( tr( "Based on Qt %1 (%2, %3 bit)" ).arg(
QString qtVersionText = tr( "Based on Qt %1 (%2, %3 bit)" ).arg(
QLatin1String( qVersion() ),
compilerVersion,
QString::number( QSysInfo::WordSize ) ) );
QString::number( QSysInfo::WordSize ) );
#ifdef USE_QTWEBKIT
qtVersionText += QLatin1String( ", Qt WebKit" );
#else
qtVersionText += QLatin1String( ", Qt WebEngine" );
#endif
ui.qtVersion->setText( qtVersionText );

QFile creditsFile( ":/CREDITS.txt" );

Expand Down
14 changes: 14 additions & 0 deletions article-style-expand-optional-parts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:root
{
--gd-page-background-color: ;
}

.dsl_opt
{
display: inline;
}

.hidden_expand_opt
{
display: none !important;
}
13 changes: 9 additions & 4 deletions article-style-st-babylon.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:root
{
--gd-page-background-color: white;
}

html
{
background-color: white;
Expand Down Expand Up @@ -74,19 +79,19 @@ h3 {
}

.gdexpandicon {
background-image: url('qrcx://localhost/icons/expand_article.png');
background-image: url('qrc:///icons/expand_article.png');
}

.gdexpandicon:hover {
background-image: url('qrcx://localhost/icons/expand_article_hovered.png');
background-image: url('qrc:///icons/expand_article_hovered.png');
}

.gdcollapseicon {
background-image: url('qrcx://localhost/icons/collapse_article.png');
background-image: url('qrc:///icons/collapse_article.png');
}

.gdcollapseicon:hover {
background-image: url('qrcx://localhost/icons/collapse_article_hovered.png');
background-image: url('qrc:///icons/collapse_article_hovered.png');
}

.bglpos { color: black; font-weight: bold; font-size: 11px; background: #F0EDED; display: inline; }
Expand Down
15 changes: 10 additions & 5 deletions article-style-st-lingoes-blue.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:root
{
--gd-page-background-color: #EAF0F8;
}

body {
background: #EAF0F8;
margin: 0.3em;
Expand Down Expand Up @@ -109,19 +114,19 @@ a:hover {
}

.gdexpandicon {
background-image: url('qrcx://localhost/icons/expand_article.png');
background-image: url('qrc:///icons/expand_article.png');
}

.gdexpandicon:hover {
background-image: url('qrcx://localhost/icons/expand_article_hovered.png');
background-image: url('qrc:///icons/expand_article_hovered.png');
}

.gdcollapseicon {
background-image: url('qrcx://localhost/icons/collapse_article.png');
background-image: url('qrc:///icons/collapse_article.png');
}

.gdcollapseicon:hover {
background-image: url('qrcx://localhost/icons/collapse_article_hovered.png');
background-image: url('qrc:///icons/collapse_article_hovered.png');
}

.gdarticleseparator {
Expand Down Expand Up @@ -366,4 +371,4 @@ h3 {
border-width:1px;
background-color:#eeeeee;
padding: 8px 8px 8px 8px;
}
}
13 changes: 9 additions & 4 deletions article-style-st-lingoes.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:root
{
--gd-page-background-color: #fffef2;
}

a
{
color: #2233bb;
Expand Down Expand Up @@ -78,19 +83,19 @@ body


.gdexpandicon {
background-image: url('qrcx://localhost/icons/expand_article.png');
background-image: url('qrc:///icons/expand_article.png');
}

.gdexpandicon:hover {
background-image: url('qrcx://localhost/icons/expand_article_hovered.png');
background-image: url('qrc:///icons/expand_article_hovered.png');
}

.gdcollapseicon {
background-image: url('qrcx://localhost/icons/collapse_article.png');
background-image: url('qrc:///icons/collapse_article.png');
}

.gdcollapseicon:hover {
background-image: url('qrcx://localhost/icons/collapse_article_hovered.png');
background-image: url('qrc:///icons/collapse_article_hovered.png');
}

.gddictnamebodyseparator
Expand Down
5 changes: 5 additions & 0 deletions article-style-st-lingvo.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:root
{
--gd-page-background-color: white;
}

html
{
background-color: white;
Expand Down
13 changes: 9 additions & 4 deletions article-style-st-modern.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:root
{
--gd-page-background-color: white;
}

html
{
background-color: white;
Expand Down Expand Up @@ -137,19 +142,19 @@ a:hover
}

.gdexpandicon {
background-image: url('qrcx://localhost/icons/expand_article.png');
background-image: url('qrc:///icons/expand_article.png');
}

.gdexpandicon:hover {
background-image: url('qrcx://localhost/icons/expand_article_hovered.png');
background-image: url('qrc:///icons/expand_article_hovered.png');
}

.gdcollapseicon {
background-image: url('qrcx://localhost/icons/collapse_article.png');
background-image: url('qrc:///icons/collapse_article.png');
}

.gdcollapseicon:hover {
background-image: url('qrcx://localhost/icons/collapse_article_hovered.png');
background-image: url('qrc:///icons/collapse_article_hovered.png');
}

/* The first headword in a (possibly) multi-headword DSL article */
Expand Down
24 changes: 8 additions & 16 deletions article-style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/******** Global, non-dictionary-specific classes ***********/

:root
{
--gd-page-background-color: #fefdeb;
}

body
{
Expand Down Expand Up @@ -76,7 +80,7 @@ pre
.gderrordesc
{
font-style: italic;
background: url("qrcx://localhost/icons/warning.png") center left no-repeat !important;
background: url("qrc:///icons/warning.png") center left no-repeat !important;
padding-left: 22px !important;
margin: 1em;
}
Expand Down Expand Up @@ -499,7 +503,7 @@ div.xdxf
.dsl_video .img
{
display: inline-block;
background: url('qrcx://localhost/icons/video.png');
background: url('qrc:///icons/video.png');
background-repeat: no-repeat;
/* Ugly hack since "vertical-align: middle;" looks _terrible_ in Qt4's webkit: */
vertical-align: -30%;
Expand Down Expand Up @@ -1106,16 +1110,6 @@ div.xdxf
** http://style.cleverchimp.com/font_size_intervals/altintervals.html
*/

/*
body {
font: x-small sans-serif;
background: #f9f9f9 url(headbg.jpg) 0 0 no-repeat;
color: black;
margin: 0;
padding: 0;
}
*/

/* scale back up to a sane default */
.mwiki #globalWrapper {
font-size: 127%;
Expand Down Expand Up @@ -1215,7 +1209,6 @@ body {
list-style-type: square;
margin: .3em 0 0 1.5em;
padding: 0;
list-style-image: url(bullet.gif);
}
.mwiki ol {
line-height: 1.5em;
Expand Down Expand Up @@ -1726,7 +1719,6 @@ special external link styling */
.mwiki .portlet ul {
line-height: 1.5em;
list-style-type: square;
list-style-image: url(bullet.gif);
font-size: 95%;
}
.mwiki .portlet li {
Expand Down Expand Up @@ -2902,15 +2894,15 @@ in bg url to hide it from iemac */
width:16px;
height:16px;
vertical-align: text-bottom;
background-image:url('qrcx://localhost/icons/arrow.png');
background-image:url('qrc:///icons/arrow.png');
}

.gdcollapseicon {
cursor:pointer;
width:16px;
height:16px;
vertical-align: text-bottom;
background-image:url('qrcx://localhost/icons/downarrow.png');
background-image:url('qrc:///icons/downarrow.png');
}

/********** Slob dictionaries ***********/
Expand Down