mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
1
This commit is contained in:
parent
ab214cfb05
commit
e07e730a09
|
@ -516,13 +516,15 @@ void ArticleRequest::altSearchFinished()
|
|||
// if the dictionary is website dictionary and openinNewTab is enabled, emit a signal.
|
||||
if ( GlobalBroadcaster::instance()->getPreference()->openWebsiteInNewTab ) {
|
||||
if ( ( activeDict->getFeatures() | Dictionary::WebSite ) == Dictionary::WebSite ) {
|
||||
//todo ,replace the word with actual url
|
||||
//replace the word,and get the actual requested url
|
||||
string url = activeDict->getProperties()[ Dictionary::Property::Url ];
|
||||
if ( url.empty() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString requestUrl = Utils::WebSite::urlReplaceWord( QString::fromStdString( url ), word );
|
||||
emit GlobalBroadcaster::instance()
|
||||
-> websiteDictionary( QString::fromStdString( activeDict->getName() ), QString::fromStdString( url ) );
|
||||
-> websiteDictionary( QString::fromStdString( activeDict->getName() ), requestUrl );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ void WebSiteArticleRequest::requestFinished( QNetworkReply * r )
|
|||
|
||||
sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str,
|
||||
vector< wstring > const & /*alts*/,
|
||||
wstring const & context,
|
||||
wstring const & /*context*/,
|
||||
bool /*ignoreDiacritics*/ )
|
||||
{
|
||||
QString urlString = Utils::WebSite::urlReplaceWord( QString( urlTemplate ), QString::fromStdU32String( str ) );
|
||||
|
@ -330,14 +330,14 @@ sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str,
|
|||
QUrl url( urlString );
|
||||
GlobalBroadcaster::instance()->addWhitelist( url.host() );
|
||||
|
||||
QString encodeUrl = encodeUrl = urlString;
|
||||
const QString & encodeUrl = urlString;
|
||||
|
||||
if ( GlobalBroadcaster::instance()->getPreference()->openWebSiteInNewTab ) {
|
||||
if ( GlobalBroadcaster::instance()->getPreference()->openWebsiteInNewTab ) {
|
||||
result += string( "<div><span>this website dictionary is opened in the new tab</span></div>" );
|
||||
}
|
||||
else {
|
||||
fmt::format_to( std::back_inserter( result ),
|
||||
R"(<iframe id="gdexpandframe-{}" src="{}"
|
||||
R"(<iframe id="gdexpandframe-{}" src="{}"
|
||||
onmouseover="processIframeMouseOver('gdexpandframe-{}');"
|
||||
onmouseout="processIframeMouseOut();" scrolling="no"
|
||||
style="overflow:visible; width:100%; display:block; border:none;"
|
||||
|
|
|
@ -2182,7 +2182,12 @@ void MainWindow::updateBackForwardButtons()
|
|||
void MainWindow::updatePronounceAvailability()
|
||||
{
|
||||
if ( ui.tabWidget->count() > 0 ) {
|
||||
getCurrentArticleView()->hasSound( [ this ]( bool has ) {
|
||||
ArticleView * pView = getCurrentArticleView();
|
||||
if ( pView == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
pView->hasSound( [ this ]( bool has ) {
|
||||
navPronounce->setEnabled( has );
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue