mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
opt:remove runnable in ftshelper
This commit is contained in:
parent
002a4c8302
commit
71b5d3e6ba
|
@ -399,11 +399,6 @@ bool isCJKChar( ushort ch )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FTSResultsRequestRunnable::run()
|
|
||||||
{
|
|
||||||
r.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FTSResultsRequest::checkArticles( QVector< uint32_t > const & offsets,
|
void FTSResultsRequest::checkArticles( QVector< uint32_t > const & offsets,
|
||||||
QStringList const & words,
|
QStringList const & words,
|
||||||
QRegExp const & searchRegexp )
|
QRegExp const & searchRegexp )
|
||||||
|
|
|
@ -65,28 +65,6 @@ void makeFTSIndex( BtreeIndexing::BtreeDictionary * dict, QAtomicInt & isCancell
|
||||||
|
|
||||||
bool isCJKChar( ushort ch );
|
bool isCJKChar( ushort ch );
|
||||||
|
|
||||||
class FTSResultsRequest;
|
|
||||||
|
|
||||||
class FTSResultsRequestRunnable : public QRunnable
|
|
||||||
{
|
|
||||||
FTSResultsRequest & r;
|
|
||||||
QSemaphore & hasExited;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
FTSResultsRequestRunnable( FTSResultsRequest & r_,
|
|
||||||
QSemaphore & hasExited_ ) : r( r_ ),
|
|
||||||
hasExited( hasExited_ )
|
|
||||||
{}
|
|
||||||
|
|
||||||
~FTSResultsRequestRunnable()
|
|
||||||
{
|
|
||||||
hasExited.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void run();
|
|
||||||
};
|
|
||||||
|
|
||||||
class FTSResultsRequest : public Dictionary::DataRequest
|
class FTSResultsRequest : public Dictionary::DataRequest
|
||||||
{
|
{
|
||||||
BtreeIndexing::BtreeDictionary & dict;
|
BtreeIndexing::BtreeDictionary & dict;
|
||||||
|
@ -102,7 +80,6 @@ class FTSResultsRequest : public Dictionary::DataRequest
|
||||||
int wordsInIndex;
|
int wordsInIndex;
|
||||||
|
|
||||||
QAtomicInt isCancelled;
|
QAtomicInt isCancelled;
|
||||||
QSemaphore hasExited;
|
|
||||||
|
|
||||||
QList< FTS::FtsHeadword > * foundHeadwords;
|
QList< FTS::FtsHeadword > * foundHeadwords;
|
||||||
|
|
||||||
|
@ -149,11 +126,10 @@ public:
|
||||||
searchString = gd::toQString( Folding::applyDiacriticsOnly( gd::toWString( searchString_ ) ) );
|
searchString = gd::toQString( Folding::applyDiacriticsOnly( gd::toWString( searchString_ ) ) );
|
||||||
|
|
||||||
foundHeadwords = new QList< FTS::FtsHeadword >;
|
foundHeadwords = new QList< FTS::FtsHeadword >;
|
||||||
QThreadPool::globalInstance()->start(
|
QThreadPool::globalInstance()->start( [ this ]() { this->run(); }, -100 );
|
||||||
new FTSResultsRequestRunnable( *this, hasExited ), -100 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(); // Run from another thread by DslResourceRequestRunnable
|
void run();
|
||||||
|
|
||||||
virtual void cancel()
|
virtual void cancel()
|
||||||
{
|
{
|
||||||
|
@ -165,7 +141,6 @@ public:
|
||||||
isCancelled.ref();
|
isCancelled.ref();
|
||||||
if( foundHeadwords )
|
if( foundHeadwords )
|
||||||
delete foundHeadwords;
|
delete foundHeadwords;
|
||||||
hasExited.acquire();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue