Skip to content

Commit

Permalink
opt: icon generate refactor (#2046)
Browse files Browse the repository at this point in the history
* opt: icon generate refactor
  • Loading branch information
xiaoyifang authored Dec 28, 2024
1 parent b37c286 commit 25c2982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/common/dictionary_icon_name.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ QString Icons::DictionaryIconName::getIconName( const QString & dictionaryName )
//get the first character of the dictionary name
QString name = dictionaryName.at( 0 ).toUpper();
auto it1 = _iconDictionaryNames.contains( name );
std::vector< QString > vector = {};
if ( it1 ) {
vector = _iconDictionaryNames.value( name );
vector.emplace_back( dictionaryName );
auto vector = _iconDictionaryNames.value( name );
vector++;
_iconDictionaryNames.insert( name, vector );
}
else {
vector.emplace_back( dictionaryName );
_iconDictionaryNames.insert( name, vector );
_iconDictionaryNames.insert( name, 1 );
}

name = name + QString::number( vector.size() );
name = name + QString::number( _iconDictionaryNames.value( name ) );
_dictionaryIconNames.insert( dictionaryName, name );
return name;
}
2 changes: 1 addition & 1 deletion src/common/dictionary_icon_name.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Icons {
class DictionaryIconName
{
//map icon name to dictionary names;
QMap< QString, std::vector< QString > > _iconDictionaryNames;
QMap< QString, int > _iconDictionaryNames;
//map dictionary name to icon name;
QMap< QString, QString > _dictionaryIconNames;

Expand Down

0 comments on commit 25c2982

Please sign in to comment.