mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
* On initial load do deferred dictionary init at the very end.
This commit is contained in:
parent
cfd6e1d440
commit
ba9b13d9e6
|
@ -158,7 +158,8 @@ void LoadDictionaries::indexingDictionary( string const & dictionaryName ) throw
|
|||
void loadDictionaries( QWidget * parent, bool showInitially,
|
||||
Config::Class const & cfg,
|
||||
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
||||
QNetworkAccessManager & dictNetMgr )
|
||||
QNetworkAccessManager & dictNetMgr,
|
||||
bool doDeferredInit_ )
|
||||
{
|
||||
dictionaries.clear();
|
||||
|
||||
|
@ -232,7 +233,12 @@ void loadDictionaries( QWidget * parent, bool showInitially,
|
|||
|
||||
// Run deferred inits
|
||||
|
||||
if ( doDeferredInit_ )
|
||||
doDeferredInit( dictionaries );
|
||||
}
|
||||
|
||||
void doDeferredInit( std::vector< sptr< Dictionary::Class > > & dictionaries )
|
||||
{
|
||||
for( unsigned x = 0; x < dictionaries.size(); ++x )
|
||||
dictionaries[ x ]->deferredInit();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,16 @@ private:
|
|||
/// Loads all dictionaries mentioned in the configuration passed, into the
|
||||
/// supplied array. When necessary, a window would pop up describing the process.
|
||||
/// If showInitially is passed as true, the window will always popup.
|
||||
/// If doDeferredInit is true (default), doDeferredInit() is done on all
|
||||
/// dictionaries at the end.
|
||||
void loadDictionaries( QWidget * parent, bool showInitially,
|
||||
Config::Class const & cfg,
|
||||
std::vector< sptr< Dictionary::Class > > &,
|
||||
QNetworkAccessManager & dictNetMgr );
|
||||
QNetworkAccessManager & dictNetMgr,
|
||||
bool doDeferredInit = true );
|
||||
|
||||
/// Runs deferredInit() on all the given dictionaries. Useful when
|
||||
/// loadDictionaries() was previously called with doDeferredInit = false.
|
||||
void doDeferredInit( std::vector< sptr< Dictionary::Class > > & );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -269,6 +269,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
this, SLOT( checkForNewRelease() ) );
|
||||
|
||||
prepareNewReleaseChecks();
|
||||
|
||||
// makeDictionaries() didn't do deferred init - we do it here, at the end.
|
||||
doDeferredInit( dictionaries );
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -397,7 +400,7 @@ void MainWindow::makeDictionaries()
|
|||
|
||||
wordFinder.clear();
|
||||
|
||||
loadDictionaries( this, isVisible(), cfg, dictionaries, dictNetMgr );
|
||||
loadDictionaries( this, isVisible(), cfg, dictionaries, dictNetMgr, false );
|
||||
|
||||
updateStatusLine();
|
||||
updateGroupList();
|
||||
|
|
Loading…
Reference in a new issue