From c2fc90801b7dd2b7bfccc5409ea4e9919ecc2801 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Nov 2024 17:14:27 +0800 Subject: [PATCH] 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()