From 7c32cad65af00d7d5ca6a1f4398c20f8533e1b13 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Nov 2024 16:45:13 +0800 Subject: [PATCH 01/11] opt: erase the need to removeTabs --- src/ui/editdictionaries.cc | 16 ++++++++-------- src/ui/groups.cc | 21 +++++++++++++++++++++ src/ui/groups.hh | 4 +++- src/ui/orderandprops.cc | 21 +++++++++++++++++++++ src/ui/orderandprops.hh | 4 +++- 5 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 01af97e4..9675e031 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -214,16 +214,16 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) Instances::updateNames( savedInactive, dictionaries ); if ( rebuildGroups ) { - ui.tabs->removeTab( 1 ); - ui.tabs->removeTab( 1 ); + // ui.tabs->removeTab( 1 ); + // ui.tabs->removeTab( 1 ); - orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries ); - groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); + orderAndProps->rebuild( this, savedOrder, savedInactive, dictionaries ); + groups->rebuild( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); - ui.tabs->insertTab( 1, orderAndProps, QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) ); - ui.tabs->insertTab( 2, groups, QIcon( ":/icons/bookcase.svg" ), tr( "&Groups" ) ); - connect( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo ); - connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); + // ui.tabs->insertTab( 1, orderAndProps, QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) ); + // ui.tabs->insertTab( 2, groups, QIcon( ":/icons/bookcase.svg" ), tr( "&Groups" ) ); + // connect( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo ); + // connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); } setUpdatesEnabled( true ); } diff --git a/src/ui/groups.cc b/src/ui/groups.cc index 09661f3b..ada9cd36 100644 --- a/src/ui/groups.cc +++ b/src/ui/groups.cc @@ -64,6 +64,27 @@ Groups::Groups( QWidget * parent, countChanged(); } +void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, + Config::Groups const & groups_, + Config::Group const & order ){ + + setUpdatesEnabled( false ); + dicts = dicts_; + groups = groups_; + + ui.dictionaries->setAsSource(); + ui.dictionaries->populate( Instances::Group( order, dicts, Config::Group() ).dictionaries, dicts ); + + ui.searchLine->applyTo( ui.dictionaries ); + + // Populate groups' widget + + ui.groups->populate( groups, dicts, ui.dictionaries->getCurrentDictionaries() ); + + countChanged(); + setUpdatesEnabled( true ); +} + void Groups::editGroup( unsigned id ) { for ( int x = 0; x < groups.size(); ++x ) { diff --git a/src/ui/groups.hh b/src/ui/groups.hh index b6bbac08..4431afad 100644 --- a/src/ui/groups.hh +++ b/src/ui/groups.hh @@ -18,7 +18,9 @@ public: std::vector< sptr< Dictionary::Class > > const &, Config::Groups const &, Config::Group const & order ); - + void rebuild( vector< sptr< Dictionary::Class > > const & dicts_, + Config::Groups const & groups_, + Config::Group const & order ); /// Instructs the dialog to position itself on editing the given group. void editGroup( unsigned id ); diff --git a/src/ui/orderandprops.cc b/src/ui/orderandprops.cc index 08e5a898..2f28a555 100644 --- a/src/ui/orderandprops.cc +++ b/src/ui/orderandprops.cc @@ -133,6 +133,27 @@ OrderAndProps::OrderAndProps( QWidget * parent, showDictNumbers(); } +void OrderAndProps::rebuild( Config::Group const & dictionaryOrder, + Config::Group const & inactiveDictionaries, + std::vector< sptr< Dictionary::Class > > const & allDictionaries ) +{ + Instances::Group order( dictionaryOrder, allDictionaries, Config::Group() ); + Instances::Group inactive( inactiveDictionaries, allDictionaries, Config::Group() ); + + Instances::complementDictionaryOrder( order, inactive, allDictionaries ); + + setUpdatesEnabled( false ); + ui.dictionaryOrder->populate( order.dictionaries, allDictionaries ); + ui.inactiveDictionaries->populate( inactive.dictionaries, allDictionaries ); + + ui.searchLine->applyTo( ui.dictionaryOrder ); + + disableDictionaryDescription(); + + showDictNumbers(); + setUpdatesEnabled( true ); +} + Config::Group OrderAndProps::getCurrentDictionaryOrder() const { Instances::Group g; diff --git a/src/ui/orderandprops.hh b/src/ui/orderandprops.hh index 99c154e8..8e9bb938 100644 --- a/src/ui/orderandprops.hh +++ b/src/ui/orderandprops.hh @@ -17,7 +17,9 @@ public: Config::Group const & dictionaryOrder, Config::Group const & inactiveDictionaries, std::vector< sptr< Dictionary::Class > > const & allDictionaries ); - + void rebuild( Config::Group const & dictionaryOrder, + Config::Group const & inactiveDictionaries, + std::vector< sptr< Dictionary::Class > > const & allDictionaries ); Config::Group getCurrentDictionaryOrder() const; Config::Group getCurrentInactiveDictionaries() const; From db4c352d6c85f7c14d6fcf4655c67d1a6f0f1ddb Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Nov 2024 16:45:31 +0800 Subject: [PATCH 02/11] opt: erase the need to removeTabs --- src/ui/editdictionaries.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 9675e031..77eff3d8 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -217,8 +217,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) // ui.tabs->removeTab( 1 ); // ui.tabs->removeTab( 1 ); - orderAndProps->rebuild( this, savedOrder, savedInactive, dictionaries ); - groups->rebuild( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); + orderAndProps->rebuild( savedOrder, savedInactive, dictionaries ); + groups->rebuild( dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); // ui.tabs->insertTab( 1, orderAndProps, QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) ); // ui.tabs->insertTab( 2, groups, QIcon( ":/icons/bookcase.svg" ), tr( "&Groups" ) ); From 2de21417588295b3861f898123fa3c8c891199d7 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 09:04:09 +0000 Subject: [PATCH 03/11] [autofix.ci] apply automated fixes --- src/ui/groups.cc | 11 ++++++----- src/ui/groups.hh | 4 ++-- src/ui/orderandprops.cc | 4 ++-- src/ui/orderandprops.hh | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ui/groups.cc b/src/ui/groups.cc index ada9cd36..3601a033 100644 --- a/src/ui/groups.cc +++ b/src/ui/groups.cc @@ -64,12 +64,13 @@ Groups::Groups( QWidget * parent, countChanged(); } -void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, - Config::Groups const & groups_, - Config::Group const & order ){ - +void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, + Config::Groups const & groups_, + Config::Group const & order ) +{ + setUpdatesEnabled( false ); - dicts = dicts_; + dicts = dicts_; groups = groups_; ui.dictionaries->setAsSource(); diff --git a/src/ui/groups.hh b/src/ui/groups.hh index 4431afad..ebb2eda6 100644 --- a/src/ui/groups.hh +++ b/src/ui/groups.hh @@ -19,8 +19,8 @@ public: Config::Groups const &, Config::Group const & order ); void rebuild( vector< sptr< Dictionary::Class > > const & dicts_, - Config::Groups const & groups_, - Config::Group const & order ); + Config::Groups const & groups_, + Config::Group const & order ); /// Instructs the dialog to position itself on editing the given group. void editGroup( unsigned id ); diff --git a/src/ui/orderandprops.cc b/src/ui/orderandprops.cc index 2f28a555..e978b73d 100644 --- a/src/ui/orderandprops.cc +++ b/src/ui/orderandprops.cc @@ -134,8 +134,8 @@ OrderAndProps::OrderAndProps( QWidget * parent, } void OrderAndProps::rebuild( Config::Group const & dictionaryOrder, - Config::Group const & inactiveDictionaries, - std::vector< sptr< Dictionary::Class > > const & allDictionaries ) + Config::Group const & inactiveDictionaries, + std::vector< sptr< Dictionary::Class > > const & allDictionaries ) { Instances::Group order( dictionaryOrder, allDictionaries, Config::Group() ); Instances::Group inactive( inactiveDictionaries, allDictionaries, Config::Group() ); diff --git a/src/ui/orderandprops.hh b/src/ui/orderandprops.hh index 8e9bb938..030a0cc6 100644 --- a/src/ui/orderandprops.hh +++ b/src/ui/orderandprops.hh @@ -18,8 +18,8 @@ public: Config::Group const & inactiveDictionaries, std::vector< sptr< Dictionary::Class > > const & allDictionaries ); void rebuild( Config::Group const & dictionaryOrder, - Config::Group const & inactiveDictionaries, - std::vector< sptr< Dictionary::Class > > const & allDictionaries ); + Config::Group const & inactiveDictionaries, + std::vector< sptr< Dictionary::Class > > const & allDictionaries ); Config::Group getCurrentDictionaryOrder() const; Config::Group getCurrentInactiveDictionaries() const; From c2fc90801b7dd2b7bfccc5409ea4e9919ecc2801 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Nov 2024 17:14:27 +0800 Subject: [PATCH 04/11] opt: update name should reflect the latest info --- src/ui/editdictionaries.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 77eff3d8..dfa1b3f2 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -113,7 +113,6 @@ void EditDictionaries::currentChanged( int index ) if ( index == -1 || !isVisible() ) { return; // Sent upon the construction/destruction } - qDebug() << ui.tabs->currentWidget()->objectName(); if ( lastTabName.isEmpty() || lastTabName == "Sources" ) { // We're switching away from the Sources tab -- if its contents were // changed, we need to either apply or reject now. @@ -183,9 +182,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) { dictionariesChanged = true; - Config::Groups savedGroups = groups->getGroups(); - Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); - Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); cfg.paths = sources.getPaths(); cfg.soundDirs = sources.getSoundDirs(); @@ -209,10 +205,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) loadDictionaries( this, cfg, dictionaries, dictNetMgr ); - Instances::updateNames( savedGroups, dictionaries ); - Instances::updateNames( savedOrder, dictionaries ); - Instances::updateNames( savedInactive, dictionaries ); - if ( rebuildGroups ) { // ui.tabs->removeTab( 1 ); // ui.tabs->removeTab( 1 ); @@ -225,6 +217,15 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) // connect( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo ); // connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); } + + Config::Groups savedGroups = groups->getGroups(); + Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); + Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); + + Instances::updateNames( savedGroups, dictionaries ); + Instances::updateNames( savedOrder, dictionaries ); + Instances::updateNames( savedInactive, dictionaries ); + setUpdatesEnabled( true ); } EditDictionaries::~EditDictionaries() From 1cf495e7dd12f86876a9ce2bf9a623f0f7787974 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Nov 2024 17:32:05 +0800 Subject: [PATCH 05/11] Revert "opt: update name should reflect the latest info" This reverts commit 1272ea2d20a7908b9a69d6b551511916f97cc024. --- src/ui/editdictionaries.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index dfa1b3f2..77eff3d8 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -113,6 +113,7 @@ void EditDictionaries::currentChanged( int index ) if ( index == -1 || !isVisible() ) { return; // Sent upon the construction/destruction } + qDebug() << ui.tabs->currentWidget()->objectName(); if ( lastTabName.isEmpty() || lastTabName == "Sources" ) { // We're switching away from the Sources tab -- if its contents were // changed, we need to either apply or reject now. @@ -182,6 +183,9 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) { dictionariesChanged = true; + Config::Groups savedGroups = groups->getGroups(); + Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); + Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); cfg.paths = sources.getPaths(); cfg.soundDirs = sources.getSoundDirs(); @@ -205,6 +209,10 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) loadDictionaries( this, cfg, dictionaries, dictNetMgr ); + Instances::updateNames( savedGroups, dictionaries ); + Instances::updateNames( savedOrder, dictionaries ); + Instances::updateNames( savedInactive, dictionaries ); + if ( rebuildGroups ) { // ui.tabs->removeTab( 1 ); // ui.tabs->removeTab( 1 ); @@ -217,15 +225,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) // connect( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo ); // connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); } - - Config::Groups savedGroups = groups->getGroups(); - Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); - Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); - - Instances::updateNames( savedGroups, dictionaries ); - Instances::updateNames( savedOrder, dictionaries ); - Instances::updateNames( savedInactive, dictionaries ); - setUpdatesEnabled( true ); } EditDictionaries::~EditDictionaries() From 10b0496cce48b4ceaa129cde9c98fd5d376f59b3 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 4 Nov 2024 14:05:02 +0800 Subject: [PATCH 06/11] 1: do not update name --- src/ui/editdictionaries.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 77eff3d8..c0f377dd 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -209,9 +209,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) loadDictionaries( this, cfg, dictionaries, dictNetMgr ); - Instances::updateNames( savedGroups, dictionaries ); - Instances::updateNames( savedOrder, dictionaries ); - Instances::updateNames( savedInactive, dictionaries ); if ( rebuildGroups ) { // ui.tabs->removeTab( 1 ); From 59d01868daa05c176c7dceeb7756037b69ece27f Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 4 Nov 2024 14:15:54 +0800 Subject: [PATCH 07/11] 1: do not update name --- src/ui/editdictionaries.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index c0f377dd..ab2ab307 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -183,9 +183,9 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) { dictionariesChanged = true; - Config::Groups savedGroups = groups->getGroups(); - Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); - Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); + Config::Groups savedGroups = cfg.groups; + Config::Group savedOrder = cfg.dictionaryOrder; + Config::Group savedInactive = cfg.inactiveDictionaries; cfg.paths = sources.getPaths(); cfg.soundDirs = sources.getSoundDirs(); From 5bef4cef22d200bff0f0a0babb5bc1118508441d Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Mon, 4 Nov 2024 21:25:44 +0800 Subject: [PATCH 08/11] 1 --- src/ui/editdictionaries.cc | 5 ++--- src/ui/groups.cc | 5 ++--- src/ui/groups.hh | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index ab2ab307..1b30f100 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -204,12 +204,11 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) // Those hold pointers to dictionaries, we need to free them. groupInstances.clear(); - groups.clear(); - orderAndProps.clear(); + // groups.clear(); + // orderAndProps.clear(); loadDictionaries( this, cfg, dictionaries, dictNetMgr ); - if ( rebuildGroups ) { // ui.tabs->removeTab( 1 ); // ui.tabs->removeTab( 1 ); diff --git a/src/ui/groups.cc b/src/ui/groups.cc index 3601a033..15a49e12 100644 --- a/src/ui/groups.cc +++ b/src/ui/groups.cc @@ -68,8 +68,7 @@ void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, Config::Groups const & groups_, Config::Group const & order ) { - - setUpdatesEnabled( false ); + this->setUpdatesEnabled( false ); dicts = dicts_; groups = groups_; @@ -83,7 +82,7 @@ void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, ui.groups->populate( groups, dicts, ui.dictionaries->getCurrentDictionaries() ); countChanged(); - setUpdatesEnabled( true ); + this->setUpdatesEnabled( true ); } void Groups::editGroup( unsigned id ) diff --git a/src/ui/groups.hh b/src/ui/groups.hh index ebb2eda6..0d54c321 100644 --- a/src/ui/groups.hh +++ b/src/ui/groups.hh @@ -18,7 +18,7 @@ public: std::vector< sptr< Dictionary::Class > > const &, Config::Groups const &, Config::Group const & order ); - void rebuild( vector< sptr< Dictionary::Class > > const & dicts_, + void rebuild( std::vector< sptr< Dictionary::Class > > const & dicts_, Config::Groups const & groups_, Config::Group const & order ); /// Instructs the dialog to position itself on editing the given group. @@ -33,7 +33,7 @@ public: private: Ui::Groups ui; - std::vector< sptr< Dictionary::Class > > const & dicts; + std::vector< sptr< Dictionary::Class > > dicts; Config::Groups groups; QToolButton * groupsListButton; From 5092ebe2ee9314ad5bd14896efe71ebd087a5f91 Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Mon, 4 Nov 2024 21:52:53 +0800 Subject: [PATCH 09/11] 1 --- src/dict/loaddictionaries.cc | 2 +- src/ui/editdictionaries.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dict/loaddictionaries.cc b/src/dict/loaddictionaries.cc index fc4bb737..e369ac6e 100644 --- a/src/dict/loaddictionaries.cc +++ b/src/dict/loaddictionaries.cc @@ -224,7 +224,7 @@ void loadDictionaries( QWidget * parent, loadDicts.wait(); - if ( loadDicts.getExceptionText().size() ) { + if ( !loadDicts.getExceptionText().empty() ) { QMessageBox::critical( parent, QCoreApplication::translate( "LoadDictionaries", "Error loading dictionaries" ), QString::fromUtf8( loadDicts.getExceptionText().c_str() ) ); diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 1b30f100..103aa3a6 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -183,9 +183,9 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) { dictionariesChanged = true; - Config::Groups savedGroups = cfg.groups; - Config::Group savedOrder = cfg.dictionaryOrder; - Config::Group savedInactive = cfg.inactiveDictionaries; + Config::Groups savedGroups = groups->getGroups(); + Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder(); + Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries(); cfg.paths = sources.getPaths(); cfg.soundDirs = sources.getSoundDirs(); From c5ca1b7d638ed7bb66aabac3a74b40e59b67f3dd Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Thu, 7 Nov 2024 21:27:45 +0800 Subject: [PATCH 10/11] 1 --- src/ui/groups.cc | 2 +- src/ui/orderandprops.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/groups.cc b/src/ui/groups.cc index 15a49e12..e7f4af6f 100644 --- a/src/ui/groups.cc +++ b/src/ui/groups.cc @@ -75,7 +75,7 @@ void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, ui.dictionaries->setAsSource(); ui.dictionaries->populate( Instances::Group( order, dicts, Config::Group() ).dictionaries, dicts ); - ui.searchLine->applyTo( ui.dictionaries ); + // ui.searchLine->applyTo( ui.dictionaries ); // Populate groups' widget diff --git a/src/ui/orderandprops.cc b/src/ui/orderandprops.cc index e978b73d..862d5462 100644 --- a/src/ui/orderandprops.cc +++ b/src/ui/orderandprops.cc @@ -146,7 +146,7 @@ void OrderAndProps::rebuild( Config::Group const & dictionaryOrder, ui.dictionaryOrder->populate( order.dictionaries, allDictionaries ); ui.inactiveDictionaries->populate( inactive.dictionaries, allDictionaries ); - ui.searchLine->applyTo( ui.dictionaryOrder ); + // ui.searchLine->applyTo( ui.dictionaryOrder ); disableDictionaryDescription(); From 3c5233f2a184362aebf084c851b214912902432b Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 11 Nov 2024 09:19:29 +0800 Subject: [PATCH 11/11] 1 --- src/ui/editdictionaries.cc | 11 ----------- src/ui/groups.cc | 3 --- src/ui/orderandprops.cc | 2 -- 3 files changed, 16 deletions(-) diff --git a/src/ui/editdictionaries.cc b/src/ui/editdictionaries.cc index 103aa3a6..ea832637 100644 --- a/src/ui/editdictionaries.cc +++ b/src/ui/editdictionaries.cc @@ -204,22 +204,11 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) // Those hold pointers to dictionaries, we need to free them. groupInstances.clear(); - // groups.clear(); - // orderAndProps.clear(); - loadDictionaries( this, cfg, dictionaries, dictNetMgr ); if ( rebuildGroups ) { - // ui.tabs->removeTab( 1 ); - // ui.tabs->removeTab( 1 ); - orderAndProps->rebuild( savedOrder, savedInactive, dictionaries ); groups->rebuild( dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); - - // ui.tabs->insertTab( 1, orderAndProps, QIcon( ":/icons/book.svg" ), tr( "&Dictionaries" ) ); - // ui.tabs->insertTab( 2, groups, QIcon( ":/icons/bookcase.svg" ), tr( "&Groups" ) ); - // connect( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo ); - // connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); } setUpdatesEnabled( true ); } diff --git a/src/ui/groups.cc b/src/ui/groups.cc index e7f4af6f..8c1fe30a 100644 --- a/src/ui/groups.cc +++ b/src/ui/groups.cc @@ -75,10 +75,7 @@ void Groups::rebuild( vector< sptr< Dictionary::Class > > const & dicts_, ui.dictionaries->setAsSource(); ui.dictionaries->populate( Instances::Group( order, dicts, Config::Group() ).dictionaries, dicts ); - // ui.searchLine->applyTo( ui.dictionaries ); - // Populate groups' widget - ui.groups->populate( groups, dicts, ui.dictionaries->getCurrentDictionaries() ); countChanged(); diff --git a/src/ui/orderandprops.cc b/src/ui/orderandprops.cc index 862d5462..e2681033 100644 --- a/src/ui/orderandprops.cc +++ b/src/ui/orderandprops.cc @@ -146,8 +146,6 @@ void OrderAndProps::rebuild( Config::Group const & dictionaryOrder, ui.dictionaryOrder->populate( order.dictionaries, allDictionaries ); ui.inactiveDictionaries->populate( inactive.dictionaries, allDictionaries ); - // ui.searchLine->applyTo( ui.dictionaryOrder ); - disableDictionaryDescription(); showDictNumbers();