improve:foundDictsPane refresh logic

This commit is contained in:
xiaoyifang 2022-01-09 12:54:50 +08:00
parent 29bd94b8a7
commit 13fdf08450
4 changed files with 9 additions and 5 deletions

View file

@ -2554,7 +2554,8 @@ void ArticleView::setActiveDictIds(ActiveDictIds ad) {
if (ad.word == currentWord) { if (ad.word == currentWord) {
currentActiveDictIds << ad.dictIds; currentActiveDictIds << ad.dictIds;
currentActiveDictIds.removeDuplicates(); currentActiveDictIds.removeDuplicates();
qDebug() << "current word:"<<currentWord<<"receivedd:"<<ad.word<<":" << ad.dictIds<<this; emit updateFoundInDictsList();
qDebug() << "receive dicts:"<<ad.word<<":" << ad.dictIds;
} }
} }

View file

@ -241,6 +241,8 @@ signals:
/// Signals that the dictionaries pane was requested to be showed /// Signals that the dictionaries pane was requested to be showed
void showDictsPane( ); void showDictsPane( );
/// Signals that the founded dictionaries ready to be showed
void updateFoundInDictsList( );
/// Emitted when an article becomes active, /// Emitted when an article becomes active,
/// typically in response to user actions /// typically in response to user actions

View file

@ -1645,6 +1645,9 @@ ArticleView * MainWindow::createNewTab( bool switchToIt,
connect( view, SIGNAL( pageLoaded( ArticleView * ) ), connect( view, SIGNAL( pageLoaded( ArticleView * ) ),
this, SLOT( pageLoaded( ArticleView * ) ) ); this, SLOT( pageLoaded( ArticleView * ) ) );
connect( view, SIGNAL( updateFoundInDictsList( ) ),
this, SLOT( updateFoundInDictsList() ) );
connect( view, SIGNAL( openLinkInNewTab( QUrl const &, QUrl const &, QString const &, ArticleView::Contexts const & ) ), connect( view, SIGNAL( openLinkInNewTab( QUrl const &, QUrl const &, QString const &, ArticleView::Contexts const & ) ),
this, SLOT( openLinkInNewTab( QUrl const &, QUrl const &, QString const &, ArticleView::Contexts const & ) ) ); this, SLOT( openLinkInNewTab( QUrl const &, QUrl const &, QString const &, ArticleView::Contexts const & ) ) );
@ -1885,7 +1888,7 @@ void MainWindow::pageLoaded( ArticleView * view )
if ( cfg.preferences.pronounceOnLoadMain ) if ( cfg.preferences.pronounceOnLoadMain )
pronounce( view ); pronounce( view );
updateFoundInDictsList(); //updateFoundInDictsList();
} }
void MainWindow::showStatusBarMessage( QString const & message, int timeout, QPixmap const & icon ) void MainWindow::showStatusBarMessage( QString const & message, int timeout, QPixmap const & icon )

View file

@ -219,8 +219,6 @@ private:
void updatePronounceAvailability(); void updatePronounceAvailability();
void updateFoundInDictsList();
void updateBackForwardButtons(); void updateBackForwardButtons();
void updateWindowTitle(); void updateWindowTitle();
@ -287,7 +285,7 @@ private slots:
/// the timer. Does nothing otherwise. /// the timer. Does nothing otherwise.
void prepareNewReleaseChecks(); void prepareNewReleaseChecks();
private slots: void updateFoundInDictsList();
/// Does the new release check. /// Does the new release check.
void checkForNewRelease(); void checkForNewRelease();