From 99ddb7686e4009ce441004d0afedc535b1448a2b Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Mon, 7 Jun 2021 20:43:39 +0300 Subject: [PATCH] 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. --- mainwindow.cc | 8 -------- scanpopup.cc | 3 --- 2 files changed, 11 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 97469c24..ae7fce7e 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2792,10 +2792,6 @@ void MainWindow::showTranslationFor( Config::InputPhrase const & phrase, updatePronounceAvailability(); updateFoundInDictsList(); - // Add to history - - addWordToHistory( phrase.phrase ); - updateBackForwardButtons(); #if 0 @@ -2908,10 +2904,6 @@ void MainWindow::showTranslationFor( QString const & inWord, updatePronounceAvailability(); updateFoundInDictsList(); - // Add to history - - addWordToHistory( inWord ); - updateBackForwardButtons(); } diff --git a/scanpopup.cc b/scanpopup.cc index 5d268cc8..264dc7a4 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -815,9 +815,6 @@ void ScanPopup::showTranslationFor( Config::InputPhrase const & inputPhrase ) unsigned groupId = ui.groupList->getCurrentGroup(); definition->showDefinition( inputPhrase, groupId ); definition->focus(); - - // Add to history - emit sendWordToHistory( inputPhrase.phrase.trimmed() ); } vector< sptr< Dictionary::Class > > const & ScanPopup::getActiveDicts()