mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
fix: auto pronounce audio does not play
This commit is contained in:
parent
caf6424ec8
commit
710c07f05f
|
@ -705,19 +705,13 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
&PronounceEngine::emitAudio,
|
||||
this,
|
||||
[ this ]( auto audioUrl ) {
|
||||
if ( !isActiveWindow() )
|
||||
return;
|
||||
auto view = getCurrentArticleView();
|
||||
if ( ( cfg.preferences.pronounceOnLoadMain || cfg.preferences.pronounceOnLoadPopup ) && view != nullptr ) {
|
||||
if ( cfg.preferences.pronounceOnLoadPopup ) {
|
||||
if ( !scanPopup || !scanPopup->isActiveWindow() )
|
||||
return;
|
||||
if ( ( cfg.preferences.pronounceOnLoadMain ) && view != nullptr ) {
|
||||
|
||||
view->openLink( QUrl::fromEncoded( audioUrl.toUtf8() ), {} );
|
||||
}
|
||||
else if ( cfg.preferences.pronounceOnLoadMain ) {
|
||||
if ( scanPopup && scanPopup->isActiveWindow() )
|
||||
return;
|
||||
view->openLink( QUrl::fromEncoded( audioUrl.toUtf8() ), {} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
applyProxySettings();
|
||||
|
||||
|
|
|
@ -157,6 +157,17 @@ ScanPopup::ScanPopup( QWidget * parent,
|
|||
connect( &dictionaryBar, &DictionaryBar::showDictionaryInfo, this, &ScanPopup::showDictionaryInfo );
|
||||
connect( &dictionaryBar, &DictionaryBar::openDictionaryFolder, this, &ScanPopup::openDictionaryFolder );
|
||||
|
||||
connect( &GlobalBroadcaster::instance()->pronounce_engine,
|
||||
&PronounceEngine::emitAudio,
|
||||
this,
|
||||
[ this ]( auto audioUrl ) {
|
||||
if ( !isActiveWindow() )
|
||||
return;
|
||||
if ( cfg.preferences.pronounceOnLoadPopup ) {
|
||||
|
||||
definition->openLink( QUrl::fromEncoded( audioUrl.toUtf8() ), {} );
|
||||
}
|
||||
} );
|
||||
pinnedGeometry = cfg.popupWindowGeometry;
|
||||
if ( cfg.popupWindowGeometry.size() )
|
||||
restoreGeometry( cfg.popupWindowGeometry );
|
||||
|
|
Loading…
Reference in a new issue