Browse Source

fix definition of noDigitRegex

master
Brad Parker 10 years ago
parent
commit
e64c045405
  1. 8
      wireless.cpp
  2. 2
      wireless.h

8
wireless.cpp

@ -13,7 +13,6 @@ extern "C" {
#include "utils.h"
#include <iostream>
#include <QStringList>
#include <QRegularExpression>
#define BIT(x) (1ULL<<(x))
@ -95,6 +94,8 @@ struct nl_interfaceCallback {
\brief The Wireless class is used to manage 802.11 wireless information associated with an interface. Currently this class makes the assumption that it will only be used within the United States FCC regulatory domain. Only drivers supporting the Linux kernel nl80211 interface are supported.
*/
static QRegularExpression s_noDigitRegex("[^\\d]");
/*!
Constructs a Wireless object. All operations will be limited to the specified \a interface.
*/
@ -103,7 +104,6 @@ QObject(0),
m_interface(interface),
m_interfaceType(),
m_bands(),
m_noDigitRegex("[^\\d]"),
m_isValid(false),
m_isNL80211(false),
m_iftype(NL80211_IFTYPE_UNSPECIFIED)
@ -406,7 +406,7 @@ int Wireless::ChanToFreq(int channel) {
*/
QString Wireless::ChanToFreq(QString channel, QString outputFormat) {
QString freq;
channel = channel.replace(m_noDigitRegex, "");
channel = channel.replace(s_noDigitRegex, "");
if(outputFormat.isEmpty()) {
bool ok = false;
@ -442,7 +442,7 @@ int Wireless::FreqToChan(int frequency) {
*/
QString Wireless::FreqToChan(QString frequency, QString outputFormat) {
QString chan;
frequency = frequency.replace(m_noDigitRegex, "");
frequency = frequency.replace(s_noDigitRegex, "");
if(frequency.length() < 4) {
for(int i = frequency.length() + 1; i <= 4; ++i) {

2
wireless.h

@ -5,6 +5,7 @@
#include <QMap>
#include "libip_global.h"
#include <linux/nl80211.h>
#include <QRegularExpression>
class LIBIP_EXPORT Wireless : public QObject {
Q_OBJECT
@ -97,7 +98,6 @@ private:
QString m_interface;
QString m_interfaceType;
QList<BandInfo> m_bands;
QRegularExpression m_noDigitRegex;
bool m_isValid;
bool m_isNL80211;
nl80211_iftype m_iftype;

Loading…
Cancel
Save