![]() |
XML Mill
1.0.0
A GUI based XML editor with a memory.
|
00001 /* Copyright (c) 2012 - 2013 by William Hallatt. 00002 * 00003 * This file forms part of "XML Mill". 00004 * 00005 * The official website for this project is <http://www.goblincoding.com> and, 00006 * although not compulsory, it would be appreciated if all works of whatever 00007 * nature using this source code (in whole or in part) include a reference to 00008 * this site. 00009 * 00010 * Should you wish to contact me for whatever reason, please do so via: 00011 * 00012 * <http://www.goblincoding.com/contact> 00013 * 00014 * This program is free software: you can redistribute it and/or modify it under 00015 * the terms of the GNU General Public License as published by the Free Software 00016 * Foundation, either version 3 of the License, or (at your option) any later 00017 * version. 00018 * 00019 * This program is distributed in the hope that it will be useful, but WITHOUT 00020 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00021 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along with 00024 * this program (GNUGPL.txt). If not, see 00025 * 00026 * <http://www.gnu.org/licenses/> 00027 */ 00028 00029 #ifndef GCSEARCHFORM_H 00030 #define GCSEARCHFORM_H 00031 00032 #include <QDialog> 00033 #include <QPlainTextEdit> 00034 00035 namespace Ui 00036 { 00037 class GCSearchForm; 00038 } 00039 00040 class GCTreeWidgetItem; 00041 00043 00050 class GCSearchForm : public QDialog 00051 { 00052 Q_OBJECT 00053 00054 public: 00058 explicit GCSearchForm( const QList< GCTreeWidgetItem* >& items, QPlainTextEdit* textEdit, QWidget* parent = 0 ); 00059 00061 ~GCSearchForm(); 00062 00063 signals: 00067 void foundItem( GCTreeWidgetItem* ); 00068 00069 private slots: 00074 void search(); 00075 00079 void resetCursor(); 00080 00084 void searchUp(); 00085 00088 void caseSensitive(); 00089 00092 void wholeWords(); 00093 00094 private: 00096 QList< GCTreeWidgetItem* > gatherMatchingItems( const QString& nodeText ); 00097 00100 void findMatchingTreeItem( const QList< GCTreeWidgetItem* > matchingItems, bool ascending ); 00101 00105 void resetHighlights(); 00106 00109 void highlightFind(); 00110 00111 Ui::GCSearchForm* ui; 00112 QPlainTextEdit* m_text; 00113 QBrush m_savedBackground; 00114 QBrush m_savedForeground; 00115 bool m_wasFound; 00116 bool m_searchUp; 00117 bool m_firstRun; 00118 int m_previousIndex; 00119 00120 QTextDocument::FindFlags m_searchFlags; 00121 QList< GCTreeWidgetItem* > m_items; 00122 }; 00123 00124 #endif // GCSEARCHFORM_H