Don't add the same phrase to history twice in a row

Each of the 3 removed history addition requests follows a call to
ArticleView::showDefinition() with the same phrase/word as an argument.
Each showDefinition() overload adds its phrase/word argument to history.

These duplicate history additions weren't noticeable because
History::addItem() searches for and removes its argument from items to
avoid duplicate history entries. But the extra function calls, signal
emissions, linear searches and QList manipulation wasted processor time.
This commit is contained in:
Igor Kushnir 2021-06-07 20:43:39 +03:00
parent 60bc05218f
commit 99ddb7686e
2 changed files with 0 additions and 11 deletions

View file

@ -2792,10 +2792,6 @@ void MainWindow::showTranslationFor( Config::InputPhrase const & phrase,
updatePronounceAvailability(); updatePronounceAvailability();
updateFoundInDictsList(); updateFoundInDictsList();
// Add to history
addWordToHistory( phrase.phrase );
updateBackForwardButtons(); updateBackForwardButtons();
#if 0 #if 0
@ -2908,10 +2904,6 @@ void MainWindow::showTranslationFor( QString const & inWord,
updatePronounceAvailability(); updatePronounceAvailability();
updateFoundInDictsList(); updateFoundInDictsList();
// Add to history
addWordToHistory( inWord );
updateBackForwardButtons(); updateBackForwardButtons();
} }

View file

@ -815,9 +815,6 @@ void ScanPopup::showTranslationFor( Config::InputPhrase const & inputPhrase )
unsigned groupId = ui.groupList->getCurrentGroup(); unsigned groupId = ui.groupList->getCurrentGroup();
definition->showDefinition( inputPhrase, groupId ); definition->showDefinition( inputPhrase, groupId );
definition->focus(); definition->focus();
// Add to history
emit sendWordToHistory( inputPhrase.phrase.trimmed() );
} }
vector< sptr< Dictionary::Class > > const & ScanPopup::getActiveDicts() vector< sptr< Dictionary::Class > > const & ScanPopup::getActiveDicts()