Skip to content

Commit

Permalink
opt:generate unique id (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang authored Jan 5, 2025
1 parent 0543cb2 commit ce7f0e6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/dict/dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -606,16 +606,13 @@ string getFtsSuffix()

QString generateRandomDictionaryId()
{
return QString(
QCryptographicHash::hash( QDateTime::currentDateTime().toString( "\"Random\"dd.MM.yyyy hh:mm:ss.zzz" ).toUtf8(),
QCryptographicHash::Md5 )
.toHex() );
return QCryptographicHash::hash( QUuid::createUuid().toString().toUtf8(), QCryptographicHash::Md5 ).toHex();
}

QMap< std::string, sptr< Dictionary::Class > > dictToMap( std::vector< sptr< Dictionary::Class > > const & dicts )
{
QMap< std::string, sptr< Dictionary::Class > > dictMap;
for ( auto & dict : dicts ) {
for ( const auto & dict : dicts ) {
if ( !dict ) {
continue;
}
Expand Down

0 comments on commit ce7f0e6

Please sign in to comment.