Skip to content

Commit

Permalink
fix: double click to translation should stop audio first.
Browse files Browse the repository at this point in the history
there are cases when the audio is too long (in wiki).
when double click occured .the audio is still playing.
  • Loading branch information
xiaoyifang committed Feb 25, 2022
1 parent 59ea20f commit d607079
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 11 additions & 7 deletions mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
}

Expand Down

0 comments on commit d607079

Please sign in to comment.