mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 21:04:09 +00:00
Merge branch 'staged' into dev
This commit is contained in:
commit
5ad877e1bc
|
@ -1032,41 +1032,43 @@ void EpwingBook::fixHeadword( QString & headword )
|
||||||
|
|
||||||
headword.remove( QChar( 0x30FB ) ); // Used in Japan transcription
|
headword.remove( QChar( 0x30FB ) ); // Used in Japan transcription
|
||||||
|
|
||||||
if( isHeadwordCorrect( headword) )
|
//if( isHeadwordCorrect( headword) )
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
QString fixed = headword;
|
QString fixed = headword;
|
||||||
QRegularExpression leadingSlashRx( "/[^/]+/" );
|
QRegularExpression leadingSlashRx( "/[^/]+/" );
|
||||||
fixed.remove(leadingSlashRx );
|
fixed.remove(leadingSlashRx );
|
||||||
|
|
||||||
if( isHeadwordCorrect( fixed ) )
|
//if( isHeadwordCorrect( fixed ) )
|
||||||
{
|
//{
|
||||||
headword = fixed;
|
// headword = fixed;
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
gd::wstring folded = Folding::applyPunctOnly( gd::toWString( fixed ) );
|
gd::wstring folded = Folding::applyPunctOnly( gd::toWString( fixed ) );
|
||||||
fixed = gd::toQString( folded );
|
fixed = gd::toQString( folded );
|
||||||
|
|
||||||
if( isHeadwordCorrect( fixed ) )
|
//if( isHeadwordCorrect( fixed ) )
|
||||||
{
|
//{
|
||||||
headword = fixed;
|
// headword = fixed;
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
folded = Folding::applyDiacriticsOnly( folded );
|
folded = Folding::applyDiacriticsOnly( folded );
|
||||||
fixed = gd::toQString( folded );
|
fixed = gd::toQString( folded );
|
||||||
|
|
||||||
if( isHeadwordCorrect( fixed ) )
|
//if( isHeadwordCorrect( fixed ) )
|
||||||
{
|
//{
|
||||||
headword = fixed;
|
// headword = fixed;
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
folded = Folding::applyWhitespaceOnly( folded );
|
//folded = Folding::applyWhitespaceOnly( folded );
|
||||||
fixed = gd::toQString( folded );
|
//fixed = gd::toQString( folded );
|
||||||
|
|
||||||
|
//if( isHeadwordCorrect( fixed ) )
|
||||||
|
// headword = fixed;
|
||||||
|
|
||||||
if( isHeadwordCorrect( fixed ) )
|
|
||||||
headword = fixed;
|
headword = fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -596,7 +596,7 @@ bool isPunct( wchar ch )
|
||||||
case 0xFF64: // HALFWIDTH IDEOGRAPHIC COMMA
|
case 0xFF64: // HALFWIDTH IDEOGRAPHIC COMMA
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return QChar::isPunct(ch)||QChar::isSymbol(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@ void HeadwordListModel::requestFinished()
|
||||||
filtered << w;
|
filtered << w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( filtered.isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
beginInsertRows( QModelIndex(), words.size(), words.size() + filtered.count() - 1 );
|
beginInsertRows( QModelIndex(), words.size(), words.size() + filtered.count() - 1 );
|
||||||
|
|
||||||
for( const auto & word : filtered )
|
for( const auto & word : filtered )
|
||||||
words.append( word );
|
words.append( word );
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue