File indexing completed on 2024-04-28 05:49:12
0001 /* 0002 SPDX-FileCopyrightText: 2011-21 Kåre Särs <kare.sars@iki.fi> 0003 SPDX-FileCopyrightText: 2022 Waqar Ahmed <waqar.17a@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 #pragma once 0008 0009 #include "MatchModel.h" 0010 #include "ui_results.h" 0011 0012 #include <QWidget> 0013 0014 class Results final : public QWidget, public Ui::Results 0015 { 0016 Q_OBJECT 0017 public: 0018 Results(QWidget *parent = nullptr); 0019 int matches = 0; 0020 QRegularExpression regExp; 0021 bool useRegExp = false; 0022 bool matchCase = false; 0023 QString searchStr; 0024 QString replaceStr; 0025 int searchPlaceIndex = 0; 0026 QString treeRootText; 0027 MatchModel matchModel; 0028 bool displayFolderOptions = false; 0029 bool isDetachedToMainWindow = false; 0030 0031 // Used by katemainwindow when we try to close this widget 0032 Q_INVOKABLE bool shouldClose() 0033 { 0034 return true; 0035 } 0036 0037 bool isEmpty() const; 0038 void setFilterLineVisible(bool visible); 0039 void expandRoot(); 0040 bool isMatch(const QModelIndex &index) const; 0041 class MatchProxyModel *model() const; 0042 QModelIndex firstFileMatch(KTextEditor::Document *doc) const; 0043 QModelIndex closestMatchAfter(KTextEditor::Document *doc, const KTextEditor::Cursor &cursor) const; 0044 QModelIndex firstMatch() const; 0045 QModelIndex nextMatch(const QModelIndex &itemIndex) const; 0046 QModelIndex prevMatch(const QModelIndex &itemIndex) const; 0047 QModelIndex closestMatchBefore(KTextEditor::Document *doc, const KTextEditor::Cursor &cursor) const; 0048 QModelIndex lastMatch() const; 0049 KTextEditor::Range matchRange(const QModelIndex &matchIndex) const; 0050 bool replaceSingleMatch(KTextEditor::Document *doc, const QModelIndex &matchIndex, const QRegularExpression ®Exp, const QString &replaceString); 0051 void itemSelected(const QModelIndex &item); 0052 0053 Q_SIGNALS: 0054 void requestDetachToMainWindow(Results *); 0055 };