diff --git a/src/dict/dictdfiles.cc b/src/dict/dictdfiles.cc index 094feca3..ef1a58a5 100644 --- a/src/dict/dictdfiles.cc +++ b/src/dict/dictdfiles.cc @@ -92,11 +92,6 @@ public: ~DictdDictionary(); - string getName() noexcept override - { - return dictionaryName; - } - map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); diff --git a/src/dict/dictserver.cc b/src/dict/dictserver.cc index 21c0b71d..4a4b8d23 100644 --- a/src/dict/dictserver.cc +++ b/src/dict/dictserver.cc @@ -176,7 +176,6 @@ class DictServerDictionary: public Dictionary::Class { Q_OBJECT - string name; QString url, icon; quint32 langId; QString errorString; @@ -196,11 +195,13 @@ public: QString const & strategies_, QString const & icon_ ): Dictionary::Class( id, vector< string >() ), - name( name_ ), url( url_ ), icon( icon_ ), langId( 0 ) { + + dictionaryName = name_; + int pos = url.indexOf( "://" ); if ( pos < 0 ) { url = "dict://" + url; @@ -301,11 +302,6 @@ public: disconnectFromServer( socket ); } - string getName() noexcept override - { - return name; - } - map< Property, string > getProperties() noexcept override { return {}; @@ -925,4 +921,4 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::DictServers const return result; } #include "dictserver.moc" -} // namespace DictServer \ No newline at end of file +} // namespace DictServer diff --git a/src/dict/dsl.cc b/src/dict/dsl.cc index f5aef6de..8fe62868 100644 --- a/src/dict/dsl.cc +++ b/src/dict/dsl.cc @@ -172,10 +172,6 @@ public: ~DslDictionary(); - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override { diff --git a/src/dict/epwing.cc b/src/dict/epwing.cc index 7ca3aed8..cc2b6fff 100644 --- a/src/dict/epwing.cc +++ b/src/dict/epwing.cc @@ -82,7 +82,6 @@ class EpwingDictionary: public BtreeIndexing::BtreeDictionary QMutex idxMutex; File::Index idx; IdxHeader idxHeader; - string bookName; ChunkedStorage::Reader chunks; Epwing::Book::EpwingBook eBook; QString cacheDirectory; @@ -96,15 +95,6 @@ public: ~EpwingDictionary(); - string getName() noexcept override - { - return bookName; - } - - void setName( string _name ) noexcept override - { - bookName = _name; - } map< Dictionary::Property, string > getProperties() noexcept override { @@ -227,7 +217,7 @@ EpwingDictionary::EpwingDictionary( string const & id, idx.seek( sizeof( idxHeader ) ); if ( data.size() > 0 ) { idx.read( &data.front(), idxHeader.nameSize ); - bookName = string( &data.front(), idxHeader.nameSize ); + dictionaryName = string( &data.front(), idxHeader.nameSize ); } // Initialize eBook diff --git a/src/dict/forvo.cc b/src/dict/forvo.cc index 1e010959..287b9cc2 100644 --- a/src/dict/forvo.cc +++ b/src/dict/forvo.cc @@ -20,7 +20,6 @@ namespace { class ForvoDictionary: public Dictionary::Class { - string name; QString apiKey, languageCode; QNetworkAccessManager & netMgr; @@ -32,17 +31,13 @@ public: QString const & languageCode_, QNetworkAccessManager & netMgr_ ): Dictionary::Class( id, vector< string >() ), - name( name_ ), apiKey( apiKey_ ), languageCode( languageCode_ ), netMgr( netMgr_ ) { + dictionaryName = name_; } - string getName() noexcept override - { - return name; - } map< Property, string > getProperties() noexcept override { diff --git a/src/dict/gls.cc b/src/dict/gls.cc index 9be2fea0..15b238bc 100644 --- a/src/dict/gls.cc +++ b/src/dict/gls.cc @@ -358,11 +358,6 @@ public: ~GlsDictionary(); - string getName() noexcept override - { - return dictionaryName; - } - map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); diff --git a/src/dict/hunspell.cc b/src/dict/hunspell.cc index 1a603337..d0a7ff3b 100644 --- a/src/dict/hunspell.cc +++ b/src/dict/hunspell.cc @@ -41,7 +41,6 @@ namespace { class HunspellDictionary: public Dictionary::Class { - string name; Hunspell hunspell; #ifdef Q_OS_WIN32 @@ -56,19 +55,15 @@ public: /// files[ 0 ] should be .aff file, files[ 1 ] should be .dic file. HunspellDictionary( string const & id, string const & name_, vector< string > const & files ): Dictionary::Class( id, files ), - name( name_ ), #ifdef Q_OS_WIN32 hunspell( Utf8ToLocal8Bit( files[ 0 ] ).c_str(), Utf8ToLocal8Bit( files[ 1 ] ).c_str() ) #else hunspell( files[ 0 ].c_str(), files[ 1 ].c_str() ) #endif { + dictionaryName = name_; } - string getName() noexcept override - { - return name; - } map< Property, string > getProperties() noexcept override { diff --git a/src/dict/lingualibre.cc b/src/dict/lingualibre.cc index fbf213af..88102469 100644 --- a/src/dict/lingualibre.cc +++ b/src/dict/lingualibre.cc @@ -60,7 +60,6 @@ private slots: class LinguaDictionary: public Dictionary::Class { - string name; QString languageCode; QString langWikipediaID; QNetworkAccessManager & netMgr; @@ -68,10 +67,10 @@ class LinguaDictionary: public Dictionary::Class public: LinguaDictionary( string const & id, string name_, QString languageCode_, QNetworkAccessManager & netMgr_ ): Dictionary::Class( id, vector< string >() ), - name( std::move( name_ ) ), languageCode( std::move( languageCode_ ) ), netMgr( netMgr_ ) { + dictionaryName = name_; /* map of iso lang code to wikipedia lang id Data was obtained by this query on https://commons-query.wikimedia.org/ @@ -166,10 +165,6 @@ WHERE { } } - string getName() noexcept override - { - return name; - } map< Property, string > getProperties() noexcept override { diff --git a/src/dict/mdx.cc b/src/dict/mdx.cc index e81aab94..3e7fc522 100644 --- a/src/dict/mdx.cc +++ b/src/dict/mdx.cc @@ -215,10 +215,6 @@ public: void deferredInit() override; - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override { diff --git a/src/dict/sdict.cc b/src/dict/sdict.cc index 389c17ec..2a6de02e 100644 --- a/src/dict/sdict.cc +++ b/src/dict/sdict.cc @@ -113,10 +113,6 @@ public: ~SdictDictionary(); - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override { diff --git a/src/dict/slob.cc b/src/dict/slob.cc index 0a530131..685b496e 100644 --- a/src/dict/slob.cc +++ b/src/dict/slob.cc @@ -614,10 +614,6 @@ public: ~SlobDictionary(); - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override { diff --git a/src/dict/sounddir.cc b/src/dict/sounddir.cc index 563e949c..c0e2b299 100644 --- a/src/dict/sounddir.cc +++ b/src/dict/sounddir.cc @@ -61,7 +61,6 @@ bool indexIsOldOrBad( string const & indexFile ) class SoundDirDictionary: public BtreeIndexing::BtreeDictionary { - string name; QMutex idxMutex; File::Index idx; IdxHeader idxHeader; @@ -76,10 +75,6 @@ public: vector< string > const & dictionaryFiles, QString const & iconFilename_ ); - string getName() noexcept override - { - return name; - } map< Dictionary::Property, string > getProperties() noexcept override { @@ -113,12 +108,13 @@ SoundDirDictionary::SoundDirDictionary( string const & id, vector< string > const & dictionaryFiles, QString const & iconFilename_ ): BtreeDictionary( id, dictionaryFiles ), - name( name_ ), idx( indexFile, QIODevice::ReadOnly ), idxHeader( idx.read< IdxHeader >() ), chunks( idx, idxHeader.chunksOffset ), iconFilename( iconFilename_ ) { + dictionaryName = name_; + // Initialize the index openIndex( IndexInfo( idxHeader.indexBtreeMaxElements, idxHeader.indexRootOffset ), idx, idxMutex ); diff --git a/src/dict/stardict.cc b/src/dict/stardict.cc index e04b3d35..f8ed4dd9 100644 --- a/src/dict/stardict.cc +++ b/src/dict/stardict.cc @@ -128,7 +128,6 @@ class StardictDictionary: public BtreeIndexing::BtreeDictionary QMutex idxMutex; File::Index idx; IdxHeader idxHeader; - string bookName; string sameTypeSequence; ChunkedStorage::Reader chunks; QMutex dzMutex; @@ -142,17 +141,6 @@ public: ~StardictDictionary(); - string getName() noexcept override - { - return bookName; - } - - void setName( string _name ) noexcept override - { - bookName = _name; - } - - map< Dictionary::Property, string > getProperties() noexcept override { return map< Dictionary::Property, string >(); @@ -236,10 +224,10 @@ StardictDictionary::StardictDictionary( string const & id, BtreeDictionary( id, dictionaryFiles ), idx( indexFile, QIODevice::ReadOnly ), idxHeader( idx.read< IdxHeader >() ), - bookName( loadString( idxHeader.bookNameSize ) ), sameTypeSequence( loadString( idxHeader.sameTypeSequenceSize ) ), chunks( idx, idxHeader.chunksOffset ) { + dictionaryName = loadString( idxHeader.bookNameSize ); // Open the .dict file DZ_ERRORS error; diff --git a/src/dict/website.cc b/src/dict/website.cc index ca03d6b4..a175c291 100644 --- a/src/dict/website.cc +++ b/src/dict/website.cc @@ -22,7 +22,6 @@ namespace { class WebSiteDictionary: public Dictionary::Class { - string name; QByteArray urlTemplate; bool experimentalIframe; QString iconFilename; @@ -38,12 +37,13 @@ public: bool inside_iframe_, QNetworkAccessManager & netMgr_ ): Dictionary::Class( id, vector< string >() ), - name( name_ ), iconFilename( iconFilename_ ), inside_iframe( inside_iframe_ ), netMgr( netMgr_ ), experimentalIframe( false ) { + dictionaryName = name_; + if ( urlTemplate_.startsWith( "http://" ) || urlTemplate_.startsWith( "https://" ) ) { experimentalIframe = true; } @@ -53,10 +53,6 @@ public: dictionaryDescription = urlTemplate_; } - string getName() noexcept override - { - return name; - } map< Property, string > getProperties() noexcept override { @@ -478,7 +474,8 @@ void WebSiteDictionary::loadIcon() noexcept loadIconFromFile( fInfo.absoluteFilePath(), true ); } } - if ( dictionaryIcon.isNull() && !loadIconFromText( ":/icons/webdict.svg", QString::fromStdString( name ) ) ) { + if ( dictionaryIcon.isNull() + && !loadIconFromText( ":/icons/webdict.svg", QString::fromStdString( dictionaryName ) ) ) { dictionaryIcon = QIcon( ":/icons/webdict.svg" ); } dictionaryIconLoaded = true; diff --git a/src/dict/xdxf.cc b/src/dict/xdxf.cc index b68f25e3..8a3e1d9a 100644 --- a/src/dict/xdxf.cc +++ b/src/dict/xdxf.cc @@ -149,10 +149,6 @@ public: ~XdxfDictionary(); - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override { diff --git a/src/dict/zim.cc b/src/dict/zim.cc index 01d7da1b..805c71da 100644 --- a/src/dict/zim.cc +++ b/src/dict/zim.cc @@ -164,10 +164,6 @@ public: ~ZimDictionary() = default; - string getName() noexcept override - { - return dictionaryName; - } map< Dictionary::Property, string > getProperties() noexcept override {