Commit graph

128 commits

Author SHA1 Message Date
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 cb5ac438fe bword link in Hunspell dictionary. 2021-12-13 22:46:02 +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 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 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
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 05bfc353a8 Allow dictionaries groups combobox standard hotkeys from FTS and Headwords dialogs 2019-07-09 18:00:23 +03:00
Igor Kushnir 503de6474f Qt5: improve repeated zooming performance
For example, looking up "United States" in my local dictionaries, then
pressing Ctrl++ to increase zoom factor from 1 to 5 takes 4 seconds with
this change and 25 seconds without it. The same scaling takes 6 seconds
with this change and 45 seconds without when I enable English Wikipedia,
which has a particularly large "United States" article.

There is a workaround that speeds up zooming: look up a nonexistent
word, scale to the desired level, then go back to the large articles.
But this is tedious if large articles are open in scan popup or
in case of many tabs in the main window.
2019-02-02 15:31:16 +02:00
Igor Kushnir ebfeb37f56 Undef common words defined in X11 headers
* #undef Bool with Qt4 as well as with Qt5.
* #undef min, #undef max from <X11/Xlibint.h>.
* #include <fixx11h.h> just after hotkeywrapper.hh. Unfortunately this
  header can not be included in hotkeywrapper.hh directly because
  some of the undef-ed words are actually used in hotkeywrapper.cc.
* #include <fixx11h.h> after <X11/Xlib.h> in mainwindow.cc just in case
  hotkeywrapper.hh stops including this Xlib.h header in the future.

These changes should make future compilation errors less likely.

For example, without "#undef min" in hotkeywrapper.hh, including
<iomanip> in mainwindow.cc after the mainwindow.hh include resulted in
the following GCC 8 compilation error:
 /usr/include/c++/8.2.1/bits/locale_facets_nonio.tcc:945:22:
  error: expected unqualified-id before ‘(’ token
      __minlen = std::min(__minlen,
                      ^~~
2019-01-28 15:58:14 +02:00
Abs62 92e8c85eec Fix behavior while words list font resizing (issue #1109) 2019-01-26 22:11:27 +03:00
Abs62 5fa5cc123f Full-text search: Allow ignore diacritics while search 2018-04-10 17:49:52 +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
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
Abs62 a2dc6d96b6 Remove item from Favorites if one already exist while click on star button in main window 2017-12-07 18:47:53 +03:00
Abs62 77c9a4c3e2 Fix "Add to Favorites" icon changing 2017-11-07 17:46:59 +03:00
Abs62 65be9f2f8a Append "Add to favorites" action to tabs context menu 2017-11-07 17:45:21 +03:00
Abs62 1824d9ab02 Change "Add to Favorites" icon if headword is already presented in Favorites 2017-10-23 17:21:43 +03:00
Abs62 a6e51afa64 Add "Add to Favorites" button to scan popup window 2017-05-15 18:08:06 +03:00
Abs62 1e34de2dbc Add "Favorites" feature 2017-05-12 17:41:08 +03:00
Abs62 e982b69216 Add command line parameters "--group-name" and "--popup-group-name" 2017-03-10 17:15:10 +03:00
Abs62 44a9a1cac5 Merge branch 'Qt4x5' into Original
# Conflicts:
#	fulltextsearch.cc
2016-04-26 19:01:40 +03:00
Abs62 30d8b6eed8 Initialize string for full-text search by value from main window translate line 2016-04-24 22:04:22 +03:00
Abs62 47936e236d Merge branch 'Temp' into Qt4x5 2015-11-01 16:08:10 +03:00
Abs62 cbef0a1a1f Show now indexing for full-text search dictionary name in status line (issue #640) 2015-11-01 16:03:15 +03:00
Abs62 c1ed847095 Merge branch 'Temp' into Qt4x5 2015-05-20 17:48:52 +03:00
Abs62 9d82ae4622 Show headwords from dictionaries setup dialog in modal mode 2015-03-23 18:58:49 +03:00
Abs62 4b8de48e5c Merge branch 'Original' into Qt4x5 2014-11-27 18:53:52 +03:00
Abs62 46298a842c Jump to dictionary when show word from dictionary headwords dialog 2014-11-17 17:37:19 +03:00
Abs62 8cabcacf55 Merge branch 'Original' into Qt4x5
Conflicts:
	btreeidx.cc
	fulltextsearch.cc
	goldendict.pro
	main.cc
2014-07-11 18:17:43 +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 b9666f7f9f Merge branch 'Original' into Qt4x5
Conflicts:
	bgl_babylon.cc
2014-05-12 18:10:26 +04:00
Igor Kushnir e79338b3a1 Fixed activating link with <Enter>; fixed FullTextSearchDialog tab order; fixed switching between UI elements via shortcuts. 2014-05-11 14:52:25 +03:00
Abs62 10532279b1 Merge branch 'Original' into Qt4x5
Conflicts:
	article_netmgr.cc
	mainwindow.cc
2014-04-23 18:16:06 +04:00
Abs62 c2cdf9b177 Full-text search: Highlight of the search results 2014-04-22 22:29:58 +04:00
Abs62 9ad0d5f985 Implement full-text search 2014-04-16 20:18:28 +04:00
Abs62 4cf35cc7e3 Merge branch 'Original' into Qt4x5
Conflicts:
	hotkeywrapper.hh
	mainwindow.cc
	mainwindow.hh
2014-04-11 19:29:56 +04:00
Abs62 9623cbdd7a Add proxy authentication dialog 2014-04-03 18:21:02 +04:00
Abs62 269ea601f5 Win-specific: ScanPopup: Fix GD main window scanning under Win7+ 2014-03-17 18:53:47 +04:00
Abs62 4bbe1aaee5 Merge branch 'Original' into Qt4x5
Conflicts:
	scanpopup.cc
2014-03-14 17:34:33 +04:00
Abs62 902c5f605b Add Ctrl+D shortcut to switch to dictionary headwords dialog 2014-03-04 20:58:51 +04:00
Abs62 55e9dc6a38 Make headwords dialog modeless 2014-03-03 17:46:41 +04:00
Abs62 a7145abdd0 Call dictionary headwords dialog via context menu of dictionaries bar and dictionaries list 2014-03-01 17:11:14 +04:00
Abs62 0fa4087b38 Merge branch 'Original' into Qt4x5
Conflicts:
	goldendict.pro
	mainwindow.cc
	zim.cc
	zipsounds.cc
2014-02-11 23:39:31 +04:00
Abs62 dabceff223 Don't jump to dictionary when new page opens in background 2014-02-09 19:15:41 +04:00
Timon Wong 01ef08a709 Merge branch 'master' into qt4x5 2013-07-05 17:03:57 +08:00