This commit is contained in:
YiFang Xiao 2024-11-09 20:40:55 +08:00
parent a9478cdc34
commit 6c63ba45b6
4 changed files with 11 additions and 6 deletions

View file

@ -524,7 +524,11 @@ void ArticleRequest::altSearchFinished()
QString requestUrl = Utils::WebSite::urlReplaceWord( QString::fromStdString( url ), word ); QString requestUrl = Utils::WebSite::urlReplaceWord( QString::fromStdString( url ), word );
emit GlobalBroadcaster::instance() emit GlobalBroadcaster::instance()
-> websiteDictionary( QString::fromStdString( activeDict->getName() ), requestUrl ); -> websiteDictionarySignal( QString::fromStdString( activeDict->getName() ), requestUrl );
QStringList dictIds;
dictIds << QString::fromStdString( activeDict->getId() );
ActiveDictIds hittedWord{ group.id, word, dictIds };
emit GlobalBroadcaster::instance() -> dictionaryChanges( hittedWord );
continue; continue;
} }
} }

View file

@ -47,7 +47,7 @@ signals:
void indexingDictionary( QString ); void indexingDictionary( QString );
void websiteDictionary( QString, QString ); void websiteDictionarySignal( QString, QString );
}; };
#endif // GLOBAL_GLOBALBROADCASTER_H #endif // GLOBAL_GLOBALBROADCASTER_H

View file

@ -96,9 +96,10 @@ void ArticleView::setupWebview()
auto * baseLayout = new QVBoxLayout( this ); auto * baseLayout = new QVBoxLayout( this );
this->tabWidget = new QTabWidget( this ); this->tabWidget = new QTabWidget( this );
baseLayout->setContentsMargins( 0, 0, 0, 0 );
baseLayout->addWidget( this->tabWidget ); baseLayout->addWidget( this->tabWidget );
QWidget * tab1 = new QWidget( tabWidget ); auto * tab1 = new QWidget( tabWidget );
// Layout // Layout
auto * mainLayout = new QVBoxLayout( tab1 ); auto * mainLayout = new QVBoxLayout( tab1 );
mainLayout->addWidget( this->webview ); mainLayout->addWidget( this->webview );

View file

@ -715,7 +715,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
this, this,
&MainWindow::showFTSIndexingName ); &MainWindow::showFTSIndexingName );
connect( GlobalBroadcaster::instance(), connect( GlobalBroadcaster::instance(),
&GlobalBroadcaster::websiteDictionary, &GlobalBroadcaster::websiteDictionarySignal,
this, this,
&MainWindow::openWebsiteInNewTab ); &MainWindow::openWebsiteInNewTab );
@ -2149,7 +2149,7 @@ void MainWindow::updateFoundInDictsList()
if ( dictionaries[ x ]->getId() == i->toUtf8().data() ) { if ( dictionaries[ x ]->getId() == i->toUtf8().data() ) {
QString dictName = QString::fromUtf8( dictionaries[ x ]->getName().c_str() ); QString dictName = QString::fromUtf8( dictionaries[ x ]->getName().c_str() );
QString dictId = QString::fromUtf8( dictionaries[ x ]->getId().c_str() ); QString dictId = QString::fromUtf8( dictionaries[ x ]->getId().c_str() );
QListWidgetItem * item = auto * item =
new QListWidgetItem( dictionaries[ x ]->getIcon(), dictName, ui.dictsList, QListWidgetItem::Type ); new QListWidgetItem( dictionaries[ x ]->getIcon(), dictName, ui.dictsList, QListWidgetItem::Type );
item->setData( Qt::UserRole, QVariant( dictId ) ); item->setData( Qt::UserRole, QVariant( dictId ) );
item->setToolTip( dictName ); item->setToolTip( dictName );
@ -2163,7 +2163,7 @@ void MainWindow::updateFoundInDictsList()
} }
} }
//if no item in dict List panel has been choose ,select first one. //if no item in dict List panel has been choosen ,select first one.
if ( ui.dictsList->count() > 0 && ui.dictsList->selectedItems().empty() ) { if ( ui.dictsList->count() > 0 && ui.dictsList->selectedItems().empty() ) {
ui.dictsList->setCurrentRow( 0 ); ui.dictsList->setCurrentRow( 0 );
} }