opt: update name should reflect the latest info

This commit is contained in:
xiaoyifang 2024-11-02 17:14:27 +08:00 committed by xiaoyifang
parent 46b425a6f6
commit ac11ba7b51

View file

@ -113,7 +113,6 @@ void EditDictionaries::currentChanged( int index )
if ( index == -1 || !isVisible() ) { if ( index == -1 || !isVisible() ) {
return; // Sent upon the construction/destruction return; // Sent upon the construction/destruction
} }
qDebug() << ui.tabs->currentWidget()->objectName();
if ( lastTabName.isEmpty() || lastTabName == "Sources" ) { if ( lastTabName.isEmpty() || lastTabName == "Sources" ) {
// We're switching away from the Sources tab -- if its contents were // We're switching away from the Sources tab -- if its contents were
// changed, we need to either apply or reject now. // changed, we need to either apply or reject now.
@ -183,9 +182,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
{ {
dictionariesChanged = true; dictionariesChanged = true;
Config::Groups savedGroups = groups->getGroups();
Config::Group savedOrder = orderAndProps->getCurrentDictionaryOrder();
Config::Group savedInactive = orderAndProps->getCurrentInactiveDictionaries();
cfg.paths = sources.getPaths(); cfg.paths = sources.getPaths();
cfg.soundDirs = sources.getSoundDirs(); cfg.soundDirs = sources.getSoundDirs();
@ -209,10 +205,6 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
loadDictionaries( this, cfg, dictionaries, dictNetMgr ); loadDictionaries( this, cfg, dictionaries, dictNetMgr );
Instances::updateNames( savedGroups, dictionaries );
Instances::updateNames( savedOrder, dictionaries );
Instances::updateNames( savedInactive, dictionaries );
if ( rebuildGroups ) { if ( rebuildGroups ) {
// ui.tabs->removeTab( 1 ); // ui.tabs->removeTab( 1 );
// 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( groups, &Groups::showDictionaryInfo, this, &EditDictionaries::showDictionaryInfo );
// connect( orderAndProps, &OrderAndProps::showDictionaryHeadwords, this, &EditDictionaries::showDictionaryHeadwords ); // 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 ); setUpdatesEnabled( true );
} }
EditDictionaries::~EditDictionaries() EditDictionaries::~EditDictionaries()