aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2016-05-31 12:43:42 -0700
committerGerald Combs <gerald@wireshark.org>2016-05-31 22:09:05 +0000
commit99f4ccb7a0b202af6f8e02252d8b23935e7f4825 (patch)
treeb75e56e430a2f21e58caee5dee62dcf3a446b26f /ui
parent469719f39d82eaa89646ec8471f91dee884723f6 (diff)
Qt: Use a standard "Start" button in Capture Options.
QDialogButtonBox does a fine job of creating and managing buttons. Instead of creating our own "Start" button, just rename the "OK" button. This matches what we do elsewhere, e.g. in the Extcap Options dialog. Change-Id: I3c5eec1f01925f7b82c4e7360d685acbe4bb2fea Reviewed-on: https://code.wireshark.org/review/15653 Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> 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/capture_interfaces_dialog.cpp13
-rw-r--r--ui/qt/capture_interfaces_dialog.h4
-rw-r--r--ui/qt/capture_interfaces_dialog.ui2
3 files changed, 8 insertions, 11 deletions
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index 9a27eb3cf3..42798ed474 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -175,10 +175,9 @@ CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) :
stat_cache_ = NULL;
// XXX - Enable / disable as needed
- start_bt_ = ui->buttonBox->addButton(tr("Start"), QDialogButtonBox::AcceptRole);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start"));
- start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false);
- connect(start_bt_, SIGNAL(clicked(bool)), this, SLOT(startButtonClicked()));
+ 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
@@ -228,7 +227,7 @@ void CaptureInterfacesDialog::interfaceSelected()
{
InterfaceTree::updateGlobalDeviceSelections(ui->interfaceTree, col_interface_);
- start_bt_->setEnabled((global_capture_opts.num_selected > 0) ? true: false);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0) ? true: false);
emit interfacesChanged();
@@ -265,7 +264,7 @@ void CaptureInterfacesDialog::updateWidgets()
}
ui->compileBPF->setEnabled(can_capture);
- start_bt_->setEnabled(can_capture);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(can_capture);
}
CaptureInterfacesDialog::~CaptureInterfacesDialog()
@@ -357,7 +356,7 @@ void CaptureInterfacesDialog::on_cbResolveTransportNames_toggled(bool checked)
gbl_resolv_flags.transport_name = checked;
}
-void CaptureInterfacesDialog::startButtonClicked()
+void CaptureInterfacesDialog::on_buttonBox_accepted()
{
if (saveOptionsToPreferences()) {
emit setFilterValid(true, ui->captureFilterComboBox->lineEdit()->text());
@@ -578,7 +577,7 @@ void CaptureInterfacesDialog::updateInterfaces()
}
- start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0)? true: false);
if (!stat_timer_) {
updateStatistics();
diff --git a/ui/qt/capture_interfaces_dialog.h b/ui/qt/capture_interfaces_dialog.h
index ed3b05e523..0a7f2efa04 100644
--- a/ui/qt/capture_interfaces_dialog.h
+++ b/ui/qt/capture_interfaces_dialog.h
@@ -94,7 +94,7 @@ private slots:
void on_manageButton_clicked();
void on_cbResolveNetworkNames_toggled(bool checked);
void on_cbResolveTransportNames_toggled(bool checked);
- void startButtonClicked();
+ void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_buttonBox_helpRequested();
void interfaceSelected();
@@ -121,8 +121,6 @@ private:
Ui::CaptureInterfacesDialog *ui;
Qt::CheckState m_pressedItemState;
- QPushButton *start_bt_;
- QPushButton *stop_bt_;
if_stat_cache_t *stat_cache_;
QTimer *stat_timer_;
InterfaceTreeDelegate interface_item_delegate_;
diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui
index cd1f1abdfc..17c648ad8d 100644
--- a/ui/qt/capture_interfaces_dialog.ui
+++ b/ui/qt/capture_interfaces_dialog.ui
@@ -791,7 +791,7 @@ PLEASE NOTE: One option MUST be selected.</string>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
- <set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
+ <set>QDialogButtonBox::Close|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>