From 27ca24f83d817c9d16546b6bcee1e6769f3685f8 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Thu, 19 Nov 2020 12:49:23 +0200 Subject: [PATCH 1/4] Fix indentation of recently added code: 4 => 2 spaces --- config.cc | 4 ++-- preferences.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.cc b/config.cc index 892a8d34..019e24f6 100644 --- a/config.cc +++ b/config.cc @@ -944,7 +944,7 @@ Class load() THROW_SPEC( exError ) c.preferences.articleSizeLimit = preferences.namedItem( "articleSizeLimit" ).toElement().text().toInt(); if ( !preferences.namedItem( "limitInputPhraseLength" ).isNull() ) - c.preferences.limitInputPhraseLength = ( preferences.namedItem( "limitInputPhraseLength" ).toElement().text() == "1" ); + c.preferences.limitInputPhraseLength = ( preferences.namedItem( "limitInputPhraseLength" ).toElement().text() == "1" ); if ( !preferences.namedItem( "inputPhraseLengthLimit" ).isNull() ) c.preferences.inputPhraseLengthLimit = preferences.namedItem( "inputPhraseLengthLimit" ).toElement().text().toInt(); @@ -2322,7 +2322,7 @@ QString getCacheDir() throw() QString getNetworkCacheDir() throw() { - return getCacheDir() + "/network"; + return getCacheDir() + "/network"; } } diff --git a/preferences.cc b/preferences.cc index 02934e71..6dcfa9a1 100644 --- a/preferences.cc +++ b/preferences.cc @@ -651,7 +651,7 @@ void Preferences::customProxyToggled( bool ) void Preferences::on_maxNetworkCacheSize_valueChanged( int value ) { - ui.clearNetworkCacheOnExit->setEnabled( value != 0 ); + ui.clearNetworkCacheOnExit->setEnabled( value != 0 ); } void Preferences::helpRequested() From dea11ca080271e1b51224606117a65e1d5f3b7a8 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Thu, 19 Nov 2020 12:50:38 +0200 Subject: [PATCH 2/4] inputPhraseLengthLimit option's single step: 5 => 10 This speeds up decreasing the default value that is probably too large for most users. I think that very few users would want to tune this option's value finer than 10. Those who need such precision can enter the desired number manually. --- preferences.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preferences.ui b/preferences.ui index c90a2779..ee826fb8 100644 --- a/preferences.ui +++ b/preferences.ui @@ -1803,7 +1803,7 @@ from mouse-over, selection, clipboard or command line 10000 - 5 + 10 1000 From aba899743829f0532407e087166313a5aac585c9 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Thu, 19 Nov 2020 14:21:23 +0200 Subject: [PATCH 3/4] Increase inputPhraseLengthLimit option's maximum Those who use GoldenDict to translate long text with Google Translate or pronounce it with a text-to-speech engine (see a discussion in comments under #1313) may still want to limit the input phrase length. But they might prefer a limit greater than the current maximum - ten thousand symbols. Ten million minus one symbols should be generous enough. I don't want to increase the maximum further to avoid excessive widening of spinboxes in the Preferences UI. Besides, a ten megabyte input phrase freezes GoldenDict's UI with high CPU usage for a minute on my system. --- preferences.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preferences.ui b/preferences.ui index ee826fb8..ed810484 100644 --- a/preferences.ui +++ b/preferences.ui @@ -1800,7 +1800,7 @@ from mouse-over, selection, clipboard or command line Input phrases longer than this size will be ignored - 10000 + 9999999 10 From ecb8f542939dadacdc03ad73ee00a68fea761e48 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Thu, 19 Nov 2020 14:10:36 +0200 Subject: [PATCH 4/4] Preferences: disable spinboxes when their checkboxes are unchecked Neither of the two int options has any effect if the corresponding bool option is turned off. --- preferences.cc | 14 ++++++++++++++ preferences.hh | 3 +++ 2 files changed, 17 insertions(+) diff --git a/preferences.cc b/preferences.cc index 6dcfa9a1..59eddea2 100644 --- a/preferences.cc +++ b/preferences.cc @@ -210,9 +210,13 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): ui.confirmFavoritesDeletion->setChecked( p.confirmFavoritesDeletion ); ui.collapseBigArticles->setChecked( p.collapseBigArticles ); + on_collapseBigArticles_toggled( ui.collapseBigArticles->isChecked() ); ui.articleSizeLimit->setValue( p.articleSizeLimit ); + ui.limitInputPhraseLength->setChecked( p.limitInputPhraseLength ); + on_limitInputPhraseLength_toggled( ui.limitInputPhraseLength->isChecked() ); ui.inputPhraseLengthLimit->setValue( p.inputPhraseLengthLimit ); + ui.ignoreDiacritics->setChecked( p.ignoreDiacritics ); ui.synonymSearchEnabled->setChecked( p.synonymSearchEnabled ); @@ -654,6 +658,16 @@ void Preferences::on_maxNetworkCacheSize_valueChanged( int value ) ui.clearNetworkCacheOnExit->setEnabled( value != 0 ); } +void Preferences::on_collapseBigArticles_toggled( bool checked ) +{ + ui.articleSizeLimit->setEnabled( checked ); +} + +void Preferences::on_limitInputPhraseLength_toggled( bool checked ) +{ + ui.inputPhraseLengthLimit->setEnabled( checked ); +} + void Preferences::helpRequested() { if( !helpWindow ) diff --git a/preferences.hh b/preferences.hh index 66e6227d..71142091 100644 --- a/preferences.hh +++ b/preferences.hh @@ -54,6 +54,9 @@ private slots: void customProxyToggled( bool ); void on_maxNetworkCacheSize_valueChanged( int value ); + void on_collapseBigArticles_toggled( bool checked ); + void on_limitInputPhraseLength_toggled( bool checked ); + void helpRequested(); void closeHelp(); };