Triage tool ui improvement (#2320)

* triage tool: ui improvement

* small code tweak

* ci fix

* ci fix 2nd attempt
This commit is contained in:
Maksim Derbasov 2019-11-03 10:30:30 +03:00 committed by Daniel Marjamäki
parent c95b5d0a3c
commit 7de55b09f8
2 changed files with 315 additions and 266 deletions

View File

@ -264,13 +264,19 @@ void MainWindow::findInFilesClicked() {
ui->inFilesResult->clear(); ui->inFilesResult->clear();
const QString text = ui->lineEdit->text(); const QString text = ui->lineEdit->text();
const QStringList filter { QStringList filter;
"*.cpp","*.cxx","*.cc","*.c++","*.hpp","*.h","*.hxx","*.hh","*.tpp","*.txx","*.C","*.c","*.cl" if(ui->hFilesFilter->isChecked()) {
}; filter << "*.hpp" << "*.h" << "*.hxx" << "*.hh" << "*.tpp" << "*.txx";
}
if(ui->srcFilter->isChecked()) {
filter << "*.cpp" << "*.cxx" << "*.cc" << "*.c++" << "*.C" << "*.c" << "*.cl";
}
QMimeDatabase mimeDatabase; QMimeDatabase mimeDatabase;
QDirIterator it(WORK_FOLDER, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); QDirIterator it(WORK_FOLDER, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
const auto common_path_len = WORK_FOLDER.length() + 1; // let's remove common part of path imporve UI
while (it.hasNext()) { while (it.hasNext()) {
const QString fileName = it.next(); const QString fileName = it.next();
const QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileName); const QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileName);
@ -288,7 +294,7 @@ void MainWindow::findInFilesClicked() {
++lineN; ++lineN;
line = in.readLine(); line = in.readLine();
if (line.contains(text, Qt::CaseInsensitive)) { if (line.contains(text, Qt::CaseInsensitive)) {
ui->inFilesResult->addItem(fileName + ":" + QString::number(lineN)); ui->inFilesResult->addItem(fileName.mid(common_path_len) + QString{":"} + QString::number(lineN));
break; break;
} }
} }
@ -304,5 +310,5 @@ void MainWindow::searchResultsDoubleClick() {
QString filename = ui->inFilesResult->currentItem()->text(); QString filename = ui->inFilesResult->currentItem()->text();
const auto idx = filename.lastIndexOf(':'); const auto idx = filename.lastIndexOf(':');
const int line = filename.midRef(idx + 1).toInt(); const int line = filename.midRef(idx + 1).toInt();
showSrcFile(filename.left(idx), "", line); showSrcFile(WORK_FOLDER + QString{"/"} + filename.left(idx), "", line);
} }

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1057</width> <width>1057</width>
<height>538</height> <height>637</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -15,6 +15,64 @@
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="middleLayout">
<item>
<widget class="CodeEditor" name="code">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="urllabel">
<property name="text">
<string>url</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="edit1"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="filelabel">
<property name="text">
<string>file</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="edit2"/>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="leftDock">
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -61,7 +119,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="versionLabel">
<property name="text"> <property name="text">
<string>Version</string> <string>Version</string>
</property> </property>
@ -87,45 +145,32 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="CodeEditor" name="code">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>url</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="edit1"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>file</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="edit2"/>
</item>
</layout> </layout>
</item> </widget>
</layout> </widget>
</item> <widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1057</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QDockWidget" name="rightDock">
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_5">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<layout class="QVBoxLayout" name="filesNavigatorLayout"> <layout class="QVBoxLayout" name="filesNavigatorLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="filterLayout">
<item> <item>
<widget class="QLineEdit" name="lineEdit"> <widget class="QLineEdit" name="lineEdit">
<property name="maximumSize"> <property name="maximumSize">
@ -166,15 +211,9 @@
<attribute name="title"> <attribute name="title">
<string>Filesystem</string> <string>Filesystem</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTreeView" name="directoryTree"> <widget class="QTreeView" name="directoryTree">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>341</width>
<height>381</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -194,53 +233,57 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
</widget> </widget>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="inFilesTab"> <widget class="QWidget" name="inFilesTab">
<attribute name="title"> <attribute name="title">
<string>In Files Result</string> <string>In Files Result</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QListWidget" name="inFilesResult"> <widget class="QListWidget" name="inFilesResult">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>341</width>
<height>381</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
</widget> </widget>
</widget>
</widget>
</item> </item>
</layout> <item>
</item> <layout class="QHBoxLayout" name="fileFilterLayout">
</layout> <item>
</widget> <widget class="QCheckBox" name="hFilesFilter">
<widget class="QMenuBar" name="menuBar"> <property name="text">
<property name="geometry"> <string>*.h, *.hpp,...</string>
<rect> </property>
<x>0</x> <property name="checked">
<y>0</y> <bool>true</bool>
<width>1057</width>
<height>30</height>
</rect>
</property> </property>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar"> </item>
<attribute name="toolBarArea"> <item>
<enum>TopToolBarArea</enum> <widget class="QCheckBox" name="srcFilter">
</attribute> <property name="text">
<attribute name="toolBarBreak"> <string>*.c, *.cpp,...</string>
<bool>false</bool> </property>
</attribute> <property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>
@ -252,86 +295,6 @@
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>results</sender>
<signal>itemDoubleClicked(QListWidgetItem*)</signal>
<receiver>MainWindow</receiver>
<slot>showResult(QListWidgetItem*)</slot>
<hints>
<hint type="sourcelabel">
<x>28</x>
<y>104</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>104</y>
</hint>
</hints>
</connection>
<connection>
<sender>loadFile</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>loadFile()</slot>
<hints>
<hint type="sourcelabel">
<x>22</x>
<y>65</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>46</y>
</hint>
</hints>
</connection>
<connection>
<sender>loadFromClipboard</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>loadFromClipboard()</slot>
<hints>
<hint type="sourcelabel">
<x>142</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>528</x>
<y>268</y>
</hint>
</hints>
</connection>
<connection>
<sender>version</sender>
<signal>currentIndexChanged(QString)</signal>
<receiver>MainWindow</receiver>
<slot>filter(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>98</x>
<y>489</y>
</hint>
<hint type="destinationlabel">
<x>493</x>
<y>39</y>
</hint>
</hints>
</connection>
<connection>
<sender>random100</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>refreshResults()</slot>
<hints>
<hint type="sourcelabel">
<x>30</x>
<y>464</y>
</hint>
<hint type="destinationlabel">
<x>3</x>
<y>460</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>lineEdit</sender> <sender>lineEdit</sender>
<signal>textChanged(QString)</signal> <signal>textChanged(QString)</signal>
@ -396,6 +359,86 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>loadFile</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>loadFile()</slot>
<hints>
<hint type="sourcelabel">
<x>22</x>
<y>65</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>46</y>
</hint>
</hints>
</connection>
<connection>
<sender>loadFromClipboard</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>loadFromClipboard()</slot>
<hints>
<hint type="sourcelabel">
<x>142</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>528</x>
<y>268</y>
</hint>
</hints>
</connection>
<connection>
<sender>random100</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>refreshResults()</slot>
<hints>
<hint type="sourcelabel">
<x>30</x>
<y>464</y>
</hint>
<hint type="destinationlabel">
<x>3</x>
<y>460</y>
</hint>
</hints>
</connection>
<connection>
<sender>results</sender>
<signal>itemDoubleClicked(QListWidgetItem*)</signal>
<receiver>MainWindow</receiver>
<slot>showResult(QListWidgetItem*)</slot>
<hints>
<hint type="sourcelabel">
<x>28</x>
<y>104</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>104</y>
</hint>
</hints>
</connection>
<connection>
<sender>version</sender>
<signal>currentIndexChanged(QString)</signal>
<receiver>MainWindow</receiver>
<slot>filter(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>98</x>
<y>489</y>
</hint>
<hint type="destinationlabel">
<x>493</x>
<y>39</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>loadFile()</slot> <slot>loadFile()</slot>