Commit graph

554 commits

Author SHA1 Message Date
shenleban tongying 79f8b05d40 Add showScanFlag condition to mainWindow's clipboardChange 2022-11-20 00:39:41 -05:00
shenlebantongying e0c193bcb6 Let scanPopup always constructed
Before: Construst Scanpopup only when both enableClipboardHotkey and enableScanPopup are true

Now: Always construct ScanPopup so that users can freely enable Copy->ScanPopup through navbar or tray
2022-11-19 22:35:06 -05:00
shenlebantongying 8232bc208d scan popup: Fix windows build 2022-11-19 21:54:22 -05:00
shenleban tongying 0d186dc33d fix: modifier keys should only affect Selection 2022-11-19 21:15:23 -05:00
shenleban tongying 06a296c99f Put conditions on the ClipboardChange for X11 2022-11-19 13:48:26 -05:00
shenleban tongying a4359bef3c Only process clipboard change when scanning enabled 2022-11-19 12:08:57 -05:00
shenleban tongying 9d9ad3ecc9 rename enableScanPopupAction to enableScanningAction which now governs both popup and sendToMainWindow kinds of scanning 2022-11-19 10:40:57 -05:00
shenleban tongying b3b740854a Unify trackClipboardChanges and enableScanPopupAction
* There is no difference between those two on Windows and MacOS which only support clipboard (Ctrl+C) scanning

* Q_WS_X11 was defined on Qt4, and it causes the super weird trackClipboardChanges to occur on Windows
2022-11-19 10:30:31 -05:00
shenleban tongying eb5806503a Remove enableScanPopup: Respect navBar toggling more
* Always construct Scan Popup object regardless of the setting
2022-11-19 09:30:58 -05:00
shenleban tongying edbc4d32cd Remove enableScanPopup: Let Scan popup's 💡 on navBar always visible 2022-11-19 09:25:53 -05:00
shenleban tongying 92bdec7119 Rename QAction * enableScanPopup
There is a var named exactly the same used in the same file!
2022-11-19 09:04:04 -05:00
shenleban tongying c08d584233 About copy version info: fix styles 2022-11-19 05:17:34 -05:00
shenlebantongying b7e1648356
Merge branch 'xiaoyifang:staged' into staged 2022-11-19 03:20:16 -05:00
Xiao YiFang 3653b616cf Merge commit '83d71daf03e468f784e41e834dc32c67fe2a5870' into staged 2022-11-18 20:23:32 +08:00
shenleban tongying 8d3b4165da Add "copy info" buttons to about dialog 2022-11-17 05:14:18 -05:00
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
Xiao YiFang 6c72f650fe Merge remote-tracking branch 'gd/master' into staged 2022-11-15 20:02:24 +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
Xiao YiFang f1468a5af4 feature: add support to import txt format file to favorite pannel
fix #198
2022-11-12 12:31:03 +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 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 9330c89e4b Don't attempt to translate empty or whitespace-only text
Silently ignore empty or whitespace-only translation requests. It should
be clear to most users why GoldenDict ignores them.

The translated word ends up as the "word" URL query item value, which is
trimmed in ArticleNetworkAccessManager::getResource(). So the added
trimming in MainWindow::translateInputFinished() should be fine.

When a trimmed translated word was empty, InputPhrase::isValid()
returned false, ArticleNetworkAccessManager::getResource() returned a
null pointer and ArticleNetworkAccessManager::createRequest() fell back
to QNetworkAccessManager::createRequest(), which:
* failed silently in the Qt 4 version;
* displayed the
    Protocol "gdlookup" is unknown
    Failed to load URL gdlookup://localhost?word= &group=4.
    QtNetwork Error 301
error page in the Qt 5 version.

Fixes #1179.
2022-11-02 19:16:33 +03:00
Xiao YiFang 59ec8c4a48 [clean code]: remove macos lionsupport check
this macos version is too old .
2022-11-02 20:42:39 +08:00
Xiao YiFang e8412eb820 opt: new release check logic changed to this very repository. 2022-10-15 17:28:55 +08:00
Xiao YiFang ead9e6132f inspect element crash on the first time 2022-10-14 10:52:09 +08:00
Xiao YiFang 486edab3f7 fix: when show mainwindows in fedora ,the menu got focused
seems like a regression caused by goldendict/goldendict#235

fix #158
2022-10-01 09:16:36 +08:00
Xiao YiFang a0ae0df21d fix upstream conflict 2022-09-22 20:13:57 +08:00
Igor Kushnir 927566244f Don't percent-encode local file names while saving an article
This commit fixes broken links in complete saved articles to files whose
names contain reserved characters. An HTML parser decodes a
percent-encoded URL before looking for the referenced file on disk. So
a file with a percent-encoded name cannot be found. Percent-encode only
the URL to fix the bug.
2022-09-21 20:33:54 +03:00
Xiao YiFang 44b282fb51 opt: gd useragent minor changes. 2022-09-18 08:57: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
Xiao YiFang c24f57975e Revert "fix: minor code changes related to ctrl+c"
This reverts commit 0f1e107d5f.
2022-09-11 09:36:45 +08:00
Xiao YiFang 0f1e107d5f fix: minor code changes related to ctrl+c 2022-09-10 22:12:47 +08:00
Xiao YiFang cd5e5abe4d opt:scanpopup inspect element action optimization 2022-09-08 21:11:43 +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
xiaoyifang 5242ed57c4
Merge branch 'goldendict:master' into staged 2022-09-05 15:26:58 +08:00
Igor Kushnir 8f41079069 Make saving complete article work in Qt 5.15
The old code works correctly in Qt 4.8.7. But in Qt 5.15.5
selectedFilter is never equal to either element of filters. So HTML Only
is saved no matter which option the user selects.
2022-09-04 12:09:42 +03:00
Xiao YiFang 92e06428f7 fix: trayicon scan popup icon display not correct 2022-08-31 21:53:56 +08:00
Xiao YiFang f00bf25d55 Revert "opt: customized about:blank page"
This reverts commit cee57d69ce.
2022-08-23 18:47:58 +08:00
Xiao YiFang cee57d69ce opt: customized about:blank page 2022-08-22 20:22:14 +08:00
Xiao YiFang f0a289fba0 fix: Ctrl+T new tab's tab name is empty 2022-08-21 14:10:42 +08:00
Xiao YiFang f542642c85 opt: inspector 2022-08-19 19:56:49 +08:00
Xiao YiFang 6a7e54c165 fix:add log to clipboard datachange signal
fix:add log to clipboard datachange signal
2022-08-14 23:16:51 +08:00
Xiao YiFang 370eb1357f fix:tracking clipboard not working 2022-08-14 16:18:38 +08:00
Xiao YiFang 74c0da034b inspector variable change 2022-08-09 20:29:59 +08:00
Xiao YiFang c41068d608 article inspector debug info 2022-08-08 20:48:46 +08:00
Xiao YiFang fa64d450ea opt: optimize the function in tracking clipboard in trayicon 2022-08-02 22:27:14 +08:00
xiaoyifang f8b3c9a6eb
Merge branch 'goldendict:master' into staged 2022-07-30 07:35:30 +08:00
Abs62 1064880450 Fix favorities indication when new tabs open in background 2022-07-29 18:48:04 +03:00
Xiao YiFang 66b10495dd fix merge conflict 2022-07-17 18:45:05 +08:00
Abs62 aa02fdcc25 A little more Ctrl+Tab/Ctrl+Shift+Tab handling 2022-07-14 18:14:28 +03:00
Abs62 f640643672 Disable focus acquiring by tabs menu button 2022-07-13 17:32:41 +03:00
Abs62 896bd350be Handle Ctrl+Tab/Ctrl+Shift+Tab in translate line as tabs switch 2022-07-13 17:31:57 +03:00
Xiao YiFang 5322a6bc56 opt:remove dictMap parameter 2022-07-10 17:11:13 +08:00
Xiao YiFang 3d5f3d6616 feat: clipboard tracking 2022-06-24 21:34:03 +08:00
Xiao YiFang 7eb603a9c5 feat: expose clipboard tracking function 2022-06-24 21:20:16 +08:00
Xiao YiFang 547f2a4cd2 remember last link's groupId and muted dictionary 2022-06-08 20:52:44 +08:00
Xiao YiFang 9daff6ae37 support mdex builtin link entry: 2022-06-07 08:14:53 +08:00
Xiao YiFang f015ff555f feature: save bookmark to favorite panel
reuse fulltext match to implement this bookmark feature
2022-06-02 08:16:01 +08:00
Xiao YiFang 530591ffbd fix: add unicodeoption to qregularexpression 2022-06-01 21:15:25 +08:00
Xiao YiFang 7ec75d60b9 opt: refact the inspector windows logic 2022-05-29 16:00:28 +08:00
Xiao YiFang ee95307628 fix:remove x11extra private 2022-05-29 16:00:28 +08:00
xiaoyifang 2bccf038b1
Merge branch 'goldendict:master' into staged 2022-05-26 07:12:25 +08:00
wisherhxl 0cea62699d Linux-specific: workaround of clipboard issue with Ctrl+C+C
Closes #1420, closes #650, closes #858.
2022-05-25 21:01:33 +03:00
Xiao YiFang e241cbef33 fix merge conflict
when merge the changes introduced by pull #77
2022-05-25 23:54:45 +08:00
Igor Kushnir c770e9688e Don't update state prematurely in showTranslationFor()
MainWindow::showTranslationFor() overloads disable the "Pronounce Word"
action, then call ArticleView::showDefinition(). And then immediately
update pronounce availability, Found in Dictionaries list, Back and
Forward buttons. Since ArticleView::showDefinition() loads the requested
page asynchronously, the previous page is still current. Therefore the
"Pronounce Word" action is immediately re-enabled (if the still-current
article has sounds), the other state updates have no effect whatsoever.
Once the new page is loaded, the state is updated again in
MainWindow::pageLoaded() - this time with the desired effect.

