From a8817242bfb1265d9bf9984b597a530ff6688fea Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Sun, 31 Jul 2022 16:17:57 +0800 Subject: [PATCH] custom icon generate --- dictionary.cc | 67 +++++++++++++++++++++++++++++++++++++++++++-- dictionary.hh | 4 +++ ftshelpers.cc | 7 +---- icons/mdict-bg.png | Bin 0 -> 11647 bytes mdx.cc | 3 +- resources.qrc | 1 + utils.hh | 8 ++++++ 7 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 icons/mdict-bg.png diff --git a/dictionary.cc b/dictionary.cc index 4bc4ab8b..0a3aa572 100644 --- a/dictionary.cc +++ b/dictionary.cc @@ -18,8 +18,6 @@ #include #include #include "fsencoding.hh" -#include "langcoder.hh" - #include #include #include @@ -275,6 +273,71 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName ) return false; } +bool Class::loadIconFromText( QString const & text ) +{ + if( text.isEmpty() ) + return false; + QImage img( ":/icons/mdict-bg.png" ); + + if ( !img.isNull() ) + { + int iconSize = 48; + //some icon is very large ,will crash the application. + img = img.scaledToWidth( iconSize ); + QImage result( iconSize, iconSize, QImage::Format_ARGB32 ); + + int max = img.width() > img.height() ? img.width() : img.height(); + + QPainter painter( &result ); + painter.setRenderHint(QPainter::RenderHint::Antialiasing); + painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2, + img.height() == max ? 0 : ( max - img.height() ) / 2 ), + img ); + QFont font = painter.font(); + //the text should be a little smaller than the icon + font.setPixelSize( iconSize * 0.6 ); + font.setWeight( QFont::Black ); + painter.setFont( font ); + + const QRect rectangle = QRect( 0, 0, iconSize, iconSize ); + + //select a single char. + auto abbrName = getAbbrName( text ); + + painter.drawText( rectangle, Qt::AlignCenter, abbrName); + + painter.end(); + + dictionaryNativeIcon = dictionaryIcon = QIcon( QPixmap::fromImage( result ) ); + + return !dictionaryIcon.isNull(); + } + return false; +} + +QString Class::getAbbrName( QString const & text ) +{ + if(text.isEmpty()) + return QString(); + //remove whitespace + QString simplified = text; + simplified.remove(QRegularExpression("\\s")); + int index = qHash( simplified ) % simplified.size(); + + QString abbrName; + if( !Utils::isCJKChar( simplified.at( index ).unicode() ) ) + { + // take two chars. + abbrName = simplified.mid( index, 2 ); + } + else + { + abbrName = simplified.mid( index, 1 ); + } + + return abbrName; +} + void Class::isolateCSS( QString & css, QString const & wrapperSelector ) { if( css.isEmpty() ) diff --git a/dictionary.hh b/dictionary.hh index 08b9ff5a..cf984210 100644 --- a/dictionary.hh +++ b/dictionary.hh @@ -16,6 +16,7 @@ #include "langcoder.hh" #include "config.hh" #include "utils.hh" +#include /// Abstract dictionary-related stuff namespace Dictionary { @@ -275,6 +276,9 @@ protected: // Load icon from filename directly if isFullName == true // else treat filename as name without extension bool loadIconFromFile( QString const & filename, bool isFullName = false ); + bool loadIconFromText( QString const & text ); + + QString getAbbrName( QString const & text ); /// Make css content usable only for articles from this dictionary void isolateCSS( QString & css, QString const & wrapperSelector = QString() ); diff --git a/ftshelpers.cc b/ftshelpers.cc index db6e6b13..76eb07ce 100644 --- a/ftshelpers.cc +++ b/ftshelpers.cc @@ -468,12 +468,7 @@ void makeFTSIndex( BtreeIndexing::BtreeDictionary * dict, QAtomicInt & isCancell bool isCJKChar( ushort ch ) { - if( ( ch >= 0x3400 && ch <= 0x9FFF ) - || ( ch >= 0xF900 && ch <= 0xFAFF ) - || ( ch >= 0xD800 && ch <= 0xDFFF ) ) - return true; - - return false; + return Utils::isCJKChar(ch); } void FTSResultsRequest::checkArticles( QVector< uint32_t > const & offsets, diff --git a/icons/mdict-bg.png b/icons/mdict-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..89868894570f6b6be66cd8c18aa326d37372bc25 GIT binary patch literal 11647 zcmaKSbyV9=5GU^L?(Wv&Zowf?N+B)oEf(C}2@u>VTC~Lq6btTFtfjaGiWYY+zkB!I z-TiU*@{H@h=C``MY#&Q6@Zt~x#r4Gt0#621mN1&C;2|Glv=5TC%6kC=!C!%9nC z1?lC#S8-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XGy|5CJoR-LVC=TT%!7DQY@iA7o4bmwKK;P4Ulv4||DVemrALTI_B zip(6(#Z+FlDg*l*RCA{J74{EdQe0*nPXu#?^y0q%D;hnuh2_G8h<&)2OKHAgTA%E~ zqH=_rKe(cQ14*>NHo1zuB9nVtXR-XMkf}NxAM=y>=`&mgSqmxHnwv?Cy z;_to^^$J)?hlSf_%;{uQ)*+uWw-Zqy`+OHNDtr4KH}IQ9`aG}h7SI}dj5YN{+|L0lNuS* zcIlK0G?D#};Es~R|FdFusN@lMrZ`*EiZjh5Q?%saO6S4g|Efyicons/closetab-hover.png icons/1downarrow.svg icons/wizard-selected.svg + icons/mdict-bg.png diff --git a/utils.hh b/utils.hh index a30a144c..28db1830 100644 --- a/utils.hh +++ b/utils.hh @@ -15,7 +15,15 @@ namespace Utils { +inline bool isCJKChar( ushort ch ) +{ + if( ( ch >= 0x3400 && ch <= 0x9FFF ) + || ( ch >= 0xF900 && ch <= 0xFAFF ) + || ( ch >= 0xD800 && ch <= 0xDFFF ) ) + return true; + return false; +} /** * remove right end space */