Qt: Fix conversation buttons.

Move parts of currentTabChanged to conversationSelectionChanged. This
lets us enable the "Follow Stream" and "Graph" buttons when either the
current tab or the current selection changes.

Bug: 12893
Change-Id: I025447d26073a938f2d8b5a8fcad7c0d5e855650
Reviewed-on: https://code.wireshark.org/review/18963
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2016-11-26 18:31:19 -06:00
parent 1239336af0
commit 7c3aa5a88c
2 changed files with 24 additions and 15 deletions

View File

@ -168,6 +168,8 @@ bool ConversationDialog::addTrafficTable(register_ct_t* table)
conv_tree->setItemDelegateForColumn(CONV_COLUMN_START, new TimelineDelegate(conv_tree));
conv_tree->setItemDelegateForColumn(CONV_COLUMN_DURATION, new TimelineDelegate(conv_tree));
connect(conv_tree, SIGNAL(itemSelectionChanged()),
this, SLOT(conversationSelectionChanged()));
connect(conv_tree, SIGNAL(titleChanged(QWidget*,QString)),
this, SLOT(setTabText(QWidget*,QString)));
connect(conv_tree, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)),
@ -198,17 +200,6 @@ bool ConversationDialog::addTrafficTable(register_ct_t* table)
return true;
}
conv_item_t *ConversationDialog::currentConversation()
{
ConversationTreeWidget *cur_tree = qobject_cast<ConversationTreeWidget *>(trafficTableTabWidget()->currentWidget());
if (!cur_tree || cur_tree->selectedItems().count() < 1) {
return NULL;
}
return cur_tree->selectedItems()[0]->data(0, Qt::UserRole).value<conv_item_t *>();
}
void ConversationDialog::followStream()
{
if (file_closed_) {
@ -271,6 +262,15 @@ void ConversationDialog::graphTcp()
void ConversationDialog::currentTabChanged()
{
bool copy_enable = trafficTableTabWidget()->currentWidget() ? true : false;
copy_bt_->setEnabled(copy_enable);
conversationSelectionChanged();
TrafficTableDialog::currentTabChanged();
}
void ConversationDialog::conversationSelectionChanged()
{
bool follow_enable = false, graph_enable = false;
conv_item_t *conv_item = currentConversation();
@ -286,12 +286,8 @@ void ConversationDialog::currentTabChanged()
break;
}
}
copy_bt_->setEnabled(copy_enable);
follow_bt_->setEnabled(follow_enable);
graph_bt_->setEnabled(graph_enable);
TrafficTableDialog::currentTabChanged();
}
void ConversationDialog::on_displayFilterCheckBox_toggled(bool checked)
@ -571,6 +567,18 @@ private:
bool *resolve_names_ptr_;
};
conv_item_t *ConversationDialog::currentConversation()
{
ConversationTreeWidget *cur_tree = qobject_cast<ConversationTreeWidget *>(trafficTableTabWidget()->currentWidget());
if (!cur_tree || cur_tree->selectedItems().count() < 1) {
return NULL;
}
ConversationTreeWidgetItem *ctwi = dynamic_cast<ConversationTreeWidgetItem *>(cur_tree->selectedItems()[0]);
return ctwi->convItem();
}
// ConversationTreeWidget
// TrafficTableTreeWidget / QTreeWidget subclass that allows tapping

View File

@ -83,6 +83,7 @@ private:
private slots:
void currentTabChanged();
void conversationSelectionChanged();
void on_displayFilterCheckBox_toggled(bool checked);
void followStream();
void graphTcp();