So the only effect of the state updates in
MainWindow::showTranslationFor() is to revert the intentional disabling
of the "Pronounce Word" action. Plus waste some CPU time. The
pronunciation-disabling behavior looks better to me and is consistent
with the scan popup's behavior (which immediately hides the
"Pronounce Word" button).
2022-05-25 18:27:18 +03:00
Xiao YiFang de11e573d3 fix:quit application failed
when the inspector windows is show
2022-05-23 23:38:04 +08:00
Xiao YiFang fe1fd6b933 fix: webengineview font lose affect after restart the application 2022-05-23 20:14:26 +08:00
Xiao YiFang a7ba9e4b36 opt:use acceptNavigationRequest instead of weburlinterceptor 2022-05-20 18:01:41 +08:00
Xiao YiFang 459b684e5b opt: make the inspect window's instance to exactly only one. 2022-05-20 17:31:47 +08:00
Xiao YiFang e6ab87ca73 fix:add ifr local scheme
due to iframe security policy and x-frame-option .
the website online dictionary can not work in qt 5.15.2+ version.
this is a workaround to pass through the restriction.
2022-05-15 22:54:26 +08:00
Xiao YiFang 9c402d986e opt: add dictionary fallback font family settings 2022-05-08 16:44:09 +08:00
xiaoyifang 5a0a6c6491 feature:add ignore punctuaion option 2022-04-23 16:15:23 +08:00
xiaoyifang eaf76fbcb6 clean code:remove useless code
the maximumwindowssize was only set value in the ~MainWindows() which means
it can not be saved into the config file.
2022-04-19 22:22:03 +08:00
xiaoyifang 8b9544bc17 fix:currentIndexChanged slot does not match 2022-04-01 23:32:11 +08:00
xiaoyifang 228d7001e5
Merge pull request #35 from ngn999/bugfix/Macbook_scroll_issue
disable macOS trackpad zoom; fix a deadlock
2022-03-31 00:10:37 +08:00
ngn999 6d0c7b0fec reindent MainWindow::on_saveArticle_triggered 2022-03-31 00:03:42 +08:00
ngn999 b187c0ef41 fix code review indent issue 2022-03-30 23:08:24 +08:00
xiaoyifang 19e738becc optimize: print preview dialog set zoom factor to 100% 2022-03-30 17:19:08 +08:00
xiaoyifang 88a69d1976 fix:revert deferredInit 2022-03-30 15:34:59 +08:00
xiaoyifang 3ea8fd78ef print preview blurry 2022-03-29 20:47:41 +08:00
ngn999 188f67556c no memory problem 2022-03-28 11:24:27 +08:00
ngn999 748bafd43b fix save file progress dialog never close bug 2022-03-28 11:09:33 +08:00
ngn999 e45f466a9d make toHtml async 2022-03-28 10:30:23 +08:00
ngn999 05bbf54330 rewrite lambda capture list 2022-03-27 23:36:14 +08:00
ngn999 6c310b41af make isFramedArticle async, and remvoe runJavaScriptSync() 2022-03-27 23:05:45 +08:00
ngn999 95be606a9e make ArticleView::hasSound() async 2022-03-27 22:22:42 +08:00
xiaoyifang 9836e8d529 ui: update icon 2022-03-27 18:12:33 +08:00
xiaoyifang c5fae8de1b fix:edit dictionaries 2022-03-22 20:20:48 +08:00
xiaoyifang fa2aae908b toolbar icon size 2022-03-15 22:26:24 +08:00
xiaoyifang 0560785a65 replace dictionary vector with QMap
remove signal DictGroupWidget::showDictionaryInfo
2022-03-14 08:22:31 +08:00
xiaoyifang c664ac315c dictionary group ,id match performance improve .
use qmap to replace the double for loop check.
2022-03-14 00:17:34 +08:00
xiaoyifang ab1b525f12 printreviewdialog change default printer 2022-03-12 18:31:21 +08:00
xiaoyifang 5d8b410a8b fix: exception with PopupFocusReason 2022-03-11 22:26:38 +08:00
yifang fb2eac9b5e upgrade to 6.2,linux compile 2022-03-11 22:14:40 +08:00
xiaoyifang 23d833fbb8 6.2: currentIndexChanged signal is changed. 2022-03-11 22:00:53 +08:00
xiaoyifang 7b5511a7bd upgrade to qt6.2 2022-03-11 22:00:45 +08:00
xiaoyifang 3a092947da fix:popup javascript windows 2022-03-11 00:41:35 +08:00