mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
fix work wit arrays
This commit is contained in:
parent
0c219544b2
commit
9184aa78f4
@ -21,7 +21,6 @@
|
||||
#include <QProcess>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "cstdio"
|
||||
|
||||
|
||||
Netctl::Netctl(MainWindow *wid, QString netctlPath, QString profileDir, QString sudoPath)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QTextStream>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
NetctlProfile::NetctlProfile(MainWindow *wid, QString profileDir, QString sudoPath)
|
||||
@ -104,11 +105,45 @@ QHash<QString, QString> NetctlProfile::getSettingsFromProfile(QString profile)
|
||||
if (profileFile.atEnd())
|
||||
break;
|
||||
else if (fileStr[0] != '#') {
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2)
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed();
|
||||
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
|
||||
if ((fileStr.split(QString("="))[1][0] == QChar('(')) &&
|
||||
(fileStr.split(QString("="))[1][fileStr.split(QString("="))[1].size()-2] == QChar(')')))
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed();
|
||||
else if (fileStr.split(QString("="))[1][0] == QChar('(')) {
|
||||
QString parameterName = fileStr.split(QString("="))[0];
|
||||
QStringList parameter;
|
||||
if (!fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed()
|
||||
.isEmpty())
|
||||
parameter.append(fileStr.split(QString("="))[1]
|
||||
.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed());
|
||||
while(true) {
|
||||
fileStr = QString(profileFile.readLine());
|
||||
if ((profileFile.atEnd()) ||
|
||||
(fileStr[fileStr.size()-2] == QChar(')')))
|
||||
break;
|
||||
if (!fileStr.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed()
|
||||
.isEmpty())
|
||||
parameter.append(fileStr.remove(QString("("))
|
||||
.remove(QString(")"))
|
||||
.trimmed());
|
||||
}
|
||||
settings[parameterName] = parameter.join(QString("\n"));
|
||||
}
|
||||
else
|
||||
settings[fileStr.split(QString("="))[0]] = fileStr.split(QString("="))[1]
|
||||
.trimmed();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "mainwindow.h"
|
||||
#include "netctlinteract.h"
|
||||
#include "sleepthread.h"
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
WpaSup::WpaSup(MainWindow *wid, QStringList wpaConfig, QString sudoPath, QString ifaceDir, QString preferedInterface)
|
||||
|
Loading…
Reference in New Issue
Block a user