aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-09 15:19:45 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-12 15:50:07 +0000
commitc5a056832dc9e3afaeb89beb6feedf134287183c (patch)
tree126d1e1c68edee0b8c7a6bcfca9c04342b22ab1e
parent23beb9700c3fc8eea9f3540813a7b0edeaee98ae (diff)
Try to fix wireless toolbar behavior on Linux.
Split interface get and set activity into explicit getInterfaceInfo and setInterfaceInfo member functions. Make sure we connect to QComboBox "activated" signals (which are only triggered by user activity) instead of "currentIndexChanged" signals (which are triggered on any change). Hopefully this will make the wireless toolbar read-only until the user selects a combobox item. Bug: 11487 Change-Id: I236ff3f5972b0b7d543f21bb955d7892190a7814 Reviewed-on: https://code.wireshark.org/review/10918 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--ui/qt/wireless_frame.cpp50
-rw-r--r--ui/qt/wireless_frame.h8
2 files changed, 38 insertions, 20 deletions
diff --git a/ui/qt/wireless_frame.cpp b/ui/qt/wireless_frame.cpp
index 202a246f20..6140e7417a 100644
--- a/ui/qt/wireless_frame.cpp
+++ b/ui/qt/wireless_frame.cpp
@@ -41,6 +41,7 @@
// - Push more status messages ("switched to...") to the status bar.
// - Add a "Decrypt in the driver" checkbox?
// - Check for frequency and channel type changes.
+// - Find something appropriate to run from the helperToolButton on Linux.
// Questions:
// - From our perspective, what's the difference between "NOHT" and "HT20"?
@@ -77,7 +78,7 @@ WirelessFrame::WirelessFrame(QWidget *parent) :
ui->fcsFilterFrame->setVisible(ws80211_has_fcs_filter());
- updateWidgets();
+ getInterfaceInfo();
startTimer(update_interval_);
}
@@ -97,6 +98,12 @@ void WirelessFrame::setCaptureInProgress(bool capture_in_progress)
// the current selection goes away.
void WirelessFrame::timerEvent(QTimerEvent *)
{
+ // Don't interfere with user activity.
+ if (ui->interfaceComboBox->view()->isVisible()
+ || ui->channelComboBox->view()->isVisible()
+ || ui->channelTypeComboBox->view()->isVisible()
+ || ui->fcsComboBox->view()->isVisible()) return;
+
ws80211_free_interfaces(interfaces_);
interfaces_ = ws80211_find_interfaces();
const QString old_iface = ui->interfaceComboBox->currentText();
@@ -131,7 +138,7 @@ void WirelessFrame::timerEvent(QTimerEvent *)
}
if (ui->interfaceComboBox->currentText().compare(old_iface) != 0) {
- on_channelComboBox_activated(ui->interfaceComboBox->currentIndex());
+ getInterfaceInfo();
}
}
@@ -176,10 +183,14 @@ void WirelessFrame::on_prefsToolButton_clicked()
emit showWirelessPreferences(QString("wlan"));
}
-void WirelessFrame::on_interfaceComboBox_currentIndexChanged(const QString &cur_iface)
+void WirelessFrame::getInterfaceInfo()
{
+ const QString cur_iface = ui->interfaceComboBox->currentText();
+
ui->channelComboBox->clear();
ui->channelTypeComboBox->clear();
+ ui->fcsComboBox->clear();
+
if (cur_iface.isEmpty()) {
updateWidgets();
return;
@@ -231,14 +242,16 @@ void WirelessFrame::on_interfaceComboBox_currentIndexChanged(const QString &cur_
}
}
}
+
updateWidgets();
}
-void WirelessFrame::setChannel()
+void WirelessFrame::setInterfaceInfo()
{
QString cur_iface = ui->interfaceComboBox->currentText();
int cur_chan_idx = ui->channelComboBox->currentIndex();
int cur_type_idx = ui->channelTypeComboBox->currentIndex();
+ int cur_fcs_idx = ui->fcsComboBox->currentIndex();
if (cur_iface.isEmpty() || cur_chan_idx < 0 || cur_type_idx < 0) return;
@@ -274,29 +287,34 @@ void WirelessFrame::setChannel()
}
#endif
- updateWidgets();
+ if (cur_fcs_idx >= 0) {
+ if (ws80211_set_fcs_validation(cur_iface.toUtf8().constData(), (enum ws80211_fcs_validation) cur_fcs_idx) != 0) {
+ QString err_str = tr("Unable to set FCS validation behavior.");
+ emit pushAdapterStatus(err_str);
+ }
+ }
+
+ getInterfaceInfo();
+}
+
+void WirelessFrame::on_interfaceComboBox_activated(int)
+{
+ getInterfaceInfo();
}
void WirelessFrame::on_channelComboBox_activated(int)
{
- setChannel();
+ setInterfaceInfo();
}
void WirelessFrame::on_channelTypeComboBox_activated(int)
{
- setChannel();
+ setInterfaceInfo();
}
-void WirelessFrame::on_fcsComboBox_activated(int index)
+void WirelessFrame::on_fcsComboBox_activated(int)
{
- QString cur_iface = ui->interfaceComboBox->currentText();
- if (cur_iface.isEmpty()) return;
-
- if (ws80211_set_fcs_validation(cur_iface.toUtf8().constData(), (enum ws80211_fcs_validation) index) != 0) {
- QString err_str = tr("Unable to set FCS validation behavior.");
- emit pushAdapterStatus(err_str);
- }
- updateWidgets();
+ setInterfaceInfo();
}
/*
diff --git a/ui/qt/wireless_frame.h b/ui/qt/wireless_frame.h
index d9249ea647..7067473dc7 100644
--- a/ui/qt/wireless_frame.h
+++ b/ui/qt/wireless_frame.h
@@ -48,18 +48,18 @@ protected:
void timerEvent(QTimerEvent *);
private:
- void setChannel();
+ void getInterfaceInfo();
+ void setInterfaceInfo();
private slots:
void updateWidgets();
void on_helperToolButton_clicked();
void on_prefsToolButton_clicked();
- void on_interfaceComboBox_currentIndexChanged(const QString &cur_iface);
+ void on_interfaceComboBox_activated(int);
void on_channelComboBox_activated(int);
void on_channelTypeComboBox_activated(int);
-
- void on_fcsComboBox_activated(int index);
+ void on_fcsComboBox_activated(int);
private:
Ui::WirelessFrame *ui;