mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: refactor code (#1657)
* opt: refactor code * [autofix.ci] apply automated fixes * opt: refactor code * opt: refactor code * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
c42a79c7d4
commit
93ca284bad
|
@ -707,40 +707,38 @@ void ArticleRequest::bodyFinished()
|
|||
|
||||
bodyDone = true;
|
||||
|
||||
{
|
||||
string footer;
|
||||
string footer;
|
||||
|
||||
if ( closePrevSpan ) {
|
||||
footer += "</div></div>";
|
||||
closePrevSpan = false;
|
||||
}
|
||||
|
||||
if ( !foundAnyDefinitions ) {
|
||||
// No definitions were ever found, say so to the user.
|
||||
|
||||
// Larger words are usually whole sentences - don't clutter the output
|
||||
// with their full bodies.
|
||||
footer += ArticleMaker::makeNotFoundBody( word.size() < 40 ? word : "", group.name );
|
||||
|
||||
// When there were no definitions, we run stemmed search.
|
||||
stemmedWordFinder = std::make_shared< WordFinder >( this );
|
||||
|
||||
connect( stemmedWordFinder.get(),
|
||||
&WordFinder::finished,
|
||||
this,
|
||||
&ArticleRequest::stemmedSearchFinished,
|
||||
Qt::QueuedConnection );
|
||||
|
||||
stemmedWordFinder->stemmedMatch( word, activeDicts );
|
||||
}
|
||||
else {
|
||||
footer += R"(<div class="empty-space"></div>)";
|
||||
footer += "</body></html>";
|
||||
}
|
||||
|
||||
appendString( footer );
|
||||
if ( closePrevSpan ) {
|
||||
footer += "</div></div>";
|
||||
closePrevSpan = false;
|
||||
}
|
||||
|
||||
if ( !foundAnyDefinitions ) {
|
||||
// No definitions were ever found, say so to the user.
|
||||
|
||||
// Larger words are usually whole sentences - don't clutter the output
|
||||
// with their full bodies.
|
||||
footer += ArticleMaker::makeNotFoundBody( word.size() < 40 ? word : word.left( 40 ) + "...", group.name );
|
||||
|
||||
// When there were no definitions, we run stemmed search.
|
||||
stemmedWordFinder = std::make_shared< WordFinder >( this );
|
||||
|
||||
connect( stemmedWordFinder.get(),
|
||||
&WordFinder::finished,
|
||||
this,
|
||||
&ArticleRequest::stemmedSearchFinished,
|
||||
Qt::QueuedConnection );
|
||||
|
||||
stemmedWordFinder->stemmedMatch( word, activeDicts );
|
||||
}
|
||||
else {
|
||||
footer += R"(<div class="empty-space"></div>)";
|
||||
footer += "</body></html>";
|
||||
}
|
||||
|
||||
appendString( footer );
|
||||
|
||||
if ( stemmedWordFinder.get() ) {
|
||||
update();
|
||||
qDebug() << "send dicts(stemmed):" << hittedWord;
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
|
||||
#include <QThreadPool>
|
||||
#include <QMessageBox>
|
||||
#include <qalgorithms.h>
|
||||
|
||||
#if defined( Q_OS_WIN32 )
|
||||
|
||||
#include "initializing.hh"
|
||||
#include <qt_windows.h>
|
||||
#include <QOperatingSystemVersion>
|
||||
|
||||
#endif
|
||||
#include "globalregex.hh"
|
||||
|
||||
namespace FTS {
|
||||
|
|
Loading…
Reference in a new issue