forked from osmocom/wireshark
Qt: Better handle retapping for traffic tables
Retapping can have some side-effects and was done in an overflowing way. Reducing the number of times retapping is required and done, and also giving control for taps reload to TrafficTab
This commit is contained in:
parent
056fd8a1e3
commit
05759d3ec5
|
@ -92,14 +92,12 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli
|
|||
TrafficTableDialog(parent, cf, filter, table_name_),
|
||||
tcp_graph_requested_(false)
|
||||
{
|
||||
trafficTab()->setProtocolInfo(tr("Conversation"), &(recent.conversation_tabs), &createModel);
|
||||
trafficTab()->setFirstTab(cli_proto_id);
|
||||
trafficTab()->setProtocolInfo(tr("Conversation"), cli_proto_id, &(recent.conversation_tabs), &createModel);
|
||||
trafficTab()->setDelegate(CONV_COLUMN_START, &createDelegate);
|
||||
trafficTab()->setDelegate(CONV_COLUMN_DURATION, &createDelegate);
|
||||
connect(trafficTab(), &TrafficTab::filterAction, this, &ConversationDialog::filterAction);
|
||||
connect(trafficTab()->tabBar(), &QTabBar::currentChanged, this, &ConversationDialog::tabChanged);
|
||||
connect(trafficTab(), &TrafficTab::tabDataChanged, this, &ConversationDialog::tabChanged);
|
||||
connect(absoluteTimeCheckBox(), &QCheckBox::toggled, trafficTab(), &TrafficTab::useAbsoluteTime);
|
||||
|
||||
follow_bt_ = buttonBox()->addButton(tr("Follow Stream…"), QDialogButtonBox::ActionRole);
|
||||
follow_bt_->setToolTip(tr("Follow a TCP or UDP stream."));
|
||||
|
@ -122,13 +120,8 @@ ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli
|
|||
}
|
||||
|
||||
updateWidgets();
|
||||
|
||||
cap_file_.delayedRetapPackets();
|
||||
}
|
||||
|
||||
ConversationDialog::~ConversationDialog()
|
||||
{}
|
||||
|
||||
void ConversationDialog::captureFileClosing()
|
||||
{
|
||||
trafficTab()->disableTap();
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
* @param filter Display filter to apply.
|
||||
*/
|
||||
explicit ConversationDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id = -1, const char *filter = NULL);
|
||||
~ConversationDialog();
|
||||
|
||||
protected:
|
||||
void captureFileClosing();
|
||||
|
|
|
@ -66,10 +66,8 @@ static ATapDataModel * createModel(int protoId, QString filter)
|
|||
EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id, const char *filter) :
|
||||
TrafficTableDialog(parent, cf, filter, table_name_)
|
||||
{
|
||||
trafficTab()->setProtocolInfo(tr("Endpoints"), &(recent.endpoint_tabs), &createModel);
|
||||
trafficTab()->setFirstTab(cli_proto_id);
|
||||
trafficTab()->setProtocolInfo(tr("Endpoints"), cli_proto_id, &(recent.endpoint_tabs), &createModel);
|
||||
connect(trafficTab(), &TrafficTab::filterAction, this, &EndpointDialog::filterAction);
|
||||
|
||||
connect(trafficTab(), &TrafficTab::tabDataChanged, this, &EndpointDialog::tabChanged);
|
||||
connect(trafficTab(), &TrafficTab::currentChanged, this, &EndpointDialog::tabChanged);
|
||||
|
||||
|
@ -93,12 +91,6 @@ EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_i
|
|||
}
|
||||
|
||||
updateWidgets();
|
||||
|
||||
cap_file_.delayedRetapPackets();
|
||||
}
|
||||
|
||||
EndpointDialog::~EndpointDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void EndpointDialog::captureFileClosing()
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
* @param filter Display filter to apply.
|
||||
*/
|
||||
explicit EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id = -1, const char *filter = NULL);
|
||||
~EndpointDialog();
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -108,7 +108,9 @@ bool ATapDataModel::enableTap()
|
|||
_disableTap = true;
|
||||
return false;
|
||||
}
|
||||
g_string_free(errorString, TRUE);
|
||||
|
||||
if (errorString)
|
||||
g_string_free(errorString, TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -274,7 +276,8 @@ void ATapDataModel::setFilter(QString filter)
|
|||
disableTap();
|
||||
}
|
||||
|
||||
g_string_free(errorString, TRUE);
|
||||
if (errorString)
|
||||
g_string_free(errorString, TRUE);
|
||||
}
|
||||
|
||||
ATapDataModel::dataModelType ATapDataModel::modelType() const
|
||||
|
|
|
@ -63,6 +63,9 @@ TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const c
|
|||
connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(currentTabChanged()));
|
||||
connect(ui->trafficTab, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged()));
|
||||
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)), this, SLOT(captureEvent(CaptureEvent)));
|
||||
|
||||
connect(ui->absoluteTimeCheckBox, &QCheckBox::toggled, trafficTab(), &TrafficTab::useAbsoluteTime);
|
||||
connect(trafficTab(), &TrafficTab::retapRequired, &cap_file_, &CaptureFile::delayedRetapPackets);
|
||||
}
|
||||
|
||||
TrafficTableDialog::~TrafficTableDialog()
|
||||
|
|
|
@ -101,9 +101,10 @@ TrafficTab::~TrafficTab()
|
|||
}
|
||||
}
|
||||
|
||||
void TrafficTab::setProtocolInfo(QString tableName, GList ** recentList, ATapModelCallback createModel)
|
||||
void TrafficTab::setProtocolInfo(QString tableName, int cliId, GList ** recentList, ATapModelCallback createModel)
|
||||
{
|
||||
_tableName = tableName;
|
||||
_cliId = cliId;
|
||||
_recentList = recentList;
|
||||
if (createModel)
|
||||
_createModel = createModel;
|
||||
|
@ -120,6 +121,12 @@ void TrafficTab::setProtocolInfo(QString tableName, GList ** recentList, ATapMod
|
|||
_protocols << proto_get_id_by_filter_name(name.toStdString().c_str());
|
||||
}
|
||||
|
||||
// Bring the command-line specified type to the front.
|
||||
if ((_cliId > 0) && (get_conversation_by_proto_id(_cliId))) {
|
||||
_protocols.removeAll(_cliId);
|
||||
_protocols.prepend(_cliId);
|
||||
}
|
||||
|
||||
QWidget * container = new QWidget(this);
|
||||
container->setFixedHeight(tabBar()->height());
|
||||
container->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
|
||||
|
@ -164,19 +171,6 @@ void TrafficTab::toggleTab(bool checked)
|
|||
updateTabs();
|
||||
}
|
||||
|
||||
void TrafficTab::setFirstTab(int cliId)
|
||||
{
|
||||
_cliId = cliId;
|
||||
|
||||
// Bring the command-line specified type to the front.
|
||||
if ((_cliId > 0) && (get_conversation_by_proto_id(_cliId))) {
|
||||
_protocols.removeAll(_cliId);
|
||||
_protocols.prepend(_cliId);
|
||||
}
|
||||
|
||||
updateTabs();
|
||||
}
|
||||
|
||||
void TrafficTab::setDelegate(int column, ATapCreateDelegate createDelegate)
|
||||
{
|
||||
if (! createDelegate || column < 0)
|
||||
|
@ -328,6 +322,8 @@ void TrafficTab::updateTabs()
|
|||
TabData tabData = qvariant_cast<TabData>(tabBar()->tabData(idx));
|
||||
_tabs.insert(tabData.protoId(), idx);
|
||||
}
|
||||
|
||||
emit retapRequired();
|
||||
}
|
||||
|
||||
void TrafficTab::doCurrentIndexChange(const QModelIndex & cur, const QModelIndex &)
|
||||
|
|
|
@ -96,19 +96,13 @@ public:
|
|||
* without having to removing the predefined object during setup of the UI.
|
||||
*
|
||||
* @param tableName The name for the table. Used for the protocol selection button
|
||||
* @param cliId a protocol id for the first tab
|
||||
* @param recentList The list to store the selected protocols in
|
||||
* @param createModel A callback, which will create the correct model for the trees
|
||||
*
|
||||
* @see ATapModelCallback
|
||||
*/
|
||||
void setProtocolInfo(QString tableName, GList ** recentList, ATapModelCallback createModel);
|
||||
|
||||
/**
|
||||
* @brief Ensure, that the given protocol id is the first tab set
|
||||
*
|
||||
* @param cliId a protocol id for the first tab
|
||||
*/
|
||||
void setFirstTab(int cliId);
|
||||
void setProtocolInfo(QString tableName, int cliId, GList ** recentList, ATapModelCallback createModel);
|
||||
|
||||
/**
|
||||
* @brief Set the Delegate object for a specific column
|
||||
|
@ -226,6 +220,7 @@ public slots:
|
|||
signals:
|
||||
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
|
||||
void tabDataChanged(int index);
|
||||
void retapRequired();
|
||||
|
||||
private:
|
||||
QString _tableName;
|
||||
|
|
Loading…
Reference in New Issue