From c787a08d2fff5a8bb001acc6d1f2eb53011f86d0 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Wed, 6 Nov 2024 12:07:23 +0800 Subject: [PATCH 1/3] opt: add option about --- src/config.cc | 10 ++++++++++ src/config.hh | 1 + src/ui/preferences.cc | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/config.cc b/src/config.cc index 96b3d842..a82f7af4 100644 --- a/src/config.cc +++ b/src/config.cc @@ -212,6 +212,7 @@ Preferences::Preferences(): doubleClickTranslates( true ), selectWordBySingleClick( false ), autoScrollToTargetArticle( true ), + targetArticleAtFirst(false), escKeyHidesMainWindow( false ), darkMode( false ), darkReaderMode( false ), @@ -941,6 +942,11 @@ Class load() ( preferences.namedItem( "autoScrollToTargetArticle" ).toElement().text() == "1" ); } + if ( !preferences.namedItem( "targetArticleAtFirst" ).isNull() ) { + c.preferences.targetArticleAtFirst = + ( preferences.namedItem( "targetArticleAtFirst" ).toElement().text() == "1" ); + } + if ( !preferences.namedItem( "escKeyHidesMainWindow" ).isNull() ) { c.preferences.escKeyHidesMainWindow = ( preferences.namedItem( "escKeyHidesMainWindow" ).toElement().text() == "1" ); @@ -1877,6 +1883,10 @@ void save( Class const & c ) opt.appendChild( dd.createTextNode( c.preferences.autoScrollToTargetArticle ? "1" : "0" ) ); preferences.appendChild( opt ); + opt = dd.createElement( "targetArticleAtFirst" ); + opt.appendChild( dd.createTextNode( c.preferences.targetArticleAtFirst ? "1" : "0" ) ); + preferences.appendChild( opt ); + opt = dd.createElement( "escKeyHidesMainWindow" ); opt.appendChild( dd.createTextNode( c.preferences.escKeyHidesMainWindow ? "1" : "0" ) ); preferences.appendChild( opt ); diff --git a/src/config.hh b/src/config.hh index bc4c960d..46a37ce7 100644 --- a/src/config.hh +++ b/src/config.hh @@ -345,6 +345,7 @@ struct Preferences bool doubleClickTranslates; bool selectWordBySingleClick; bool autoScrollToTargetArticle; + bool targetArticleAtFirst; bool escKeyHidesMainWindow; bool alwaysOnTop; diff --git a/src/ui/preferences.cc b/src/ui/preferences.cc index 9b97c9ef..9b44ea12 100644 --- a/src/ui/preferences.cc +++ b/src/ui/preferences.cc @@ -180,6 +180,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ): ui.doubleClickTranslates->setChecked( p.doubleClickTranslates ); ui.selectBySingleClick->setChecked( p.selectWordBySingleClick ); ui.autoScrollToTargetArticle->setChecked( p.autoScrollToTargetArticle ); + ui.targetArticleAtFirst->setChecked( p.targetArticleAtFirst ); ui.escKeyHidesMainWindow->setChecked( p.escKeyHidesMainWindow ); ui.darkMode->setChecked( p.darkMode ); ui.darkReaderMode->setChecked( p.darkReaderMode ); @@ -411,6 +412,7 @@ Config::Preferences Preferences::getPreferences() p.doubleClickTranslates = ui.doubleClickTranslates->isChecked(); p.selectWordBySingleClick = ui.selectBySingleClick->isChecked(); p.autoScrollToTargetArticle = ui.autoScrollToTargetArticle->isChecked(); + p.targetArticleAtFirst = ui.targetArticleAtFirst->isChecked(); p.escKeyHidesMainWindow = ui.escKeyHidesMainWindow->isChecked(); p.darkMode = ui.darkMode->isChecked(); From 27cbb7351be0a05d7dc83583382e0655c05e6399 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Wed, 6 Nov 2024 13:35:22 +0800 Subject: [PATCH 2/3] opt: add option about --- src/ui/preferences.ui | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ui/preferences.ui b/src/ui/preferences.ui index d616e44c..a25f3ad8 100644 --- a/src/ui/preferences.ui +++ b/src/ui/preferences.ui @@ -169,6 +169,16 @@ however, the article from the topmost dictionary is shown. + + + + Place the target article at the first place. + + + true + + + From 15b918eb6a8f771b9327d56589fcdb8925efdf12 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 01:47:29 +0000 Subject: [PATCH 3/3] [autofix.ci] apply automated fixes --- src/config.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.cc b/src/config.cc index a82f7af4..f096c2d2 100644 --- a/src/config.cc +++ b/src/config.cc @@ -212,7 +212,7 @@ Preferences::Preferences(): doubleClickTranslates( true ), selectWordBySingleClick( false ), autoScrollToTargetArticle( true ), - targetArticleAtFirst(false), + targetArticleAtFirst( false ), escKeyHidesMainWindow( false ), darkMode( false ), darkReaderMode( false ),