aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
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;