Commit graph

86 commits

Author SHA1 Message Date
Xiao YiFang 794d4b934f fix: replace hhotkeyedit with qkeysequenceedit
related to #291
2022-12-30 01:11:22 +08:00
shenleban tongying 9828ef9dc8 perfect_dark: add toggle option to enable Dark Reader mode 2022-12-26 12:29:30 -05:00
shenleban tongying 870e18aa29 mac: ensure tabbar always show full name 2022-12-22 02:24:07 -05:00
Xiao YiFang c53cd32fe7 ui:rearrange controls in preference dialog 2022-12-18 12:34:51 +08:00
Xiao YiFang 41d05cb27a feature: enhance clipboard data processing
when copied text from some applications such as Kindle PC, the copied text will have extra informations added by
the application . This option used to strip the added text away
2022-12-13 21:42:53 +08:00
Xiao YiFang d969b63c1e add experimental darkmode
relate #188
2022-12-11 09:29:33 +08:00
xiaoyifang def764e5ac replace by-sa-2.0 icons 2022-12-05 10:21:50 +08:00
shenleban tongying 664a1e87e4 Remove ScanPopup Alt mode ("Keys may also be pressed afterwards").
The functionality of "select then press a key to get popup " has equivalent of using Ctrl+C+C on Hotkeys.
2022-11-20 04:12:58 -05:00
shenleban tongying e6b9810cc7 Group Selection related Settings together 2022-11-19 12:28:11 -05:00
shenleban tongying 20b435053f X11: Add two Preferences to optional tracking clipboard or selection tracking 2022-11-19 11:35:25 -05:00
shenleban tongying aa3778bb64 Remove enableScanPopup: Complete. Remove from config file and ui file
At here, all code working exactly same as before
The only change is that ScanPopup always enabled for all users
2022-11-19 09:50:20 -05:00
xiaoyifang ea21eba386 fix revert c5035d87fc conflict
related to the issue #203
2022-11-17 16:43:42 +08:00
Xiao YiFang 11b29d30a7 clean code:remove x11 scanpopup flag setting 2022-09-25 12:49:22 +08:00
Xiao YiFang c5035d87fc opt:remove scan popup options 2022-09-17 23:03:17 +08:00
Xiao YiFang 8e4c326341 Revert "opt: rewrite ctrl+C+C logic ,use clipboard not global hot key (#139)"
This reverts commit a66bdf2962.
2022-09-11 09:36:52 +08:00
xiaoyifang a66bdf2962
opt: rewrite ctrl+C+C logic ,use clipboard not global hot key (#139)
* opt: rewrite ctrl+C+C logic ,use clipboard not global hot key
2022-09-08 19:58:52 +08:00
Xiao YiFang 0a2661f986 add 'send to anki' function
users can configure the ankiconnect to use together with anki
2022-05-21 17:34:22 +08:00
Xiao YiFang fbfc2d7f43 feature: add anki connect configuration 2022-05-21 10:30:32 +08:00
Xiao YiFang 41f2ca9864 clean code: remove outdated code
xorg xrecord detection logic
2022-05-20 08:24:23 +08:00
Xiao YiFang 9c402d986e opt: add dictionary fallback font family settings 2022-05-08 16:44:09 +08:00
YiFang Xiao f6cf152804 Merge branch 'feature/add-ignore-punctuation' into staged 2022-04-23 22:34:05 +08:00
YiFang Xiao d3ef9498c5 fix: scanpop dialog flag ui 2022-04-23 17:59:48 +08:00
xiaoyifang 5a0a6c6491 feature:add ignore punctuaion option 2022-04-23 16:15:23 +08:00
xiaoyifang 948f67f4c1 ui: top margin reset to default. 2022-03-27 14:29:06 +08:00
xiaoyifang bcab27c281 format:ui preferences.ui align top 2022-02-19 19:53:33 +08:00
yifang 3abe4ca062 ui:preference dialog,the top margin removed 2022-02-12 13:04:33 +08:00
yifang 71cd723985 ui:set interface(first tab) as default tab 2022-02-12 13:03:17 +08:00
Igor Kushnir d7ec541383 Add "Automatically scroll to target article" option
When a user clicks on a link in a dictionary or requests translation of
a word by double-clicking or translates selection via the context menu,
at first the article from the highest-priority dictionary is at the top.
Then, after approximately one second, the article from the dictionary,
out of which the translation was requested, becomes current and the view
scrolls down to this article placing it on top, hiding articles from the
dictionaries above it.

Such application behavior is inconvenient in some workflows so that the
user manually navigates to the top dictionary translation when this
automatic scrolling happens.

For example: a user has English->Russian dictionaries and
English->English dictionaries. The English->Russian dictionaries are
higher up in the dictionary order because they provide easier/faster to
understand translations. Some rare words and phrases are missing from
the English->Russian dictionaries however. Thus the user occasionally
reads the English explanation of a word/phrase. When the user
double-clicks on a word or follows a link in the English->English
dictionary article, she would rather see translations from the
preferable English->Russian dictionaries.

The new option allows to disable automatic scrolling and ensure that
articles from higher-priority dictionaries are visible. The option
doesn't affect backward/forward navigation via arrow buttons or
Alt+Arrow shortcuts: these still scroll to the stored vertical position
among articles. This remaining automatic scrolling happens much faster,
is not a problem for the described use case and hopefully for other use
cases.
2022-02-12 12:48:48 +08:00
xiaoyifang 12fca6e38c imp. remove mouseover32 preferences.ui configuration . 2022-02-03 16:55:11 +08:00
xiaoyifang c96a83f5d2 imp. remove mouseover32 2022-02-03 16:55:10 +08:00
xiaoyifang 089b08bc06
Update preferences.ui
high dpi:change preference Audio tab icon
2022-01-26 09:30:41 +08:00
xiaoyifang 9c5d7acc5a high dpi:change icon 2022-01-25 22:54:17 +08:00
xiaoyifang 9cf5ee8443 high dpi:change icon reference in code from png to svg. 2022-01-24 22:23:38 +08:00
Igor Kushnir b7da546dd5 Fix string case in all files: Goldendict => GoldenDict
Run the following string-replacement command in my GNU/Linux system:
    git grep -l Goldendict | xargs sed -i 's/Goldendict/GoldenDict/g'
2020-11-19 18:36:35 +02:00
Igor Kushnir aba8997438 Increase inputPhraseLengthLimit option's maximum
Those who use GoldenDict to translate long text with Google Translate
or pronounce it with a text-to-speech engine (see a discussion in
comments under #1313) may still want to limit the input phrase length.
But they might prefer a limit greater than the current maximum - ten
thousand symbols. Ten million minus one symbols should be generous
enough. I don't want to increase the maximum further to avoid excessive
widening of spinboxes in the Preferences UI. Besides, a ten megabyte
input phrase freezes GoldenDict's UI with high CPU usage for a minute on
my system.
2020-11-19 17:58:35 +02:00
Igor Kushnir dea11ca080 inputPhraseLengthLimit option's single step: 5 => 10
This speeds up decreasing the default value that is probably too large
for most users. I think that very few users would want to tune this
option's value finer than 10. Those who need such precision can enter
the desired number manually.
2020-11-19 12:56:29 +02:00
Igor Kushnir 193aa4e31d Set up network disk cache for articleNetMgr
When a Wikipedia article is already cached, this change reduces the
amount of sent and received network data almost tenfold.

Setting up a network disk cache in the same way for dictNetMgr does not
noticeably impact the amount of network traffic. Either this network
access manager sends and receives very little data or the data is never
the same. So dictNetMgr does not need a disk cache.

Use QNetworkDiskCache's default maximum size of 50 MiB as the default
network cache size. This size is large enough to accommodate tens of
huge MediaWiki articles. It is also small enough that the user is
unlikely to run out of disk space because of the cache.

Clear network cache on exit by default because most users probably
don't load the same online articles after restarting GoldenDict. Plus
storing the network cache on disk indefinitely by default would be a new
and unexpected to the users privacy risk.

Nikita Moor came up with the idea and wrote an initial network disk
cache implementation in #1310.
2020-11-18 19:04:28 +02:00
Abs62 c02915d5e5 1. Set limit input phrase length option turned off by default
2. Set input phrase length limit to 1000 by default
2020-11-16 18:12:17 +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
Abs62 48e850c7ec Fix typo 2018-06-13 22:01:13 +03:00
Abs62 d7bc012411 Add option to ignore diacritics while articles search 2018-06-13 19:00:42 +03:00
Abs62 b7dbb6cd96
Merge pull request #999 from vedgy/move-send-to-main-window-option-in-ui
Move scanToMainWindow checkbox out of enableScanPopup group box
2018-04-17 20:31:33 +03:00
Igor Kushnir 5c74494935 Linux-specific: Add an option to disable scan popup inside Goldendict
When scan popup is configured to appear without any key modifiers
pressed and is active on X11, it interferes with selecting text inside
the scan popup window (or inside the main window if "Send translated
word to main window" option is enabled). It also makes searching text
inside article definition impossible - in the main window and
even more so in the scan popup window.

However, when scan popup is configured to appear only when some keys are
pressed, or when the scan flag feature is enabled, it may work fine
inside Goldendict windows.

It is possible to automatically decide whether to show scan popup when
selection or clipboard inside Goldendict changes. But such logic might
be unsuitable for some use cases. For example, invoking scan popup by
selecting article definition text in the main window works fine.
Therefore this commit makes ignoring selection and clipboard changes
inside Goldendict itself optional. This commit implements one of two
feature requests in issue #606.

This new option could have effect on non-X11 platforms if the hidden
trackClipboardChanges option is enabled. But it is much less useful on
these platforms because scan popup without key modifiers is unusable
there (at least under Windows). Let us show and use the option only on
X11 to avoid cluttering Preferences UI on other platforms.
2018-04-17 20:13:25 +03:00
Igor Kushnir fa308aae96 Move scanToMainWindow checkbox out of enableScanPopup group box
This option has effect even when scan popup functionality is disabled -
when the Ctrl+C+C hotkey is triggered. So the scanToMainWindow checkbox
should not be disabled when enableScanPopup is unchecked. Fixes #716.
2018-04-17 16:48:56 +03:00
Igor Kushnir 15dfdee49f Allow customizing unpinned scan popup window flags on X11 with Qt5
My tests in many desktop environments and window managers indicate that
no single configuration works perfectly in all environments. There are
also behavior differences between Qt::Popup and Qt::Tool flags, which
are not exactly bugs, so I suppose users might subjectively prefer
different options.

Customizing the flags allows the user to prevent unpinned scan popup
window flickering with Qt5 on Linux. In a way adding these options fixes
issue #645, which is: the scan popup window blinks rapidly, barely
noticeably in some applications, such as Calibre ebook-viewer
and Chromium. In this case the scan popup window usually ends up hidden
when selection ends, unless it was finished with a jerk.

I have tested the new options in 9 desktop environments and window
managers: at least one configuration for each eliminates #645 and makes
the scan popup window work the same as with Qt4 in this regard:
the popup window remains visible, text in the popup's translation line
keeps up with the text selection in the external application,
and the selected text is being translated on the fly.

Moreover, for each tested DE/WM, at least one configuration makes
the scan popup window work perfectly as far as I am concerned.

This issue was partially worked around with a 200ms scan popup delay
timer in the recent commit 58e41fe3ce
for the duplicate issue #854. However the timer solution is incomplete
because it requires the user to select text quickly and without delays.
If global mouse selection does not change for 200ms while the left mouse
button is held down, the user will likely not see the scan popup when
(s)he finishes selection, and will have to try selecting again -
hopefully faster this time.

The 200ms delay is no longer critically important after this commit,
but it is still beneficial: the lookup query changes less often,
which in turn reduces article definition update frequency.
So the delay improves the UI (perhaps subjectively) and performance.
2018-04-15 19:46:35 +03:00
Igor Kushnir 9aa3c44d4e Add QMediaPlayer internal player back end (Qt5 only)
* add config and GUI support for internal player back end switching;
* make FFmpeg player disabling option consistent with other similar
  qmake options by using CONFIG;
* add a new qmake option that disables Qt Multimedia player. This is
  useful for GNU/Linux distributions where Qt WebKit and Qt Multimedia
  packages depend on different GStreamer versions and don't work
  correctly when combined in one application.

The existing FFmpeg+libao internal player back end has a relatively
low-level implementation, which is difficult to understand and improve.
There are at least 3 open internal player issues:
  1) many GNU/Linux users have to edit their libao configuration file to
     make Goldendict's internal player work (issue #412);
  2) libao's pulseaudio plugin does not support 32-bit audio, which
     means that many MediaWiki pronunciations don't work with the most
     popular GNU/Linux audio driver (issue #949);
  3) Ffmpeg::DecoderContext uses deprecated FFmpeg APIs, which causes
     compiler warnings and means that this internal player back end
     may not compile with a future FFmpeg library version (issue #978).

The Qt Multimedia back end implementation uses the highest-level
Qt audio API and is very simple.
This new back end works flawlessly on my GNU/Linux machine.
I'm not making it the default back end because I don't know how well
it will work on other platforms with different configurations.
2018-03-30 17:10:33 +03:00
Boyuan Yang 2c80aa4c67 Fix typos found by codespell 2017-09-16 21:18:42 +08:00
sunwxg ad8008c37b Add scan popup flag
After select a word, show a flag window, click the flag to show
popup window.
2017-06-05 21:15:38 +08:00
Abs62 caf39bfdb5 Add option for turn on/off confirmation for favorites items deletion 2017-05-17 18:26:32 +03:00
Abs62 72523dcfb4 Add option to periodical save of Favorites 2017-05-13 13:18:25 +03:00