Skip to content

Commit

Permalink
remove functionality of payload search range
Browse files Browse the repository at this point in the history
It was broken for long time and most probably
unused

#502

Signed-off-by: Viktor Kopp <[email protected]>
  • Loading branch information
vifactor committed Sep 9, 2024
1 parent c1a6854 commit 5f9605e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 184 deletions.
112 changes: 0 additions & 112 deletions src/searchdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ SearchDialog::SearchDialog(QWidget *parent) :
match = false;
onceClicked = false;
startLine = -1;
is_PayloadStartFound = false;
is_PayloadEndFound = false;
is_PayLoadRangeValid = false;

lineEdits = new QList<QLineEdit*>();
lineEdits->append(ui->lineEditText);
Expand Down Expand Up @@ -108,19 +105,6 @@ bool SearchDialog::getOnceClicked(){return onceClicked;}
QString SearchDialog::getApIDText(){ return ui->apIdlineEdit->text();}
QString SearchDialog::getCtIDText(){ return ui->ctIdlineEdit->text();}


QString SearchDialog::getPayLoadStampStart()
{
//qDebug() << "content of payload start" << ui->payloadStartlineEdit->text()<< __LINE__;
return ui->payloadStartlineEdit->text();
}

QString SearchDialog::getPayLoadStampEnd()
{
//qDebug() << "content of payload end" << ui->payloadEndlineEdit->text()<< __LINE__;
return ui->payloadEndlineEdit->text();
}

QString SearchDialog::getTimeStampStart()
{
//qDebug() << "content of start time" << ui->timeStartlineEdit->text()<< __LINE__;
Expand Down Expand Up @@ -324,22 +308,6 @@ int SearchDialog::find()
}
}


// check payload search pattern
payloadStart = getPayLoadStampStart();
payloadEnd = getPayLoadStampEnd();

if( (false == payloadStart.isEmpty() ) && ( false == payloadEnd.isEmpty() ) )
{
//qDebug() << "Payload search enabled" << __LINE__;
is_payLoadSearchSelected = true;
}
else
{
is_payLoadSearchSelected = false;
//qDebug() << "Payload search is disabled" << payloadStart.isEmpty() << payloadEnd.isEmpty() << __LINE__;
}

//check APID and CTID search
stApid = getApIDText();
stCtid = getCtIDText();
Expand Down Expand Up @@ -401,10 +369,6 @@ void SearchDialog::findMessages(long int searchLine, long int searchBorder, QReg
is_Case_Sensitive = Qt::CaseSensitive;
}

is_PayloadStartFound = false;
is_PayloadEndFound = false;
is_PayLoadRangeValid = false;

m_searchtablemodel->clear_SearchResults();

QProgressDialog fileprogress("Searching...", "Abort", 0, file->sizeFilter(), this);
Expand Down Expand Up @@ -479,10 +443,6 @@ void SearchDialog::findMessages(long int searchLine, long int searchBorder, QReg
continue;
}

// TODO: implement functionality about payload start and end
// Note: This feature has been broken for some time before this refactoring:
// See https://github.com/COVESA/dlt-viewer/issues/502

if (foundLine(searchLine))
break;
else
Expand All @@ -492,78 +452,6 @@ void SearchDialog::findMessages(long int searchLine, long int searchBorder, QReg
stoptime();
}


bool SearchDialog::payLoadStartpatternCheck(const QString& tempPayload)
{
// When the start payload patternn is found, consider range as valid
if((tempPayload.contains(payloadStart)) && (false == is_PayloadEndFound) && true == is_payLoadSearchSelected)
{
//qDebug() << "Found start payload pattern" << __LINE__;
is_PayLoadRangeValid = true;
is_PayloadStartFound = true;
}
return is_PayLoadRangeValid;
}


bool SearchDialog::payLoadStoppatternCheck(const QString& tempPayload)
{
// When the stop payload patern is found, consider range as ivalid
if(true == is_PayloadStartFound && true == is_payLoadSearchSelected && true == is_payLoadSearchSelected)
{
if(tempPayload.contains(payloadEnd))
{
//qDebug() << "Found stop payload pattern" << __LINE__;
is_PayloadEndFound = true;
is_PayLoadRangeValid = false;
}
//else qDebug() << "No stop payload pattern" << __LINE__;
}
return is_PayLoadRangeValid;
}

bool SearchDialog::timeStampPayloadValidityCheck(long int searchLine)
{
// qDebug() << "timeStampPayloadValidityCheck" << __LINE__;
if(true == is_TimeStampSearchSelected)
{
if(true == is_payLoadSearchSelected)
{
if(is_PayLoadRangeValid == true)
{
if(foundLine(searchLine))
{
return true;
}
}
}
else
{
if(foundLine(searchLine) == true)
{
return true;
}
}
}
else if(true == is_payLoadSearchSelected)
{
if(true == is_PayLoadRangeValid)
if(foundLine(searchLine))
{
return true;
}
}
else // all the other cases
{
if(foundLine(searchLine) == true)
{
return true;
}
}
return false;
}


bool SearchDialog::foundLine(long int searchLine)
{
match = true;
Expand Down
8 changes: 0 additions & 8 deletions src/searchdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ class SearchDialog : public QDialog
bool match;
bool onceClicked;
bool fSilentMode;
bool is_PayloadStartFound;
bool is_PayloadEndFound;
bool is_PayLoadRangeValid;
bool is_payLoadSearchSelected;
bool is_TimeStampSearchSelected;
bool fIs_APID_CTID_requested;

Expand All @@ -96,8 +92,6 @@ class SearchDialog : public QDialog
double dTimeStampStart;
double dTimeStampStop;

QString payloadStart;
QString payloadEnd;
QString stApid;
QString stCtid;

Expand Down Expand Up @@ -131,8 +125,6 @@ class SearchDialog : public QDialog
bool getOnceClicked();
bool searchtoIndex();
bool foundLine(long int searchLine);
bool payLoadStartpatternCheck(const QString& tempPayload);
bool payLoadStoppatternCheck(const QString& tempPayload);
QString getApIDText();
QString getCtIDText();
QString getTimeStampStart();
Expand Down
67 changes: 3 additions & 64 deletions src/searchdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>431</height>
<height>359</height>
</rect>
</property>
<property name="minimumSize">
Expand All @@ -26,7 +26,7 @@
<string>Search</string>
</property>
<property name="windowIcon">
<iconset resource="resource.qrc">
<iconset resource="resources/resource.qrc">
<normaloff>:/toolbar/png/system-search.png</normaloff>:/toolbar/png/system-search.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
Expand Down Expand Up @@ -160,67 +160,6 @@
<string>Timestamp end:</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set here a payload range to be found. The range is defined by a starting pattern and an end pattern. Every message between these patterns is regarded as a search hit.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>PayLoad start:</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>220</x>
<y>80</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PayLoad end:</string>
</property>
</widget>
<widget class="QLineEdit" name="payloadStartlineEdit">
<property name="geometry">
<rect>
<x>130</x>
<y>80</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pattern which is considererd as starting mark.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the TimeStamp start after which the text would be searched&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLineEdit" name="payloadEndlineEdit">
<property name="geometry">
<rect>
<x>340</x>
<y>80</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pattern which is considererd as stop mark.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the TimeStamp end before which this text would be searched&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</item>
<item row="10" column="3">
Expand Down Expand Up @@ -522,7 +461,7 @@
<tabstop>radioButtonPosCurrent</tabstop>
</tabstops>
<resources>
<include location="resource.qrc"/>
<include location="resources/resource.qrc"/>
</resources>
<connections>
<connection>
Expand Down

0 comments on commit 5f9605e

Please sign in to comment.