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

Simplify handling of logging only mode in log table view #569

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading