Commit graph

3463 commits

Author SHA1 Message Date
Xiao YiFang 4e4c9375be opt: langcoder optimization 2022-06-23 20:03:29 +08:00
Xiao YiFang af4946d7a7 fix upstream merge conflict 2022-06-22 17:48:52 +08:00
Xiao YiFang 01a8995504 the headword length is not correct
due to the parse of the headword length ,   the last headword has incorrect data length ,which has
cross over many headwords.

the string(constData) will ignore the other headwords coming behind the \0 character.
2022-06-22 07:52:19 +08:00
Igor Kushnir 7fa7ad6e52 FFmpeg 5.0 player: stop reading raw data at EOF
Since the update to FFmpeg 5.0, when FFmpeg+libao internal player is
selected, most sounds fail to be pronounced. Furthermore, each failed
pronunciation attempt increases GoldenDict's CPU usage. Finally,
GoldenDict continues to hang and utilize the CPU cores when the user
attempts to exit it.

The reason for the issue is: GoldenDict's readAudioData() returns 0 at
EOF but FFmpeg expects the callback to return AVERROR_EOF. As a result,
internal player's threads are busy calling readAudioData() indefinitely.

a606f27f4c
documented the expected return value of the read_packet callback.
252500a78f
removed the code that handled the deprecated 0 return value gracefully.

The relevant deprecation warning
"Invalid return value 0 for stream protocol" had been flooding
GoldenDict's output for years

Fixes #1489.
2022-06-21 17:53:23 +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
xiaoyifang 8ee6446df1
Merge pull request #104 from xiaoyifang/fix/concurrent-run
concurrent run will crash application
2022-06-19 21:22:30 +08:00
Xiao YiFang bd02d65ecc concurrent run will crash application 2022-06-19 20:26:39 +08:00
Xiao YiFang 6ff042d56f fulltext search can not cancel 2022-06-19 14:56:18 +08:00
Xiao YiFang 4edd3b3987 add mutex to scopedmemmap 2022-06-19 13:26:41 +08:00
Xiao YiFang 3c02fb7499 bump alpha version to 22.6.22 2022-06-19 10:16:31 +08:00
Xiao YiFang f65d47602a concurrent excepton 2022-06-18 20:46:17 +08:00
Xiao YiFang ff5e3b5778 feat:optimize fulltext search ,skip unfinished ftx 2022-06-18 18:50:05 +08:00
Xiao YiFang a5726aead7 replace regularexpress with global static variables 2022-06-18 18:20:58 +08:00
Xiao YiFang afd477e3a6 fix:a very race case boundary protection
need further inverstigation
2022-06-18 13:53:26 +08:00
Xiao YiFang 9472e1a06c code simplified 2022-06-18 12:50:12 +08:00
Xiao YiFang 3d3088738e revert mutex parent class from qrecursivemutex to qmutex 2022-06-18 09:17:43 +08:00
Xiao YiFang 7a43cc366e use qmutex instead of mutex(qmutexrecursive) 2022-06-18 09:09:49 +08:00
Xiao YiFang 6d5ff66008 feat: cancel fulltext search 2022-06-17 21:41:45 +08:00
Xiao YiFang 2f3af9d7d3 map nullptr check 2022-06-17 20:37:59 +08:00
Xiao YiFang fa72de7b17 github:ubuntu 6.x appimage 2022-06-17 20:29:02 +08:00
Xiao YiFang ceb31baf97 add mutex to getBlock 2022-06-17 20:23:16 +08:00
Xiao YiFang 5c4a968781 github:upgrade qt6.3.0 to qt6.3.1 2022-06-16 21:08:01 +08: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 2da252539a auto file unmap 2022-06-16 20:37:26 +08:00
Xiao YiFang 947323854a remove extra parantheses 2022-06-16 20:28:00 +08:00
Xiao YiFang 02f7fc0048 opt: concurrent limitation and auto release semaphore 2022-06-16 20:17:07 +08:00
xiaoyifang c42326834a
Update ubuntu-6.2.yml 2022-06-16 10:06:46 +08:00
xiaoyifang f2ba7fc6c0
Update ubuntu.yml 2022-06-16 10:06:19 +08:00
xiaoyifang 8f3ff22fa5
Merge pull request #101 from xiaoyifang/feature/optimize-combine-cjk-search
optimize combine cjk search
2022-06-16 08:34:52 +08:00
Xiao YiFang 79e2f7c098 unmap file when throw exception 2022-06-16 08:18:59 +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 6f9c1067a3 opt: optimize cjk fulltext search
1, add concurrent parallel task limitaion
2022-06-16 08:08:43 +08:00
Xiao YiFang f52251d640 fix:mdict compact html parse style error 2022-06-16 08:00:40 +08:00
xiaoyifang 5fa479b127
Merge pull request #100 from xiaoyifang/feature/concurrent-fseek
feat:mdx lock free when loadArticle
2022-06-15 14:08:29 +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
Xiao YiFang 206474364a feat:mdx lock free when loadArticle 2022-06-14 21:35:21 +08:00
Xiao YiFang 53bd9f96dc concurrent minor changes
1, limit QtConcurrent thread count
2, add mutex to sets operation
2022-06-14 20:51:30 +08:00
xiaoyifang 5259be69e0
Merge pull request #99 from xiaoyifang/feature/github-action-release
github: add release changelog
2022-06-14 07:41:22 +08:00
Xiao YiFang 0088377266 clean code:remove useless code 2022-06-14 07:22:16 +08:00
Xiao YiFang ab0a8ed608 github: add release changelog 2022-06-13 22:00:01 +08:00
Xiao YiFang e8bcaa2252 style: move duplicate class together 2022-06-13 19:45:29 +08:00
Xiao YiFang ec5d2b12db style:do not allow dictionary title to be selected 2022-06-13 19:45:29 +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