Commit graph

351 commits

Author SHA1 Message Date
shenleban tongying 2aeed5e705 clang-tidy: apply modernize-use-override 2022-12-29 02:14:53 -05:00
shenleban tongying 3c668165c0 fix: _O_pen link's shortcut is conflict with Save S_o_und 2022-12-27 04:54:03 -05:00
shenleban tongying 07e92e8ac1 refactor: upgrade most of macro based Signal/Slot to new syntax 2022-12-25 21:08:17 -05:00
Xiao YiFang 1507bf9c6c remove redundant logic
these lines seems not needed
2022-12-11 19:15:30 +08:00
shenleban tongying 4452c06c3e Replace sptr with std::shared_ptr
* Make sptr an alias of std::shared_ptr
* Make old sptr's implicit conversion explict through std::make_shared
2022-11-28 22:54:31 -05:00
xiaoyifang df91a5b7bd add spx extenstion to the QFileDialog save path 2022-11-17 14:09:11 +08:00
Xiao YiFang 66ec6b6d63 fix: mdx headword total count is incorrect 2022-11-16 21:09:30 +08:00
Xiao YiFang 6d9a6c3d6b fix:return directly when the searched word is empty 2022-11-04 21:25:55 +08:00
Xiao YiFang 208cd50979 fix: when history forward/back ,the founded dictionary does not change
fixed #184
2022-11-04 21:23:42 +08:00
xiaoyifang e66380763f Revert "fix possible crash in archlinux"
This reverts commit 9719091776.

Revert "fix crash on archlinux"

This reverts commit 0dc2b4d416.
2022-11-01 17:40:20 +08:00
xiaoyifang 9719091776 fix possible crash in archlinux 2022-10-26 16:17:28 +08:00
Xiao YiFang 0dc2b4d416 fix crash on archlinux
I guess the issue #173 may be  rooted in here
2022-10-22 19:27:43 +08:00
Xiao YiFang f8f42092d3 fix:remove comment 2022-10-22 13:43:53 +08:00
Xiao YiFang cd5e5abe4d opt:scanpopup inspect element action optimization 2022-09-08 21:11:43 +08:00
Xiao YiFang 5180dfb35e fix:about blank page handle 2022-08-23 20:12:03 +08:00
Xiao YiFang 229b98e24d fix: blank page 2022-08-23 19:09:58 +08:00
Xiao YiFang a205d22139 opt: remove setZoomFactor when loading 2022-08-19 19:48:01 +08:00
Sixu Hu f296210a43 fix:crash when searching 2022-08-18 02:36:17 +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 6caf4fa58c feat: fulltext qtconcurrent worker return directly when canceled
concurrent index with segmentation lock
2022-07-30 11:53:07 +08:00
Xiao YiFang 086850467a opt: return directly when load about:blank or load unsuccessful 2022-07-28 21:23:52 +08:00
Xiao YiFang dd244e0336 opt: update dictionaries when disable certain dictionary 2022-07-17 18:23:21 +08:00
Xiao YiFang 5b4f112110 Merge branch 'master' of https://github.com/goldendict/goldendict into goldendict-master
# Conflicts:
#	.travis.yml
#	articleview.cc
#	locale/ar_SA.ts
#	locale/ay_WI.ts
#	locale/be_BY.ts
#	locale/be_BY@latin.ts
#	locale/bg_BG.ts
#	locale/cs_CZ.ts
#	locale/de_DE.ts
#	locale/el_GR.ts
#	locale/eo_EO.ts
#	locale/es_AR.ts
#	locale/es_BO.ts
#	locale/es_ES.ts
#	locale/fa_IR.ts
#	locale/fi_FI.ts
#	locale/fr_FR.ts
#	locale/hi_IN.ts
#	locale/ie_001.ts
#	locale/it_IT.ts
#	locale/ja_JP.ts
#	locale/jb_JB.ts
#	locale/ko_KR.ts
#	locale/lt_LT.ts
#	locale/mk_MK.ts
#	locale/nl_NL.ts
#	locale/pl_PL.ts
#	locale/pt_BR.ts
#	locale/qu_WI.ts
#	locale/ru_RU.ts
#	locale/sk_SK.ts
#	locale/sq_AL.ts
#	locale/sr_SR.ts
#	locale/sv_SE.ts
#	locale/tg_TJ.ts
#	locale/tk_TM.ts
#	locale/tr_TR.ts
#	locale/uk_UA.ts
#	locale/vi_VN.ts
#	locale/zh_CN.ts
#	locale/zh_TW.ts
2022-07-10 12:39:12 +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 dc058e7d68 fix: remove useless code . 2022-07-08 22:13:40 +08:00
Igor Kushnir 7db10b6664 Show current match and match count during FTS result navigation
This information is going to be especially useful in the upcoming Qt
WebEngine version of GoldenDict. In the Qt WebEngine version only the
words equal to the last found result can be highlighted, not all FTS
matches as in the Qt WebKit version.
2022-07-02 18:54:03 +03:00
Xiao YiFang 4d81b3b9e0 fix merge conflict 2022-07-02 19:13:53 +08:00
Igor Kushnir d8d3002329 Revert "Replace a fruitless check with an assertion"
The assertion failure can be triggered by full-text-searching for a
common word, selecting a result with many large articles and quickly
selecting text in the first article while the page is still loading.

This reverts commit c936d03fa0.
2022-07-02 12:21:34 +03:00
Igor Kushnir 1e43bdf18c highlightFTSResults: return earlier if the regexp is empty
A default-constructed QRegExp is passed to ArticleView::showDefinition()
when a user navigates from an FTS-result page by clicking a link or
double-clicking a word. QRegExp().pattern() returns an empty string,
which is stored in the "regexp" query item of an URL. When this URL is
loaded, ArticleView::loadFinished() calls highlightFTSResults(), which
then calls closeSearch(), performs multiple string and regular
expression operations and early-returns because the regular expression
pattern is empty. Returning earlier skips useless work in this case.

An alternative optimization is not calling highlightFTSResults() at all
when the regular expression is empty, but that would skip the
closeSearch() call and keep the FTS search frame visible on a page with
an empty regexp.
2022-07-01 19:48:42 +03:00
Igor Kushnir c936d03fa0 Replace a fruitless check with an assertion
This reduces CPU time waste and simplifies adding Qt WebEngine support.
2022-07-01 18:43:43 +03:00
xiaoyifang 7bcdfac334
Merge branch 'goldendict:master' into staged 2022-06-21 07:52:25 +08:00
Igor Kushnir 39abe4f1a6 Restart search when case sensitivity changes
One issue with the current implementation is that a wrong-cased match
remains selected when the user checks the Case Sensitive checkbox.
Another issue is that the noResults property of searchText is not
updated right away, which means that searchText's background color
remains wrong until next search.

Handle toggling case sensitivity in the same way as editing the searched
text: restart search from the beginning of the page. This improves the
Search-in-page UI consistency.
2022-06-20 19:18:57 +03:00
Xiao YiFang 1830415da5 fix: highlight a rare case when toPlainText omit space between two words 2022-06-16 21:03:58 +08:00
Xiao YiFang 4b9d71376d remove javascript highlight logic
webengine's findtext(highlight) has little features compared to webkits
2022-06-16 08:08:49 +08:00
Xiao YiFang 5571f877bc fix: F12 inspect windows open on the first time 2022-06-15 08:12:27 +08:00
Xiao YiFang 4cf184d646 fix upstream merge conflict 2022-06-15 07:51:45 +08:00
Xiao YiFang 949ad6de57 fix mergeconflict when merge upstream 2022-06-14 22:07:01 +08:00
Igor Kushnir 9b5756d5e1 Don't update pages history in ArticleView::setCurrentArticle()
The current article is saved to pages history user data before any
navigation to another page and before reloading the current page.
Therefore saving it each time the user activates an article is
redundant. This redundancy is not consistent, because when a user
activates an article by clicking on it, the current article changes in
the UI, but is not immediately saved in history as setCurrentArticle()
is not called. The inconsistent redundancy is a waste of CPU time and
can hide bugs.
2022-06-12 21:26:09 +03: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 0173251b22 Jump to the first article too after expanding optional parts
When the first article in the list is current, expanding or collapsing
optional parts results in:
1) uncontrolled jumps due to the content height changes if the scroll
   position is not (0, 0);
2) current article change if a non-first article is saved in history
   user data (e.g. if a mouse click had made the first article active).

Treat the first current article in the same way as non-first ones.

This change also affects the case when the current article is not
present in the article list. If the current article is simply empty,
then there is no behavior change. If the current article is not empty,
it *must* be in the list, unless something else went wrong.
2022-06-12 20:14:22 +03:00
Igor Kushnir de69036e9e ArticleView: deduplicate expand-optional-parts code 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 ca0209faff Save current article and window position before loading DSL picture
Without the added saveHistoryUserData() call, returning back from the
enlarged picture page ("gdpicture") restores the current article and the
window position that were last saved. At this commit the "gdpicture"
behavior is consistent with regular links: returning back from the
enlarged picture page sets the article with the picture as current and
restores the window position at the time of the click on the picture.
2022-06-12 20:13:54 +03:00
Igor Kushnir 10d0d8193b setCurrentArticle(): return false if the article doesn't exist
201f11e656 missed this possibility and may
have inadvertently changed the application behavior in a corner case.
2022-06-08 19:05:02 +03:00
Xiao YiFang 9daff6ae37 support mdex builtin link entry: 2022-06-07 08:14:53 +08:00
Xiao YiFang 5f856bf2ae refactor getqueryword 2022-06-07 08:14:53 +08:00
Xiao YiFang 80021a6328 opt: findText will clear the last findText , so this line is useless
it will override by the following findText
2022-06-03 13:09:18 +08:00
Xiao YiFang b5d005d3ed opt: clear the delayedHighlight text earlier 2022-06-03 12:32:27 +08:00