2021-08-02 21:58:39 +08:00
|
|
|
#ifndef SEARCHDIALOG_H
|
|
|
|
#define SEARCHDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2021-08-03 23:55:57 +08:00
|
|
|
#include "../qsynedit/SearchBase.h"
|
2021-08-02 21:58:39 +08:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class SearchDialog;
|
|
|
|
}
|
|
|
|
|
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 findInFiles(const QString& text);
|
|
|
|
void replace(const QString& sFind, const QString& sReplace);
|
|
|
|
void replaceInFiles(const QString& sFind, const QString& sReplace);
|
2021-08-03 23:55:57 +08:00
|
|
|
PSynSearchBase searchEngine() 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:
|
|
|
|
int execute(Editor* editor, SearchAction actionType);
|
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
|