Custom icons for morphology dictionaries

This commit is contained in:
Abs62 2012-12-07 16:01:39 +04:00
parent 5e2727ce71
commit afb4b66e15

View file

@ -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;