edit dictionaries panel ,update refresh change

This commit is contained in:
xiaoyifang 2022-03-18 23:12:43 +08:00 committed by YiFang Xiao
parent 23cb551e3d
commit a088b0e1c7

View file

@ -213,10 +213,9 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
groupInstances.clear(); // Those hold pointers to dictionaries, we need to groupInstances.clear(); // Those hold pointers to dictionaries, we need to
// free them. // free them.
ui.tabs->setUpdatesEnabled( false ); ui.tabs->setUpdatesEnabled( false );
ui.tabs->removeTab( 1 );
ui.tabs->removeTab( 1 );
groups.reset(); groups.reset();
orderAndProps.reset(); orderAndProps.reset();
@ -247,12 +246,14 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
if ( rebuildGroups ) if ( rebuildGroups )
{ {
orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries, dictMap ); orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries, dictMap );
groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
ui.tabs->removeTab( 1 );
ui.tabs->removeTab( 1 );
ui.tabs->insertTab( 1, orderAndProps.get(), QIcon(":/icons/book.svg"), tr( "&Dictionaries" ) ); ui.tabs->insertTab( 1, orderAndProps.get(), QIcon(":/icons/book.svg"), tr( "&Dictionaries" ) );
groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
ui.tabs->insertTab( 2, groups.get(), QIcon(":/icons/bookcase.svg"), tr( "&Groups" ) ); ui.tabs->insertTab( 2, groups.get(), QIcon(":/icons/bookcase.svg"), tr( "&Groups" ) );
ui.tabs->setUpdatesEnabled( true );
if ( noGroupEdits ) if ( noGroupEdits )
origCfg.groups = groups->getGroups(); origCfg.groups = groups->getGroups();
@ -263,6 +264,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
if ( noInactiveEdits ) if ( noInactiveEdits )
origCfg.inactiveDictionaries = orderAndProps->getCurrentInactiveDictionaries(); origCfg.inactiveDictionaries = orderAndProps->getCurrentInactiveDictionaries();
} }
ui.tabs->setUpdatesEnabled( true );
} }
void EditDictionaries::helpRequested() void EditDictionaries::helpRequested()