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.
This commit is contained in:
xiaoyifang 2022-02-25 23:33:34 +08:00
parent 59ea20f4c1
commit d607079ffb
2 changed files with 12 additions and 8 deletions

View file

@ -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();

View file

@ -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() );
}
}