Commit graph

65 commits

Author SHA1 Message Date
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 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
Abs62 15b10bcbc9 Merge branch 'Original' into Qt4x5 2014-10-03 15:29:18 +04:00
Abs62 ebad891e34 Handle "audio" tag in Wiki-dictionaries to play sounds via GD player 2014-07-24 18:10:36 +04:00
Abs62 b9666f7f9f Merge branch 'Original' into Qt4x5
Conflicts:
	bgl_babylon.cc
2014-05-12 18:10:26 +04:00
Abs62 4120213ee8 Rename "DPRINTF" and "FDPRINTF" debug macro 2014-05-11 01:02:31 +04:00
Abs62 34271ecc1d Merge branch 'Temp' into Qt4x5
Conflicts:
	article_maker.cc
	article_netmgr.cc
	articleview.cc
	forvo.cc
	goldendict.pro
	hotkeywrapper.cc
	hunspell.cc
	mainwindow.cc
2013-12-18 19:09:48 +04:00
Abs62 444938a330 Fix logging to file UTF-8 encoded messages 2013-11-16 22:34:09 +04:00
Abs62 1f87d8a911 Merge branch 'master' into Qt4x5
Conflicts:
	btreeidx.cc
	goldendict.pro
	lsa.cc
	mouseover.cc
	sounddir.cc
	xdxf2html.cc
2013-09-27 17:03:27 +04:00
Abs62 c7b04526d2 Possibility to log GD console messages into file "gd_log.txt" in GD config directory. Activated by "--log-to-file" key in command line. 2013-09-20 18:25:44 +04:00
Timon Wong e09ca5402d Merge branch 'master' into qt4x5
Conflicts:
	goldendict.pro
2013-08-19 10:54:38 +08:00
Tvangeste 148fd1f275 Fix compilation failures with Visual C++ 2012 (issue #375) 2013-08-07 20:29:36 +02:00
Timon Wong ee0fc80001 Merge branch 'master' into qt4x5
Conflicts:
	articleview.cc
	btreeidx.cc
	goldendict.pro
	mediawiki.cc
2013-08-02 17:00:16 +08:00
Abs62 c1cfbae60e Enhanced support for RTL languages in articles 2013-07-10 17:48:09 +04:00
Timon Wong f30c41dbf6 Remove Url::Class, add Qt4x5::Url::ensureLeadingSlash() and fix all related 2013-05-31 12:20:25 +08:00
Timon Wong ad4394d02b #212: Workaround for Qt5 changed behavior in QUrl::setPath() 2013-05-30 23:05:41 +08:00
Timon Wong 1d85f1b359 #212: Scratch, currently works under windows, for both Qt4 and Qt5 2013-05-30 21:24:21 +08:00
Tvangeste 05070b4fc8 Eliminate some compiler warnings (in Release mode). 2013-02-04 14:46:52 +01:00
Julian Depetris Chauvin 25be9b074a Check if icon is loaded before trying to load it again 2013-01-31 19:30:11 -03:00