Skip to content

Commit

Permalink
Simplify handling of logging only mode in log table view (#569)
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Kopp <[email protected]>
  • Loading branch information
vifactor authored Oct 24, 2024
1 parent 97d8b3c commit 26b051c
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions src/tablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "qdltoptmanager.h"

static long int lastrow = -1; // necessary because object tablemodel can not be changed, so no member variable can be used
char buffer[DLT_VIEWER_LIST_BUFFER_SIZE];


void getmessage( int indexrow, long int filterposindex, unsigned int* decodeflag, QDltMsg* msg, QDltMsg* lastmsg, QDltFile* qfile, bool* success )
{
Expand Down Expand Up @@ -72,7 +70,6 @@ TableModel::TableModel(const QString & /*data*/, QObject *parent)

}


int TableModel::columnCount(const QModelIndex & /*parent*/) const
{
return DLT_VIEWER_COLUMN_COUNT+project->settings->showArguments;
Expand Down Expand Up @@ -101,33 +98,32 @@ TableModel::TableModel(const QString & /*data*/, QObject *parent)
return QVariant();
}

if (loggingOnlyMode) {
if ((role == Qt::DisplayRole) && (index.column() == FieldNames::Payload))
return QString("Logging only Mode! Disable in Project Settings!");
else
return QVariant();
}

filterposindex = qfile->getMsgFilterPos(index.row());

if (role == Qt::DisplayRole)
{
/* get the message with the selected item id */
if(true == loggingOnlyMode)

getmessage( index.row(), filterposindex, &decodeflag, &msg, &lastmsg, qfile, &success);
if ( success == false )
{
if(index.column() == FieldNames::Index)
{
msg = QDltMsg();
return QString("%1").arg(qfile->getMsgFilterPos(index.row()));
}
else
else if(index.column() == FieldNames::Payload)
{
getmessage( index.row(), filterposindex, &decodeflag, &msg, &lastmsg, qfile, &success);

if ( success == false )
{
if(index.column() == FieldNames::Index)
{
return QString("%1").arg(qfile->getMsgFilterPos(index.row()));
}
else if(index.column() == FieldNames::Payload)
{
qDebug() << "Corrupted message at index" << index.row();
return QString("!!CORRUPTED MESSAGE!!");
}
return QVariant();
}
qDebug() << "Corrupted message at index" << index.row();
return QString("!!CORRUPTED MESSAGE!!");
}
return QVariant();
}

if((QDltSettingsManager::getInstance()->value("startup/pluginsEnabled", true).toBool()))
{
Expand Down Expand Up @@ -242,10 +238,6 @@ TableModel::TableModel(const QString & /*data*/, QObject *parent)
case FieldNames::ArgCount:
return QString("%1").arg(msg.getNumberOfArguments());
case FieldNames::Payload:
if( true == loggingOnlyMode)
{
return QString("Logging only Mode! Disable in Project Settings!");
}
/* display payload */
visu_data = msg.toStringPayload().simplified().remove(QChar::Null);
if(qfile) qfile->applyRegExString(msg,visu_data);
Expand Down

0 comments on commit 26b051c

Please sign in to comment.