Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Functionality to Developer's Log #300

Merged
merged 2 commits into from
Aug 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/dlgdevelopertools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ DlgDeveloperTools::DlgDeveloperTools(QWidget* pParent,
connect(controlSearch, SIGNAL(searchCleared()),
this, SLOT(slotControlSearchClear()));

// Set up the log search box
connect(logSearch, SIGNAL(returnPressed()),
this, SLOT(slotLogSearch()));
connect(logSearchButton, SIGNAL(clicked()),
this, SLOT(slotLogSearch()));

m_logCursor = logTextView->textCursor();

// Update at 2FPS.
startTimer(500);

Expand Down Expand Up @@ -98,3 +106,9 @@ void DlgDeveloperTools::slotControlSearch(const QString& search) {
void DlgDeveloperTools::slotControlSearchClear() {
m_controlProxyModel.setFilterFixedString(QString());
}

void DlgDeveloperTools::slotLogSearch() {
QString textToFind = logSearch->text();
m_logCursor = logTextView->document()->find(textToFind, m_logCursor);
logTextView->setTextCursor(m_logCursor);
}
3 changes: 3 additions & 0 deletions src/dlgdevelopertools.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DlgDeveloperTools : public QDialog, public Ui::DlgDeveloperTools {
private slots:
void slotControlSearch(const QString& search);
void slotControlSearchClear();
void slotLogSearch();

private:
ControlModel m_controlModel;
Expand All @@ -33,6 +34,8 @@ class DlgDeveloperTools : public QDialog, public Ui::DlgDeveloperTools {
QSortFilterProxyModel m_statProxyModel;

QFile m_logFile;
QTextCursor m_logCursor;

};

#endif /* DLGDEVELOPERTOOLS_H */
47 changes: 35 additions & 12 deletions src/dlgdevelopertoolsdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="toolTabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="controlsTab">
<attribute name="title">
Expand All @@ -27,6 +27,19 @@
<item row="0" column="1">
<widget class="WSearchLineEdit" name="controlSearch"/>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTableView" name="controlsTable">
<property name="editTriggers">
Expand Down Expand Up @@ -55,8 +68,18 @@
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="logTab">
<attribute name="title">
<string>Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QLineEdit" name="logSearch"/>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand All @@ -68,14 +91,14 @@
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="logTab">
<attribute name="title">
<string>Log</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<item row="0" column="2">
<widget class="QPushButton" name="logSearchButton">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTextEdit" name="logTextView">
<property name="readOnly">
<bool>true</bool>
Expand All @@ -84,8 +107,8 @@
<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;
&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;
p, li { white-space: pre-wrap; }
&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;
&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>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&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>
</property>
<property name="overwriteMode">
<bool>true</bool>
Expand Down