aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-14 16:35:52 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-14 16:35:52 +0000
commit4ceb4e9050a93b1e2487571316e3f7b1cb0f37d9 (patch)
tree181c084bdc3a08d34f95a050be0052551f836124 /ui/qt
parentb46282db28038b663822ce5fa352b81aecd23ad9 (diff)
Properly enable and disable "View/Expand Subtrees". Get rid
of ProtoTree::protoItemUnselected and use an empty string in protoItemSelected to indicate that nothing is selected. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@44492 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/main_status_bar.cpp6
-rw-r--r--ui/qt/main_window.cpp5
-rw-r--r--ui/qt/main_window.ui3
-rw-r--r--ui/qt/proto_tree.cpp33
-rw-r--r--ui/qt/proto_tree.h2
5 files changed, 38 insertions, 11 deletions
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index 38ed87a5fd..2994f3d572 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -243,7 +243,11 @@ void MainStatusBar::popFileStatus() {
}
void MainStatusBar::pushFieldStatus(QString &message) {
- m_infoStatus.pushText(message, STATUS_CTX_FIELD);
+ if (message.isNull()) {
+ popFieldStatus();
+ } else {
+ m_infoStatus.pushText(message, STATUS_CTX_FIELD);
+ }
}
void MainStatusBar::popFieldStatus() {
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index dba12cc75b..c0d3a6b968 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -136,8 +136,9 @@ MainWindow::MainWindow(QWidget *parent) :
connect(protoTree, SIGNAL(protoItemSelected(QString&)),
ui->statusBar, SLOT(pushFieldStatus(QString&)));
- connect(protoTree, SIGNAL(protoItemUnselected()),
- ui->statusBar, SLOT(popFieldStatus()));
+
+ connect(protoTree, SIGNAL(protoItemSelected(bool)),
+ ui->actionViewExpandSubtrees, SLOT(setEnabled(bool)));
ui->mainStack->setCurrentWidget(mainWelcome);
}
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 78c3cae5df..61de368137 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -406,6 +406,9 @@
</property>
</action>
<action name="actionViewExpandSubtrees">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>E&amp;xpand Subtrees</string>
</property>
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index c4cffaae83..197ebc5e0f 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -190,8 +190,10 @@ void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) {
itemInfo.append(QString(tr(", %1 bytes")).arg(finfo_length));
}
- emit protoItemUnselected();
+ emit protoItemSelected(QString());
+ emit protoItemSelected(false);
emit protoItemSelected(itemInfo);
+ emit protoItemSelected(true);
} // else the GTK+ version pushes an empty string as described below.
/*
* Don't show anything if the field name is zero-length;
@@ -214,7 +216,8 @@ void ProtoTree::updateSelectionStatus(QTreeWidgetItem* item) {
*/
} else {
- emit protoItemUnselected();
+ emit protoItemSelected(QString());
+ emit protoItemSelected(false);
}
}
@@ -224,12 +227,28 @@ void ProtoTree::expandSubtrees()
{
QTreeWidgetItem *topSel;
- foreach(topSel, selectedItems()) {
- QTreeWidgetItemIterator iter(topSel);
- while (*iter) {
- (*iter)->setExpanded(true);
- iter++;
+ if (selectedItems().length() < 1) {
+ return;
+ }
+
+ topSel = selectedItems()[0];
+
+ if (!topSel) {
+ return;
+ }
+
+ while (topSel->parent()) {
+ topSel = topSel->parent();
+ }
+
+ QTreeWidgetItemIterator iter(topSel);
+ while (*iter) {
+ if ((*iter) != topSel && (*iter)->parent() == NULL) {
+ // We found the next top-level item
+ break;
}
+ (*iter)->setExpanded(true);
+ iter++;
}
}
diff --git a/ui/qt/proto_tree.h b/ui/qt/proto_tree.h
index 3371fb9582..a8a615e98b 100644
--- a/ui/qt/proto_tree.h
+++ b/ui/qt/proto_tree.h
@@ -43,7 +43,7 @@ private:
signals:
void protoItemSelected(QString &);
- void protoItemUnselected();
+ void protoItemSelected(bool);
public slots:
void updateSelectionStatus(QTreeWidgetItem*);