Behaviour Change: 'Clear All' in the port stats window now clears only the visible ports in the window, not all ports of all portgroups. This behaviour is the more appropriate behaviour when two or more clients are connected to the same portgroup and are using mutually exclusive ports within the portgroup - this way they don't affect each other's ports (assuming they have only their used ports visible)

This commit is contained in:
Srivats P. 2015-05-07 18:56:32 +05:30
parent ab76da1ad2
commit 382c94b326

View File

@ -163,12 +163,29 @@ void PortStatsWindow::on_tbClear_clicked()
}
}
// 'All' => all ports currently visible, not all ports in all portgroups
void PortStatsWindow::on_tbClearAll_clicked()
{
// FIXME: we clear all, not just all ports currently displayed!!!
for (int i = 0; i < pgl->numPortGroups(); i++)
QAbstractItemModel *mdl = tvPortStats->model();
QModelIndexList shownColumns;
QList<PortStatsModel::PortGroupAndPortList> portList;
// Find the 'visible' columns
for(int vi = 0; vi < mdl->columnCount(); vi++) {
int li = tvPortStats->horizontalHeader()->logicalIndex(vi);
if (!tvPortStats->isColumnHidden(li)) {
shownColumns.append(mdl->index(0, li));
}
}
// Get ports corresponding to the shown columns
model->portListFromIndex(shownColumns, portList);
// Clear shown ports, portgroup by portgroup
for (int i = 0; i < portList.size(); i++)
{
pgl->portGroupByIndex(i).clearPortStats();
pgl->portGroupByIndex(portList.at(i).portGroupId)
.clearPortStats(&portList[i].portList);
}
}
@ -177,10 +194,7 @@ void PortStatsWindow::on_tbFilter_clicked()
bool ok;
QList<uint> currentColumns, newColumns;
PortStatsFilterDialog dialog;
QAbstractItemModel *mdl = model;
if (proxyStatsModel)
mdl = proxyStatsModel;
QAbstractItemModel *mdl = tvPortStats->model();
// create the input list for the filter dialog -
// list of logical-indexes ordered by their current visual indexes