mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
Jump to dictionary when show word from dictionary headwords dialog
This commit is contained in:
parent
e107975d8c
commit
46298a842c
|
@ -140,6 +140,8 @@ void DictHeadwords::setup( Dictionary::Class *dict_ )
|
|||
|
||||
setWindowIcon( dict->getIcon() );
|
||||
|
||||
dictId = QString( dict->getId().c_str() );
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
@ -219,7 +221,7 @@ void DictHeadwords::itemClicked( const QModelIndex & index )
|
|||
if ( value.canConvert< QString >() )
|
||||
{
|
||||
QString headword = value.toString();
|
||||
emit headwordSelected( headword );
|
||||
emit headwordSelected( headword, dictId );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ protected:
|
|||
QStringListModel * model;
|
||||
QSortFilterProxyModel * proxy;
|
||||
WordListItemDelegate * delegate;
|
||||
QString dictId;
|
||||
|
||||
QAction helpAction;
|
||||
|
||||
|
@ -54,7 +55,7 @@ private slots:
|
|||
void helpRequested();
|
||||
|
||||
signals:
|
||||
void headwordSelected( QString const & );
|
||||
void headwordSelected( QString const &, QString const & );
|
||||
void closeDialog();
|
||||
};
|
||||
|
||||
|
|
|
@ -2102,7 +2102,7 @@ void MainWindow::translateInputChanged( QString const & newValue )
|
|||
wordFinder.prefixMatch( req, getActiveDicts() );
|
||||
}
|
||||
|
||||
void MainWindow::translateInputFinished( bool checkModifiers )
|
||||
void MainWindow::translateInputFinished( bool checkModifiers, QString const & dictID )
|
||||
{
|
||||
QString word = Folding::unescapeWildcardSymbols( translateLine->text() );
|
||||
|
||||
|
@ -2112,7 +2112,7 @@ void MainWindow::translateInputFinished( bool checkModifiers )
|
|||
if ( checkModifiers && ( mods & (Qt::ControlModifier | Qt::ShiftModifier) ) )
|
||||
addNewTab();
|
||||
|
||||
showTranslationFor( word );
|
||||
showTranslationFor( word, 0, dictID );
|
||||
|
||||
if ( cfg.preferences.searchInDock )
|
||||
{
|
||||
|
@ -2536,7 +2536,8 @@ void MainWindow::showHistoryItem( QString const & word )
|
|||
}
|
||||
|
||||
void MainWindow::showTranslationFor( QString const & inWord,
|
||||
unsigned inGroup )
|
||||
unsigned inGroup,
|
||||
QString const & dictID )
|
||||
{
|
||||
ArticleView *view = getCurrentArticleView();
|
||||
|
||||
|
@ -2546,7 +2547,7 @@ void MainWindow::showTranslationFor( QString const & inWord,
|
|||
( groupInstances.empty() ? 0 :
|
||||
groupInstances[ groupList->currentIndex() ].id );
|
||||
|
||||
view->showDefinition( inWord, group );
|
||||
view->showDefinition( inWord, group, dictID );
|
||||
|
||||
updatePronounceAvailability();
|
||||
updateFoundInDictsList();
|
||||
|
@ -3507,6 +3508,13 @@ void MainWindow::wordReceived( const QString & word)
|
|||
translateInputFinished( false );
|
||||
}
|
||||
|
||||
void MainWindow::headwordReceived( const QString & word, const QString & ID )
|
||||
{
|
||||
toggleMainWindow( true );
|
||||
translateLine->setText( Folding::escapeWildcardSymbols( word ) );
|
||||
translateInputFinished( false, QString( "gdfrom-" )+ ID );
|
||||
}
|
||||
|
||||
void MainWindow::updateHistoryMenu()
|
||||
{
|
||||
if ( ui.historyPane->toggleViewAction()->isChecked() )
|
||||
|
@ -3766,8 +3774,8 @@ void MainWindow::showDictionaryHeadwords( Dictionary::Class * dict )
|
|||
{
|
||||
headwordsDlg = new DictHeadwords( this, cfg, dict );
|
||||
addGlobalActionsToDialog( headwordsDlg );
|
||||
connect( headwordsDlg, SIGNAL( headwordSelected( QString ) ),
|
||||
this, SLOT( wordReceived( QString ) ) );
|
||||
connect( headwordsDlg, SIGNAL( headwordSelected( QString, QString ) ),
|
||||
this, SLOT( headwordReceived( QString, QString ) ) );
|
||||
connect( headwordsDlg, SIGNAL( closeDialog() ),
|
||||
this, SLOT( closeHeadwordsDialog() ) );
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public slots:
|
|||
void messageFromAnotherInstanceReceived( QString const & );
|
||||
void showStatusBarMessage ( QString const &, int, QPixmap const & );
|
||||
void wordReceived( QString const & );
|
||||
void headwordReceived( QString const &, QString const & );
|
||||
void setExpandMode( bool expand );
|
||||
|
||||
private:
|
||||
|
@ -329,7 +330,7 @@ private slots:
|
|||
|
||||
void currentGroupChanged( QString const & );
|
||||
void translateInputChanged( QString const & );
|
||||
void translateInputFinished( bool checkModifiers = true );
|
||||
void translateInputFinished( bool checkModifiers = true, QString const & dictID = QString() );
|
||||
|
||||
/// Closes any opened search in the article view, and focuses the translateLine/close main window to tray.
|
||||
void handleEsc();
|
||||
|
@ -364,7 +365,8 @@ private slots:
|
|||
|
||||
void mutedDictionariesChanged();
|
||||
|
||||
void showTranslationFor( QString const &, unsigned inGroup = 0 );
|
||||
void showTranslationFor( QString const &, unsigned inGroup = 0,
|
||||
QString const & dictID = QString() );
|
||||
|
||||
void showTranslationFor( QString const &, QStringList const & dictIDs,
|
||||
QRegExp const & searchRegExp );
|
||||
|
|
Loading…
Reference in a new issue