Commit graph

82 commits

Author SHA1 Message Date
shenleban tongying 7feb883408
refactor: move all dictionary parsers to /src/dict/
If a file contains `makeDictionaries` then it belongs to there
2023-04-17 16:55:34 -04:00
shenleban tongying 540dda26ed cleanup: Replace all usages of qrcx://localhost with qrc://
The replacement command:
git grep -l 'qrcx://localhost' | xargs sed -i 's/qrcx:\/\/localhost/qrc:\/\//g'

The qrcx:// URL scheme was introduced in 2009 or earlier - it is present
in the first commit in GoldenDict's git history. Back then GoldenDict
supported Qt versions earlier than 4.6, in which
QWebSecurityOrigin::addLocalScheme() was introduced. Adding the qrc URL
scheme as local obsoletes the qrcx URL scheme. GoldenDict does not
compile against Qt versions earlier than 4.6, so there is no reason to
use this custom URL scheme anymore.

Co-authored-by:  Igor Kushnir <igorkuo@gmail.com>
2023-03-05 15:20:05 -05:00
Xiao YiFang 6151c914f5 fix:wikipedia url request 2023-03-02 21:23:35 +08:00
xiaoyifang 7a3755333c Merge remote-tracking branch 'gd/master' into staged 2023-02-08 09:47:51 +08:00
Igor Kushnir e1e70e6a6c Wiki: parse sections and generate ToC if absent from HTML
Fixes #1601
2023-02-07 19:56:18 +03:00
shenleban tongying 2aeed5e705 clang-tidy: apply modernize-use-override 2022-12-29 02:14:53 -05:00
shenleban tongying fcfa4e43e2 refactor: replace escaped strings with raw strings via clang-tidy 2022-12-24 17:01:50 -05:00
xiaoyifang 08c0df49e1 fix: change macro QT_NO_OPENSSL to QT_NO_SSL 2022-12-15 15:11:09 +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
Xiao YiFang ceb4a00d2e opt:add wikipedia url to whitelist. 2022-07-11 21:01:49 +08:00
Xiao YiFang ba10f68c1c clean code: replace throw() with noexcept 2022-06-03 21:29:06 +08:00
xiaoyifang 64d989f9c5 clean code:remove unnecessary typedef 2022-04-05 20:53:25 +08:00
xiaoyifang a9a457cc00 optimize: add specific icon for wiktionary 2022-03-24 20:14:01 +08:00
xiaoyifang 7b5511a7bd upgrade to qt6.2 2022-03-11 22:00:45 +08:00
xiaoyifang 84dcc1cbb1 optimize:wikidictionary ,remove 200ms delay. 2022-02-25 23:41:54 +08:00
xiaoyifang c2b466ce19 Merge branch 'feature/cpp-refactor-code' into staged 2022-02-03 17:51:40 +08:00
yifang 65fcedd44a improvement:mediawiki request will hang forever,if can not access .
set the timeout to improve UX.
2022-01-15 12:53:19 +08:00
xiaoyifang c7d33f4eb9 clean code: remove old cpp feature 2022-01-09 16:35:07 +08:00
xiaoyifang 5eac08c97a rename qt4x5.hh to utils.hh
the filename qt4x5 is not proper now,for the qt4 version can never meet.and the qt5 is actually mean qt>5 .
2021-12-13 22:45:35 +08:00
yifang.xiao 0365015ac6 clean code:
remove "#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )" check ,the check should always be true based on current situation.
2021-12-13 22:45:33 +08:00
yifang.xiao f39429f35a remove IS_QT_5 2021-12-13 22:45:28 +08:00
xiaoyifang 402add183e clean qt_version < 5 code. 2021-12-13 22:43:46 +08:00
Igor Kushnir df192bf555 Don't show duplicate MediaWiki articles
Duplicate articles can be shown when the alts collection is not empty
and a MediaWiki site redirects multiple words to a single page. The
alts collection can be populated when:
* option Preferences=>Advanced=>"Extra search via synonyms" is enabled;
* a Morphology dictionary is active;
* a translation of a phrase is requested in a way that makes GoldenDict
  pass the input phrase to Preferences::sanitizeInputPhrase().

Steps to reproduce 1:
1. Create and switch to a dictionary group with (1) "English Wikipedia"
   and (2) "English (US) Morphology" dictionaries in it.
2. Request a translation of the word "plays" (without quotes).

Steps to reproduce 2:
1. Create a dictionary group with "English Wiktionary" dictionary in it;
   switch to this group in the scan popup window (or in the main window
   if the Preferences=>Scan Popup=>"Send translated word to main window"
   option is enabled).
2. Select the word "i.e." (without quotes) and press Ctrl+C+C (or
   whatever hotkey is configured to translate a word from clipboard).
2021-06-17 12:06:36 +03:00
Igor Kushnir 57c4c33780 Add support for *.oga audio files
For example, the first audio link in "The United States" English
Wikipedia article - "The Star-Spangled Banner" - ends with ".oga".
Without this commit the audio link is not recognized by GoldenDict:
* it is not pronounced when a Preferences=>Audio=>"Auto-pronounce..."
  option is enabled;
* clicking on the link opens it in the default browser instead of
  playing inside GoldenDict.
