mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
clean: remove redundant dictionaryNativeIcon
`dictionaryNativeIcon` was intended to access the original icon before none-square icons were transformed into squares. `dictionaryNativeIcon` is only used in dictionaryBar, but according to the intention, it shouldn't. In reality, `dictionaryNativeIcon` is almost always equal to `dictionaryIcon`.
This commit is contained in:
parent
0bf0fde8b5
commit
1589e14b70
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -16,7 +16,6 @@
|
|||
<file>icons/icon32_hunspell.png</file>
|
||||
<file>icons/icon32_wiki.png</file>
|
||||
<file>icons/wiktionary.png</file>
|
||||
<file>icons/icon_dsl_native.png</file>
|
||||
<file>icons/forvo.png</file>
|
||||
<file>icons/lingualibre.svg</file>
|
||||
<file>CREDITS.txt</file>
|
||||
|
|
|
@ -340,7 +340,7 @@ void AardDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_aard.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_aard.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -318,9 +318,6 @@ namespace
|
|||
|
||||
if (img.loadFromData( ( unsigned char *) iconData, idxHeader.iconSize ) )
|
||||
{
|
||||
// Load successful
|
||||
|
||||
dictionaryNativeIcon = QIcon( QPixmap::fromImage( img ) );
|
||||
|
||||
// Transform it to be square
|
||||
int max = img.width() > img.height() ? img.width() : img.height();
|
||||
|
@ -342,7 +339,7 @@ namespace
|
|||
}
|
||||
|
||||
if ( dictionaryIcon.isNull() )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/icon32_bgl.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_bgl.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -221,7 +221,7 @@ void DictdDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_dictd.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_dictd.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -210,13 +210,6 @@ QIcon const & Class::getIcon() noexcept
|
|||
return dictionaryIcon;
|
||||
}
|
||||
|
||||
QIcon const & Class::getNativeIcon() noexcept
|
||||
{
|
||||
if( !dictionaryIconLoaded )
|
||||
loadIcon();
|
||||
return dictionaryNativeIcon;
|
||||
}
|
||||
|
||||
void Class::loadIcon() noexcept
|
||||
{
|
||||
dictionaryIconLoaded = true;
|
||||
|
@ -269,8 +262,6 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
|
|||
Qt::MaskOutColor ) );
|
||||
#endif
|
||||
|
||||
dictionaryNativeIcon = QIcon( QPixmap::fromImage( img ));
|
||||
|
||||
// Transform it to be square
|
||||
int max = img.width() > img.height() ? img.width() : img.height();
|
||||
|
||||
|
@ -330,7 +321,7 @@ bool Class::loadIconFromText( QString iconUrl, QString const & text )
|
|||
|
||||
painter.end();
|
||||
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon( QPixmap::fromImage( result ) );
|
||||
dictionaryIcon = QIcon( QPixmap::fromImage( result ) );
|
||||
|
||||
return !dictionaryIcon.isNull();
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ class Class: public QObject
|
|||
|
||||
protected:
|
||||
QString dictionaryDescription;
|
||||
QIcon dictionaryIcon, dictionaryNativeIcon;
|
||||
QIcon dictionaryIcon;
|
||||
bool dictionaryIconLoaded;
|
||||
bool can_FTS;
|
||||
QAtomicInt FTS_index_completed;
|
||||
|
@ -377,11 +377,6 @@ public:
|
|||
/// Returns the dictionary's icon.
|
||||
virtual QIcon const & getIcon() noexcept;
|
||||
|
||||
/// Returns the dictionary's native icon. Dsl icons are usually rectangular,
|
||||
/// and are adapted by getIcon() to be square. This function allows getting
|
||||
/// the original icon with no geometry transformations applied.
|
||||
virtual QIcon const & getNativeIcon() noexcept;
|
||||
|
||||
/// Returns the dictionary's source language.
|
||||
virtual quint32 getLangFrom() const
|
||||
{ return 0; }
|
||||
|
|
|
@ -258,7 +258,7 @@ void DictServerDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
if( dictionaryIcon.isNull() )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/network.svg");
|
||||
dictionaryIcon = QIcon(":/icons/network.svg");
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -472,7 +472,6 @@ void DslDictionary::loadIcon() noexcept
|
|||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryIcon = QIcon(":/icons/icon32_dsl.png");
|
||||
dictionaryNativeIcon = QIcon(":/icons/icon_dsl_native.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -281,7 +281,7 @@ void EpwingDictionary::loadIcon() noexcept
|
|||
if( dictionaryIcon.isNull() )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_epwing.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_epwing.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -91,7 +91,7 @@ void ForvoDictionary::loadIcon() noexcept
|
|||
if ( dictionaryIconLoaded )
|
||||
return;
|
||||
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/forvo.png" );
|
||||
dictionaryIcon = QIcon( ":/icons/forvo.png" );
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ void GlsDictionary::loadIcon() noexcept
|
|||
if ( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icon
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_gls.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_gls.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -159,7 +159,7 @@ void HunspellDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_hunspell.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_hunspell.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -327,7 +327,7 @@ WHERE {
|
|||
if( dictionaryIconLoaded )
|
||||
return;
|
||||
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/lingualibre.svg" );
|
||||
dictionaryIcon = QIcon( ":/icons/lingualibre.svg" );
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -510,7 +510,7 @@ void LsaDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/playsound_full.png");
|
||||
dictionaryIcon = QIcon(":/icons/playsound_full.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -861,7 +861,7 @@ void MdxDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) && !loadIconFromText(":/icons/mdict-bg.png", text ) )
|
||||
{
|
||||
// Use default icons
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/mdict.png" );
|
||||
dictionaryIcon = QIcon( ":/icons/mdict.png" );
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -92,9 +92,9 @@ void MediaWikiDictionary::loadIcon() noexcept
|
|||
if( dictionaryIcon.isNull() )
|
||||
{
|
||||
if( url.contains( "tionary" ) )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/wiktionary.png" );
|
||||
dictionaryIcon = QIcon( ":/icons/wiktionary.png" );
|
||||
else
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/icon32_wiki.png" );
|
||||
dictionaryIcon = QIcon( ":/icons/icon32_wiki.png" );
|
||||
}
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ void ProgramsDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
if( dictionaryIcon.isNull() )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/programs.svg");
|
||||
dictionaryIcon = QIcon(":/icons/programs.svg");
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ void SdictDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_sdict.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_sdict.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -757,7 +757,7 @@ void SlobDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_slob.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_slob.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -300,7 +300,7 @@ void SoundDirDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
if( dictionaryIcon.isNull() )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/playsound_full.png");
|
||||
dictionaryIcon = QIcon(":/icons/playsound_full.png");
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ void StardictDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_stardict.png");
|
||||
dictionaryIcon = QIcon(":/icons/icon32_stardict.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -18,7 +18,7 @@ BaseTransliterationDictionary::BaseTransliterationDictionary( string const & id,
|
|||
name( name_ ),
|
||||
caseSensitive( caseSensitive_ )
|
||||
{
|
||||
dictionaryIcon = dictionaryNativeIcon = icon_;
|
||||
dictionaryIcon = icon_;
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ void VoiceEnginesDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
if ( dictionaryIcon.isNull() )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon( ":/icons/text2speech.svg" );
|
||||
dictionaryIcon = QIcon( ":/icons/text2speech.svg" );
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ void WebSiteDictionary::loadIcon() noexcept
|
|||
loadIconFromFile( fInfo.absoluteFilePath(), true );
|
||||
}
|
||||
if( dictionaryIcon.isNull() && !loadIconFromText(":/icons/webdict.svg", QString::fromStdString(name ) ) )
|
||||
dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/webdict.svg");
|
||||
dictionaryIcon = QIcon(":/icons/webdict.svg");
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,6 @@ void XdxfDictionary::loadIcon() noexcept
|
|||
// Load failed -- use default icons
|
||||
|
||||
dictionaryIcon = QIcon(":/icons/icon32_xdxf.png");
|
||||
dictionaryNativeIcon = QIcon(":/icons/icon32_xdxf.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -290,7 +290,7 @@ void ZimDictionary::loadIcon() noexcept
|
|||
try {
|
||||
auto illustration = df.getIllustrationItem( 48 ).getData();
|
||||
QImage img = QImage::fromData( reinterpret_cast< const uchar * >( illustration.data() ), illustration.size() );
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon( QPixmap::fromImage( img ) );
|
||||
dictionaryIcon = QIcon( QPixmap::fromImage( img ) );
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
return;
|
||||
|
@ -300,7 +300,7 @@ void ZimDictionary::loadIcon() noexcept
|
|||
}
|
||||
|
||||
// Fallback to default icon
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon( ":/icons/icon32_zim.png" );
|
||||
dictionaryIcon = QIcon( ":/icons/icon32_zim.png" );
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ void ZipSoundsDictionary::loadIcon() noexcept
|
|||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/playsound_full.png");
|
||||
dictionaryIcon = QIcon(":/icons/playsound_full.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
|
|
|
@ -52,7 +52,7 @@ void DictionaryBar::setDictionaries( vector< sptr< Dictionary::Class > >
|
|||
|
||||
for( unsigned x = 0; x < dictionaries.size(); ++x )
|
||||
{
|
||||
QIcon icon = dictionaries[ x ]->getNativeIcon();
|
||||
QIcon icon = dictionaries[ x ]->getIcon();
|
||||
|
||||
QString dictName = QString::fromUtf8( dictionaries[ x ]->
|
||||
getName().c_str() );
|
||||
|
|
Loading…
Reference in a new issue