mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Merge pull request #284 from shenlebantongying/fix/shorcut_clean
refactor: remove duplicated favoriatePane shortcut setting
This commit is contained in:
commit
caa97a7120
|
@ -525,7 +525,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
ui.menuView->addAction( ui.dictsPane->toggleViewAction() );
|
||||
ui.dictsPane->toggleViewAction()->setShortcut( QKeySequence( "Ctrl+R" ) );
|
||||
ui.menuView->addAction( ui.favoritesPane->toggleViewAction() );
|
||||
ui.favoritesPane->toggleViewAction()->setShortcut( QKeySequence( "Ctrl+I" ) );
|
||||
ui.menuView->addAction( ui.historyPane->toggleViewAction() );
|
||||
|
||||
ui.menuView->addSeparator();
|
||||
|
@ -588,8 +587,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
ui.favoritesPaneWidget->setSaveInterval( cfg.preferences.favoritesStoreInterval );
|
||||
|
||||
connect( ui.favoritesPane, &QDockWidget::visibilityChanged, this, &MainWindow::updateFavoritesMenu );
|
||||
|
||||
connect( ui.menuFavorites, &QMenu::aboutToShow, this, &MainWindow::updateFavoritesMenu );
|
||||
connect(ui.showHideFavorites,&QAction::triggered,this,&MainWindow::toggle_favoritesPane);
|
||||
|
||||
connect( ui.favoritesPaneWidget,
|
||||
&FavoritesPaneWidget::favoritesItemRequested,
|
||||
|
@ -2511,15 +2509,6 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
|
|||
{
|
||||
QKeyEvent * ke = static_cast<QKeyEvent*>( ev );
|
||||
|
||||
// Handle Ctrl+I to show the Favorities Pane.
|
||||
if ( ke->key() == Qt::Key_I && ke->modifiers() == Qt::ControlModifier )
|
||||
{
|
||||
if( ev->type() == QEvent::KeyPress )
|
||||
on_showHideFavorites_triggered();
|
||||
ev->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle F3/Shift+F3 shortcuts
|
||||
if ( ke->key() == Qt::Key_F3 )
|
||||
{
|
||||
|
@ -3842,7 +3831,7 @@ void MainWindow::headwordReceived( const QString & word, const QString & ID )
|
|||
|
||||
void MainWindow::updateFavoritesMenu()
|
||||
{
|
||||
if ( ui.favoritesPane->toggleViewAction()->isChecked() )
|
||||
if ( ui.favoritesPane->isVisible() )
|
||||
{
|
||||
ui.showHideFavorites->setText( tr( "&Hide" ) );
|
||||
}
|
||||
|
@ -3864,10 +3853,17 @@ void MainWindow::updateHistoryMenu()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_showHideFavorites_triggered()
|
||||
void MainWindow::toggle_favoritesPane()
|
||||
{
|
||||
ui.favoritesPane->toggleViewAction()->trigger();
|
||||
ui.favoritesPane->raise(); // useful when the Pane is tabbed.
|
||||
if( ui.favoritesPane->isVisible() )
|
||||
{
|
||||
ui.favoritesPane->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.favoritesPane->show();
|
||||
ui.favoritesPane->raise(); // useful when the Pane is tabbed.
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggle_historyPane()
|
||||
|
|
|
@ -437,7 +437,7 @@ private slots:
|
|||
|
||||
void on_rescanFiles_triggered();
|
||||
|
||||
void on_showHideFavorites_triggered();
|
||||
void toggle_favoritesPane();
|
||||
void toggle_historyPane(); // Toggling visibility
|
||||
void on_exportHistory_triggered();
|
||||
void on_importHistory_triggered();
|
||||
|
|
Loading…
Reference in a new issue