2021-06-12 07:53:19 +03:00
Igor Kushnir 261e45a5d7 MediaWiki: remove the obsolete "fix audio" replacement
I have searched for the "<button" string and even for the "<\s*button"
pattern in tens of articles from all 5 default Wikipedia and all 5
default Wiktionary sites. Found none. I assume this pattern is obsolete.
Removing this useless code improves performance by doing less searching.

I have run the following command on directories that contained many
Wikipedia and Wiktionary articles received by GoldenDict:
  pcregrep -MrI --buffer-size 20M '<\s*button' DIR-WITH-ARTICLES
2020-12-09 12:19:46 +02:00
Igor Kushnir dec59439b9 MediaWiki: remove the /wiki/ prefix from links w/o regexp
This string replacement is 3-5 times faster than the QRegularExpression
replacement in "The United States" and "Paris" English Wikipedia
articles on my GNU/Linux system.

Before fe39fc8a05 the pattern started with
"<a\\shref=" instead of the current "<a\\s+href=", and no related bug
has been reported. I haven't encountered any whitespace character other
than space in this position. I believe that a single tab or a single EOL
character do not make sense after "<a". So a regression is unlikely.

I have searched for a tab or a newline character after "<a" and for a
whitespace character after "<a " in tens of articles from all 5 default
Wikipedia and all 5 default Wiktionary sites. Found none.

I have run the following command on directories that contained many
Wikipedia and Wiktionary articles received by GoldenDict:
  pcregrep -MrI --buffer-size 20M "$PATTERN" DIR-WITH-ARTICLES
with PATTERN='<a(\t|\n)' and PATTERN='<a \s+href'.
2020-12-09 12:19:10 +02:00
Passw 30a61c0ee0
remove dead assignment in mediawiki.cc 2020-10-25 20:12:33 +08:00
Abs62 9bae6d2201 Wiki: Fix urls in "srcset" attribute (issue #1096) 2019-03-04 19:38:15 +03:00
Abs62 d7bc012411 Add option to ignore diacritics while articles search 2018-06-13 19:00:42 +03:00
Abs62 fd00e9d156 Fix gcc 7.3 compiler warnings (#issue 978) 2018-05-21 18:32:04 +03:00
Abs62 357638b033 Wiki: Fix handling of url's without urls scheme 2018-03-11 16:33:17 +03:00
Abs62 f2294ec3b6 Wiki: Fix parsing of "audio" tags (issue #967) 2018-03-11 16:08:37 +03:00
Abs62 cbdad22f2d Qt5: Some optimizations for QRegularExpression 2018-02-28 17:15:27 +03:00
Abs62 fe39fc8a05 Qt5: More QRegularExpression instead of QRegExp 2018-02-27 20:18:35 +03:00
Abs62 109bd56f39 Wiki: Fix work with headwords containing the '+' sign 2018-01-31 20:54:51 +03:00
Igor Kushnir deea197ca7 Fix subpage links in MediaWiki
I haven't encountered any prefix other than "/wiki/" that should be
discarded. If there are such other prefixes, I think they would conform
to some pattern, and so the replacement code could be adjusted to
accommodate them.

This commit fixes #813.
Examples of pages with subpage links in English Wikipedia that are fixed
by this commit: "Asio (disambiguation)", "Asio C plus plus library".
This issue is much more prevalent in Wookieepedia because it has
a two-tab link system with the patterns */Legends and */Canon.
2018-01-31 14:09:19 +02:00
Abs62 a1a8ece42c Call disconnect() before deleteLater() for QNetworkReply objects 2017-03-20 17:31:02 +03:00
Abs62 229bcc8ef5 Wiki: Fix some image urls 2016-06-14 00:15:12 +03:00
Abs62 436edad84d Merge branch 'Original' into Qt4x5 2016-04-22 17:59:01 +03:00
Abs62 dad18b8113 Fix crash at quit while some network queries still active 2016-04-21 18:14:04 +03:00
Abs62 47936e236d Merge branch 'Temp' into Qt4x5 2015-11-01 16:08:10 +03:00
Abs62 cf3ec5dfc1 Wiki: Handle inter-article anchors 2015-10-31 22:26:50 +03:00
Abs62 e24de4d881 Merge branch 'Original' into Qt4x5
Conflicts:
	xdxf2html.cc
2015-10-14 18:23:46 +03:00
Abs62 a8df5c941f Wiki: Fix some links handling (issue #615) 2015-07-24 18:00:39 +03:00
Abs62 3275bc462c Merge branch 'Original' into Qt4x5 2015-06-24 17:55:06 +03:00
Abs62 8717a56910 MediaWiki engine: Fix resource urls for SSL connection (issue #609) 2015-06-24 17:50:14 +03:00
Abs62 9b44890a01 Merge branch 'Original' into Qt4x5 2015-02-26 18:06:49 +03:00
Abs62 20396aa988 Wiki's: Ignore SSL connection errors 2015-02-20 17:18:03 +03:00
Abs62 4b8de48e5c Merge branch 'Original' into Qt4x5 2014-11-27 18:53:52 +03:00
Abs62 610408c78a Fix wiki relative image url (issue #544) 2014-11-21 18:49:14 +03:00