From 9cc51a150dbd148b22b72eb805bc69ff34420370 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 11 Apr 2022 09:39:44 +0800 Subject: [PATCH] - enhancement: add help link for regular expression in search dialog --- NEWS.md | 1 + RedPandaIDE/widgets/searchdialog.cpp | 15 ++++++++ RedPandaIDE/widgets/searchdialog.h | 4 +++ RedPandaIDE/widgets/searchdialog.ui | 52 ++++++++++++++++++++++++---- 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index b97a820a..a1b8c30d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ Red Panda C++ Version 1.0.4 - fix: hide function tips, when move or resize the main window + - enhancement: add help link for regular expression in search dialog Red Panda C++ Version 1.0.3 - fix: when oj problem grabbed by competitive companion received, diff --git a/RedPandaIDE/widgets/searchdialog.cpp b/RedPandaIDE/widgets/searchdialog.cpp index e0939a7f..654fcdeb 100644 --- a/RedPandaIDE/widgets/searchdialog.cpp +++ b/RedPandaIDE/widgets/searchdialog.cpp @@ -23,6 +23,7 @@ #include "../qsynedit/Search.h" #include "../qsynedit/SearchRegex.h" #include "../project.h" +#include "../settings.h" #include #include @@ -466,6 +467,20 @@ std::shared_ptr SearchDialog::batchFindInEditor(SynEdit *e return parentItem; } +void SearchDialog::showEvent(QShowEvent *event) +{ + QDialog::showEvent(event); + if (pSettings->environment().language()=="zh_CN") { + ui->txtRegExpHelp->setText( + QString("

(?)

") + .arg("https://www.runoob.com/regexp/regexp-tutorial.html")); + } else { + ui->txtRegExpHelp->setText( + QString("

(?)

") + .arg("https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference")); + } +} + QTabBar *SearchDialog::tabBar() const { return mTabBar; diff --git a/RedPandaIDE/widgets/searchdialog.h b/RedPandaIDE/widgets/searchdialog.h index 260c0067..46568864 100644 --- a/RedPandaIDE/widgets/searchdialog.h +++ b/RedPandaIDE/widgets/searchdialog.h @@ -72,6 +72,10 @@ private: PSynSearchBase mSearchEngine; PSynSearchBase mBasicSearchEngine; PSynSearchBase mRegexSearchEngine; + + // QWidget interface +protected: + void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; }; #endif // SEARCHDIALOG_H diff --git a/RedPandaIDE/widgets/searchdialog.ui b/RedPandaIDE/widgets/searchdialog.ui index 27b46a66..9d882a85 100644 --- a/RedPandaIDE/widgets/searchdialog.ui +++ b/RedPandaIDE/widgets/searchdialog.ui @@ -126,10 +126,50 @@ - - - Regular Expression - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Regular Expression + + + + + + + + 0 + 0 + + + + <html><head/><body><p><a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference"><span style=" text-decoration: underline; color:#0000ff;">(?)</span></a></p></body></html> + + + true + + + + @@ -253,7 +293,7 @@ 20 - 40 + 0 @@ -299,7 +339,7 @@ 20 - 40 + 0