fix: move Contexts to header file

This commit is contained in:
Xiao YiFang 2023-01-02 22:00:42 +08:00
parent 9acbd3aa2f
commit 4a30302864
6 changed files with 19 additions and 8 deletions

View file

@ -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 );

7
base_type.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef BASE_TYPE_H
#define BASE_TYPE_H
#include <QString>
typedef QMap< QString, QString > Contexts;
#endif // BASE_TYPE_H

View file

@ -269,6 +269,7 @@ HEADERS += folding.hh \
articlewebpage.h \
audiooutput.h \
base/globalregex.hh \
base_type.h \
globalbroadcaster.h \
headwordsmodel.h \
iframeschemehandler.h \

View file

@ -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 );

View file

@ -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 );

View file

@ -10,6 +10,7 @@
#include <QMouseEvent>
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
#include <QDesktopWidget>
#include <QStringList>
#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