fix: phrase send from scanpopup should not escape again

fix #626
This commit is contained in:
yifang xiao 2023-05-09 13:02:20 +00:00 committed by xiaoyifang
parent 242328332d
commit 2b72e14b55
2 changed files with 8 additions and 8 deletions

View file

@ -748,9 +748,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
this, SLOT(editDictionaries(unsigned)),
Qt::QueuedConnection);
connect( scanPopup, &ScanPopup::sendPhraseToMainWindow,
this,&MainWindow::phraseReceived,
Qt::QueuedConnection);
connect( scanPopup, &ScanPopup::sendPhraseToMainWindow, this, [ this ]( Config::InputPhrase const & phrase ) {
phraseReceived( phrase, WildcardsAreAlreadyEscaped );
} );
connect( scanPopup, &ScanPopup::inspectSignal,this,&MainWindow::inspectElement );
connect( scanPopup, &ScanPopup::forceAddWordToHistory, this, &MainWindow::forceAddWordToHistory );
@ -3728,17 +3728,17 @@ ArticleView * MainWindow::getCurrentArticleView()
return 0;
}
void MainWindow::phraseReceived( Config::InputPhrase const & phrase )
void MainWindow::phraseReceived( Config::InputPhrase const & phrase, WildcardPolicy wildcardPolicy )
{
toggleMainWindow( true );
setTranslateBoxTextAndKeepSuffix( phrase.phrase, EscapeWildcards, NoPopupChange );
setTranslateBoxTextAndKeepSuffix( phrase.phrase, wildcardPolicy, NoPopupChange );
translateBoxSuffix = phrase.punctuationSuffix;
respondToTranslationRequest( phrase, false );
}
void MainWindow::wordReceived( const QString & word)
{
phraseReceived( Config::InputPhrase::fromPhrase( word ) );
phraseReceived( Config::InputPhrase::fromPhrase( word ), EscapeWildcards );
}
void MainWindow::headwordReceived( const QString & word, const QString & ID )

View file

@ -60,11 +60,12 @@ public:
/// Set group for main/popup window
void setGroupByName( QString const & name, bool main_window );
enum WildcardPolicy { EscapeWildcards, WildcardsAreAlreadyEscaped };
public slots:
void messageFromAnotherInstanceReceived( QString const & );
void showStatusBarMessage ( QString const &, int, QPixmap const & );
void phraseReceived( Config::InputPhrase const & );
void phraseReceived( Config::InputPhrase const &, WildcardPolicy );
void wordReceived( QString const & );
void headwordReceived( QString const &, QString const & );
void headwordFromFavorites( QString const &, QString const & );
@ -252,7 +253,6 @@ private:
void updateSuggestionList();
void updateSuggestionList( QString const & text );
enum WildcardPolicy { EscapeWildcards, WildcardsAreAlreadyEscaped };
enum TranslateBoxPopup { NoPopupChange, EnablePopup, DisablePopup };
void setTranslateBoxTextAndKeepSuffix( QString text, WildcardPolicy wildcardPolicy,
TranslateBoxPopup popupAction );