mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
Merge pull request #1432 from shenlebantongying/clean/open-search-act
clean: remove unnecessary passing of openSearchAction to ArticleView's ctor
This commit is contained in:
commit
fbb1c25852
|
@ -94,7 +94,6 @@ ArticleView::ArticleView( QWidget * parent,
|
||||||
Instances::Groups const & groups_,
|
Instances::Groups const & groups_,
|
||||||
bool popupView_,
|
bool popupView_,
|
||||||
Config::Class const & cfg_,
|
Config::Class const & cfg_,
|
||||||
QAction & openSearchAction_,
|
|
||||||
QLineEdit const * translateLine_,
|
QLineEdit const * translateLine_,
|
||||||
QAction * dictionaryBarToggled_,
|
QAction * dictionaryBarToggled_,
|
||||||
GroupComboBox const * groupComboBox_ ):
|
GroupComboBox const * groupComboBox_ ):
|
||||||
|
@ -113,7 +112,6 @@ ArticleView::ArticleView( QWidget * parent,
|
||||||
selectCurrentArticleAction( this ),
|
selectCurrentArticleAction( this ),
|
||||||
copyAsTextAction( this ),
|
copyAsTextAction( this ),
|
||||||
inspectAction( this ),
|
inspectAction( this ),
|
||||||
openSearchAction( openSearchAction_ ),
|
|
||||||
searchIsOpened( false ),
|
searchIsOpened( false ),
|
||||||
dictionaryBarToggled( dictionaryBarToggled_ ),
|
dictionaryBarToggled( dictionaryBarToggled_ ),
|
||||||
groupComboBox( groupComboBox_ ),
|
groupComboBox( groupComboBox_ ),
|
||||||
|
@ -201,9 +199,6 @@ ArticleView::ArticleView( QWidget * parent,
|
||||||
webview->addAction( &articleDownAction );
|
webview->addAction( &articleDownAction );
|
||||||
connect( &articleDownAction, &QAction::triggered, this, &ArticleView::moveOneArticleDown );
|
connect( &articleDownAction, &QAction::triggered, this, &ArticleView::moveOneArticleDown );
|
||||||
|
|
||||||
webview->addAction( &openSearchAction );
|
|
||||||
connect( &openSearchAction, &QAction::triggered, this, &ArticleView::openSearch );
|
|
||||||
|
|
||||||
selectCurrentArticleAction.setShortcut( QKeySequence( "Ctrl+Shift+A" ) );
|
selectCurrentArticleAction.setShortcut( QKeySequence( "Ctrl+Shift+A" ) );
|
||||||
selectCurrentArticleAction.setText( tr( "Select Current Article" ) );
|
selectCurrentArticleAction.setText( tr( "Select Current Article" ) );
|
||||||
webview->addAction( &selectCurrentArticleAction );
|
webview->addAction( &selectCurrentArticleAction );
|
||||||
|
|
|
@ -49,7 +49,6 @@ class ArticleView: public QWidget
|
||||||
|
|
||||||
QAction pasteAction, articleUpAction, articleDownAction, goBackAction, goForwardAction, selectCurrentArticleAction,
|
QAction pasteAction, articleUpAction, articleDownAction, goBackAction, goForwardAction, selectCurrentArticleAction,
|
||||||
copyAsTextAction, inspectAction;
|
copyAsTextAction, inspectAction;
|
||||||
QAction & openSearchAction;
|
|
||||||
bool searchIsOpened;
|
bool searchIsOpened;
|
||||||
bool expandOptionalParts;
|
bool expandOptionalParts;
|
||||||
QString rangeVarName;
|
QString rangeVarName;
|
||||||
|
@ -105,7 +104,6 @@ public:
|
||||||
Instances::Groups const &,
|
Instances::Groups const &,
|
||||||
bool popupView,
|
bool popupView,
|
||||||
Config::Class const & cfg,
|
Config::Class const & cfg,
|
||||||
QAction & openSearchAction_,
|
|
||||||
QLineEdit const * translateLine,
|
QLineEdit const * translateLine,
|
||||||
QAction * dictionaryBarToggled = nullptr,
|
QAction * dictionaryBarToggled = nullptr,
|
||||||
GroupComboBox const * groupComboBox = nullptr );
|
GroupComboBox const * groupComboBox = nullptr );
|
||||||
|
@ -319,6 +317,9 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
/// Opens the search (Ctrl+F)
|
||||||
|
void openSearch();
|
||||||
|
|
||||||
void on_searchPrevious_clicked();
|
void on_searchPrevious_clicked();
|
||||||
void on_searchNext_clicked();
|
void on_searchNext_clicked();
|
||||||
|
|
||||||
|
@ -361,9 +362,6 @@ private slots:
|
||||||
/// Nagivates to the next article relative to the active one.
|
/// Nagivates to the next article relative to the active one.
|
||||||
void moveOneArticleDown();
|
void moveOneArticleDown();
|
||||||
|
|
||||||
/// Opens the search area
|
|
||||||
void openSearch();
|
|
||||||
|
|
||||||
void on_searchText_textEdited();
|
void on_searchText_textEdited();
|
||||||
void on_searchText_returnPressed();
|
void on_searchText_returnPressed();
|
||||||
void on_searchCloseButton_clicked();
|
void on_searchCloseButton_clicked();
|
||||||
|
|
|
@ -1783,7 +1783,6 @@ ArticleView * MainWindow::createNewTab( bool switchToIt, QString const & name )
|
||||||
groupInstances,
|
groupInstances,
|
||||||
false,
|
false,
|
||||||
cfg,
|
cfg,
|
||||||
*ui.searchInPageAction,
|
|
||||||
translateLine,
|
translateLine,
|
||||||
dictionaryBar.toggleViewAction(),
|
dictionaryBar.toggleViewAction(),
|
||||||
groupList );
|
groupList );
|
||||||
|
@ -1823,6 +1822,8 @@ ArticleView * MainWindow::createNewTab( bool switchToIt, QString const & name )
|
||||||
connect( view, &ArticleView::zoomOut, this, &MainWindow::zoomout );
|
connect( view, &ArticleView::zoomOut, this, &MainWindow::zoomout );
|
||||||
connect( view, &ArticleView::saveBookmarkSignal, this, &MainWindow::addBookmarkToFavorite );
|
connect( view, &ArticleView::saveBookmarkSignal, this, &MainWindow::addBookmarkToFavorite );
|
||||||
|
|
||||||
|
connect( ui.searchInPageAction, &QAction::triggered, view, &ArticleView::openSearch );
|
||||||
|
|
||||||
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
|
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
|
||||||
|
|
||||||
int index = cfg.preferences.newTabsOpenAfterCurrentOne ? ui.tabWidget->currentIndex() + 1 : ui.tabWidget->count();
|
int index = cfg.preferences.newTabsOpenAfterCurrentOne ? ui.tabWidget->currentIndex() + 1 : ui.tabWidget->count();
|
||||||
|
|
|
@ -85,8 +85,6 @@ ScanPopup::ScanPopup( QWidget * parent,
|
||||||
{
|
{
|
||||||
ui.setupUi( this );
|
ui.setupUi( this );
|
||||||
|
|
||||||
openSearchAction.setShortcut( QKeySequence( "Ctrl+F" ) );
|
|
||||||
|
|
||||||
if ( layoutDirection() == Qt::RightToLeft ) {
|
if ( layoutDirection() == Qt::RightToLeft ) {
|
||||||
// Adjust button icons for Right-To-Left layout
|
// Adjust button icons for Right-To-Left layout
|
||||||
ui.goBackButton->setIcon( QIcon( ":/icons/next.svg" ) );
|
ui.goBackButton->setIcon( QIcon( ":/icons/next.svg" ) );
|
||||||
|
@ -104,7 +102,6 @@ ScanPopup::ScanPopup( QWidget * parent,
|
||||||
groups,
|
groups,
|
||||||
true,
|
true,
|
||||||
cfg,
|
cfg,
|
||||||
openSearchAction,
|
|
||||||
ui.translateBox->translateLine(),
|
ui.translateBox->translateLine(),
|
||||||
dictionaryBar.toggleViewAction() );
|
dictionaryBar.toggleViewAction() );
|
||||||
|
|
||||||
|
@ -114,6 +111,9 @@ ScanPopup::ScanPopup( QWidget * parent,
|
||||||
connect( definition, &ArticleView::sendWordToHistory, this, &ScanPopup::sendWordToHistory );
|
connect( definition, &ArticleView::sendWordToHistory, this, &ScanPopup::sendWordToHistory );
|
||||||
connect( definition, &ArticleView::typingEvent, this, &ScanPopup::typingEvent );
|
connect( definition, &ArticleView::typingEvent, this, &ScanPopup::typingEvent );
|
||||||
|
|
||||||
|
openSearchAction.setShortcut( QKeySequence( "Ctrl+F" ) );
|
||||||
|
connect( &openSearchAction, &QAction::triggered, definition, &ArticleView::openSearch );
|
||||||
|
|
||||||
wordListDefaultFont = ui.translateBox->completerWidget()->font();
|
wordListDefaultFont = ui.translateBox->completerWidget()->font();
|
||||||
translateLineDefaultFont = ui.translateBox->font();
|
translateLineDefaultFont = ui.translateBox->font();
|
||||||
groupListDefaultFont = ui.groupList->font();
|
groupListDefaultFont = ui.groupList->font();
|
||||||
|
|
Loading…
Reference in a new issue