diff --git a/src/dict/aard.cc b/src/dict/aard.cc index 4cd00232..a7744f0c 100644 --- a/src/dict/aard.cc +++ b/src/dict/aard.cc @@ -747,7 +747,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f { vector< sptr< Dictionary::Class > > dictionaries; - for ( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end(); ++i ) { + for ( auto i = fileNames.begin(); i != fileNames.end(); ++i ) { // Skip files with the extensions different to .aar to speed up the // scanning if ( i->size() < 4 || strcasecmp( i->c_str() + ( i->size() - 4 ), ".aar" ) != 0 ) @@ -756,7 +756,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f // Got the file -- check if we need to rebuid the index vector< string > dictFiles( 1, *i ); - + initializing.loadingDictionary( *i ); string dictId = Dictionary::makeDictionaryId( dictFiles ); string indexFile = indicesDir + dictId; diff --git a/src/dict/dictionary.hh b/src/dict/dictionary.hh index aa6b6373..dd529ac6 100644 --- a/src/dict/dictionary.hh +++ b/src/dict/dictionary.hh @@ -548,6 +548,7 @@ public: /// is useful to show in some kind of a splash screen. /// The dictionaryName is in utf8. virtual void indexingDictionary( string const & dictionaryName ) noexcept = 0; + virtual void loadingDictionary( string const & dictionaryName ) noexcept = 0; virtual ~Initializing() = default; }; diff --git a/src/dict/dsl.cc b/src/dict/dsl.cc index a1d03cda..cd5061b2 100644 --- a/src/dict/dsl.cc +++ b/src/dict/dsl.cc @@ -1746,6 +1746,8 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f || File::tryPossibleName( baseName + "_ABRV.DSL.dz", abrvFileName ) ) dictFiles.push_back( abrvFileName ); + initializing.loadingDictionary( fileName ); + string dictId = Dictionary::makeDictionaryId( dictFiles ); // See if there's a zip file with resources present. If so, include it. diff --git a/src/dict/loaddictionaries.cc b/src/dict/loaddictionaries.cc index 5d03e07f..c47feafc 100644 --- a/src/dict/loaddictionaries.cc +++ b/src/dict/loaddictionaries.cc @@ -190,6 +190,11 @@ void LoadDictionaries::indexingDictionary( string const & dictionaryName ) noexc emit indexingDictionarySignal( QString::fromUtf8( dictionaryName.c_str() ) ); } +void LoadDictionaries::loadingDictionary( string const & dictionaryName ) noexcept +{ + emit loadingDictionarySignal( QString::fromUtf8( dictionaryName.c_str() ) ); +} + void loadDictionaries( QWidget * parent, bool showInitially, @@ -207,6 +212,7 @@ void loadDictionaries( QWidget * parent, LoadDictionaries loadDicts( cfg ); QObject::connect( &loadDicts, &LoadDictionaries::indexingDictionarySignal, &init, &Initializing::indexing ); + QObject::connect( &loadDicts, &LoadDictionaries::loadingDictionarySignal, &init, &Initializing::loading ); QEventLoop localLoop; diff --git a/src/dict/loaddictionaries.hh b/src/dict/loaddictionaries.hh index 7d659e01..aa0a8297 100644 --- a/src/dict/loaddictionaries.hh +++ b/src/dict/loaddictionaries.hh @@ -48,6 +48,7 @@ public: public: virtual void indexingDictionary( std::string const & dictionaryName ) noexcept; + virtual void loadingDictionary( std::string const & dictionaryName ) noexcept; private: @@ -58,6 +59,7 @@ private: signals: void indexingDictionarySignal( QString const & dictionaryName ); + void loadingDictionarySignal( QString const & dictionaryName ); }; /// Loads all dictionaries mentioned in the configuration passed, into the diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index b47559ea..fa0f33e7 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -1294,6 +1294,8 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f vector< string > dictFiles( 1, fileName ); findResourceFiles( fileName, dictFiles ); + initializing.loadingDictionary( fileName ); + string dictId = Dictionary::makeDictionaryId( dictFiles ); string indexFile = indicesDir + dictId; diff --git a/src/initializing.cc b/src/initializing.cc index 92ae5b68..0acf099d 100644 --- a/src/initializing.cc +++ b/src/initializing.cc @@ -32,6 +32,16 @@ void Initializing::indexing( QString const & dictionaryName ) show(); } +void Initializing::loading( QString const & dictionaryName ) +{ + ui.operation->setText( tr( "Loading..." ) ); + ui.dictionary->setText( dictionaryName ); + ui.dictionary->show(); + ui.progressBar->show(); + adjustSize(); + show(); +} + void Initializing::closeEvent( QCloseEvent * ev ) { ev->ignore(); diff --git a/src/initializing.hh b/src/initializing.hh index c6cbe592..c32cefaf 100644 --- a/src/initializing.hh +++ b/src/initializing.hh @@ -17,6 +17,7 @@ public: public slots: void indexing( QString const & dictionaryName ); + void loading( const QString & dictionaryName ); private: