Qt: Remove unnecessary cli option

There was an option that was never used, in that you
could set your protocol tap as a first tab in the
Conversations and Endpoint dialogs.
This commit is contained in:
Roland Knall 2022-06-08 17:42:58 +02:00 committed by Roland Knall
parent de103394fe
commit 3029a4a4d9
12 changed files with 27 additions and 86 deletions

View File

@ -572,12 +572,9 @@ private slots:
void on_actionStatisticsFlowGraph_triggered();
void openStatisticsTreeDialog(const gchar *abbr);
void statCommandConversations(const char *arg = NULL, void *userdata = NULL);
void on_actionStatisticsConversations_triggered();
void statCommandEndpoints(const char *arg = NULL, void *userdata = NULL);
void on_actionStatisticsEndpoints_triggered();
void on_actionStatisticsPacketLengths_triggered();
void statCommandIOGraph(const char *, void *);
void on_actionStatisticsIOGraph_triggered();
void actionStatisticsPlugin_triggered();

View File

@ -2903,10 +2903,9 @@ void LogwolfMainWindow::openStatisticsTreeDialog(const gchar *abbr)
st_dialog->show();
}
// -z conv,...
void LogwolfMainWindow::statCommandConversations(const char *arg, void *userdata)
void LogwolfMainWindow::on_actionStatisticsConversations_triggered()
{
ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_);
connect(conv_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t, guint, guint)),
@ -2914,15 +2913,9 @@ void LogwolfMainWindow::statCommandConversations(const char *arg, void *userdata
conv_dialog->show();
}
void LogwolfMainWindow::on_actionStatisticsConversations_triggered()
void LogwolfMainWindow::on_actionStatisticsEndpoints_triggered()
{
statCommandConversations(NULL, NULL);
}
// -z endpoints,...
void LogwolfMainWindow::statCommandEndpoints(const char *arg, void *userdata)
{
EndpointDialog *endp_dialog = new EndpointDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
EndpointDialog *endp_dialog = new EndpointDialog(*this, capture_file_);
connect(endp_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(endp_dialog, SIGNAL(openFollowStreamDialog(follow_type_t)),
@ -2930,18 +2923,12 @@ void LogwolfMainWindow::statCommandEndpoints(const char *arg, void *userdata)
endp_dialog->show();
}
void LogwolfMainWindow::on_actionStatisticsEndpoints_triggered()
{
statCommandEndpoints(NULL, NULL);
}
void LogwolfMainWindow::on_actionStatisticsPacketLengths_triggered()
{
openStatisticsTreeDialog("plen");
}
// -z io,stat
void LogwolfMainWindow::statCommandIOGraph(const char *, void *)
void LogwolfMainWindow::on_actionStatisticsIOGraph_triggered()
{
const DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
QString displayFilter;
@ -2954,11 +2941,6 @@ void LogwolfMainWindow::statCommandIOGraph(const char *, void *)
iog_dialog->show();
}
void LogwolfMainWindow::on_actionStatisticsIOGraph_triggered()
{
statCommandIOGraph(NULL, NULL);
}
void LogwolfMainWindow::actionStatisticsPlugin_triggered()
{
QAction* action = qobject_cast<QAction*>(sender());

View File

@ -88,11 +88,11 @@ static QAbstractItemDelegate * createDelegate(QWidget * parent)
return delegate;
}
ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id, const char *filter) :
TrafficTableDialog(parent, cf, filter, table_name_),
ConversationDialog::ConversationDialog(QWidget &parent, CaptureFile &cf) :
TrafficTableDialog(parent, cf, table_name_),
tcp_graph_requested_(false)
{
trafficTab()->setProtocolInfo(tr("Conversation"), cli_proto_id, &(recent.conversation_tabs), &createModel);
trafficTab()->setProtocolInfo(tr("Conversation"), &(recent.conversation_tabs), &createModel);
trafficTab()->setDelegate(CONV_COLUMN_START, &createDelegate);
trafficTab()->setDelegate(CONV_COLUMN_DURATION, &createDelegate);
trafficTab()->setFilter(cf.displayFilter());

View File

@ -24,7 +24,7 @@ public:
* @param cli_proto_id If valid, add this protocol and bring it to the front.
* @param filter Display filter to apply.
*/
explicit ConversationDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id = -1, const char *filter = NULL);
explicit ConversationDialog(QWidget &parent, CaptureFile &cf);
protected:
void captureFileClosing();

View File

@ -63,10 +63,10 @@ static ATapDataModel * createModel(int protoId, QString filter)
return new EndpointDataModel(protoId, filter);
}
EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id, const char *filter) :
TrafficTableDialog(parent, cf, filter, table_name_)
EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf) :
TrafficTableDialog(parent, cf, table_name_)
{
trafficTab()->setProtocolInfo(tr("Endpoints"), cli_proto_id, &(recent.endpoint_tabs), &createModel);
trafficTab()->setProtocolInfo(tr("Endpoints"), &(recent.endpoint_tabs), &createModel);
trafficTab()->setFilter(cf.displayFilter());
displayFilterCheckBox()->setChecked(cf.displayFilter().length() > 0);
connect(trafficTab(), &TrafficTab::filterAction, this, &EndpointDialog::filterAction);

View File

@ -24,10 +24,8 @@ public:
*
* @param parent Parent widget.
* @param cf Capture file. No statistics will be calculated if this is NULL.
* @param cli_proto_id If valid, add this protocol and bring it to the front.
* @param filter Display filter to apply.
*/
explicit EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id = -1, const char *filter = NULL);
explicit EndpointDialog(QWidget &parent, CaptureFile &cf);
signals:

