Skip to content

Commit c5942e7

Browse files
committed
Merge pull request #300 from badescunicu/search_log
Search Functionality to Developer's Log
2 parents 169c8f1 + bc2b640 commit c5942e7

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

src/dlgdevelopertools.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ DlgDeveloperTools::DlgDeveloperTools(QWidget* pParent,
5151
connect(controlSearch, SIGNAL(searchCleared()),
5252
this, SLOT(slotControlSearchClear()));
5353

54+
// Set up the log search box
55+
connect(logSearch, SIGNAL(returnPressed()),
56+
this, SLOT(slotLogSearch()));
57+
connect(logSearchButton, SIGNAL(clicked()),
58+
this, SLOT(slotLogSearch()));
59+
60+
m_logCursor = logTextView->textCursor();
61+
5462
// Update at 2FPS.
5563
startTimer(500);
5664

@@ -98,3 +106,9 @@ void DlgDeveloperTools::slotControlSearch(const QString& search) {
98106
void DlgDeveloperTools::slotControlSearchClear() {
99107
m_controlProxyModel.setFilterFixedString(QString());
100108
}
109+
110+
void DlgDeveloperTools::slotLogSearch() {
111+
QString textToFind = logSearch->text();
112+
m_logCursor = logTextView->document()->find(textToFind, m_logCursor);
113+
logTextView->setTextCursor(m_logCursor);
114+
}

src/dlgdevelopertools.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class DlgDeveloperTools : public QDialog, public Ui::DlgDeveloperTools {
2424
private slots:
2525
void slotControlSearch(const QString& search);
2626
void slotControlSearchClear();
27+
void slotLogSearch();
2728

2829
private:
2930
ControlModel m_controlModel;
@@ -33,6 +34,8 @@ class DlgDeveloperTools : public QDialog, public Ui::DlgDeveloperTools {
3334
QSortFilterProxyModel m_statProxyModel;
3435

3536
QFile m_logFile;
37+
QTextCursor m_logCursor;
38+
3639
};
3740

3841
#endif /* DLGDEVELOPERTOOLS_H */

src/dlgdevelopertoolsdlg.ui

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<item>
1818
<widget class="QTabWidget" name="toolTabWidget">
1919
<property name="currentIndex">
20-
<number>0</number>
20+
<number>1</number>
2121
</property>
2222
<widget class="QWidget" name="controlsTab">
2323
<attribute name="title">
@@ -27,6 +27,19 @@
2727
<item row="0" column="1">
2828
<widget class="WSearchLineEdit" name="controlSearch"/>
2929
</item>
30+
<item row="0" column="0">
31+
<spacer name="horizontalSpacer">
32+
<property name="orientation">
33+
<enum>Qt::Horizontal</enum>
34+
</property>
35+
<property name="sizeHint" stdset="0">
36+
<size>
37+
<width>40</width>
38+
<height>20</height>
39+
</size>
40+
</property>
41+
</spacer>
42+
</item>
3043
<item row="1" column="0" colspan="2">
3144
<widget class="QTableView" name="controlsTable">
3245
<property name="editTriggers">
@@ -55,8 +68,18 @@
5568
</attribute>
5669
</widget>
5770
</item>
71+
</layout>
72+
</widget>
73+
<widget class="QWidget" name="logTab">
74+
<attribute name="title">
75+
<string>Log</string>
76+
</attribute>
77+
<layout class="QGridLayout" name="gridLayout_2">
78+
<item row="0" column="1">
79+
<widget class="QLineEdit" name="logSearch"/>
80+
</item>
5881
<item row="0" column="0">
59-
<spacer name="horizontalSpacer">
82+
<spacer name="horizontalSpacer_2">
6083
<property name="orientation">
6184
<enum>Qt::Horizontal</enum>
6285
</property>
@@ -68,14 +91,14 @@
6891
</property>
6992
</spacer>
7093
</item>
71-
</layout>
72-
</widget>
73-
<widget class="QWidget" name="logTab">
74-
<attribute name="title">
75-
<string>Log</string>
76-
</attribute>
77-
<layout class="QVBoxLayout" name="verticalLayout_3">
78-
<item>
94+
<item row="0" column="2">
95+
<widget class="QPushButton" name="logSearchButton">
96+
<property name="text">
97+
<string>Search</string>
98+
</property>
99+
</widget>
100+
</item>
101+
<item row="1" column="0" colspan="3">
79102
<widget class="QTextEdit" name="logTextView">
80103
<property name="readOnly">
81104
<bool>true</bool>
@@ -84,8 +107,8 @@
84107
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
85108
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
86109
p, li { white-space: pre-wrap; }
87-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
88-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
110+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
111+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.Lucida Grande UI'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
89112
</property>
90113
<property name="overwriteMode">
91114
<bool>true</bool>

0 commit comments

Comments
 (0)