Commit graph

100 commits

Author SHA1 Message Date
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 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
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 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
Abs62 5fa5cc123f Full-text search: Allow ignore diacritics while search 2018-04-10 17:49:52 +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
Igor Kushnir d5998cabb7 Remove redundant option useExternalPlayer from Preferences
This change substantially reduces audio player configuration code
complexity. The single remaining bool option - useInternalPlayer -
is enough for the binary audio player implementation choice.

Removing the useExternalPlayer option doesn't change the application GUI
behavior except for minor differences in one or two corner cases, which
could be classified as bugs fixed by this commit. For example, before
this commit, if the configuration file contained the following lines
  <useExternalPlayer>0</useExternalPlayer>
  <useInternalPlayer>0</useInternalPlayer>
an external player would be actually used for audio playback, but
neither of the two audio radio buttons would be checked in
Preferences GUI, and audioPlaybackProgram line edit would be disabled.
Whereas, after this commit, an external player is still used for
audio playback, but useExternalPlayer radio button is checked
in Preferences GUI, and the audioPlaybackProgram line edit is enabled.
2018-03-30 17:03:45 +03:00
Abs62 0b6f36479d Add config file parameter to limit headwords number to expand multi-word headwords while indexing (issie #914) 2017-10-25 17:37:39 +03:00
Abs62 cdf2c0d404 Add option to ignore words order while full-text search 2017-07-25 18:28:29 +03:00
Abs62 a75dcfb7c5 ScanPopup: Add button to stay over all other windows (issue #659) 2017-07-13 18:00:19 +03: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
Abs62 1e34de2dbc Add "Favorites" feature 2017-05-12 17:41:08 +03:00
Abs62 fa9d1aecd9 Add option to enable/disable search via synonyms 2017-03-09 19:11:17 +03:00
Abs62 b7a707d7c0 Websites: Add alternative loading method 2016-06-17 19:31:16 +03:00
Abs62 fcc2758eb3 Merge branch 'Original' into Qt4x5
Conflicts:
	goldendict.pro
2015-10-27 18:08:57 +03:00
Zhe Wang b5ac249062 ChineseConversion: load OpenCC data files by relative path on Windows and OS X 2015-10-26 11:58:12 +08:00
Zhe Wang a1986254d2 ChineseConversion: conditional compilation and OpenCC exception handling 2015-10-26 09:38:22 +08:00
Zhe Wang ff7fa16e64 Distinguish between variants of traditional Chinese 2015-10-20 11:52:36 +08:00
Zhe Wang 12f67a79a4 Support conversion between simplified and traditional Chinese characters 2015-10-20 00:00:35 +08:00
Abs62 06431967ad Fix compilation with Qt 5.4 2014-12-12 17:04:27 +03:00
Abs62 d3a13bd154 Allow to choose help language 2014-06-25 18:01:11 +04:00
Abs62 3531a74c6e Add help buttons to dialogs 2014-06-24 17:55:06 +04:00
Abs62 d4c68d3c49 Add help system 2014-06-23 20:03:14 +04:00
Abs62 15d87e06b4 DICT servers: Add search strategy choose 2014-05-03 21:41:16 +04:00
Abs62 ceb04dbd6a DICT protocol support 2014-05-02 17:36:50 +04:00
Abs62 fd1d035c01 Add full-text search tuning tab to preferences dialog 2014-04-17 18:31:51 +04:00
Abs62 9ad0d5f985 Implement full-text search 2014-04-16 20:18:28 +04:00
Abs62 9623cbdd7a Add proxy authentication dialog 2014-04-03 18:21:02 +04:00
Abs62 fe9998f2bf Add system proxy choose in preferences 2014-04-02 17:54:50 +04:00
Abs62 4a4bfade1d Show all headwords for selected dictionary 2014-02-28 16:36:28 +04:00
Abs62 32a2cf55b9 Add config file option for track clipboard changes 2014-01-09 18:17:50 +04:00
Abs62 696fdbb994 Win-specific: Refactor of main window geometry saving 2013-12-20 18:25:33 +04:00
Tvangeste de2bf73e66 New interface preference: Context menu dictionaries limit
Controls both context menus, in the dictionary bar and in the article view.
Can be adjusted in Preferences -> Interface -> Context menu dictionaries limit.
By default, it is set to 20.
2013-06-11 20:31:01 +02:00
Abs62 d721e627b1 Allow to collapse/expand articles; auto collapse for big articles (issue #331) 2013-06-02 15:20:33 +04:00
Timon Wong 329aa02f93 Add "Inspect" action to context menu
* The "Inspect" action will bring up web inspector from WebKit.
* Restorable inspector window geometry.
2013-05-30 10:18:28 +08:00
Tvangeste 82e6648efc Added an option to hide GoldenDict identification in the HTTP User-Agent headers (Issue #259).
A new preference in the "Network" tab is added:
* Do not identify GoldenDict in HTTP headers.
2013-05-15 17:59:30 +02:00
Abs62 534509adaf Handle errors during configuration file loading 2013-05-08 20:50:06 +04:00
Timon Wong c4752eb14c Add internal audio player(ffmpeg/libav + libao).
* phonon, bass, playsound are removed.
2013-05-05 18:22:12 +08:00
Abs62 0fb8eed553 Win-specific: Add volume and rate tuning for TTS, fix some errors 2013-04-26 17:41:39 +04:00
Abs62 c14ef3458f Win-specific: Add TTS support for Windows (by Timon Wong) 2013-04-24 18:52:04 +04:00
Tvangeste ce4a212155 Use the native OS dialog to save articles, store the save location in a config 2013-04-12 09:31:09 +02:00
Abs62 0ac060576d Save images and sounds via context menu (issue #223) 2013-02-22 16:44:23 +04:00
Abs62 2553ddf2b8 Periodical save of history (issue #209) 2013-02-05 16:51:23 +04:00
Abs62 f4f27de3cd Make changes from commit d8decdae83 Win-specific (issue #213) 2013-02-04 18:10:37 +04:00
Julian Depetris Chauvin c6cbaa64cd Custom icon support for Sound dir dictionaries - default to no custom icon 2013-02-02 19:00:19 -03:00
Julian Depetris Chauvin 5ec0362a72 Custom icon support for Sound dir dictionaries 2013-02-02 15:25:24 -03:00
Abs62 d8decdae83 Properly save/restore main window configuration when it maximized 2013-01-29 23:20:53 +04:00