Commit graph

2911 commits

Author SHA1 Message Date
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
Abs62 03696662af
Merge pull request #998 from vedgy/option-to-disable-scan-popup-inside-goldendict
Add an option to disable scan popup inside goldendict
2018-04-17 20:31:19 +03:00
Abs62 d9980bf662
Merge pull request #997 from vedgy/small-audio-player-fixes
Small audio player fixes
2018-04-17 20:30:56 +03:00
Abs62 f4c22aac5c
Merge pull request #996 from morealaz/master
add possibility to use icon from system theme for tray icon
2018-04-17 20:30:41 +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
Mohammadreza Abdollahzadeh eea6f686f6
add possibility to use icon from system theme for tray icon 2018-04-17 11:58:20 +04:30
Igor Kushnir 19ab09b754 Do not pass null to qobject_cast()
qobject_cast() implementations in Qt4 and Qt5 until version 5.4
unconditionally dereference the argument to access a static member.
This is undefined behavior. When Goldendict is compiled with GCC's
-fsanitize=undefined option in Release mode and launched with
<useInternalPlayer>1</useInternalPlayer> in config, the application
crashes right away with the following message:
runtime error: member call on null pointer of type 'struct AudioPlayer'
2018-04-16 18:12:41 +03:00
Igor Kushnir fb71eb4ce1 Stop Ffmpeg::AudioService in Ffmpeg::~AudioPlayer()
When the current audio player instance changes, the destroyed player's
playback must be stopped for consistency between implementations and to
avoid surprises. Note that this residual playback could be stopped only
by switching back to the Ffmpeg player or by exiting the application.
2018-04-16 18:12:41 +03:00
Abs62 b34ac9630e
Merge pull request #995 from vedgy/x11-fix-unpinned-scan-popup-option
Allow customizing unpinned scan popup window flags on X11 with Qt5
2018-04-15 20:49:30 +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 d530af7781 Qt5: disable an obsolete Qt4 X11 window focus workaround
I have verified in numerous desktop environments and window managers
that the workaround does not work with Qt5.
Let us disable it in Qt5 builds to prevent potential issues
and eliminate the small performance overhead.
2018-04-15 19:46:35 +03:00
Abs62 3c4cdaff8e
Merge pull request #993 from hosiet/pr-update-zh-cn-translation
Update zh_CN translation
2018-04-12 18:16:23 +03:00
Boyuan Yang ed6210cc8f
Update zh_CN translation. 2018-04-12 17:35:11 +08:00
Abs62 140ecf27c7 Update help system 2018-04-11 17:57:00 +03:00
Abs62 879dd0c385
Merge pull request #992 from perfect7gentleman/patch-1
Update groups_widgets.hh
2018-04-10 20:07:54 +03:00
Perfect Gentleman a65967805a
Update groups_widgets.hh
fixes https://github.com/goldendict/goldendict/issues/991
2018-04-11 00:04:12 +07:00
Abs62 3d4a468b6c Qt5: Fix compilation with Qt 5.11 (issue #991) 2018-04-10 18:44:43 +03:00
Abs62 0c8730ec22 Lupdate all translations, update Russian translation 2018-04-10 18:39:22 +03:00
Abs62 5fa5cc123f Full-text search: Allow ignore diacritics while search 2018-04-10 17:49:52 +03:00
Abs62 eb6dc37470 Qt5: Some more fixes for compilation under early Qt5 versions (issue #990) 2018-04-08 20:25:55 +03:00
Abs62 2b3a8d16bc Mdx: Fix resource files indexing (issue #971) 2018-04-08 18:00:21 +03:00
Abs62 62529d8a6c Qt5: Fix compilation under early Qt5 versions (issue #990) 2018-04-08 17:48:46 +03:00
Abs62 e824c4a4c4 Lupdate all translations, update Russian translation 2018-04-01 20:10:18 +03:00
Abs62 11ca5e63d6 Add ".webm" extension to known video types 2018-04-01 16:18:11 +03:00
Abs62 03bbe01b79 Fix warnings while compile with FFMpeg 3.4.2 (issue #978) 2018-03-30 23:05:22 +03:00
Abs62 bd48045aa9
Merge pull request #987 from vedgy/qt-multimedia-audio-player
Add Qt Multimedia audio player back end (Qt5 only)
2018-03-30 19:45:29 +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 6a77c23986 Implement "inactive dictionaries" feature for all groups (issue #984) 2018-03-28 17:21:32 +03:00
Abs62 d65a1f7869 Save popup window configuration without it destroying 2018-03-27 21:23:48 +03:00
Abs62 2ff7e4e6d0 Refactor quit/end-of-session handling 2018-03-27 17:46:03 +03:00
Abs62 5552c18a39 Remove mention of qt4x5 git branch from readme.md 2018-03-26 17:37:00 +03:00
Abs62 3cf4561802 Save Favorites inside commitData() 2018-03-26 17:35:49 +03:00
Abs62 c5b8102cf5
Merge pull request #983 from vedgy/overhaul-audio-player
Overhaul audio player
2018-03-26 17:33:49 +03:00
Abs62 655d2456c0
Merge pull request #981 from vedgy/fix-ub-in-gestures
Don't static_cast to a wrong type in Gestures
2018-03-26 17:33:21 +03:00
Igor Kushnir 278e05cbf3 Run a single external audio player process at a time
External and internal audio players work similarly now. Fixes #950.

* inherit a new ExternalAudioPlayer class from AudioPlayerInterface;
* use an existing ExternalViewer class to implement ExternalAudioPlayer;
* take (const char *, int) instead of std::vector<char> in
  ExternalViewer constructor to fit into AudioPlayerInterface;
* extend ExternalViewer API to let ExternalAudioPlayer stop superseded
  audio player processes;
* make AudioPlayerInterface::play() return an error message string to
  allow reporting immediate failures from derived classes;
* Document AudioPlayerInterface API;
* Document AudioPlayerFactory::player();
* use the common audio interface exclusively in ArticleView.
2018-03-24 21:34:06 +02:00
Igor Kushnir e5045860ef Make adding new audio player implementations easy
* add a new interface class AudioPlayerInterface;
* inherit a new proxy class Ffmpeg::AudioPlayer from it;
* partially switch ArlticleView to using the interface;
* expose MainWindow's AudioPlayerInterface instance to all ArticleView
  instances;
* add a new AudioPlayerFactory class responsible for creating instances
  of concrete classes derived from AudioPlayerInterface depending on
  relevant Config::Preferences values;
* increase minimum supported Qt version from 4.5 to 4.6 in README
  in order to use QScopedPointer introduced in Qt 4.6.
2018-03-24 21:31:48 +02:00
Igor Kushnir 2e25be8f71 Eliminate redundant casts to/from void* in Ffmpeg player 2018-03-24 20:16:50 +02:00
Igor Kushnir 6e9c79f67b Don't static_cast to a wrong type in Gestures
The result of a downcast to a wrong dynamic type is undefined according
to the C++ standard.

Wrong casts were detected at goldendict start by GCC's
-fsanitize=undefined option. This commit fixes #974.
2018-03-24 18:03:10 +02:00
Abs62 bd95948264 Fix potential error in dictzip.c (issue #978) 2018-03-23 20:40:54 +03:00
Abs62 dd0464b9d5 Hunspell: Strip comments while search base form of word 2018-03-23 16:08:33 +03:00
Abs62 0e22d06f97
Merge pull request #977 from kyleskimo/patch-3
Update zh_TW.ts
2018-03-23 16:02:45 +03:00
kyleskimo 22f0e6ff77
Update zh_TW.ts
Update translation.
2018-03-23 14:24:29 +08:00
Abs62 4ec525d67d Fix typos 2018-03-21 22:15:22 +03:00
Abs62 1dc4c24966 DSL: Warnings about unknown and unfinished tags 2018-03-19 17:44:12 +03:00
Abs62 ad705bd01e Fix isNameOf...() functions for case of string contains whitespaces only 2018-03-19 17:42:30 +03:00
Abs62 9468f266f5 Increase limit of node elements while build index 2018-03-13 22:25:17 +03:00
Abs62 e89df78ecb A little optimization of read data from network 2018-03-12 20:22:38 +03:00
Abs62 cbdd6bfe5a Qt5: Fix some potential issues after using QRegularExpression instead of QRegExp 2018-03-12 00:06:09 +03:00