mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24: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 ) {
|
for ( const auto & activeDict : activeDicts ) {
|
||||||
try {
|
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(
|
sptr< Dictionary::DataRequest > r = activeDict->getArticle(
|
||||||
wordStd,
|
wordStd,
|
||||||
altsVector,
|
altsVector,
|
||||||
|
|
|
@ -46,6 +46,8 @@ signals:
|
||||||
void dictionaryClear( ActiveDictIds ad );
|
void dictionaryClear( ActiveDictIds ad );
|
||||||
|
|
||||||
void indexingDictionary( QString );
|
void indexingDictionary( QString );
|
||||||
|
|
||||||
|
void websiteDictionary( QString );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBAL_GLOBALBROADCASTER_H
|
#endif // GLOBAL_GLOBALBROADCASTER_H
|
||||||
|
|
|
@ -713,6 +713,10 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
&GlobalBroadcaster::indexingDictionary,
|
&GlobalBroadcaster::indexingDictionary,
|
||||||
this,
|
this,
|
||||||
&MainWindow::showFTSIndexingName );
|
&MainWindow::showFTSIndexingName );
|
||||||
|
connect( GlobalBroadcaster::instance(),
|
||||||
|
&GlobalBroadcaster::websiteDictionary,
|
||||||
|
this,
|
||||||
|
&MainWindow::openWebsiteInNewTab );
|
||||||
|
|
||||||
connect( &GlobalBroadcaster::instance()->pronounce_engine,
|
connect( &GlobalBroadcaster::instance()->pronounce_engine,
|
||||||
&PronounceEngine::emitAudio,
|
&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 )
|
QString MainWindow::unescapeTabHeader( QString const & header )
|
||||||
{
|
{
|
||||||
// Reset table header to original headword
|
// Reset table header to original headword
|
||||||
|
|
|
@ -293,6 +293,7 @@ private slots:
|
||||||
void openDictionaryFolder( QString const & id );
|
void openDictionaryFolder( QString const & id );
|
||||||
|
|
||||||
void showFTSIndexingName( QString const & name );
|
void showFTSIndexingName( QString const & name );
|
||||||
|
void openWebsiteInNewTab( QString const & name,QString const & url );
|
||||||
|
|
||||||
void handleAddToFavoritesButton();
|
void handleAddToFavoritesButton();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue