Commit graph

458 commits

Author SHA1 Message Date
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
yifang 4a96067e86 fix:large memory consumption when edit dictionaries through right menu context 2022-03-03 23:59:42 +08:00
yifang f16b25737d optimize: hide sources when edit dictionaries with specific groupid 2022-03-03 23:45:35 +08:00
yifang 0040724b6f Revert "fix:edit dictionaries dialog ,memory consume too much"
This reverts commit c9d053d227.
2022-03-03 23:13:04 +08:00
yifang c9d053d227 fix:edit dictionaries dialog ,memory consume too much 2022-02-28 21:21:34 +08:00
xiaoyifang d607079ffb fix: double click to translation should stop audio first.
there are cases when the audio is too long (in wiki).
when double click occured .the audio is still playing.
2022-02-25 23:33:34 +08:00
xiaoyifang 448f8f80a5 clean:remove hotkey dll handler 2022-02-25 23:01:54 +08:00
xiaoyifang 434dbd6e45 fix:Win+Up Win+Down to restore and save geometry
the above shortkey can not restore geometry after resize the window
clean code .
2022-02-25 22:54:34 +08:00
xiaoyifang aeee511859 fix:Win+Up Win+Down to restore and save geometry
the above shortkey can not restore geometry after resize the window
2022-02-25 22:51:39 +08:00
yifang 7e2231805f optimize: float number compare precision
optimize: float number compare precision
2022-02-19 01:08:20 +08:00
yifang 835e376b16 fix: typo 2022-02-18 20:43:07 +08:00
yifang cc9b64876f fix: try to fix macos close to tray issue
can not be sure .
though the code will have not side effect.
2022-02-18 20:22:56 +08:00
xiaoyifang 6fbadad807 clean:open dictionary folder in windows
make windows's logic same as linux
2022-02-16 23:00:20 +08:00
xiaoyifang 570c75e920 performance: Prefer prefix ++/-- operators for non-primitive types.
more detail check https://hownot2code.com/2016/06/30/use-a-prefix-increment-operator-i-in-iterators-instead-of-a-postfix-i-operator/
2022-02-16 22:08:32 +08:00
xiaoyifang 9ecc10ed50 performance: Prefer prefix ++/-- operators for non-primitive types.
more detail check https://hownot2code.com/2016/06/30/use-a-prefix-increment-operator-i-in-iterators-instead-of-a-postfix-i-operator/
2022-02-16 21:47:03 +08:00
yifang bd01dad108 clean: Condition '!explorerLaunched' is always true
fixes #13
2022-02-16 08:18:14 +08:00
yifang 23c41789de fix: popup link clicked 2022-02-15 20:22:43 +08:00
xiaoyifang 84175279ab fix: link click in popup windows ,translation should be in popup dialog too 2022-02-14 23:48:05 +08:00
xiaoyifang c329430a7b fix:warning qt-style-st-lingoes.css the file was missing 2022-02-13 17:01:17 +03:00
xiaoyifang d167cf1d49 fix:warning qt-style-st-lingoes.css the file was missing 2022-02-13 20:57:39 +08:00
yifang 0b29b65aca add useragent goldendict for compatible reason 2022-02-08 12:59:41 +08:00
xiaoyifang 0c94406e2a fix merge conflict with feature/deprecated 2022-02-03 17:50:47 +08:00
xiaoyifang c96a83f5d2 imp. remove mouseover32 2022-02-03 16:55:10 +08:00
yifang c810b7849d Merge remote-tracking branch 'origin/feature/highdpi-icon' into dev 2022-01-30 09:10:20 +08:00
xiaoyifang 291d6c6804 high dpi:replace menu button 2022-01-29 13:26:25 +08:00
yifang 0eb49e4a6b Merge remote-tracking branch 'origin/feature/highdpi-icon' into branch-qt-5.15 2022-01-28 20:06:25 +08:00
yifang eddc813aef high dpi:replace gnome image icon 2022-01-28 08:30:01 +08:00
yifang f1337862f1 Merge branch 'branch-qt-5.15' into dev 2022-01-27 08:24:21 +08:00
yifang 1d32ec4609 Merge branch 'feature/highdpi-icon' into dev 2022-01-27 08:24:16 +08:00
yifang d38daedc99
high dpi:remove coresponding png files with same name with svg
close https://github.com/goldendict/goldendict/issues/1441
2022-01-27 08:23:57 +08:00
yifang 2e5ca5f70f
fix:print preview resolution is too low 2022-01-27 00:47:27 +08:00
yifang e0e03cc6af Merge branch 'feature/highdpi-icon' into dev 2022-01-26 23:57:51 +08:00
yifang df6f51c011
high dpi: change right context menu on tab ,'close current tab' icon 2022-01-26 07:36:14 +08:00
xiaoyifang 5f184a8b3c Merge branch 'feature/highdpi-icon' into dev 2022-01-25 23:58:14 +08:00
xiaoyifang 9c5d7acc5a high dpi:change icon 2022-01-25 22:54:17 +08:00
xiaoyifang aa12bbe167 Merge branch 'branch-qt-5.15' into dev 2022-01-24 22:27:04 +08:00
xiaoyifang 23e148a345 Merge branch 'feature/highdpi-icon' into dev 2022-01-24 22:26:00 +08:00
xiaoyifang 9cf5ee8443 high dpi:change icon reference in code from png to svg. 2022-01-24 22:23:38 +08:00
yifang a0014cf668
dictionary bar icon size does not display correctly 2022-01-23 19:41:50 +08:00
xiaoyifang d310ee849a fix: click in dictionary panel not working . 2022-01-23 14:19:20 +08:00
yifang 5c76bc746c fix:right context menu ,select current article 2022-01-19 20:16:45 +08:00
xiaoyifang 4e7fe7dd6d improvement: make tab title does not show url . 2022-01-18 22:26:52 +08:00
yifang 0ba2cacc29
improvement:remove gdCurrentArticle js variable 2022-01-17 21:50:54 +08:00
yifang 63626bde13 improvement: refactor code,move ignoreKeyEvent method to utils. 2022-01-14 22:58:19 +08:00
yifang 9a4b119976 improvement:refactor code ,ignore key event extract to method 2022-01-13 20:39:58 +08:00
xiaoyifang 13fdf08450 improve:foundDictsPane refresh logic 2022-01-09 12:54:50 +08:00
xiaoyifang bd6cc8b9c9 fix: resource scheme handler received finished signal twice,more likely to crash the webengine. 2022-01-09 09:52:40 +08:00
xiaoyifang 3b4c105655 improve:Win Specific, replace deprecated method 2022-01-08 22:26:21 +08:00
yifang 46b4151cc4 improve: replace all the deprecated method before 5.15 2022-01-08 22:08:23 +08:00
yifang 8fc762a57b fix:add "gdprg","gdvideo","gdpicture","gdtts" scheme 2021-12-31 23:48:21 +08:00
xiaoyifang 0ed7c1cc1d
Merge branch 'goldendict:master' into branch-qt-5.15 2021-12-31 09:31:29 +08:00
yifang 3ebe5c9b23 fix: translateLine text disappeared after main windows hide and show up again. 2021-12-30 21:19:50 +08:00
yifang a1c0cfa042 single click to open external link in external browser 2021-12-29 23:28:26 +08:00
yifang 09063ecc5a clean code:
QString::SkipEmptyParts=>Qt::SkipEmptyParts
2021-12-29 22:29:06 +08:00
yifang e7218fc12b open link content duplicated in all the tabs. 2021-12-28 21:49:32 +08:00
yifang 5860e81ff3 typingEvent fix,double characters when focus 2021-12-18 18:08:45 +08:00
yifang de3d7b8b19 clean code:remove QT_VERSION check 2021-12-16 19:59:00 +08:00
xiaoyifang e04aa50a99 fix issue mentioned in https://github.com/goldendict/goldendict/issues/1393#issuecomment-993716654 2021-12-15 23:43:03 +08:00
xiaoyifang cb5ac438fe bword link in Hunspell dictionary. 2021-12-13 22:46:02 +08:00
yifang 98ca729446 remove qt_version_check macro 2021-12-13 22:45:57 +08:00
xiaoyifang 303179b410 clean code:
remove qt version check
save geometry
2021-12-13 22:45:35 +08:00
xiaoyifang 5eac08c97a rename qt4x5.hh to utils.hh
the filename qt4x5 is not proper now,for the qt4 version can never meet.and the qt5 is actually mean qt>5 .
2021-12-13 22:45:35 +08:00
yifang.xiao 0365015ac6 clean code:
remove "#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )" check ,the check should always be true based on current situation.
2021-12-13 22:45:33 +08:00
yifang.xiao ab358fb3a5 remove old qt(<5) code. 2021-12-13 22:43:43 +08:00
Igor Kushnir 8260ac87ba Linux-specific: Don't ignore main window close event
If GoldenDict's option "Close to system tray" is checked and
GoldenDict's main window is visible when the user logs out, the logout
is canceled in latest stable versions of KDE Plasma and Xfce desktop
environments (probably in other GNU/Linux desktop environments too, but
they weren't tested). The cause of this unintended and pointless logout
cancellation is ignoring the close event.

Close events are accepted by default. main() calls
`app.setQuitOnLastWindowClosed( false );`. Thus, if the close event is
not touched, the main window is hidden as before this change.
GoldenDict's configuration, history and favorites are still committed
and saved in both KDE Plasma and Xfce when logging out first
closes/hides the main window, then quits GoldenDict.

The change is limited to GNU/Linux because @Abs62 pointed out that
closing the main window breaks global hotkeys on Windows. I have
verified that closing the main window does not break global hotkeys on
GNU/Linux with Qt5 or Qt4. No one has volunteered to test whether the
change is needed on macOS, so it is safer not to apply it there.

Closes #1421.
2021-11-29 11:25:39 +02:00
xiaoyifang 9857ed0559 use char32_t as the inner string unit. 2021-10-20 23:02:37 +08:00
xiaoyifang bdb9561ec9 rename scheme handler 2021-10-02 20:48:49 +08:00
xiaoyifang d2257ce061 Merge remote-tracking branch 'remotes/origin/master' into branch-qt-5.15
# Conflicts:
#	articleview.cc
2021-09-24 14:08:26 +08:00
yifang 3b120ee765 1 remove useless code
2 define js variable to avoid js error
2021-09-24 21:42:55 +08:00
yifang a23409c875 fix:loaded url twice 2021-09-24 20:29:13 +08:00
xiaoyifang 17afc21478 1.js undefined error
2,disable chrome auto play feature
2021-09-22 11:20:42 +08:00
yifang 4a5af10277 add local scheme ,such as qrcx,gadu,etc. 2021-09-21 18:22:08 +08:00
xiaoyifang 0279273369 add gico scheme handler 2021-08-28 10:35:23 +08:00
yifang e5c72f8ecc change to setcontent 2021-08-21 09:41:40 +08:00
xiaoyifang eddfa075bd connect reply content to article view 2021-08-14 15:25:10 +08:00
xiaoyifang 939a96b7a6 register local scheme gdlookup:// 2021-08-05 14:57:22 +08:00
yifang 54bdf12d8d network manager change 2021-07-24 15:18:46 +08:00
xiaoyifang 3aadf52344 webkit to webengine 2021-07-15 22:58:32 +08:00
Igor Kushnir baff02a14b Make MainWindow::setTranslateBoxTextAnd*() harder to misuse
Most callers of these member functions should escape wildcard symbols in
the `text` argument. Yet nothing in the functions' signatures suggested
such escaping. With the added enum WildcardPolicy argument, the callers
are forced to decide whether or not the wildcards should be escaped.
2021-06-30 20:01:40 +03:00
Igor Kushnir 9ff28e226f Translate box: add missing wildcard symbol (un)escaping
When not-escaped wildcard symbols are placed in the translate box/line,
word completion can occupy the CPU for seconds. So it is safer to err on
the side of escaping than the other way around.

The missed unescaping in ScanPopup::translateInputFinished() was
inconsistent with the main window. It made escaping in the scan popup's
translate box unusable by attempting to translate e.g. "\*" verbatim.
2021-06-30 20:01:40 +03:00
Igor Kushnir f919685797 Extract duplicated "gdfrom-" string manipulation into functions
Such helper functions facilitate understanding of the code and simplify
implementing new features.
2021-06-29 13:31:09 +03:00
Igor Kushnir fdf0464628 Save&restore the geometry of Dictionaries dialog
The geometries of many GoldenDict's dialogs and windows are already
stored in config. Dictionaries dialog can make use of extra horizontal
space when there are many groups, extra vertical space - when there are
many dictionaries. A user can now resize this dialog to her liking once.
2021-06-23 09:53:42 +03:00
Abs62 e1c9a0d6de Fix compilation without C++11 support 2021-06-18 21:33:24 +03:00
Igor Kushnir 99ddb7686e Don't add the same phrase to history twice in a row
Each of the 3 removed history addition requests follows a call to
ArticleView::showDefinition() with the same phrase/word as an argument.
Each showDefinition() overload adds its phrase/word argument to history.

These duplicate history additions weren't noticeable because
History::addItem() searches for and removes its argument from items to
avoid duplicate history entries. But the extra function calls, signal
emissions, linear searches and QList manipulation wasted processor time.
2021-06-17 12:06:36 +03:00
Igor Kushnir 60bc05218f Add input phrase's punctuation suffix to alts
Preferences::sanitizeInputPhrase() transforms an input phrase by
removing its whitespace/punctuation prefix and suffix. Translating a
phrase from X11 primary selection or from clipboard, via mouse-over or
from the command line results in such sanitization. This is useful when
a punctuation mark or a space is selected accidentally alongside a word.
This sanitization can be undesirable, however, when an abbreviated word
is selected. For example: "etc.", "e.g.", "i.e.".

This commit implements searching for the input word with the punctuation
suffix preserved as an alternative form of the sanitized word to show
articles for both. For example, when the word "etc." is translated from
the clipboard, both "ETC" and "etc." articles are displayed.

The punctuation suffix is preserved when the word is passed from the
scan popup to the main window and when the translate line text is
refreshed (e.g. when the current group is changed). The suffix is not
stored in history and favorites (doing so would require file format
changes and possibly substantial code changes, this can be implemented
later if need be).

Trim the input phrase once in ArticleNetworkAccessManager::getResource()
instead of verbose trimming in multiple places in
ArticleMaker::makeDefinitionFor().

Closes #1350.
2021-06-17 12:06:36 +03:00
proletarius101 38d7193f49 Rename id in metadata and desktop entry to org.goldendict.GoldenDict
https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-id-generic

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#file-naming
2021-02-27 20:04:28 +08: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 9fb33d10bd Disable focus acquiring by "New tab" button 2020-10-22 20:41:37 +03:00
Abs62 1cef1a8733 Qt5-specific: Fix crash after Ctrl+Tab when tabs navigation in MRU order is turned on in preferences 2019-11-16 16:01:13 +03:00
Abs62 df92b38ea8 Mac-specific: Fix save/restore main window configuration with Qt 5.12 2019-09-30 19:57:30 +03:00
Abs62 c53fe1c640 Windows: Fix crashes when all global hotkeys are disabled (issue #1184) 2019-08-07 22:54:49 +03:00
Abs62 05bfc353a8 Allow dictionaries groups combobox standard hotkeys from FTS and Headwords dialogs 2019-07-09 18:00:23 +03:00
coozoo 09a7d4db33 Fix empty menu if program compiled with qt5
Fixed by not adding dummy system tray under X env
Tested for:
Mate 1.22.1
XFCE4 4.12
KDE 5.14.5 (damn it's so ugly now)
GNOME (with topicons-plus extension)

This commit fixes #907, fixes #1097 and fixes #1155
2019-05-27 18:58:27 +03:00
Igor Kushnir 13a321190f Don't construct scan popup twice at startup
abcabb77fa added a makeScanPopup() call
after applyQtStyleSheet() in MainWindow constructor to apply Qt style
sheets to the scan popup. This call destroys the scan popup created
earlier in the MainWindow constructor and creates a new instance.

Let us remove the first, now redundant invocation of makeScanPopup()
from MainWindow::makeDictionaries() to improve startup performance.
makeDictionaries() is currently called only once, so modifying it is not
a problem. If makeDictionaries() is used elsewhere in the future,
the added assertion will remind to reconstruct the scan popup.
2019-05-15 11:09:20 +03:00
Abs62 abcabb77fa Initialize scanPopup window after setting of Qt style sheets (issue #1144) 2019-05-13 18:17:27 +03:00
Abs62 c3ff15f4d8 Fix one more crash under Qt 5.12 2019-04-22 19:50:06 +03:00
Abs62 5fb4ff183e Fix some more possibly crashes with Qt 5.12 2019-03-22 17:10:26 +03:00