diff options
author | Roland Knall <roland.knall@br-automation.com> | 2015-12-01 15:41:44 +0100 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-12-01 23:33:57 +0000 |
commit | b932ee8f136ffeb3e78ce0f03e08df81fd18d9d4 (patch) | |
tree | 2826b2e104b2894ae3a47c840cc1f3efce2d5420 /ui/qt/preference_editor_frame.cpp | |
parent | 96bf82ced0b58c7a4c2a6c300efeebe4f05c0ff4 (diff) | |
download | wireshark-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/preference_editor_frame.cpp')
-rw-r--r-- | ui/qt/preference_editor_frame.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/qt/preference_editor_frame.cpp b/ui/qt/preference_editor_frame.cpp index e942359997..6b193e36c0 100644 --- a/ui/qt/preference_editor_frame.cpp +++ b/ui/qt/preference_editor_frame.cpp @@ -35,6 +35,8 @@ #include "wireshark_application.h" +#include <QPushButton> + #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // Qt::escape #include <QTextDocument> @@ -128,7 +130,7 @@ void PreferenceEditorFrame::uintLineEditTextEdited(const QString &new_str) if (new_str.isEmpty()) { new_uint_ = pref_->stashed_val.uint; ui->preferenceLineEdit->setSyntaxState(SyntaxLineEdit::Empty); - ui->okButton->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); return; } @@ -141,7 +143,7 @@ void PreferenceEditorFrame::uintLineEditTextEdited(const QString &new_str) new_uint_ = pref_->stashed_val.uint; ui->preferenceLineEdit->setSyntaxState(SyntaxLineEdit::Invalid); } - ui->okButton->setEnabled(ok); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok); } void PreferenceEditorFrame::stringLineEditTextEdited(const QString &new_str) @@ -170,7 +172,7 @@ void PreferenceEditorFrame::rangeLineEditTextEdited(const QString &new_str) void PreferenceEditorFrame::on_modulePreferencesToolButton_clicked() { - on_cancelButton_clicked(); + on_buttonBox_rejected(); if (module_) { QString module_name = module_->name; emit showProtocolPreferences(module_name); @@ -179,12 +181,12 @@ void PreferenceEditorFrame::on_modulePreferencesToolButton_clicked() void PreferenceEditorFrame::on_preferenceLineEdit_returnPressed() { - if (ui->okButton->isEnabled()) { - on_okButton_clicked(); + if (ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled()) { + on_buttonBox_accepted(); } } -void PreferenceEditorFrame::on_okButton_clicked() +void PreferenceEditorFrame::on_buttonBox_accepted() { bool apply = false; switch(pref_->type) { @@ -219,7 +221,7 @@ void PreferenceEditorFrame::on_okButton_clicked() prefs_main_write(); } } - on_cancelButton_clicked(); + on_buttonBox_rejected(); // Emit signals once UI is hidden if (apply) { wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged); @@ -227,7 +229,7 @@ void PreferenceEditorFrame::on_okButton_clicked() } } -void PreferenceEditorFrame::on_cancelButton_clicked() +void PreferenceEditorFrame::on_buttonBox_rejected() { pref_ = NULL; module_ = NULL; |