From d607079ffba4eb8ab8d2635d616aee2b667fce2b Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Fri, 25 Feb 2022 23:33:34 +0800 Subject: [PATCH] fix: double click to translation should stop audio first. there are cases when the audio is too long (in wiki). when double click occured .the audio is still playing. --- articleview.cc | 2 +- mainwindow.cc | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/articleview.cc b/articleview.cc index c44689f4..2dc6926c 100644 --- a/articleview.cc +++ b/articleview.cc @@ -2250,7 +2250,7 @@ void ArticleView::onJsActiveArticleChanged(QString const & id) void ArticleView::doubleClicked( QPoint pos ) { // We might want to initiate translation of the selected word - + audioPlayer->stop(); if ( cfg.preferences.doubleClickTranslates ) { QString selectedText = ui.definition->selectedText(); diff --git a/mainwindow.cc b/mainwindow.cc index 1f666926..6568cefb 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2696,14 +2696,18 @@ void MainWindow::dictsListItemActivated( QListWidgetItem * item ) void MainWindow::dictsListSelectionChanged() { QList< QListWidgetItem * > selected = ui.dictsList->selectedItems(); - if ( selected.size() ) + if( selected.size() ) { - ArticleView * view = getCurrentArticleView(); - if(view){ - QString dictId = ui.dictsList->selectedItems().at(0)->data(Qt::UserRole).toString(); - view->setActiveArticleId(dictId); - } -// jumpToDictionary( selected.front() ); + ArticleView * view = getCurrentArticleView(); + if( view ) + { + QString dictId = ui.dictsList->selectedItems().at( 0 )->data( Qt::UserRole ).toString(); + view->setActiveArticleId( dictId ); + } + // selection change ,no need to jump to article ,if jump to article ,the position in webview would be changed + // when click the dictionary in the html. + + // jumpToDictionary( selected.front() ); } }