From 4a303028640fa1c0f6c2016583b7322e6663ad76 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Mon, 2 Jan 2023 22:00:42 +0800 Subject: [PATCH] fix: move Contexts to header file --- articleview.hh | 7 ++++--- base_type.h | 7 +++++++ goldendict.pro | 1 + mainwindow.cc | 4 ++-- mainwindow.hh | 5 +++-- scanpopup.cc | 3 ++- 6 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 base_type.h diff --git a/articleview.hh b/articleview.hh index 32f5b9b3..6cd08806 100644 --- a/articleview.hh +++ b/articleview.hh @@ -21,6 +21,7 @@ #endif #include "ankiconnector.h" #include "webmultimediadownload.hh" +#include "base_type.h" class ResourceToSaveHandler; class ArticleViewAgent ; @@ -111,7 +112,7 @@ public: ~ArticleView(); - typedef QMap< QString, QString > Contexts; + /// Returns "gdfrom-" + dictionaryId. static QString scrollToFromDictionaryId( QString const & dictionaryId ); @@ -247,11 +248,11 @@ signals: /// Signals that the following link was requested to be opened in new tab void openLinkInNewTab( QUrl const &, QUrl const & referrer, QString const & fromArticle, - ArticleView::Contexts const & contexts ); + Contexts const & contexts ); /// Signals that the following definition was requested to be showed in new tab void showDefinitionInNewTab( QString const & word, unsigned group, QString const & fromArticle, - ArticleView::Contexts const & contexts ); + Contexts const & contexts ); /// Put translated word into history void sendWordToHistory( QString const & word ); diff --git a/base_type.h b/base_type.h new file mode 100644 index 00000000..9493a74e --- /dev/null +++ b/base_type.h @@ -0,0 +1,7 @@ +#ifndef BASE_TYPE_H + #define BASE_TYPE_H + +#include + + typedef QMap< QString, QString > Contexts; +#endif // BASE_TYPE_H diff --git a/goldendict.pro b/goldendict.pro index 462cc346..e188ba30 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -269,6 +269,7 @@ HEADERS += folding.hh \ articlewebpage.h \ audiooutput.h \ base/globalregex.hh \ + base_type.h \ globalbroadcaster.h \ headwordsmodel.h \ iframeschemehandler.h \ diff --git a/mainwindow.cc b/mainwindow.cc index cc2da26f..0073468e 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2765,7 +2765,7 @@ void MainWindow::jumpToDictionary( QListWidgetItem * item, bool force ) void MainWindow::openLinkInNewTab( QUrl const & url, QUrl const & referrer, QString const & fromArticle, - ArticleView::Contexts const & contexts ) + Contexts const & contexts ) { createNewTab( !cfg.preferences.newTabsOpenInBackground, "" )-> openLink( url, referrer, fromArticle, contexts ); @@ -2774,7 +2774,7 @@ void MainWindow::openLinkInNewTab( QUrl const & url, void MainWindow::showDefinitionInNewTab( QString const & word, unsigned group, QString const & fromArticle, - ArticleView::Contexts const & contexts ) + Contexts const & contexts ) { createNewTab( !cfg.preferences.newTabsOpenInBackground, word )-> showDefinition( word, group, fromArticle, contexts ); diff --git a/mainwindow.hh b/mainwindow.hh index 7b018d33..48ff9e93 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -30,6 +30,7 @@ #include "dictheadwords.hh" #include "fulltextsearch.hh" #include "helpwindow.hh" +#include "base_type.h" #include "hotkeywrapper.hh" #include "weburlrequestinterceptor.h" @@ -386,10 +387,10 @@ private slots: QString const & name ); void openLinkInNewTab( QUrl const &, QUrl const &, QString const &, - ArticleView::Contexts const & contexts ); + Contexts const & contexts ); void showDefinitionInNewTab( QString const & word, unsigned group, QString const & fromArticle, - ArticleView::Contexts const & contexts ); + Contexts const & contexts ); void typingEvent( QString const & ); void activeArticleChanged( ArticleView const *, QString const & id ); diff --git a/scanpopup.cc b/scanpopup.cc index eae092c2..789c0c84 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -10,6 +10,7 @@ #include #if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) #include +#include #endif #include "gddebug.hh" #include "gestures.hh" @@ -18,7 +19,7 @@ #include "macmouseover.hh" #define MouseOver MacMouseOver #endif - +#include "base_type.h" using std::wstring; /// We use different window flags under Windows and X11 due to slight differences