mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
fix: when history forward/back ,the founded dictionary does not change
fixed #184
This commit is contained in:
parent
c8f445f165
commit
208cd50979
|
@ -429,9 +429,10 @@ ArticleRequest::ArticleRequest(
|
|||
data.resize( header.size() );
|
||||
memcpy( &data.front(), header.data(), header.size() );
|
||||
|
||||
// Accumulate main forms
|
||||
//clear founded dicts.
|
||||
emit GlobalBroadcaster::instance()->dictionaryClear( ActiveDictIds{word} );
|
||||
|
||||
// Accumulate main forms
|
||||
for( unsigned x = 0; x < activeDicts.size(); ++x )
|
||||
{
|
||||
sptr< Dictionary::WordSearchRequest > s = activeDicts[ x ]->findHeadwordsForSynonym( gd::toWString( word ) );
|
||||
|
|
|
@ -401,6 +401,7 @@ void ArticleView::showDefinition( Config::InputPhrase const & phrase, unsigned g
|
|||
Contexts const & contexts_ )
|
||||
{
|
||||
currentWord = phrase.phrase.trimmed();
|
||||
historyMode = false;
|
||||
currentActiveDictIds.clear();
|
||||
// first, let's stop the player
|
||||
audioPlayer->stop();
|
||||
|
@ -484,6 +485,7 @@ void ArticleView::showDefinition( QString const & word, QStringList const & dict
|
|||
if( dictIDs.isEmpty() )
|
||||
return;
|
||||
currentWord = word.trimmed();
|
||||
historyMode = false;
|
||||
// first, let's stop the player
|
||||
audioPlayer->stop();
|
||||
|
||||
|
@ -1623,6 +1625,8 @@ void ArticleView::back()
|
|||
if ( canGoBack() )
|
||||
{
|
||||
saveHistoryUserData();
|
||||
currentActiveDictIds.clear();
|
||||
historyMode = true;
|
||||
ui.definition->back();
|
||||
}
|
||||
}
|
||||
|
@ -1630,6 +1634,8 @@ void ArticleView::back()
|
|||
void ArticleView::forward()
|
||||
{
|
||||
saveHistoryUserData();
|
||||
currentActiveDictIds.clear();
|
||||
historyMode = true;
|
||||
ui.definition->forward();
|
||||
}
|
||||
|
||||
|
@ -2619,7 +2625,7 @@ void ArticleView::highlightAllFtsOccurences( QWebEnginePage::FindFlags flags )
|
|||
}
|
||||
|
||||
void ArticleView::setActiveDictIds(ActiveDictIds ad) {
|
||||
if (ad.word == currentWord) {
|
||||
if (ad.word == currentWord || historyMode) {
|
||||
// ignore all other signals.
|
||||
qDebug() << "receive dicts, current word:" << currentWord << ad.word << ":" << ad.dictIds;
|
||||
currentActiveDictIds << ad.dictIds;
|
||||
|
@ -2712,10 +2718,6 @@ void ArticleView::performFtsFindOperation( bool backwards )
|
|||
#endif
|
||||
|
||||
ui.ftsSearchStatusLabel->setText( searchStatusMessage( ftsPosition + 1, allMatches.size() ) );
|
||||
// Store new highlighted selection
|
||||
// ui.definition->page()->
|
||||
// runJavaScript( QString( "%1=window.getSelection().getRangeAt(0);_=0;" )
|
||||
// .arg( rangeVarName ) );
|
||||
}
|
||||
|
||||
void ArticleView::on_ftsSearchPrevious_clicked()
|
||||
|
|
|
@ -70,6 +70,8 @@ class ArticleView: public QFrame
|
|||
/// current active dict id list;
|
||||
QStringList currentActiveDictIds;
|
||||
|
||||
bool historyMode=false;
|
||||
|
||||
//current active dictionary id;
|
||||
QString activeDictId;
|
||||
|
||||
|
|
Loading…
Reference in a new issue