Commit graph

109 commits

Author SHA1 Message Date
Xiao YiFang 208cd50979 fix: when history forward/back ,the founded dictionary does not change
fixed #184
2022-11-04 21:23:42 +08:00
Xiao YiFang c41068d608 article inspector debug info 2022-08-08 20:48:46 +08:00
Xiao YiFang 48711e73ba remove useless method 2022-08-05 22:24:28 +08:00
Xiao YiFang dd244e0336 opt: update dictionaries when disable certain dictionary 2022-07-17 18:23:21 +08:00
Xiao YiFang 45c2bf38bd opt: do not allow open audio link in new tab 2022-07-10 10:18:02 +08:00
Xiao YiFang 949ad6de57 fix mergeconflict when merge upstream 2022-06-14 22:07:01 +08:00
Igor Kushnir 7df106c68c Refactor: get rid of ArticleView::articleToJump
This variable overrides history user data, which makes the current
article and position restoring code in ArticleView::loadFinished()
difficult to understand.

Encode the same logic in the history user data instead. This should make
the code more straightforward and less brittle in the face of changes.
2022-06-12 20:14:22 +03:00
Igor Kushnir 40dd01755e Always jump to current article before reloading
MainWindow calls ArticleView::reload() when the group list is updated.
This updating may add/remove/reorder dictionaries in the active group.

MainWindow also calls ArticleView::reload() when the display or addon
style changes.

In both of the above scenarios uncontrolled jumps and current article
change can occur (see also the parent commit message).

Move setting articleToJump from above the only ArticleView's reload()
call into ArticleView::reload() itself.
2022-06-12 20:14:22 +03:00
Igor Kushnir e8a1358bce Refactor: extract ArticleView::load()
This way it is clearer that the pages history is updated just before
each navigation to a different page.

The call to ArticleView::saveHistoryUserData() now occurs slightly later
in ArticleView::showDefinition(). I don't think the intervening code can
affect the current article or window position. So the reordering most
likely does not affect application behavior.
2022-06-12 20:13:54 +03: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 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 c6811db3a0 fix: merge conflict from upstream 2022-05-24 20:25:09 +08: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
Igor Kushnir 9f5788ee11 Remove unused declaration showFindButtons()
c2cdf9b177 declared this member function
but it was never defined.
2022-05-23 16:01:58 +03: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 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
ngn999 b187c0ef41 fix code review indent issue 2022-03-30 23:08:24 +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 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 2851533645 clean code: remove useless method
this methods related to win32 getText which has been removed
2022-03-18 22:22:48 +08:00
yifang fb2eac9b5e upgrade to 6.2,linux compile 2022-03-11 22:14:40 +08:00
xiaoyifang 7b5511a7bd upgrade to qt6.2 2022-03-11 22:00:45 +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 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
yifang 12a1ee77df
imp. : zoom factor ,set zoom also in loading process 2022-01-20 20:34:14 +08:00
yifang 8ac2f8dfe1 imp. : wrap articleview in webchannel for security reason 2022-01-20 07:38:01 +08:00
yifang 5c76bc746c fix:right context menu ,select current article 2022-01-19 20:16:45 +08:00
yifang be7319559c improvement:set web page zoomfactor besides webview. 2022-01-15 18:23:44 +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
xiaoyifang 13fdf08450 improve:foundDictsPane refresh logic 2022-01-09 12:54:50 +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
yifang e7218fc12b open link content duplicated in all the tabs. 2021-12-28 21:49:32 +08:00
yifang 101fb9027d refactor code.F12 optimize 2021-12-13 22:46:02 +08:00
yifang a2baf836e4 refactor code.F12 optimize 2021-12-13 22:46:02 +08:00
xiaoyifang 174ba53be2 found dictionaries panel update 2021-12-13 22:43:46 +08:00
xiaoyifang 402add183e clean qt_version < 5 code. 2021-12-13 22:43:46 +08:00
yifang f13c713265 right panel founded dictionaries 2021-10-05 09:23:30 +08:00
xiaoyifang d2257ce061 Merge remote-tracking branch 'remotes/origin/master' into branch-qt-5.15
# Conflicts:
#	articleview.cc
2021-09-24 14:08:26 +08:00
yifang e5c72f8ecc change to setcontent 2021-08-21 09:41:40 +08:00
yifang b1c4159a3d change function declarition 2021-08-15 11:05:38 +08:00
xiaoyifang eddfa075bd connect reply content to article view 2021-08-14 15:25:10 +08:00