Commit graph

204 commits

Author SHA1 Message Date
yifang aaea8d8e04 code clean: format 2022-01-01 18:19:11 +08:00
yifang 3ebe5c9b23 fix: translateLine text disappeared after main windows hide and show up again. 2021-12-30 21:19:50 +08:00
yifang 81c2e8d3b5 fix:zoom in does not take affect. 2021-12-30 20:41:38 +08:00
yifang a1c0cfa042 single click to open external link in external browser 2021-12-29 23:28:26 +08:00
yifang 09063ecc5a clean code:
QString::SkipEmptyParts=>Qt::SkipEmptyParts
2021-12-29 22:29:06 +08:00
yifang 77ed32dca6 cors support 2021-12-29 20:09:29 +08:00
yifang 0f08026d3f right context menu link . 2021-12-28 21:59:49 +08:00
yifang d90c528819 onJsActiveArticleChanged was remove unintentionaly 2021-12-19 18:58:48 +08:00
yifang f292e0c251 add javascript qt object to html(used to communicate between html and c++)
add jquery framework .
2021-12-19 18:37:27 +08:00
yifang de3d7b8b19 clean code:remove QT_VERSION check 2021-12-16 19:59:00 +08:00
xiaoyifang e04aa50a99 fix issue mentioned in https://github.com/goldendict/goldendict/issues/1393#issuecomment-993716654 2021-12-15 23:43:03 +08:00
yifang 8e2eac0836 remove useless comment line 2021-12-13 22:46:02 +08:00
yifang a2baf836e4 refactor code.F12 optimize 2021-12-13 22:46:02 +08:00
xiaoyifang cb5ac438fe bword link in Hunspell dictionary. 2021-12-13 22:46:02 +08:00
yifang.xiao 608f39244e single click distinguish with double click 2021-12-13 22:46:01 +08:00
yifang 98ca729446 remove qt_version_check macro 2021-12-13 22:45:57 +08:00
yifang.xiao b148c557c9 convert async to sync invoke 2021-12-13 22:45:55 +08:00
xiaoyifang 9b179dac3c runjavascript async->sync 2021-12-13 22:45:53 +08:00
yifang.xiao 5f86c33f8d F12 inspect element 2021-12-13 22:45:49 +08:00
yifang.xiao c56407863c use Eventloop to convert async function to sync function.based on current situation ,I think it would be better to keep the sync mode. webengine use aysnc callback,while webkit use sync function 2021-12-13 22:45:39 +08:00
xiaoyifang 303179b410 clean code:
remove qt version check
save geometry
2021-12-13 22:45:35 +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 69db1d4c71 fix conflict 2021-12-13 22:45:20 +08:00
xiaoyifang e7779e5302 fix todo 2021-12-13 22:43:46 +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.xiao ab358fb3a5 remove old qt(<5) code. 2021-12-13 22:43:43 +08:00
yifang.xiao 20d51afb8d remove old qt(<5) code. 2021-12-13 22:43:28 +08:00
xiaoyifang 66ed1c0507 optimize javascript scrollIntoView 2021-10-20 23:44:24 +08:00
yifang c1eef3a228 remove inspector -- useless code 2021-10-05 09:51:51 +08:00
yifang f13c713265 right panel founded dictionaries 2021-10-05 09:23:30 +08:00
xiaoyifang 09441a8b72 found in dictionaries list widgets 2021-10-04 15:27:49 +08:00
xiaoyifang bdb9561ec9 rename scheme handler 2021-10-02 20:48:49 +08:00
xiaoyifang 20c3a7241d fix: js unexpected error. 2021-09-25 10:17:05 +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 3b120ee765 1 remove useless code
2 define js variable to avoid js error
2021-09-24 21:42:55 +08:00
yifang bf2640bb25 play sound in the dictionary html 2021-09-23 13:05:05 +08:00
xiaoyifang bec982c51e remove dead code 2021-09-22 12:01:17 +08:00
xiaoyifang 17afc21478 1.js undefined error
2,disable chrome auto play feature
2021-09-22 11:20:42 +08:00
yifang 4a5af10277 add local scheme ,such as qrcx,gadu,etc. 2021-09-21 18:22:08 +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
xiaoyifang 3aadf52344 webkit to webengine 2021-07-15 22:58:32 +08:00
Igor Kushnir f919685797 Extract duplicated "gdfrom-" string manipulation into functions
Such helper functions facilitate understanding of the code and simplify
implementing new features.
2021-06-29 13:31:09 +03:00
Abs62 e1c9a0d6de Fix compilation without C++11 support 2021-06-18 21:33:24 +03:00
Igor Kushnir 60bc05218f Add input phrase's punctuation suffix to alts
Preferences::sanitizeInputPhrase() transforms an input phrase by
removing its whitespace/punctuation prefix and suffix. Translating a
phrase from X11 primary selection or from clipboard, via mouse-over or
from the command line results in such sanitization. This is useful when
a punctuation mark or a space is selected accidentally alongside a word.
This sanitization can be undesirable, however, when an abbreviated word
is selected. For example: "etc.", "e.g.", "i.e.".

This commit implements searching for the input word with the punctuation
suffix preserved as an alternative form of the sanitized word to show
articles for both. For example, when the word "etc." is translated from
the clipboard, both "ETC" and "etc." articles are displayed.

The punctuation suffix is preserved when the word is passed from the
scan popup to the main window and when the translate line text is
refreshed (e.g. when the current group is changed). The suffix is not
stored in history and favorites (doing so would require file format
changes and possibly substantial code changes, this can be implemented
later if need be).

Trim the input phrase once in ArticleNetworkAccessManager::getResource()
instead of verbose trimming in multiple places in
ArticleMaker::makeDefinitionFor().

Closes #1350.
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 61eb4e08fe Add options to limit input phrase length
When a long text is accidentally selected or copied while the scan popup
is on, Goldendict spends a lot of CPU time to gradually create a
"No translation..." article. When translation of huge (e.g. 15 MB) text
from the clipboard is (accidentally) requested, Goldendict freezes for a
while. Turning the added input phrase limit option on eliminates this
waste of the CPU time.

I have implemented these options primarily for selection and clipboard,
but they also affect mouse-over translation on Windows and command line
translation requests. This is mostly because I did not bother to limit
the options' scope. I guess hovering over an extremely long text without
spaces (e.g. Base64-encoded) could cause the same performance issue on
Windows. The command-line translation could be requested from a script
that integrates Goldendict with some other application, from which long
text could be sent for translation by accident.

I hope that the default value of 200 characters will be sufficient for
just about any real-world user input in any language. The option is on
by default, because the default length limit is generous and any longer
text is unlikely to be sent for translation intentionally. My personal
preference for the input phrase length limit is 100 symbols.

ArticleView::pasteTriggered() didn't call QString::simplified() on the
text retrieved from the clipboard. I assumed this was an oversight, so
now it *is* called - indirectly, via Preferences::sanitizeInputPhrase().
2020-11-13 17:44:38 +02:00