mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Custom icons for .zips and .lsa
This commit is contained in:
parent
dacc4779db
commit
7bbad3e829
22
lsa.cc
22
lsa.cc
|
@ -21,6 +21,7 @@
|
|||
#include <vorbis/vorbisfile.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
|
||||
namespace Lsa {
|
||||
|
||||
|
@ -180,9 +181,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
virtual void loadIcon() throw()
|
||||
{ dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/playsound.png");
|
||||
dictionaryIconLoaded = true; }
|
||||
virtual void loadIcon() throw();
|
||||
};
|
||||
|
||||
string LsaDictionary::getName() throw()
|
||||
|
@ -483,6 +482,23 @@ sptr< Dictionary::DataRequest > LsaDictionary::getResource( string const & name
|
|||
return dr;
|
||||
}
|
||||
|
||||
void LsaDictionary::loadIcon() throw()
|
||||
{
|
||||
QString fileName =
|
||||
QDir::fromNativeSeparators( FsEncoding::decode( getDictionaryFilenames()[ 0 ].c_str() ) );
|
||||
|
||||
// Remove the extension
|
||||
fileName.chop( 3 );
|
||||
|
||||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/playsound.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||
|
|
21
zipsounds.cc
21
zipsounds.cc
|
@ -109,9 +109,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
virtual void loadIcon() throw()
|
||||
{ dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/playsound.png");
|
||||
dictionaryIconLoaded = true; }
|
||||
virtual void loadIcon() throw();
|
||||
};
|
||||
|
||||
ZipSoundsDictionary::ZipSoundsDictionary( string const & id,
|
||||
|
@ -273,6 +271,23 @@ sptr< Dictionary::DataRequest > ZipSoundsDictionary::getResource( string const &
|
|||
return new Dictionary::DataRequestInstant( false );
|
||||
}
|
||||
|
||||
void ZipSoundsDictionary::loadIcon() throw()
|
||||
{
|
||||
QString fileName =
|
||||
QDir::fromNativeSeparators( FsEncoding::decode( getDictionaryFilenames()[ 0 ].c_str() ) );
|
||||
|
||||
// Remove the extension
|
||||
fileName.chop( 4 );
|
||||
|
||||
if( !loadIconFromFile( fileName ) )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/playsound.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||
|
|
Loading…
Reference in a new issue