diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-11-26 18:31:19 -0600 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2016-11-28 19:35:29 +0000 |
commit | 7c3aa5a88ca78bf029fd16aea2a9a1f4861227db (patch) | |
tree | ca5c332237b9aaf3835ccc2dfc04a629807297b3 /ui/qt | |
parent | 1239336af00215172c94d5d2af3926a72ea998c3 (diff) |
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>
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/conversation_dialog.cpp | 38 | ||||
-rw-r--r-- | ui/qt/conversation_dialog.h | 1 |
2 files changed, 24 insertions, 15 deletions
diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp index 91be7785a2..be43a2e04b 100644 --- a/ui/qt/conversation_dialog.cpp +++ b/ui/qt/conversation_dialog.cpp @@ -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 diff --git a/ui/qt/conversation_dialog.h b/ui/qt/conversation_dialog.h index 1aeaf39a7a..718619ad0f 100644 --- a/ui/qt/conversation_dialog.h +++ b/ui/qt/conversation_dialog.h @@ -83,6 +83,7 @@ private: private slots: void currentTabChanged(); + void conversationSelectionChanged(); void on_displayFilterCheckBox_toggled(bool checked); void followStream(); void graphTcp(); |