View File

@ -42,10 +42,9 @@
// - Columns don't resize correctly.
// - Closing the capture file clears conversation data.
TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const char *filter, const QString &table_name) :
TrafficTableDialog::TrafficTableDialog(QWidget &parent, CaptureFile &cf, const QString &table_name) :
WiresharkDialog(parent, cf),
ui(new Ui::TrafficTableDialog),
filter_(filter)
ui(new Ui::TrafficTableDialog)
{
ui->setupUi(this);
loadGeometry(parent.width(), parent.height() * 3 / 4);
@ -122,8 +121,6 @@ void TrafficTableDialog::on_displayFilterCheckBox_toggled(bool checked)
if (checked)
trafficTab()->setFilter(cap_file_.capFile()->dfilter);
else if (!filter_.isEmpty())
trafficTab()->setFilter(filter_);
else
trafficTab()->setFilter(QString());

View File

@ -45,10 +45,9 @@ public:
*
* @param parent Parent widget.
* @param cf Capture file. No statistics will be calculated if this is NULL.
* @param filter Display filter to apply.
* @param table_name If valid, add this protocol and bring it to the front.
*/
explicit TrafficTableDialog(QWidget &parent, CaptureFile &cf, const char *filter = NULL, const QString &table_name = tr("Unknown"));
explicit TrafficTableDialog(QWidget &parent, CaptureFile &cf, const QString &table_name = tr("Unknown"));
~TrafficTableDialog();
public slots:
@ -61,7 +60,6 @@ signals:
protected:
Ui::TrafficTableDialog *ui;
QString filter_;
QPushButton *copy_bt_;
void addProgressFrame(QObject *parent);

View File

@ -83,7 +83,6 @@ TrafficTab::TrafficTab(QWidget * parent) :
_createModel = nullptr;
_disableTaps = false;
_nameResolution = false;
_cliId = 0;
_recentList = nullptr;
setTabBasename(QString());
@ -102,10 +101,9 @@ TrafficTab::~TrafficTab()
}
}
void TrafficTab::setProtocolInfo(QString tableName, int cliId, GList ** recentList, ATapModelCallback createModel)
void TrafficTab::setProtocolInfo(QString tableName, GList ** recentList, ATapModelCallback createModel)
{
setTabBasename(tableName);
_cliId = cliId;
_recentList = recentList;
if (createModel)
_createModel = createModel;
@ -122,19 +120,13 @@ void TrafficTab::setProtocolInfo(QString tableName, int cliId, GList ** recentLi
_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));
QHBoxLayout * layout = new QHBoxLayout(container);
layout->setContentsMargins(1, 0, 1, 0);
QPushButton * cornerButton = new QPushButton(tr("%1 Types").arg(tableName));
cornerButton->setFixedHeight(tabBar()->height());
cornerButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
@ -203,11 +195,11 @@ void TrafficTab::setDelegate(int column, ATapCreateDelegate createDelegate)
QTreeView * TrafficTab::createTree(int protoId)
{
TrafficTree * tree = new TrafficTree(tabBasename(), this);
if (_createModel) {
ATapDataModel * model = _createModel(protoId, "");
connect(model, &ATapDataModel::tapListenerChanged, tree, &TrafficTree::tapListenerEnabled);
model->enableTap();
foreach(int col, _createDelegates.keys())
@ -648,7 +640,7 @@ void TrafficTab::detachTab(int tabIdx, QPoint pos) {
updateTabs();
}
void TrafficTab::attachTab(QWidget * content, QString name)
void TrafficTab::attachTab(QWidget * content, QString name)
{
ATapDataModel * model = modelForWidget(content);
if (!model) {

View File

@ -86,13 +86,12 @@ 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, int cliId, GList ** recentList, ATapModelCallback createModel);
void setProtocolInfo(QString tableName, GList ** recentList, ATapModelCallback createModel);
/**
* @brief Set the Delegate object for a specific column
@ -212,7 +211,6 @@ protected slots:
virtual void attachTab(QWidget * content, QString name) override;
private:
int _cliId;
QVector<int> _protocols;
QMap<int, QString> _allTaps;
QMap<int, QAction *> _protocolButtons;

View File

@ -640,9 +640,7 @@ private slots:
void on_actionStatisticsBACappObjectId_triggered();
void on_actionStatisticsBACappService_triggered();
void on_actionStatisticsCollectd_triggered();
void statCommandConversations(const char *arg = NULL, void *userdata = NULL);
void on_actionStatisticsConversations_triggered();
void statCommandEndpoints(const char *arg = NULL, void *userdata = NULL);
void on_actionStatisticsEndpoints_triggered();
void on_actionStatisticsHART_IP_triggered();
void on_actionStatisticsHTTPPacketCounter_triggered();
@ -650,7 +648,6 @@ private slots:
void on_actionStatisticsHTTPLoadDistribution_triggered();
void on_actionStatisticsHTTPRequestSequences_triggered();
void on_actionStatisticsPacketLengths_triggered();
void statCommandIOGraph(const char *, void *);
void on_actionStatisticsIOGraph_triggered();
void on_actionStatisticsSametime_triggered();
void on_actionStatisticsDNS_triggered();

View File

@ -3353,10 +3353,9 @@ void WiresharkMainWindow::on_actionStatisticsCollectd_triggered()
openStatisticsTreeDialog("collectd");
}
// -z conv,...
void WiresharkMainWindow::statCommandConversations(const char *arg, void *userdata)
void WiresharkMainWindow::on_actionStatisticsConversations_triggered()
{
ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_);
connect(conv_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t, guint, guint)),
@ -3366,15 +3365,9 @@ void WiresharkMainWindow::statCommandConversations(const char *arg, void *userda
conv_dialog->show();
}
void WiresharkMainWindow::on_actionStatisticsConversations_triggered()
void WiresharkMainWindow::on_actionStatisticsEndpoints_triggered()
{
statCommandConversations(NULL, NULL);
}
// -z endpoints,...
void WiresharkMainWindow::statCommandEndpoints(const char *arg, void *userdata)
{
EndpointDialog *endp_dialog = new EndpointDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg);
EndpointDialog *endp_dialog = new EndpointDialog(*this, capture_file_);
connect(endp_dialog, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)),
this, SIGNAL(filterAction(QString, FilterAction::Action, FilterAction::ActionType)));
connect(endp_dialog, SIGNAL(openFollowStreamDialog(follow_type_t)),
@ -3384,11 +3377,6 @@ void WiresharkMainWindow::statCommandEndpoints(const char *arg, void *userdata)
endp_dialog->show();
}
void WiresharkMainWindow::on_actionStatisticsEndpoints_triggered()
{
statCommandEndpoints(NULL, NULL);
}
void WiresharkMainWindow::on_actionStatisticsHART_IP_triggered()
{
openStatisticsTreeDialog("hart_ip");
@ -3419,8 +3407,7 @@ void WiresharkMainWindow::on_actionStatisticsPacketLengths_triggered()
openStatisticsTreeDialog("plen");
}
// -z io,stat
void WiresharkMainWindow::statCommandIOGraph(const char *, void *)
void WiresharkMainWindow::on_actionStatisticsIOGraph_triggered()
{
const DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
QString displayFilter;
@ -3433,11 +3420,6 @@ void WiresharkMainWindow::statCommandIOGraph(const char *, void *)
iog_dialog->show();
}
void WiresharkMainWindow::on_actionStatisticsIOGraph_triggered()
{
statCommandIOGraph(NULL, NULL);
}
void WiresharkMainWindow::on_actionStatisticsSametime_triggered()
{
openStatisticsTreeDialog("sametime");