mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-08 03:15:54 +00:00
+ new Verbose* DBus calls
+ new force request to netctl (DBus) + PointType enum + notification on hidding, + new columns in WiFi menu * improve user expierence * fix language definition * fix tests * update 3rdparty components * small refactoring
This commit is contained in:
@ -34,19 +34,40 @@
|
||||
class Netctl;
|
||||
class NetctlProfile;
|
||||
|
||||
/**
|
||||
* @enum PointType
|
||||
* @brief WiFi point type
|
||||
* @var PointType::None
|
||||
* type is not defined
|
||||
* @var PointType::TwoG
|
||||
* point is only 2 GHz
|
||||
* @var PointType::FiveG
|
||||
* point is only 5 GHz
|
||||
* @var PointType::TwoAndFiveG
|
||||
* point has 2 and 5 GHz
|
||||
*/
|
||||
enum PointType {
|
||||
None = 0,
|
||||
TwoG,
|
||||
FiveG,
|
||||
TwoAndFiveG
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct netctlWifiInfo
|
||||
* @brief WiFi information structure
|
||||
* @var netctlWifiInfo::frequencies
|
||||
* point frequencies
|
||||
* @var netctlWifiInfo::macs
|
||||
* point MAC addresses
|
||||
* @var netctlWifiInfo::name
|
||||
* ESSID
|
||||
* @var netctlWifiInfo::security
|
||||
* may be "WPA2", "WEP", "WEP", "none"
|
||||
* @var netctlWifiInfo::signal
|
||||
* Wifi point signal
|
||||
* @var netctlWifiInfo::macs
|
||||
* point MAC addresses
|
||||
* @var netctlWifiInfo::frequencies
|
||||
* point frequencies
|
||||
* @var netctlWifiInfo::type
|
||||
* WiFi point type
|
||||
* @var netctlWifiInfo::active
|
||||
* whether associated profile is active
|
||||
* @var netctlWifiInfo::exists
|
||||
@ -54,11 +75,12 @@ class NetctlProfile;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
QStringList frequencies;
|
||||
QList<int> frequencies;
|
||||
QStringList macs;
|
||||
QString name;
|
||||
QString security;
|
||||
int signal;
|
||||
PointType type = PointType::None;
|
||||
bool active;
|
||||
bool exists;
|
||||
} netctlWifiInfo;
|
||||
|
@ -280,10 +280,23 @@ QList<netctlWifiInfo> WpaSup::scanWifi()
|
||||
// append mac and frequency if exists
|
||||
int index = names.indexOf(name);
|
||||
if ((name != QString("<hidden>")) && (index > -1)) {
|
||||
scanResults[index].frequencies.append(line[1]);
|
||||
scanResults[index].frequencies.append(line[1].toInt());
|
||||
scanResults[index].macs.append(line[0]);
|
||||
if (scanResults[index].signal < line[2].toInt())
|
||||
scanResults[index].signal = line[2].toInt();
|
||||
// check type
|
||||
if ((line[1].toInt() >= 5000) && (line[1].toInt() < 6000)) {
|
||||
if (scanResults[index].type == PointType::None)
|
||||
scanResults[index].type = PointType::FiveG;
|
||||
else if (scanResults[index].type == PointType::TwoG)
|
||||
scanResults[index].type = PointType::TwoAndFiveG;
|
||||
} else if ((line[1].toInt() < 5000) && (line[1].toInt() > 2000)) {
|
||||
if (scanResults[index].type == PointType::None)
|
||||
scanResults[index].type = PointType::TwoG;
|
||||
else if (scanResults[index].type == PointType::FiveG)
|
||||
scanResults[index].type = PointType::TwoAndFiveG;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -304,7 +317,14 @@ QList<netctlWifiInfo> WpaSup::scanWifi()
|
||||
// mac
|
||||
wifiPoint.macs.append(line[0]);
|
||||
// frequencies
|
||||
wifiPoint.frequencies.append(line[1]);
|
||||
wifiPoint.frequencies.append(line[1].toInt());
|
||||
// type
|
||||
// check type
|
||||
if ((line[1].toInt() >= 5000) && (line[1].toInt() < 6000)) {
|
||||
wifiPoint.type = PointType::FiveG;
|
||||
} else if ((line[1].toInt() < 5000) && (line[1].toInt() > 2000)) {
|
||||
wifiPoint.type = PointType::TwoG;
|
||||
}
|
||||
// point signal
|
||||
wifiPoint.signal = line[2].toInt();
|
||||
// point security
|
||||
@ -422,8 +442,8 @@ QString WpaSup::getWpaCliOutput(const QString commandLine)
|
||||
}
|
||||
|
||||
QString interface = interfaces[0];
|
||||
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
||||
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
||||
QString cmd = QString("%1 -i %2 -p %3 -P %4 %5").arg(wpaCliPath).arg(interface)
|
||||
.arg(ctrlDir).arg(pidFile).arg(commandLine);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd;
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
@ -479,8 +499,8 @@ bool WpaSup::wpaCliCall(const QString commandLine)
|
||||
}
|
||||
|
||||
QString interface = interfaces[0];
|
||||
QString cmd = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
|
||||
QString(" -P ") + pidFile + QString(" ") + commandLine;
|
||||
QString cmd = QString("%1 -i %2 -p %3 -P %4 %5").arg(wpaCliPath).arg(interface)
|
||||
.arg(ctrlDir).arg(pidFile).arg(commandLine);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd;
|
||||
TaskResult process = runTask(cmd);
|
||||
waitForProcess(1);
|
||||
|
Reference in New Issue
Block a user