Commit graph

4148 commits

Author SHA1 Message Date
Igor Kushnir 83d71daf03 Don't reset FTS Ignore* options on Preferences change
Accepting changes in Preferences dialog no longer disables two options
"Ignore words order" and "Ignore diacritics", which are configurable in
Full-text search dialog.
2022-11-16 18:51:26 +03:00
Igor Kushnir c087d60165 Set article background to white while printing
cb6b00d85e set .gdarticle background to
`#fefdeb` in article-style.css, but failed to override it in
article-style-print.css.

Set html background to white as well in order to prevent a thin border
around articles' contents if non-printing article styles set html
background to a color other than white.

Printing color background makes little sense and is wasteful. Users who
prefer the old behavior can override the background color in
<Configuration Folder>/article-style-print.css.

Use `background` rather than `background-color` CSS property in order to
overwrite any background image set by non-printing article styles.
2022-11-16 18:51:01 +03:00
Xiao YiFang 67485fd875 [action] enable macos homebrew action 2022-11-16 21:10:45 +08:00
Xiao YiFang 66ec6b6d63 fix: mdx headword total count is incorrect 2022-11-16 21:09:30 +08:00
xiaoyifang 7215a34dd9
Merge pull request #192 from xiaoyifang/feature/homebrew-ffmpeg
github action: homebrew ffmpeg
2022-11-15 21:15:00 +08:00
Xiao YiFang 12acff095c ffmpeg convert the the audio to raw format 2022-11-15 21:14:34 +08:00
Xiao YiFang edea394892 [macos] add speex support 2022-11-15 21:14:34 +08:00
Xiao YiFang 6c72f650fe Merge remote-tracking branch 'gd/master' into staged 2022-11-15 20:02:24 +08:00
Xiao YiFang 4927f9a56e Merge commit 'f708c50' into staged 2022-11-15 20:02:20 +08:00
Igor Kushnir 5e8cab6d54 Show translateBoxWidget automatically when Words Zoom level decreases
When Search Pane is hidden, Words Zoom level is large and GoldenDict
main window's width is small, translateBoxWidget does not fit into the
toolbar and is hidden behind the toolbar extension button » on the right
side. Reducing Words Zoom level does not automatically make
translateBoxWidget visible until the user presses the toolbar extension
button or types text to be translated.

I haven't noticed any effect of the existing line of code that activates
groupList parent widget's layout whether Search Pane is visible or
hidden. This line was introduced in the commit that implemented
TranslateBox - da13998518. In this initial
implementation navToolbar was the parent of groupList, and
translateBoxWidget did not yet exist. I think that the introduction of
translateBoxWidget in 404a16442b obsoleted
this line of code, and so remove it here.

I have verified that this fix works as intended in the Qt 4 and the Qt 5
version both under KDE Plasma and Xfce.
2022-11-14 19:56:29 +02:00
Igor Kushnir f708c5068c Qt5: give focus to article view after last tab is closed
When the last tab is closed while the article view in it has focus,
Results Navigation Pane acquires focus in the Qt 4 version. This is OK,
because typed text is sent to the translate line and all shortcuts work.
In the Qt 5 version, depending on the value of the "Hide single tab"
option, either no widget has focus or the tab bar acquires focus in this
situation. This leads to issues described in the added comment.
2022-11-12 14:10:06 +03:00
xiaoyifang bf22c9c77c
Merge pull request #191 from xiaoyifang/feature/remove-libao
feature: remove libao dependency and use QAudioSink(QAudioOutput) to …
2022-11-12 17:27:44 +08:00
Xiao YiFang f37e2862ce remove commented line 2022-11-12 17:27:16 +08:00
Xiao YiFang 42fd3a749d add file reference link 2022-11-12 17:26:10 +08:00
Xiao YiFang c4c6ff8376 ffmpeg depends on multimedia 2022-11-12 17:03:20 +08:00
xiaoyifang 589e664fc2
Merge pull request #199 from xiaoyifang/feature/custome-macos
add script to build ffmpeg
2022-11-12 14:11:29 +08:00
Xiao YiFang 1b9faf70f5 add ffmpeg build 2022-11-12 13:57:23 +08:00
Xiao YiFang f1468a5af4 feature: add support to import txt format file to favorite pannel
fix #198
2022-11-12 12:31:03 +08:00
Xiao YiFang 1bfc5abf6c github: remove libao and install ffmpeg with speex 2022-11-12 09:34:09 +08:00
Xiao YiFang 16bc832a20 remove mac and windows dependency of libao 2022-11-12 09:34:09 +08:00
Xiao YiFang 85aad0f80c feature: remove libao dependency and use QAudioSink(QAudioOutput) to play the pcm audio format 2022-11-12 09:34:09 +08:00
Xiao YiFang e3d904f8b8 Merge branch 'staged' of github.com:xiaoyifang/goldendict into staged 2022-11-12 09:22:06 +08:00
Xiao YiFang 1554d026c5 fix: crash on headword dialog lookup
when the headword count is too small ,the application will crash .
2022-11-12 09:16:10 +08:00
xiaoyifang 5230d254a8
Merge pull request #196 from xiaoyifang/gd-master
sync upstream
2022-11-06 12:03:19 +08:00
Xiao YiFang 570949b9f9 fix conflict with upstream as codebase has changed a lot 2022-11-06 10:09:09 +08:00
Xiao YiFang f6ae13cd87 Merge remote-tracking branch 'gd/master' into gd-master 2022-11-06 10:06:05 +08:00
Xiao YiFang f33743b448 Merge commit 'fdcd6a37' into gd-master 2022-11-06 10:05:49 +08:00
Igor Kushnir 5f96f1f26e Linux-specific: don't force X11 focus unnecessarily
Focus is already transferred to GoldenDict in toggleMainWindow() only
the first time the main window is shown. At all subsequent requests to
show the main window, focus has to be forced with the workaround.
Checking focus asynchronously allows to resort to the workaround less
often.

