Commit graph

352 commits

Author SHA1 Message Date
Xiao YiFang b5d005d3ed opt: clear the delayedHighlight text earlier 2022-06-03 12:32:27 +08:00
Xiao YiFang 66499007f6 clean code: remove \n in parameter of GD_DPRINTF 2022-06-02 20:11:05 +08:00
Igor Kushnir 99982a1c11 ArticleView: expose only minimal API to JavaScript
https://doc.qt.io/archives/qt-5.5/qtwebkit-bridge.html#internet-security
Qt WebKit Bridge documentation recommends:
  When exposing native objects to an open web environment, it is
  important to understand the security implications. Think whether the
  exposed object enables the web environment access things that
  shouldn't be open, and whether the web content loaded by that web page
  comes from a trusted source.

The author of Qt WebChannel has said the following in a talk that
introduced this Qt module (WebKit Bridge replacement for Qt WebEngine):
  My suggestion here is to write dedicated QObjects with a slim, minimal
  API that only have the signals and methods that you deem safe to be
  used from the outside.
- see a comment under https://redirect.invidious.io/watch?v=KnvnTi6XafA
2022-06-02 13:51:13 +03:00
Xiao YiFang f015ff555f feature: save bookmark to favorite panel
reuse fulltext match to implement this bookmark feature
2022-06-02 08:16:01 +08:00
Xiao YiFang 7d43aea9b2 opt: right context menu ,remove non-sense characters
like punctuation and space and symbols
2022-05-29 16:00:29 +08:00
Xiao YiFang c45b4cc255 fix: invalid gdlookup url should be forbidden. 2022-05-28 10:41:28 +08:00
Xiao YiFang f98ac1b588 clean code:remove useless code 2022-05-27 21:54:30 +08:00
Xiao YiFang f1bcb37e76 fix upstream merge conflict 2022-05-25 08:00:58 +08:00
Igor Kushnir 201f11e656 Set current article at most once in loadFinished()
When the current article is set and the user expands or collapses
optional parts (e.g. via the Ctrl+* shortcut),
ArticleView::setCurrentArticle() is called twice from
ArticleView::loadFinished(). Furthermore, the window scroll position is
restored before the second jump. This is wasteful. Move the
higher-priority setCurrentArticle() call up and, if it succeeds, skip
the other call and the scrolling.

I have measured the time spent running the affected code fragment on my
GNU/Linux system before and at this commit. When the loaded articles are
not very large, the performance gain of this commit is only about 1 ms.
However, when one of the displayed articles was huge (the
"United States" English Wikipedia article), the time went from 120 ms to
5 ms.
2022-05-24 21:02:20 +03:00
Xiao YiFang 1f01e545d1 disable print background 2022-05-24 21:40:53 +08:00
Xiao YiFang c6811db3a0 fix: merge conflict from upstream 2022-05-24 20:25:09 +08:00
Igor Kushnir b87b023db0 Optimize highlighting FTS matches in articles
The wall time of calls to ArticleView::highlightAllFtsOccurences() on my
GNU/Linux system before and at this commit:
allMatches.size()   uniqueMatches.size()    before(ms)  at(ms)
79                  1                       277         4
98                  1                       380         4
267                 1                       16803       65
2022-05-23 16:05:36 +03:00
Igor Kushnir bd5b36cac7 Extract ArticleView::highlightAllFtsOccurences()
Extracting this function allows to simplify the code and facilitates
optimizing it in the next commit.

