mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
clean: remove duplicated getName
overrides
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
This commit is contained in:
parent
9c46e5c317
commit
f2ce85cda2
|
@ -92,11 +92,6 @@ public:
|
||||||
|
|
||||||
~DictdDictionary();
|
~DictdDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
return map< Dictionary::Property, string >();
|
return map< Dictionary::Property, string >();
|
||||||
|
|
|
@ -176,7 +176,6 @@ class DictServerDictionary: public Dictionary::Class
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
string name;
|
|
||||||
QString url, icon;
|
QString url, icon;
|
||||||
quint32 langId;
|
quint32 langId;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
|
@ -196,11 +195,13 @@ public:
|
||||||
QString const & strategies_,
|
QString const & strategies_,
|
||||||
QString const & icon_ ):
|
QString const & icon_ ):
|
||||||
Dictionary::Class( id, vector< string >() ),
|
Dictionary::Class( id, vector< string >() ),
|
||||||
name( name_ ),
|
|
||||||
url( url_ ),
|
url( url_ ),
|
||||||
icon( icon_ ),
|
icon( icon_ ),
|
||||||
langId( 0 )
|
langId( 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
dictionaryName = name_;
|
||||||
|
|
||||||
int pos = url.indexOf( "://" );
|
int pos = url.indexOf( "://" );
|
||||||
if ( pos < 0 ) {
|
if ( pos < 0 ) {
|
||||||
url = "dict://" + url;
|
url = "dict://" + url;
|
||||||
|
@ -301,11 +302,6 @@ public:
|
||||||
disconnectFromServer( socket );
|
disconnectFromServer( socket );
|
||||||
}
|
}
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Property, string > getProperties() noexcept override
|
map< Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -172,10 +172,6 @@ public:
|
||||||
|
|
||||||
~DslDictionary();
|
~DslDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,6 @@ class EpwingDictionary: public BtreeIndexing::BtreeDictionary
|
||||||
QMutex idxMutex;
|
QMutex idxMutex;
|
||||||
File::Index idx;
|
File::Index idx;
|
||||||
IdxHeader idxHeader;
|
IdxHeader idxHeader;
|
||||||
string bookName;
|
|
||||||
ChunkedStorage::Reader chunks;
|
ChunkedStorage::Reader chunks;
|
||||||
Epwing::Book::EpwingBook eBook;
|
Epwing::Book::EpwingBook eBook;
|
||||||
QString cacheDirectory;
|
QString cacheDirectory;
|
||||||
|
@ -96,15 +95,6 @@ public:
|
||||||
|
|
||||||
~EpwingDictionary();
|
~EpwingDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return bookName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setName( string _name ) noexcept override
|
|
||||||
{
|
|
||||||
bookName = _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
@ -227,7 +217,7 @@ EpwingDictionary::EpwingDictionary( string const & id,
|
||||||
idx.seek( sizeof( idxHeader ) );
|
idx.seek( sizeof( idxHeader ) );
|
||||||
if ( data.size() > 0 ) {
|
if ( data.size() > 0 ) {
|
||||||
idx.read( &data.front(), idxHeader.nameSize );
|
idx.read( &data.front(), idxHeader.nameSize );
|
||||||
bookName = string( &data.front(), idxHeader.nameSize );
|
dictionaryName = string( &data.front(), idxHeader.nameSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize eBook
|
// Initialize eBook
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace {
|
||||||
|
|
||||||
class ForvoDictionary: public Dictionary::Class
|
class ForvoDictionary: public Dictionary::Class
|
||||||
{
|
{
|
||||||
string name;
|
|
||||||
QString apiKey, languageCode;
|
QString apiKey, languageCode;
|
||||||
QNetworkAccessManager & netMgr;
|
QNetworkAccessManager & netMgr;
|
||||||
|
|
||||||
|
@ -32,17 +31,13 @@ public:
|
||||||
QString const & languageCode_,
|
QString const & languageCode_,
|
||||||
QNetworkAccessManager & netMgr_ ):
|
QNetworkAccessManager & netMgr_ ):
|
||||||
Dictionary::Class( id, vector< string >() ),
|
Dictionary::Class( id, vector< string >() ),
|
||||||
name( name_ ),
|
|
||||||
apiKey( apiKey_ ),
|
apiKey( apiKey_ ),
|
||||||
languageCode( languageCode_ ),
|
languageCode( languageCode_ ),
|
||||||
netMgr( netMgr_ )
|
netMgr( netMgr_ )
|
||||||
{
|
{
|
||||||
|
dictionaryName = name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Property, string > getProperties() noexcept override
|
map< Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -358,11 +358,6 @@ public:
|
||||||
|
|
||||||
~GlsDictionary();
|
~GlsDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
return map< Dictionary::Property, string >();
|
return map< Dictionary::Property, string >();
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace {
|
||||||
|
|
||||||
class HunspellDictionary: public Dictionary::Class
|
class HunspellDictionary: public Dictionary::Class
|
||||||
{
|
{
|
||||||
string name;
|
|
||||||
Hunspell hunspell;
|
Hunspell hunspell;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
|
@ -56,19 +55,15 @@ public:
|
||||||
/// files[ 0 ] should be .aff file, files[ 1 ] should be .dic file.
|
/// files[ 0 ] should be .aff file, files[ 1 ] should be .dic file.
|
||||||
HunspellDictionary( string const & id, string const & name_, vector< string > const & files ):
|
HunspellDictionary( string const & id, string const & name_, vector< string > const & files ):
|
||||||
Dictionary::Class( id, files ),
|
Dictionary::Class( id, files ),
|
||||||
name( name_ ),
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
hunspell( Utf8ToLocal8Bit( files[ 0 ] ).c_str(), Utf8ToLocal8Bit( files[ 1 ] ).c_str() )
|
hunspell( Utf8ToLocal8Bit( files[ 0 ] ).c_str(), Utf8ToLocal8Bit( files[ 1 ] ).c_str() )
|
||||||
#else
|
#else
|
||||||
hunspell( files[ 0 ].c_str(), files[ 1 ].c_str() )
|
hunspell( files[ 0 ].c_str(), files[ 1 ].c_str() )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
dictionaryName = name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Property, string > getProperties() noexcept override
|
map< Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,6 @@ private slots:
|
||||||
class LinguaDictionary: public Dictionary::Class
|
class LinguaDictionary: public Dictionary::Class
|
||||||
{
|
{
|
||||||
|
|
||||||
string name;
|
|
||||||
QString languageCode;
|
QString languageCode;
|
||||||
QString langWikipediaID;
|
QString langWikipediaID;
|
||||||
QNetworkAccessManager & netMgr;
|
QNetworkAccessManager & netMgr;
|
||||||
|
@ -68,10 +67,10 @@ class LinguaDictionary: public Dictionary::Class
|
||||||
public:
|
public:
|
||||||
LinguaDictionary( string const & id, string name_, QString languageCode_, QNetworkAccessManager & netMgr_ ):
|
LinguaDictionary( string const & id, string name_, QString languageCode_, QNetworkAccessManager & netMgr_ ):
|
||||||
Dictionary::Class( id, vector< string >() ),
|
Dictionary::Class( id, vector< string >() ),
|
||||||
name( std::move( name_ ) ),
|
|
||||||
languageCode( std::move( languageCode_ ) ),
|
languageCode( std::move( languageCode_ ) ),
|
||||||
netMgr( netMgr_ )
|
netMgr( netMgr_ )
|
||||||
{
|
{
|
||||||
|
dictionaryName = name_;
|
||||||
/* map of iso lang code to wikipedia lang id
|
/* map of iso lang code to wikipedia lang id
|
||||||
|
|
||||||
Data was obtained by this query on https://commons-query.wikimedia.org/
|
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
|
map< Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -215,10 +215,6 @@ public:
|
||||||
|
|
||||||
void deferredInit() override;
|
void deferredInit() override;
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,10 +113,6 @@ public:
|
||||||
|
|
||||||
~SdictDictionary();
|
~SdictDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -614,10 +614,6 @@ public:
|
||||||
|
|
||||||
~SlobDictionary();
|
~SlobDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,6 @@ bool indexIsOldOrBad( string const & indexFile )
|
||||||
|
|
||||||
class SoundDirDictionary: public BtreeIndexing::BtreeDictionary
|
class SoundDirDictionary: public BtreeIndexing::BtreeDictionary
|
||||||
{
|
{
|
||||||
string name;
|
|
||||||
QMutex idxMutex;
|
QMutex idxMutex;
|
||||||
File::Index idx;
|
File::Index idx;
|
||||||
IdxHeader idxHeader;
|
IdxHeader idxHeader;
|
||||||
|
@ -76,10 +75,6 @@ public:
|
||||||
vector< string > const & dictionaryFiles,
|
vector< string > const & dictionaryFiles,
|
||||||
QString const & iconFilename_ );
|
QString const & iconFilename_ );
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
@ -113,12 +108,13 @@ SoundDirDictionary::SoundDirDictionary( string const & id,
|
||||||
vector< string > const & dictionaryFiles,
|
vector< string > const & dictionaryFiles,
|
||||||
QString const & iconFilename_ ):
|
QString const & iconFilename_ ):
|
||||||
BtreeDictionary( id, dictionaryFiles ),
|
BtreeDictionary( id, dictionaryFiles ),
|
||||||
name( name_ ),
|
|
||||||
idx( indexFile, QIODevice::ReadOnly ),
|
idx( indexFile, QIODevice::ReadOnly ),
|
||||||
idxHeader( idx.read< IdxHeader >() ),
|
idxHeader( idx.read< IdxHeader >() ),
|
||||||
chunks( idx, idxHeader.chunksOffset ),
|
chunks( idx, idxHeader.chunksOffset ),
|
||||||
iconFilename( iconFilename_ )
|
iconFilename( iconFilename_ )
|
||||||
{
|
{
|
||||||
|
dictionaryName = name_;
|
||||||
|
|
||||||
// Initialize the index
|
// Initialize the index
|
||||||
|
|
||||||
openIndex( IndexInfo( idxHeader.indexBtreeMaxElements, idxHeader.indexRootOffset ), idx, idxMutex );
|
openIndex( IndexInfo( idxHeader.indexBtreeMaxElements, idxHeader.indexRootOffset ), idx, idxMutex );
|
||||||
|
|
|
@ -128,7 +128,6 @@ class StardictDictionary: public BtreeIndexing::BtreeDictionary
|
||||||
QMutex idxMutex;
|
QMutex idxMutex;
|
||||||
File::Index idx;
|
File::Index idx;
|
||||||
IdxHeader idxHeader;
|
IdxHeader idxHeader;
|
||||||
string bookName;
|
|
||||||
string sameTypeSequence;
|
string sameTypeSequence;
|
||||||
ChunkedStorage::Reader chunks;
|
ChunkedStorage::Reader chunks;
|
||||||
QMutex dzMutex;
|
QMutex dzMutex;
|
||||||
|
@ -142,17 +141,6 @@ public:
|
||||||
|
|
||||||
~StardictDictionary();
|
~StardictDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return bookName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setName( string _name ) noexcept override
|
|
||||||
{
|
|
||||||
bookName = _name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
return map< Dictionary::Property, string >();
|
return map< Dictionary::Property, string >();
|
||||||
|
@ -236,10 +224,10 @@ StardictDictionary::StardictDictionary( string const & id,
|
||||||
BtreeDictionary( id, dictionaryFiles ),
|
BtreeDictionary( id, dictionaryFiles ),
|
||||||
idx( indexFile, QIODevice::ReadOnly ),
|
idx( indexFile, QIODevice::ReadOnly ),
|
||||||
idxHeader( idx.read< IdxHeader >() ),
|
idxHeader( idx.read< IdxHeader >() ),
|
||||||
bookName( loadString( idxHeader.bookNameSize ) ),
|
|
||||||
sameTypeSequence( loadString( idxHeader.sameTypeSequenceSize ) ),
|
sameTypeSequence( loadString( idxHeader.sameTypeSequenceSize ) ),
|
||||||
chunks( idx, idxHeader.chunksOffset )
|
chunks( idx, idxHeader.chunksOffset )
|
||||||
{
|
{
|
||||||
|
dictionaryName = loadString( idxHeader.bookNameSize );
|
||||||
// Open the .dict file
|
// Open the .dict file
|
||||||
|
|
||||||
DZ_ERRORS error;
|
DZ_ERRORS error;
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace {
|
||||||
|
|
||||||
class WebSiteDictionary: public Dictionary::Class
|
class WebSiteDictionary: public Dictionary::Class
|
||||||
{
|
{
|
||||||
string name;
|
|
||||||
QByteArray urlTemplate;
|
QByteArray urlTemplate;
|
||||||
bool experimentalIframe;
|
bool experimentalIframe;
|
||||||
QString iconFilename;
|
QString iconFilename;
|
||||||
|
@ -38,12 +37,13 @@ public:
|
||||||
bool inside_iframe_,
|
bool inside_iframe_,
|
||||||
QNetworkAccessManager & netMgr_ ):
|
QNetworkAccessManager & netMgr_ ):
|
||||||
Dictionary::Class( id, vector< string >() ),
|
Dictionary::Class( id, vector< string >() ),
|
||||||
name( name_ ),
|
|
||||||
iconFilename( iconFilename_ ),
|
iconFilename( iconFilename_ ),
|
||||||
inside_iframe( inside_iframe_ ),
|
inside_iframe( inside_iframe_ ),
|
||||||
netMgr( netMgr_ ),
|
netMgr( netMgr_ ),
|
||||||
experimentalIframe( false )
|
experimentalIframe( false )
|
||||||
{
|
{
|
||||||
|
dictionaryName = name_;
|
||||||
|
|
||||||
if ( urlTemplate_.startsWith( "http://" ) || urlTemplate_.startsWith( "https://" ) ) {
|
if ( urlTemplate_.startsWith( "http://" ) || urlTemplate_.startsWith( "https://" ) ) {
|
||||||
experimentalIframe = true;
|
experimentalIframe = true;
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,6 @@ public:
|
||||||
dictionaryDescription = urlTemplate_;
|
dictionaryDescription = urlTemplate_;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Property, string > getProperties() noexcept override
|
map< Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
@ -478,7 +474,8 @@ void WebSiteDictionary::loadIcon() noexcept
|
||||||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
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" );
|
dictionaryIcon = QIcon( ":/icons/webdict.svg" );
|
||||||
}
|
}
|
||||||
dictionaryIconLoaded = true;
|
dictionaryIconLoaded = true;
|
||||||
|
|
|
@ -149,10 +149,6 @@ public:
|
||||||
|
|
||||||
~XdxfDictionary();
|
~XdxfDictionary();
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,10 +164,6 @@ public:
|
||||||
|
|
||||||
~ZimDictionary() = default;
|
~ZimDictionary() = default;
|
||||||
|
|
||||||
string getName() noexcept override
|
|
||||||
{
|
|
||||||
return dictionaryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
map< Dictionary::Property, string > getProperties() noexcept override
|
map< Dictionary::Property, string > getProperties() noexcept override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue