wpa_gui: Sort frequency and signal numerically in the scan results dialog
Signal strength was sorted lexically rather than numerically, which put "-100 dBm" before "-50 dBm" if sorted in descending order. This change fixes that. It also treats frequency in the same manner, preparing it for the IEEE 802.11ah. Signed-off-by: Adrian Nowicki <adinowicki@gmail.com>
This commit is contained in:
parent
fba25c99a5
commit
ad905e4a79
4 changed files with 43 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "signalbar.h"
|
#include "signalbar.h"
|
||||||
#include "wpagui.h"
|
#include "wpagui.h"
|
||||||
#include "networkconfig.h"
|
#include "networkconfig.h"
|
||||||
|
#include "scanresultsitem.h"
|
||||||
|
|
||||||
|
|
||||||
ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags)
|
ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags)
|
||||||
|
@ -95,7 +96,7 @@ void ScanResults::updateResults()
|
||||||
ssid = (*it).mid(pos);
|
ssid = (*it).mid(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(scanResultsWidget);
|
ScanResultsItem *item = new ScanResultsItem(scanResultsWidget);
|
||||||
if (item) {
|
if (item) {
|
||||||
item->setText(0, ssid);
|
item->setText(0, ssid);
|
||||||
item->setText(1, bssid);
|
item->setText(1, bssid);
|
||||||
|
|
18
wpa_supplicant/wpa_gui-qt4/scanresultsitem.cpp
Normal file
18
wpa_supplicant/wpa_gui-qt4/scanresultsitem.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* wpa_gui - ScanResultsItem class
|
||||||
|
* Copyright (c) 2015, Adrian Nowicki <adinowicki@gmail.com>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "scanresultsitem.h"
|
||||||
|
|
||||||
|
bool ScanResultsItem::operator< (const QTreeWidgetItem &other) const
|
||||||
|
{
|
||||||
|
int sortCol = treeWidget()->sortColumn();
|
||||||
|
if (sortCol == 2 || sortCol == 3) {
|
||||||
|
return text(sortCol).toInt() < other.text(sortCol).toInt();
|
||||||
|
}
|
||||||
|
return text(sortCol) < other.text(sortCol);
|
||||||
|
}
|
21
wpa_supplicant/wpa_gui-qt4/scanresultsitem.h
Normal file
21
wpa_supplicant/wpa_gui-qt4/scanresultsitem.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* wpa_gui - ScanResultsItem class
|
||||||
|
* Copyright (c) 2015, Adrian Nowicki <adinowicki@gmail.com>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SCANRESULTSITEM_H
|
||||||
|
#define SCANRESULTSITEM_H
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
class ScanResultsItem : public QTreeWidgetItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScanResultsItem(QTreeWidget *tree) : QTreeWidgetItem(tree) {}
|
||||||
|
bool operator< (const QTreeWidgetItem &other) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SCANRESULTSITEM_H */
|
|
@ -34,6 +34,7 @@ HEADERS += wpamsg.h \
|
||||||
wpagui.h \
|
wpagui.h \
|
||||||
eventhistory.h \
|
eventhistory.h \
|
||||||
scanresults.h \
|
scanresults.h \
|
||||||
|
scanresultsitem.h \
|
||||||
signalbar.h \
|
signalbar.h \
|
||||||
userdatarequest.h \
|
userdatarequest.h \
|
||||||
networkconfig.h \
|
networkconfig.h \
|
||||||
|
@ -45,6 +46,7 @@ SOURCES += main.cpp \
|
||||||
wpagui.cpp \
|
wpagui.cpp \
|
||||||
eventhistory.cpp \
|
eventhistory.cpp \
|
||||||
scanresults.cpp \
|
scanresults.cpp \
|
||||||
|
scanresultsitem.cpp \
|
||||||
signalbar.cpp \
|
signalbar.cpp \
|
||||||
userdatarequest.cpp \
|
userdatarequest.cpp \
|
||||||
networkconfig.cpp \
|
networkconfig.cpp \
|
||||||
|
|
Loading…
Reference in a new issue