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
9e99389cc3
commit
0d89c4ab56
|
@ -513,6 +513,15 @@ void ArticleRequest::altSearchFinished()
|
|||
|
||||
for ( const auto & activeDict : activeDicts ) {
|
||||
try {
|
||||
// if the dictionary is website dictionary and openinNewTab is enabled, emit a signal.
|
||||
if ( GlobalBroadcaster::instance()->getPreference()->openWebsiteInNewTab ) {
|
||||
if ( activeDict->getFeature() == Dictionary::WebSite ) {
|
||||
//todo ,replace the word with actual url
|
||||
emit GlobalBroadcaster::instance() -> websiteDictionary( word,url );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
sptr< Dictionary::DataRequest > r = activeDict->getArticle(
|
||||
wordStd,
|
||||
altsVector,
|
||||
|
|
|
@ -46,6 +46,8 @@ signals:
|
|||
void dictionaryClear( ActiveDictIds ad );
|
||||
|
||||
void indexingDictionary( QString );
|
||||
|
||||
void websiteDictionary( QString );
|
||||
};
|
||||
|
||||
#endif // GLOBAL_GLOBALBROADCASTER_H
|
||||
|
|
|
@ -713,6 +713,10 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
&GlobalBroadcaster::indexingDictionary,
|
||||
this,
|
||||
&MainWindow::showFTSIndexingName );
|
||||
connect( GlobalBroadcaster::instance(),
|
||||
&GlobalBroadcaster::websiteDictionary,
|
||||
this,
|
||||
&MainWindow::openWebsiteInNewTab );
|
||||
|
||||
connect( &GlobalBroadcaster::instance()->pronounce_engine,
|
||||
&PronounceEngine::emitAudio,
|
||||
|
@ -4361,6 +4365,17 @@ void MainWindow::showFTSIndexingName( QString const & name )
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::openWebsiteInNewTab( QString const & name,QString const & url )
|
||||
{
|
||||
QString escaped = Utils::escapeAmps( name );
|
||||
|
||||
auto view = new QWebEngineView(this);
|
||||
view->load(QUrl(url));
|
||||
|
||||
ui.tabWidget->insertTab( index, view, escaped );
|
||||
mruList.append( dynamic_cast< QWidget * >( view ) );
|
||||
}
|
||||
|
||||
QString MainWindow::unescapeTabHeader( QString const & header )
|
||||
{
|
||||
// Reset table header to original headword
|
||||
|
|
|
@ -293,6 +293,7 @@ private slots:
|
|||
void openDictionaryFolder( QString const & id );
|
||||
|
||||
void showFTSIndexingName( QString const & name );
|
||||
void openWebsiteInNewTab( QString const & name,QString const & url );
|
||||
|
||||
void handleAddToFavoritesButton();
|
||||
|
||||
|
|
Loading…
Reference in a new issue