Remove `#if QT_VERSION >= 0x040600` along the way as GoldenDict does not
support Qt versions older than 4.6 for several years now.
2022-05-23 16:02:01 +03:00
Xiao YiFang 55fee75acd fix: a bug with send to anki 2022-05-22 10:05:22 +08:00
Xiao YiFang 0a2661f986 add 'send to anki' function
users can configure the ankiconnect to use together with anki
2022-05-21 17:34:22 +08:00
Xiao YiFang a7ba9e4b36 opt:use acceptNavigationRequest instead of weburlinterceptor 2022-05-20 18:01:41 +08:00
Xiao YiFang 459b684e5b opt: make the inspect window's instance to exactly only one. 2022-05-20 17:31:47 +08:00
Xiao YiFang c0e3767f83 opt: format code and remove default constructor 2022-05-19 20:37:11 +08:00
Xiao YiFang 15d9104f2c fix : fulltext search will crash
close issue #69
2022-05-19 20:28:52 +08:00
Xiao YiFang a1ef0313ab opt : set webengine font family
make it take effect immediately
2022-05-17 21:24:30 +08:00
Xiao YiFang eda434f38e opt: rename emitDicts signal to dictionaryChanges 2022-05-15 22:48:22 +08:00
Xiao YiFang 20f51fc7f2 fix: double click image will clear translate input line 2022-05-08 21:02:23 +08:00
Xiao YiFang 9c402d986e opt: add dictionary fallback font family settings 2022-05-08 16:44:09 +08:00
Yifang Xiao 289b0be594 fix:archlinux variant version ,mouse back button 2022-05-05 21:37:23 +08:00
xiaoyifang 60a4853e51
Merge pull request #57 from xiaoyifang/opt/blank-page
remove blank page load
2022-04-26 20:38:56 +08:00
YiFang Xiao 75b6788937 opt: add javascript clipboard support 2022-04-26 20:21:45 +08:00
xiaoyifang ab2c1db889 remove blank page load 2022-04-22 20:24:45 +08:00
xiaoyifang e679463dc0 fix:merge compile lamda error 2022-03-31 08:54:06 +08:00
xiaoyifang 228d7001e5
Merge pull request #35 from ngn999/bugfix/Macbook_scroll_issue
disable macOS trackpad zoom; fix a deadlock
2022-03-31 00:10:37 +08:00
ngn999 13dfd39e69 fix more indent issue 2022-03-30 23:10:37 +08:00
ngn999 b187c0ef41 fix code review indent issue 2022-03-30 23:08:24 +08:00
xiaoyifang 03653925be optimize: double click send select text to tranlateline box. 2022-03-30 15:21:16 +08:00
xiaoyifang 913e4128ca fix:qt6.2 print preview 2022-03-29 20:34:55 +08:00
ngn999 32fcd38dc0 make getWebPageText async 2022-03-28 17:29:00 +08:00
ngn999 e45f466a9d make toHtml async 2022-03-28 10:30:23 +08:00
ngn999 05bbf54330 rewrite lambda capture list 2022-03-27 23:36:14 +08:00
ngn999 6c310b41af make isFramedArticle async, and remvoe runJavaScriptSync() 2022-03-27 23:05:45 +08:00
ngn999 95be606a9e make ArticleView::hasSound() async 2022-03-27 22:22:42 +08:00
xiaoyifang 9ebf38f888 F12 and right context menu inspect element
when trigger inspectelement through contextmenu , should navigate to the very element in devtool.
2022-03-26 10:44:23 +08:00
YiFang Xiao 75e0dfdec7 fix: fix todo when upgrade to 6.2 2022-03-20 19:27:35 +08:00
xiaoyifang 2851533645 clean code: remove useless method
this methods related to win32 getText which has been removed
2022-03-18 22:22:48 +08:00
xiaoyifang f18e8f8960 fix:gdau link show blocked in devtool network 2022-03-16 22:29:04 +08:00
xiaoyifang 61fb1020b8 add QWebEngineSettings::UnknownUrlSchemePolicy to qwebenginesettings 2022-03-14 23:24:53 +08:00
xiaoyifang 156eca87d5 fix:qt6.2 printer preview 2022-03-12 18:12:17 +08:00
yifang fb2eac9b5e upgrade to 6.2,linux compile 2022-03-11 22:14:40 +08:00
xiaoyifang 6b01cba709 modify webenginesettings to support qt6.2 2022-03-11 22:14:16 +08:00
xiaoyifang 7b5511a7bd upgrade to qt6.2 2022-03-11 22:00:45 +08:00
xiaoyifang 3a092947da fix:popup javascript windows 2022-03-11 00:41:35 +08:00
yifang edf8c8d4f3 optimize:rename inspector class 2022-03-05 19:34:49 +08:00
yifang ae8c2df4a8 optimize: F12 improve
when close inspected windows,the inspect is still working .
2022-03-04 23:27:34 +08:00
yifang 269a7bcf48 fix:middle mouse click open in new tab 2022-03-04 00:17:21 +08:00
xiaoyifang d607079ffb fix: double click to translation should stop audio first.
there are cases when the audio is too long (in wiki).
when double click occured .the audio is still playing.
2022-02-25 23:33:34 +08:00
xiaoyifang 70e7a49db8 fix: scroll to current article 2022-02-25 22:48:43 +08:00
xiaoyifang d341a64569 fix:scrollIntoView,set the html active style. 2022-02-25 07:47:20 +08:00
xiaoyifang f146177232 fix:Alt+Down,Alt+Up when foundDicts panel is hidden on startup. 2022-02-23 00:27:30 +08:00
xiaoyifang 650b650a66 fix:jump to current article 2022-02-23 00:04:11 +08:00
xiaoyifang 49fa66c29d format: format one line 2022-02-19 19:05:01 +08:00
xiaoyifang 3e88a5615d optimize:F12 inspect element 2022-02-19 18:59:19 +08:00
yifang 56000cf3b1 optimize: F12 inspect element
optimize:inspect element dialog
2022-02-18 20:14:10 +08:00
yifang f81ac16fa6 fix: mouse scroll zoom in out 2022-02-18 00:40:03 +08:00
xiaoyifang 6fbadad807 clean:open dictionary folder in windows
make windows's logic same as linux
2022-02-16 23:00:20 +08:00
Igor Kushnir d7ec541383 Add "Automatically scroll to target article" option
When a user clicks on a link in a dictionary or requests translation of
a word by double-clicking or translates selection via the context menu,
at first the article from the highest-priority dictionary is at the top.
Then, after approximately one second, the article from the dictionary,
out of which the translation was requested, becomes current and the view
scrolls down to this article placing it on top, hiding articles from the
dictionaries above it.

Such application behavior is inconvenient in some workflows so that the
user manually navigates to the top dictionary translation when this
automatic scrolling happens.

For example: a user has English->Russian dictionaries and
English->English dictionaries. The English->Russian dictionaries are
higher up in the dictionary order because they provide easier/faster to
understand translations. Some rare words and phrases are missing from
the English->Russian dictionaries however. Thus the user occasionally
reads the English explanation of a word/phrase. When the user
double-clicks on a word or follows a link in the English->English
dictionary article, she would rather see translations from the
preferable English->Russian dictionaries.

The new option allows to disable automatic scrolling and ensure that
articles from higher-priority dictionaries are visible. The option
doesn't affect backward/forward navigation via arrow buttons or
Alt+Arrow shortcuts: these still scroll to the stored vertical position
among articles. This remaining automatic scrolling happens much faster,
is not a problem for the described use case and hopefully for other use
cases.
2022-02-12 12:48:48 +08:00
yifang f6f0e25674 fix:double click translation ,right context menu invalid 2022-02-10 20:07:05 +08:00
yifang ccf3bea934 Merge branch 'fix/mix-sound' into staged 2022-02-04 21:20:05 +08:00
yifang 35f844a9a8 fix:when auto pronounce enabled. the sentence audio can not be played. 2022-02-04 21:19:32 +08:00
xiaoyifang 0c94406e2a fix merge conflict with feature/deprecated 2022-02-03 17:50:47 +08:00
yifang 8048830246 clean code: remove comment 2022-01-31 08:42:36 +08:00
yifang 096f21f61a imp. revert the playsound in the toolbar to use the builtin goldendict engine . 2022-01-30 19:28:49 +08:00
yifang 1d32ec4609 Merge branch 'feature/highdpi-icon' into dev 2022-01-27 08:24:16 +08:00
yifang d38daedc99
high dpi:remove coresponding png files with same name with svg
close https://github.com/goldendict/goldendict/issues/1441
2022-01-27 08:23:57 +08:00
xiaoyifang eb6aa7fba0 Merge branch 'branch-qt-5.15' into dev 2022-01-26 00:31:14 +08:00
xiaoyifang de0815f45d fix: print preview does not work 2022-01-26 00:29:58 +08:00
xiaoyifang 9cf5ee8443 high dpi:change icon reference in code from png to svg. 2022-01-24 22:23:38 +08:00
xiaoyifang 5af49e49eb fix: crash when edit dictionary through menu. when goldendict starts. 2022-01-23 11:22:40 +08:00
yifang 9700969a04
imp. : "select current article" ,if not in the view.scroll into view. 2022-01-20 21:59:47 +08:00
yifang 12a1ee77df
imp. : zoom factor ,set zoom also in loading process 2022-01-20 20:34:14 +08:00
yifang c7926daac7
fix:add debug log,hitted dictionaries changes. 2022-01-20 20:15:34 +08:00
yifang 8ac2f8dfe1 imp. : wrap articleview in webchannel for security reason 2022-01-20 07:38:01 +08:00
xiaoyifang f047c5fc9c Revert "imp. : wrap articleview in webchannel for security reason"
This reverts commit cf10810fe2.
2022-01-19 22:39:04 +08:00
yifang cf10810fe2 imp. : wrap articleview in webchannel for security reason 2022-01-19 20:50:17 +08:00
yifang 5c76bc746c fix:right context menu ,select current article 2022-01-19 20:16:45 +08:00
xiaoyifang a562975661 fix:right context menu , "select current article". 2022-01-18 23:06:17 +08:00
xiaoyifang 4e7fe7dd6d improvement: make tab title does not show url . 2022-01-18 22:26:52 +08:00
yifang 0ba2cacc29
improvement:remove gdCurrentArticle js variable 2022-01-17 21:50:54 +08:00
yifang ca9917c972 Merge branch 'temp/singleclick-event' into branch-qt-5.15 2022-01-15 11:21:18 +08:00
yifang 850c7d66e8 fix:single click on link,the emulated db click will still work on new page 2022-01-15 11:18:54 +08:00
yifang 63626bde13 improvement: refactor code,move ignoreKeyEvent method to utils. 2022-01-14 22:58:19 +08:00
yifang 713339d66b improve: handle invalid resource url such as bres://upload.wikimedia.... 2022-01-11 22:20:38 +08:00
xiaoyifang fb41852554 fix: mouse scroll by page (win specific) 2022-01-10 21:40:21 +08:00
xiaoyifang 84923e5c4d fix:save image (right context menu on image action) 2022-01-09 22:18:53 +08:00
xiaoyifang 13fdf08450 improve:foundDictsPane refresh logic 2022-01-09 12:54:50 +08:00
xiaoyifang 3f11826918 fix: invalid bres url may cause webengine to crash. such as bres://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif 2022-01-09 11:36:48 +08:00
yifang 46b4151cc4 improve: replace all the deprecated method before 5.15 2022-01-08 22:08:23 +08:00
yifang f16107e072 fix:right context menu not display correctly when select wikiweb dictionary 2022-01-08 21:45:10 +08:00
yifang e8f0202a49 clean code:remove useless code 2022-01-08 18:40:17 +08:00
yifang 0f1c0d4204 improve:right context menu active dictionaries 2022-01-08 14:51:24 +08:00
xiaoyifang 4de296b5a6 fix:single click to select work (inside html iframe) 2022-01-04 21:01:16 +08:00
xiaoyifang c17a4d9b74 right menu context 2022-01-02 16:30:16 +08:00
yifang aaea8d8e04 code clean: format 2022-01-01 18:19:11 +08:00
yifang 3ebe5c9b23 fix: translateLine text disappeared after main windows hide and show up again. 2021-12-30 21:19:50 +08:00