RedPanda-CPP/RedPandaIDE/widgets/searchdialog.h

60 lines
1.4 KiB
C
Raw Normal View History

2021-08-02 21:58:39 +08:00
#ifndef SEARCHDIALOG_H
#define SEARCHDIALOG_H
#include <QDialog>
2021-08-04 09:13:41 +08:00
#include "../qsynedit/SynEdit.h"
2021-08-05 19:58:32 +08:00
#include "../utils.h"
2021-08-02 21:58:39 +08:00
namespace Ui {
class SearchDialog;
}
2021-08-05 12:31:53 +08:00
struct SearchResultTreeItem;
2021-08-02 23:42:10 +08:00
class QTabBar;
2021-08-03 23:55:57 +08:00
class Editor;
2021-08-02 21:58:39 +08:00
class SearchDialog : public QDialog
{
Q_OBJECT
2021-08-03 23:55:57 +08:00
enum class SearchAction {
Find,
FindFiles,
Replace,
ReplaceFiles
};
2021-08-02 21:58:39 +08:00
public:
explicit SearchDialog(QWidget *parent = nullptr);
~SearchDialog();
2021-08-02 23:42:10 +08:00
void find(const QString& text);
void findNext();
void findPrevious();
2021-08-02 23:42:10 +08:00
void findInFiles(const QString& text);
2021-08-05 19:58:32 +08:00
void findInFiles(const QString& keyword, SearchFileScope scope, SynSearchOptions options);
2021-08-02 23:42:10 +08:00
void replace(const QString& sFind, const QString& sReplace);
2021-08-03 23:55:57 +08:00
PSynSearchBase searchEngine() const;
QTabBar *tabBar() const;
2021-08-02 23:42:10 +08:00
private slots:
2021-08-03 23:55:57 +08:00
void onTabChanged();
2021-08-02 23:42:10 +08:00
void on_cbFind_currentTextChanged(const QString &arg1);
void on_btnCancel_clicked();
void on_btnExecute_clicked();
2021-08-03 23:55:57 +08:00
private:
2021-08-04 09:13:41 +08:00
int execute(Editor* editor, const QString& sSearch,
const QString& sReplace, SynSearchMathedProc matchCallback = nullptr);
2021-08-05 12:31:53 +08:00
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(Editor* editor,const QString& keyword);
2021-08-02 21:58:39 +08:00
private:
Ui::SearchDialog *ui;
2021-08-02 23:42:10 +08:00
QTabBar *mTabBar;
2021-08-03 23:55:57 +08:00
SynSearchOptions mSearchOptions;
PSynSearchBase mSearchEngine;
PSynSearchBase mBasicSearchEngine;
PSynSearchBase mRegexSearchEngine;
2021-08-02 21:58:39 +08:00
};
#endif // SEARCHDIALOG_H