mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Custom icons for morphology dictionaries
This commit is contained in:
parent
5e2727ce71
commit
afb4b66e15
22
hunspell.cc
22
hunspell.cc
|
@ -19,6 +19,7 @@
|
|||
#include <hunspell/hunspell.hxx>
|
||||
#include "dprintf.hh"
|
||||
#include "fsencoding.hh"
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace HunspellMorpho {
|
||||
|
||||
|
@ -70,9 +71,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
virtual void loadIcon() throw()
|
||||
{ dictionaryIcon = dictionaryNativeIcon = QIcon(":/icons/icon32_hunspell.png");
|
||||
dictionaryIconLoaded = true; }
|
||||
virtual void loadIcon() throw();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -109,6 +108,23 @@ bool containsWhitespace( wstring const & str )
|
|||
return false;
|
||||
}
|
||||
|
||||
void HunspellDictionary::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/icon32_hunspell.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
/// HunspellDictionary::getArticle()
|
||||
|
||||
class HunspellArticleRequest;
|
||||
|
|
Loading…
Reference in a new issue