summaryrefslogtreecommitdiff
path: root/ui/qt/address_editor_frame.cpp
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-12-01 15:41:44 +0100
committerGerald Combs <gerald@wireshark.org>2015-12-01 23:33:57 +0000
commitb932ee8f136ffeb3e78ce0f03e08df81fd18d9d4 (patch)
tree2826b2e104b2894ae3a47c840cc1f3efce2d5420 /ui/qt/address_editor_frame.cpp
parent96bf82ced0b58c7a4c2a6c300efeebe4f05c0ff4 (diff)
downloadwireshark-b932ee8f136ffeb3e78ce0f03e08df81fd18d9d4.tar.gz
Qt Frames: Use ButtonBox instead of buttons
In these frames the Ok and Close buttons are implemented as standalone buttons. This leads to the scenario, that they break plattform-ui preferences on the one hand, as well as not being the same order throughout. This patch replaces all Ok/Close buttons with the Qt button box, which handles the plattform-ui internally, and additionally allways enforces the same order. Change-Id: If62b90016b222322f60c0962da04c8277589a57f Reviewed-on: https://code.wireshark.org/review/12335 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/address_editor_frame.cpp')
-rw-r--r--ui/qt/address_editor_frame.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/ui/qt/address_editor_frame.cpp b/ui/qt/address_editor_frame.cpp
index 670aec6fc5..0ed5246ad1 100644
--- a/ui/qt/address_editor_frame.cpp
+++ b/ui/qt/address_editor_frame.cpp
@@ -33,6 +33,8 @@
#include "address_editor_frame.h"
#include <ui_address_editor_frame.h>
+#include <QPushButton>
+
#include "qt_ui_utils.h"
// To do:
@@ -60,12 +62,12 @@ AddressEditorFrame::~AddressEditorFrame()
void AddressEditorFrame::editAddresses(CaptureFile &cf, int column)
{
if (!cf.capFile()->current_frame) {
- on_cancelButton_clicked();
+ on_buttonBox_rejected();
return;
}
if (!cf_read_record(cf.capFile(), cf.capFile()->current_frame)) {
- on_cancelButton_clicked();
+ on_buttonBox_rejected();
return; // error reading the frame
}
@@ -107,13 +109,13 @@ void AddressEditorFrame::updateWidgets()
ok_enable = true;
}
- ui->okButton->setEnabled(ok_enable);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok_enable);
}
void AddressEditorFrame::on_nameResolutionPreferencesToolButton_clicked()
{
static const QString module_name = "nameres";
- on_cancelButton_clicked();
+ on_buttonBox_rejected();
emit showNameResolutionPreferences(module_name);
}
@@ -129,12 +131,12 @@ void AddressEditorFrame::on_nameLineEdit_textEdited(const QString &)
void AddressEditorFrame::on_nameLineEdit_returnPressed()
{
- if (ui->okButton->isEnabled()) {
- on_okButton_clicked();
+ if (ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) {
+ on_buttonBox_accepted();
}
}
-void AddressEditorFrame::on_okButton_clicked()
+void AddressEditorFrame::on_buttonBox_accepted()
{
if (ui->addressComboBox->count() < 1 || ui->nameLineEdit->text().isEmpty()) {
return;
@@ -144,14 +146,14 @@ void AddressEditorFrame::on_okButton_clicked()
if (!add_ip_name_from_string(addr.toUtf8().constData(), name.toUtf8().constData())) {
QString error_msg = tr("Can't assign %1 to %2").arg(name).arg(addr);
emit editAddressStatus(error_msg);
- ui->okButton->setEnabled(false);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
return;
}
- on_cancelButton_clicked();
+ on_buttonBox_rejected();
emit redissectPackets();
}
-void AddressEditorFrame::on_cancelButton_clicked()
+void AddressEditorFrame::on_buttonBox_rejected()
{
ui->addressComboBox->clear();
ui->nameLineEdit->clear();