From dcfc288130e0576249f3ba7f8db7ad1681ff70f5 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 24 Feb 2017 09:26:40 -0800 Subject: [PATCH] Qt: Enable/disable Capture Interfaces buttons consistently. The "Compile BPFs" and "Start" buttons need to be enabled and disabled at the same time and according to the same criteria. Make sure we do so. Change-Id: I708886564dcf569cd71f936119195209ef6dcbd5 Reviewed-on: https://code.wireshark.org/review/20265 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Jaap Keuter Reviewed-by: Gerald Combs --- ui/qt/capture_interfaces_dialog.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp index e0eb171016..66334959e9 100644 --- a/ui/qt/capture_interfaces_dialog.cpp +++ b/ui/qt/capture_interfaces_dialog.cpp @@ -188,11 +188,8 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : stat_timer_ = NULL; stat_cache_ = NULL; - // XXX - Enable / disable as needed ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start")); - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0)? true: false); - // Start out with the list *not* sorted, so they show up in the order // in which they were provided ui->interfaceTree->sortByColumn(-1, Qt::AscendingOrder); @@ -231,6 +228,8 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); + + updateWidgets(); } /* Update global device selections based on the TreeWidget selection. */ @@ -273,8 +272,6 @@ void CaptureInterfacesDialog::interfaceSelected() { updateGlobalDeviceSelections(); - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0) ? true: false); - emit interfacesChanged(); updateSelectedFilter(); @@ -724,7 +721,7 @@ void CaptureInterfacesDialog::updateInterfaces() } - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0)? true: false); + updateWidgets(); if (!stat_timer_) { updateStatistics();