aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@zing.org>2017-07-16 14:26:51 -0700
committerGerald Combs <gerald@wireshark.org>2017-07-17 00:41:09 +0000
commit32ec45dc92a699e34e23197d2de48a043dfad426 (patch)
tree6068bbacfed09b04a431a2f139fbc2be47de5902 /ui
parent47db24861ef8b418964ad3b7d97c856a7243770a (diff)
Qt: More Main Welcome interface tweaks.
ge036f4a282 didn't ensure that an interface was selected at app startup. Change-Id: I0b04020a344aaf8e35766a45287fe263d1227c64 Reviewed-on: https://code.wireshark.org/review/22656 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/interface_frame.cpp11
-rw-r--r--ui/qt/interface_frame.h2
-rw-r--r--ui/qt/main_welcome.cpp13
3 files changed, 12 insertions, 14 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index f8e7eb60ad..f009f4105d 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -168,9 +168,18 @@ int InterfaceFrame::interfacesPresent()
return sourceModel->rowCount() - proxyModel->interfacesHidden();
}
-void InterfaceFrame::setTreeFocus()
+void InterfaceFrame::ensureSelectedInterface()
{
+#ifdef HAVE_LIBPCAP
+ if (interfacesPresent() < 1) return;
+
+ if (sourceModel->selectedDevices().count() < 1) {
+ QModelIndex first_idx = proxyModel->index(0, 0);
+ ui->interfaceTree->setCurrentIndex(first_idx);
+ }
+
ui->interfaceTree->setFocus();
+#endif
}
void InterfaceFrame::hideEvent(QHideEvent *) {
diff --git a/ui/qt/interface_frame.h b/ui/qt/interface_frame.h
index d3e8d66d77..790bf2f794 100644
--- a/ui/qt/interface_frame.h
+++ b/ui/qt/interface_frame.h
@@ -55,7 +55,7 @@ public:
QMenu * getSelectionMenu();
int interfacesPresent();
- void setTreeFocus();
+ void ensureSelectedInterface();
Q_SIGNALS:
void showExtcapOptions(QString device_name);
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index e516e89677..d1c439779d 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -270,20 +270,9 @@ void MainWelcome::appInitialized()
welcome_ui_->captureFilterComboBox->setEnabled(true);
-#ifdef HAVE_LIBPCAP
- QString capture_device = prefs.capture_device;
- if (!capture_device.isEmpty()) {
- capture_opts_default_iface_if_necessary(&global_capture_opts, prefs.capture_device);
- }
-#endif // HAVE_LIBPCAP
-
interfaceListChanged();
-#ifdef HAVE_LIBPCAP
- if (global_capture_opts.num_selected > 0) {
- welcome_ui_->interfaceFrame->setTreeFocus();
- }
-#endif // HAVE_LIBPCAP
+ welcome_ui_->interfaceFrame->ensureSelectedInterface();
delete splash_overlay_;
splash_overlay_ = NULL;