mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
1
This commit is contained in:
parent
c6387df392
commit
2c91b78e13
|
@ -42,6 +42,8 @@ class ArticleView: public QWidget
|
||||||
QWebChannel * channel;
|
QWebChannel * channel;
|
||||||
ArticleViewAgent * agent;
|
ArticleViewAgent * agent;
|
||||||
|
|
||||||
|
ArticleView * parentView;
|
||||||
|
|
||||||
AnkiConnector * ankiConnector;
|
AnkiConnector * ankiConnector;
|
||||||
|
|
||||||
QAction pasteAction, articleUpAction, articleDownAction, goBackAction, goForwardAction, selectCurrentArticleAction,
|
QAction pasteAction, articleUpAction, articleDownAction, goBackAction, goForwardAction, selectCurrentArticleAction,
|
||||||
|
@ -101,6 +103,15 @@ public:
|
||||||
AudioPlayerPtr const & audioPlayer_,
|
AudioPlayerPtr const & audioPlayer_,
|
||||||
Config::Class const & cfg_ );
|
Config::Class const & cfg_ );
|
||||||
|
|
||||||
|
void setParentView( ArticleView * parentView_ )
|
||||||
|
{
|
||||||
|
parentView = parentView_;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArticleView * getParentView()
|
||||||
|
{
|
||||||
|
return parentView;
|
||||||
|
}
|
||||||
void setCurrentGroupId( unsigned currengGrgId );
|
void setCurrentGroupId( unsigned currengGrgId );
|
||||||
unsigned getCurrentGroupId();
|
unsigned getCurrentGroupId();
|
||||||
|
|
||||||
|
|
|
@ -2173,7 +2173,7 @@ void MainWindow::updateBackForwardButtons()
|
||||||
{
|
{
|
||||||
ArticleView * view = getCurrentArticleView();
|
ArticleView * view = getCurrentArticleView();
|
||||||
|
|
||||||
if ( view ) {
|
if ( view != nullptr ) {
|
||||||
navBack->setEnabled( view->canGoBack() );
|
navBack->setEnabled( view->canGoBack() );
|
||||||
navForward->setEnabled( view->canGoForward() );
|
navForward->setEnabled( view->canGoForward() );
|
||||||
}
|
}
|
||||||
|
@ -3714,7 +3714,13 @@ void MainWindow::messageFromAnotherInstanceReceived( QString const & message )
|
||||||
ArticleView * MainWindow::getCurrentArticleView()
|
ArticleView * MainWindow::getCurrentArticleView()
|
||||||
{
|
{
|
||||||
if ( QWidget * cw = ui.tabWidget->currentWidget() ) {
|
if ( QWidget * cw = ui.tabWidget->currentWidget() ) {
|
||||||
return dynamic_cast< ArticleView * >( cw );
|
auto * pView = dynamic_cast< ArticleView * >( cw );
|
||||||
|
if ( pView != nullptr ) {
|
||||||
|
if ( pView->getParentView() != nullptr ) {
|
||||||
|
return pView->getParentView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pView;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -4375,7 +4381,7 @@ void MainWindow::openWebsiteInNewTab( QString name, QString url )
|
||||||
QString escaped = Utils::escapeAmps( name );
|
QString escaped = Utils::escapeAmps( name );
|
||||||
|
|
||||||
auto * view = new ArticleView( this, articleNetMgr, audioPlayerFactory.player(), cfg );
|
auto * view = new ArticleView( this, articleNetMgr, audioPlayerFactory.player(), cfg );
|
||||||
|
view->setParentView( getCurrentArticleView() );
|
||||||
connect( view, &ArticleView::inspectSignal, this, &MainWindow::inspectElement );
|
connect( view, &ArticleView::inspectSignal, this, &MainWindow::inspectElement );
|
||||||
view->load( url );
|
view->load( url );
|
||||||
int index = cfg.preferences.newTabsOpenAfterCurrentOne ? ui.tabWidget->currentIndex() + 1 : ui.tabWidget->count();
|
int index = cfg.preferences.newTabsOpenAfterCurrentOne ? ui.tabWidget->currentIndex() + 1 : ui.tabWidget->count();
|
||||||
|
|
Loading…
Reference in a new issue