Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
c67e88d
Finding the total count of marked messages while adding a filter to t…
Renu-Priya411 Jun 16, 2025
d0d56fd
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jun 26, 2025
b67149d
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 9, 2025
8b85bf5
Merge branch 'master' into Feature-DisplayAggregateFilterInformation
Renu-Priya411 Jul 11, 2025
9352ac3
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 16, 2025
a14b315
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 18, 2025
412e83a
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 24, 2025
d2561ed
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 31, 2025
7ec24c5
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Jul 31, 2025
87dfd51
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Aug 1, 2025
e8ce4eb
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Aug 4, 2025
6eb0a83
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Aug 5, 2025
4b441b9
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Aug 8, 2025
f79966a
Merge branch 'COVESA:master' into Feature-DisplayAggregateFilterInfor…
Renu-Priya411 Aug 22, 2025
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
111 changes: 111 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <QtEndian>
#include <QDir>
#include <QDirIterator>
#include <QTableWidget>

#if defined(_MSC_VER)
#include <io.h>
Expand Down Expand Up @@ -3334,6 +3335,13 @@ void MainWindow::on_filterWidget_customContextMenuRequested(QPoint pos)

menu.addSeparator();

action = new QAction("Marked Message Count", this);
if(list.size() != 1)
action->setEnabled(false);
else
connect(action, SIGNAL(triggered()), this, SLOT(on_actionFiltered_Message_Count_triggered()));
menu.addAction(action);

if(list.size()>=1)
action = new QAction("Set Selected Active", this);
else
Expand Down Expand Up @@ -6809,8 +6817,111 @@ void MainWindow::filterDialogRead(FilterDialog &dlg,FilterItem* item)
{
tableModel->modelChanged();
}

//Collects all the filter names and the colors used for highlighting for finding the marked message count.

filterCollectionMap[item->filter.name] = item->filter.filterColour;
}

//findFiltered Lines is used for segregating the number of lines filtered per filter.
//filterCollectionMap collects the filter name and their respective colors.
//previousFilterMap is used for checking if the same color is used for the same filter.
//If same color is used it will not be counted else, it will check the count again.

void MainWindow::findFilteredLines()
{

QAbstractItemModel *model = ui->tableView->model();
int count = 0;
int rowCount = model->rowCount();
totalMessages = rowCount;

QProgressDialog progress("Counting highlighted rows...", "Cancel", 0, rowCount, this);
progress.setWindowModality(Qt::ApplicationModal);
progress.setMinimumDuration(0); // show immediately
progress.setAutoClose(true);

for (auto it = filterCollectionMap.constBegin(); it != filterCollectionMap.constEnd(); ++it) {
const QString& filterName = it.key();
const QColor& currentColor = it.value();

// Check if already counted with same color
if (previousFilterStateMap.contains(filterName)) {
const QColor& previousColor = previousFilterStateMap[filterName].first;

if (previousColor == currentColor) {
// Same color used before → skip recount
filterCountMap[filterName] = previousFilterStateMap[filterName].second;
continue;
}
}

for (int row = 0; row < rowCount; ++row) {
QModelIndex index = model->index(row, 0); // Check only column 0
QVariant bgVariant = model->data(index, Qt::BackgroundRole);

if (bgVariant.canConvert<QBrush>()) {
QColor bgColor = qvariant_cast<QBrush>(bgVariant).color();
if (bgColor == currentColor)
++count;
}

// Update progress bar
if (it == filterCollectionMap.constBegin())
progress.setValue(row);

if (progress.wasCanceled())
return;
}

// Save in result and state map
filterCountMap[filterName] = count;
previousFilterStateMap[filterName] = qMakePair(currentColor, count);
}

progress.setValue(rowCount);
}

//The function is triggered when "Marked Message Count" is clicked in the filter's custom menu.
//It checked the number of filtered message using findFilteredLines function and then
//generates a dialog for displaying the marked messages count.

void MainWindow::on_actionFiltered_Message_Count_triggered(){

findFilteredLines();

QDialog *dialog = new QDialog(this);
dialog->setWindowTitle("Filtered Message Counts");
dialog->resize(400, 300);

// Create layout and table widget
QVBoxLayout *layout = new QVBoxLayout(dialog);
QTableWidget *table = new QTableWidget(dialog);
table->setColumnCount(3);
table->setHorizontalHeaderLabels(QStringList() << "Filter Term" << "Marked Messages" << "Total Number of Messages");
table->horizontalHeader()->setStretchLastSection(true);
table->verticalHeader()->setVisible(false);
table->setEditTriggers(QAbstractItemView::NoEditTriggers);

// Set row count based on your map
table->setRowCount(filterCountMap.size());

// Fill the table with data
int row = 0;
for (auto it = filterCountMap.constBegin(); it != filterCountMap.constEnd(); ++it, ++row) {
table->setItem(row, 0, new QTableWidgetItem(it.key()));
table->setItem(row, 1, new QTableWidgetItem(QString::number(it.value())));
table->setItem(row, 2, new QTableWidgetItem(QString::number(totalMessages)));
}

layout->addWidget(table);
dialog->setLayout(layout);

dialog->exec();

}


void MainWindow::on_action_menuFilter_Duplicate_triggered() {
QTreeWidget *widget;

Expand Down
8 changes: 8 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ class MainWindow : public QMainWindow
WorkingDirectory workingDirectory;
bool filterIsChanged;

//Maps to hold the filter values - findFilteredLines() & MarkedMessages
QMap<QString, int> filterCountMap;
QMap<QString, QColor> filterCollectionMap;
QMap<QString, QPair<QColor, int>> previousFilterStateMap;
int totalMessages;

/* Status line items */
QLabel *statusFilename;
QLabel *statusFileError;
Expand Down Expand Up @@ -374,6 +380,7 @@ class MainWindow : public QMainWindow
void writeDLTMessageToFile(const QByteArray& bufferHeader, std::string_view payload,
const EcuItem* ecuitem);

void findFilteredLines();

protected:
void keyPressEvent ( QKeyEvent * event ) override;
Expand Down Expand Up @@ -510,6 +517,7 @@ private slots:
void on_action_menuFilter_Append_Filters_triggered();
void onactionmenuFilter_SetAllActiveTriggered();
void onactionmenuFilter_SetAllInactiveTriggered();
void on_actionFiltered_Message_Count_triggered();

// Plugin methods
void on_action_menuPlugin_Hide_triggered();
Expand Down
64 changes: 34 additions & 30 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
<property name="windowTitle">
<string>MainWindow</string>
Expand All @@ -21,7 +21,7 @@
<normaloff>:/icons/png/org.genivi.DLTViewer.png</normaloff>:/icons/png/org.genivi.DLTViewer.png</iconset>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<enum>QTabWidget::TabShape::Rounded</enum>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
Expand All @@ -45,10 +45,10 @@
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
Expand All @@ -60,13 +60,13 @@
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
<enum>QAbstractItemView::ScrollMode::ScrollPerPixel</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
Expand All @@ -93,7 +93,7 @@
<x>0</x>
<y>0</y>
<width>1001</width>
<height>26</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down Expand Up @@ -191,6 +191,7 @@
<addaction name="actionToggle_FiltersEnabled"/>
<addaction name="actionToggle_SortByTimeEnabled"/>
<addaction name="actionSort_By_Timestamp"/>
<addaction name="actionFiltered_Message_Count"/>
</widget>
<widget class="QMenu" name="menuPlugin">
<property name="title">
Expand Down Expand Up @@ -311,10 +312,10 @@
<widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="dockWidgetProject">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
<property name="features">
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
<set>QDockWidget::DockWidgetFeature::DockWidgetClosable|QDockWidget::DockWidgetFeature::DockWidgetFloatable|QDockWidget::DockWidgetFeature::DockWidgetMovable</set>
</property>
<property name="windowTitle">
<string>Project</string>
Expand All @@ -324,7 +325,7 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
Expand All @@ -342,10 +343,10 @@
<item>
<widget class="QFrame" name="enableConfigFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
Expand Down Expand Up @@ -439,26 +440,26 @@
<bool>true</bool>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
<enum>Qt::FocusPolicy::TabFocus</enum>
</property>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
<enum>QTabWidget::TabPosition::South</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<enum>QTabWidget::TabShape::Rounded</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
<enum>Qt::TextElideMode::ElideNone</enum>
</property>
<property name="movable">
<bool>false</bool>
</property>
<widget class="QWidget" name="tabExplore">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
<attribute name="title">
<string>Explore</string>
Expand Down Expand Up @@ -533,7 +534,7 @@
<item>
<widget class="QTreeView" name="exploreView">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
Expand All @@ -547,7 +548,7 @@
</widget>
<widget class="QWidget" name="tabConfig">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
<attribute name="title">
<string>Config</string>
Expand All @@ -568,19 +569,19 @@
<item>
<widget class="QTreeWidget" name="configWidget">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
<enum>Qt::FocusPolicy::TabFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
Expand Down Expand Up @@ -641,7 +642,7 @@
<item>
<widget class="PluginTreeWidget" name="pluginWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>true</bool>
Expand Down Expand Up @@ -757,7 +758,7 @@
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>true</bool>
Expand All @@ -766,13 +767,13 @@
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
<enum>QAbstractItemView::DragDropMode::InternalMove</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::MoveAction</enum>
<enum>Qt::DropAction::MoveAction</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
Expand Down Expand Up @@ -849,7 +850,7 @@
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
Expand Down Expand Up @@ -1668,6 +1669,9 @@
<string>Append...</string>
</property>
</action>
<action name="actionFiltered_Message_Count">
<property name="text">
<string>Marked Message Count</string>
<action name="actionShortcuts_List">
<property name="text">
<string>Shortcuts List</string>
Expand Down