Merge branch 'staged' into dev

This commit is contained in:
Xiao YiFang 2022-10-05 15:42:29 +08:00
commit 5ad877e1bc
3 changed files with 26 additions and 24 deletions

View file

@ -1032,41 +1032,43 @@ void EpwingBook::fixHeadword( QString & headword )
headword.remove( QChar( 0x30FB ) ); // Used in Japan transcription
if( isHeadwordCorrect( headword) )
return;
//if( isHeadwordCorrect( headword) )
// return;
QString fixed = headword;
QRegularExpression leadingSlashRx( "/[^/]+/" );
fixed.remove(leadingSlashRx );
if( isHeadwordCorrect( fixed ) )
{
headword = fixed;
return;
}
//if( isHeadwordCorrect( fixed ) )
//{
// headword = fixed;
// return;
//}
gd::wstring folded = Folding::applyPunctOnly( gd::toWString( fixed ) );
fixed = gd::toQString( folded );
if( isHeadwordCorrect( fixed ) )
{
headword = fixed;
return;
}
//if( isHeadwordCorrect( fixed ) )
//{
// headword = fixed;
// return;
//}
folded = Folding::applyDiacriticsOnly( folded );
fixed = gd::toQString( folded );
if( isHeadwordCorrect( fixed ) )
{
headword = fixed;
return;
}
//if( isHeadwordCorrect( fixed ) )
//{
// headword = fixed;
// return;
//}
folded = Folding::applyWhitespaceOnly( folded );
fixed = gd::toQString( folded );
//folded = Folding::applyWhitespaceOnly( folded );
//fixed = gd::toQString( folded );
//if( isHeadwordCorrect( fixed ) )
// headword = fixed;
if( isHeadwordCorrect( fixed ) )
headword = fixed;
}

View file

@ -596,7 +596,7 @@ bool isPunct( wchar ch )
case 0xFF64: // HALFWIDTH IDEOGRAPHIC COMMA
return true;
default:
return false;
return QChar::isPunct(ch)||QChar::isSymbol(ch);
}
}

View file

@ -81,12 +81,12 @@ void HeadwordListModel::requestFinished()
filtered << w;
}
}
if( filtered.isEmpty() )
return;
beginInsertRows( QModelIndex(), words.size(), words.size() + filtered.count() - 1 );
for( const auto & word : filtered )
words.append( word );
endInsertRows();
}
}