clean: remove unnecessary passing of openSearchAction to ArticleView's ctor

This commit is contained in:
shenleban tongying 2024-03-21 19:09:05 -04:00
parent be22cb22b6
commit 57a5c52620
4 changed files with 8 additions and 14 deletions

View file

@ -94,7 +94,6 @@ ArticleView::ArticleView( QWidget * parent,
Instances::Groups const & groups_,
bool popupView_,
Config::Class const & cfg_,
QAction & openSearchAction_,
QLineEdit const * translateLine_,
QAction * dictionaryBarToggled_,
GroupComboBox const * groupComboBox_ ):
@ -113,7 +112,6 @@ ArticleView::ArticleView( QWidget * parent,
selectCurrentArticleAction( this ),
copyAsTextAction( this ),
inspectAction( this ),
openSearchAction( openSearchAction_ ),
searchIsOpened( false ),
dictionaryBarToggled( dictionaryBarToggled_ ),
groupComboBox( groupComboBox_ ),
@ -201,9 +199,6 @@ ArticleView::ArticleView( QWidget * parent,
webview->addAction( &articleDownAction );
connect( &articleDownAction, &QAction::triggered, this, &ArticleView::moveOneArticleDown );
webview->addAction( &openSearchAction );
connect( &openSearchAction, &QAction::triggered, this, &ArticleView::openSearch );
selectCurrentArticleAction.setShortcut( QKeySequence( "Ctrl+Shift+A" ) );
selectCurrentArticleAction.setText( tr( "Select Current Article" ) );
webview->addAction( &selectCurrentArticleAction );

View file

@ -49,7 +49,6 @@ class ArticleView: public QWidget
QAction pasteAction, articleUpAction, articleDownAction, goBackAction, goForwardAction, selectCurrentArticleAction,
copyAsTextAction, inspectAction;
QAction & openSearchAction;
bool searchIsOpened;
bool expandOptionalParts;
QString rangeVarName;
@ -105,7 +104,6 @@ public:
Instances::Groups const &,
bool popupView,
Config::Class const & cfg,
QAction & openSearchAction_,
QLineEdit const * translateLine,
QAction * dictionaryBarToggled = nullptr,
GroupComboBox const * groupComboBox = nullptr );
@ -319,6 +317,9 @@ signals:
public slots:
/// Opens the search (Ctrl+F)
void openSearch();
void on_searchPrevious_clicked();
void on_searchNext_clicked();
@ -361,9 +362,6 @@ private slots:
/// Nagivates to the next article relative to the active one.
void moveOneArticleDown();
/// Opens the search area
void openSearch();
void on_searchText_textEdited();
void on_searchText_returnPressed();
void on_searchCloseButton_clicked();

View file

@ -1783,7 +1783,6 @@ ArticleView * MainWindow::createNewTab( bool switchToIt, QString const & name )
groupInstances,
false,
cfg,
*ui.searchInPageAction,
translateLine,
dictionaryBar.toggleViewAction(),
groupList );
@ -1823,6 +1822,8 @@ ArticleView * MainWindow::createNewTab( bool switchToIt, QString const & name )
connect( view, &ArticleView::zoomOut, this, &MainWindow::zoomout );
connect( view, &ArticleView::saveBookmarkSignal, this, &MainWindow::addBookmarkToFavorite );
connect( ui.searchInPageAction, &QAction::triggered, view, &ArticleView::openSearch );
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
int index = cfg.preferences.newTabsOpenAfterCurrentOne ? ui.tabWidget->currentIndex() + 1 : ui.tabWidget->count();

View file

@ -85,8 +85,6 @@ ScanPopup::ScanPopup( QWidget * parent,
{
ui.setupUi( this );
openSearchAction.setShortcut( QKeySequence( "Ctrl+F" ) );
if ( layoutDirection() == Qt::RightToLeft ) {
// Adjust button icons for Right-To-Left layout
ui.goBackButton->setIcon( QIcon( ":/icons/next.svg" ) );
@ -104,7 +102,6 @@ ScanPopup::ScanPopup( QWidget * parent,
groups,
true,
cfg,
openSearchAction,
ui.translateBox->translateLine(),
dictionaryBar.toggleViewAction() );
@ -114,6 +111,9 @@ ScanPopup::ScanPopup( QWidget * parent,
connect( definition, &ArticleView::sendWordToHistory, this, &ScanPopup::sendWordToHistory );
connect( definition, &ArticleView::typingEvent, this, &ScanPopup::typingEvent );
openSearchAction.setShortcut( QKeySequence( "Ctrl+F" ) );
connect( &openSearchAction, &QAction::triggered, definition, &ArticleView::openSearch );
wordListDefaultFont = ui.translateBox->completerWidget()->font();
translateLineDefaultFont = ui.translateBox->font();
groupListDefaultFont = ui.groupList->font();