Under Xfce: the timeout of 0 ms is almost always sufficient in the Qt 5
version, but is never enough in the Qt 4 version. The timeout of 4 ms is
always sufficient in both versions.

Under KDE Plasma: the timeout of 0 ms is rarely sufficient in the Qt 5
version. Unfortunately, with any timeout other than 0 ms, the Qt 5
version does not always get focus, which would be a serious regression,
so no other timeout can be used. The Qt 4 version does not always get
focus both with and without the timeout.
2022-11-05 22:03:51 +03:00
Igor Kushnir a321593ed1 Linux-specific: check correct X11 window ID
translateLine->internalWinId() always equals 0. When the show/hide main
window hotkey is triggered right after GoldenDict starts to system tray,
`wh` equals MainWindow::internalWinId(). A few more experiments confirm
that XGetInputFocus()'s output parameter `focus_return` is an ID of a
top-level window, not of an embedded widget child.
2022-11-05 22:03:51 +03:00
Igor Kushnir fdcd6a3773 Demote input phrase limit message from warning to debug
Limiting input phrase length is disabled by default. The default length
limit value is 1000. The user has to enable the option and lower the
length limit in order to be surprised by missing translation. By making
such configuration changes, the user should become aware of this feature
and its effect.

As the person who has implemented this feature and uses 100 as the
length limit, I am never surprised or disappointed by missing
translation. The only annoyance is this warning that floods my systemd
journal. Apparently I accidentally select overly long phrases way too
often.
2022-11-05 17:38:10 +03:00
Igor Kushnir 38f5fa6c90 Don't warn about unclosed DSL [mN] tags
According to DSL documentation, closing the [mN] tags is optional:
unclosed [mN] tags affect formatting until the end of a card.

As many dictionaries don't close the [mN] tags, GoldenDict printed
multiple unclosed-tag warnings during each word lookup.
2022-11-05 17:37:43 +03:00
Igor Kushnir 7c0c586418 Extract is_mN() and isAnyM() 2022-11-05 17:37:43 +03:00
Igor Kushnir d6696b0800 Expand unclosed tag DSL warning message
The dictionary name, article and the tag name help to locate the issue.

GD_FDPRINTF() => gdWarning() to improve flexibility and user options.
2022-11-05 17:37:43 +03:00
Xiao YiFang 80fdb8cb82 fix: right mouse on the history panel and favorite panel should not trigger the click event.
which means the word should not send to the mainwindow and translated.
2022-11-05 21:02:33 +08:00
Xiao YiFang c478065f53 goldendict ,fix QT_PLUGIN_PATH variable 2022-11-05 14:52:50 +08:00
xiaoyifang 652f1b25d3
Update README.md 2022-11-05 10:46:52 +08:00
xiaoyifang 08ca40bd06
Update README.md 2022-11-05 10:44:28 +08:00
Xiao YiFang f486cd8a69 Merge remote-tracking branch 'gd/master' into staged 2022-11-05 10:01:00 +08:00
Xiao YiFang 450115c108 Merge commit '1d6b5efe' into staged 2022-11-05 10:00:52 +08:00
Xiao YiFang cbf62a4dbe Merge commit '98b37fea' into staged 2022-11-05 10:00:44 +08:00
Igor Kushnir fc9a48a113 Demote missing favorites file message from warning to debug
This file is never created if the Favorites feature is not used.

Fix a typo along the way: "favorities" => "favorites".
2022-11-04 21:03:48 +03:00
Igor Kushnir 1d6b5efeac Disable GD_DPRINTF() output in Release builds on all systems
Messages printed with GD_DPRINTF() are clearly debug messages. They
flood GoldenDict's output with lines like these:
    some body finished
    one finished.
    erasing..
    erase done..
    one not finished.
    ====reading 16384 bytes

Messages printed to stderr with GD_FDPRINTF() are more important and
less frequent => leave them in Release builds.
2022-11-04 21:01:52 +03:00
Igor Kushnir 98b37feac2 Print debug output with gdDebug() instead of av_log()
Users can enable or disable av_log() output only by inserting a call to
av_log_set_level() and recompiling GoldenDict. Blink browser engine
shipped with Qt WebEngine sets the log level to AV_LOG_QUIET in
chromium/media/base/media.cc and thus disables all output. So
GoldenDict's custom AV_LOG_INFO messages are always printed in the Qt
WebKit version and never in the Qt WebEngine version.

In contrast, users have many ways to enable or disable QDebug output
without recompilation since Qt 5. Furthermore, GoldenDict's command line
option --log-to-file allows to redirect gdDebug() output to a log file.

The two messages printed via av_log() are clearly debug messages,
because they are printed each time a word or a phrase is pronounced.
2022-11-04 19:52:39 +03:00
Xiao YiFang 6d9a6c3d6b fix:return directly when the searched word is empty 2022-11-04 21:25:55 +08:00
Xiao YiFang 208cd50979 fix: when history forward/back ,the founded dictionary does not change
fixed #184
2022-11-04 21:23:42 +08:00
Xiao YiFang c8f445f165 Merge remote-tracking branch 'gd/master' into staged 2022-11-04 20:44:11 +08:00
Igor Kushnir a27a29aca3 Linux-specific: don't open File menu after showing main window
Unfortunately the X11 focus workaround that opens the File menu cannot
be simply removed. Without this workaround, when KDE Plasma's Focus
stealing prevention level is set to Low (which is the default) or
higher, launching a second GoldenDict instance doesn't give focus to the
already running instance unless that instance's main window is currently
hidden into system tray or minimized. A workaround of hiding then
showing the main window makes the window flicker. Suggesting GoldenDict
users to set the focus stealing prevention level to None is not right,
because this setting is global and affects all applications.

Emulate a left mouse button click at position (0, 0) instead of (1, 1)
in order to waste 1 rather than 2 pixels to the left of the menu bar.

Introduce a new macro X11_MAIN_WINDOW_FOCUS_WORKAROUNDS to link the X11
focus workaround to the File menu workaround introduced in this commit.
This simplifies disabling all related workarounds at once. When the
focus workaround is replaced with a proper solution, the developer won't
forget to remove all obsolete workarounds if they are linked together.

Fixes #781.
2022-11-03 19:25:32 +03:00
Igor Kushnir 6dc74a7c7b Assign correct values to XButtonEvent::[xy]_root
The signature is: QPoint QWidget::mapToGlobal(const QPoint &) const;
2022-11-03 19:25:32 +03:00
Igor Kushnir 307fe2ba16 Download and open an image double-clicked in scan popup
Now double-clicking an image has the same effect in the main window and
in the scan popup. This consistency in no way prevents or hinders using
the popup window as designed (for fast lookup in a small group of
dictionaries), because a user is unlikely to double-click an image
accidentally.

Without this commit, when "Double-click translates the word clicked"
option is on, double-clicking an image in the scan popup translates
currently selected text if the selection is not empty.

Fixes #1279.
2022-11-02 22:22:59 +03:00
Igor Kushnir cf84f57632 Don't append duplicates to openedInspectors
There is no benefit in storing the same pointer multiple times in
openedInspectors. This occurred when an article inspector window was
closed then shown again. When the tab corresponding to the duplicated
article inspector pointer was closed, ArticleInspector::beforeClosed()
erased only one pointer from openedInspectors. This left dangling
duplicate pointer(s) in the list and eventually caused a crash when
another inspector's showEvent() accessed a dangling pointer at
openedInspectors.front().
2022-11-02 22:22:16 +03:00