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