mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
added flags
This commit is contained in:
parent
79fc70efa1
commit
ea522b3864
@ -20,6 +20,7 @@ Ver.1.2.0:
|
||||
* [gui] changed lineEdit_profile to comboBox
|
||||
* [gui] refactoring of configuration interface
|
||||
* [gui] changed setting of the interface to profile tab
|
||||
* [gui] rewrited ErrorWindow class
|
||||
* [lib] more debug information
|
||||
* [lib] rewrited getSettingsFromProfile() function
|
||||
* [plasmoid] edited configuration interface
|
||||
|
@ -106,6 +106,14 @@ QStringList ErrorWindow::getMessage(const int mess)
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
||||
break;
|
||||
case 17:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not find profile");
|
||||
break;
|
||||
case 18:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Could not find ESSID");
|
||||
break;
|
||||
default:
|
||||
title = QApplication::translate("ErrorWindow", "Error!");
|
||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||
@ -174,6 +182,12 @@ QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
||||
case 16:
|
||||
icon = QMessageBox::Critical;
|
||||
break;
|
||||
case 17:
|
||||
icon = QMessageBox::Critical;
|
||||
break;
|
||||
case 18:
|
||||
icon = QMessageBox::Critical;
|
||||
break;
|
||||
default:
|
||||
icon = QMessageBox::NoIcon;
|
||||
break;
|
||||
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ErrorWindow</class>
|
||||
<widget class="QMainWindow" name="ErrorWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>287</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Error</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="spacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_main">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Error text</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_button">
|
||||
<item>
|
||||
<spacer name="spacer_button1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_button2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked(bool)</signal>
|
||||
<receiver>ErrorWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>143</x>
|
||||
<y>83</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>252</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -52,35 +52,30 @@ int main(int argc, char *argv[])
|
||||
a.installTranslator(&translator);
|
||||
|
||||
// reading command line flags
|
||||
bool debug = false;
|
||||
bool defaultSettings = false;
|
||||
bool error = false;
|
||||
// windows
|
||||
bool showAbout = false;
|
||||
bool showHelp = false;
|
||||
bool showInfo = false;
|
||||
bool showNetctlAuto = false;
|
||||
bool showSettings = false;
|
||||
bool showVersion = false;
|
||||
// main functions
|
||||
QString selectEssid = QString("ESSID");
|
||||
QString openProfile = QString("PROFILE");
|
||||
QString selectProfile = QString("PROFILE");
|
||||
// additional functions
|
||||
bool debug = false;
|
||||
bool defaultSettings = false;
|
||||
int tabNumber = 1;
|
||||
// messages
|
||||
bool showVersion = false;
|
||||
bool showInfo = false;
|
||||
bool showHelp = false;
|
||||
// reading
|
||||
for (int i=1; i<argc; i++) {
|
||||
// windows
|
||||
// about
|
||||
if (QString(argv[i]) == QString("--about")) {
|
||||
showAbout = true;
|
||||
}
|
||||
// debug
|
||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||
debug = true;
|
||||
}
|
||||
// default settings
|
||||
else if (QString(argv[i]) == QString("--default")) {
|
||||
defaultSettings = true;
|
||||
}
|
||||
// default settings
|
||||
else if ((QString(argv[i]) == QString("-o")) || (QString(argv[i]) == QString("--open"))) {
|
||||
openProfile = QString(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
// netctl-auto
|
||||
else if (QString(argv[i]) == QString("--netctl-auto")) {
|
||||
showNetctlAuto = true;
|
||||
@ -89,6 +84,31 @@ int main(int argc, char *argv[])
|
||||
else if (QString(argv[i]) == QString("--settings")) {
|
||||
showSettings = true;
|
||||
}
|
||||
// main functions
|
||||
// select ESSID
|
||||
else if ((QString(argv[i]) == QString("-e")) || (QString(argv[i]) == QString("--essid"))) {
|
||||
selectEssid = QString(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
// open profile
|
||||
else if ((QString(argv[i]) == QString("-o")) || (QString(argv[i]) == QString("--open"))) {
|
||||
openProfile = QString(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
// select profile
|
||||
else if ((QString(argv[i]) == QString("-s")) || (QString(argv[i]) == QString("--select"))) {
|
||||
selectProfile = QString(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
// additional functions
|
||||
// debug
|
||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||
debug = true;
|
||||
}
|
||||
// default settings
|
||||
else if (QString(argv[i]) == QString("--default")) {
|
||||
defaultSettings = true;
|
||||
}
|
||||
// tab number
|
||||
else if ((QString(argv[i]) == QString("-t")) || (QString(argv[i]) == QString("--tab"))) {
|
||||
if (atoi(argv[i+1]) > 3)
|
||||
@ -99,6 +119,7 @@ int main(int argc, char *argv[])
|
||||
tabNumber = atoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
// messages
|
||||
// version message
|
||||
else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||
showVersion = true;
|
||||
@ -115,39 +136,59 @@ int main(int argc, char *argv[])
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
if (selectEssid != QString("ESSID"))
|
||||
tabNumber = 3;
|
||||
if (openProfile != QString("PROFILE"))
|
||||
tabNumber = 2;
|
||||
if (selectProfile != QString("PROFILE"))
|
||||
tabNumber = 1;
|
||||
|
||||
// messages
|
||||
QString errorMessage = QApplication::translate("MainWindow", "Unknown flag\n");
|
||||
|
||||
QString helpMessage = QString("");
|
||||
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
||||
helpMessage += QString("netctl-gui [ --about ] [ -d | --debug ] [ --default ] [ -o PROFILE | --open PROFILE ]\n");
|
||||
helpMessage += QString(" [ --netctl-auto ] [ --settings ] [ -t NUM | --tab NUM ] [ -v | --version ]\n");
|
||||
helpMessage += QString(" [ -i | --info ] [ -h | --help]\n\n");
|
||||
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Usage:"));
|
||||
helpMessage += QString("netctl-gui [ --about ] [ --netctl-auto ] [ --settings ]\n");
|
||||
helpMessage += QString(" [ -e ESSID | --essid ESSID ] [ -o PROFILE | --open PROFILE ]\n");
|
||||
helpMessage += QString(" [ -s PROFILE | --select PROFILE ]\n");
|
||||
helpMessage += QString(" [ -d | --debug ] [ --default ] [ -t NUM | --tab NUM ]\n");
|
||||
helpMessage += QString(" [ -v | --version ] [ -i | --info ] [ -h | --help]\n\n");
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Parametrs:"));
|
||||
// windows
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Open window:"));
|
||||
helpMessage += QString("%1 --about - %2\n")
|
||||
.arg(isParametrEnable(showAbout))
|
||||
.arg(QApplication::translate("MainWindow", "show about window"));
|
||||
helpMessage += QString("%1 -d --debug - %2\n")
|
||||
.arg(isParametrEnable(debug))
|
||||
.arg(QApplication::translate("MainWindow", "print debug information"));
|
||||
helpMessage += QString("%1 --default - %2\n")
|
||||
.arg(isParametrEnable(defaultSettings))
|
||||
.arg(QApplication::translate("MainWindow", "start with default settings"));
|
||||
helpMessage += QString(" -o %1 --open %1 - %2\n")
|
||||
.arg(openProfile)
|
||||
.arg(QApplication::translate("MainWindow", "open profile %1").arg(openProfile));
|
||||
helpMessage += QString("%1 --netctl-auto - %2\n")
|
||||
.arg(isParametrEnable(showNetctlAuto))
|
||||
.arg(QApplication::translate("MainWindow", "show netctl-auto window"));
|
||||
helpMessage += QString("%1 --settings - %2\n")
|
||||
.arg(isParametrEnable(showSettings))
|
||||
.arg(QApplication::translate("MainWindow", "show settings window"));
|
||||
// main functions
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Functions:"));
|
||||
helpMessage += QString(" -e %1 --essid %1 - %2\n")
|
||||
.arg(selectEssid, -10)
|
||||
.arg(QApplication::translate("MainWindow", "select ESSID %1").arg(selectEssid));
|
||||
helpMessage += QString(" -o %1 --open %1 - %2\n")
|
||||
.arg(openProfile, -10)
|
||||
.arg(QApplication::translate("MainWindow", "open profile %1").arg(openProfile));
|
||||
helpMessage += QString(" -s %1 --select %1 - %2\n")
|
||||
.arg(selectProfile, -10)
|
||||
.arg(QApplication::translate("MainWindow", "select profile %1").arg(selectProfile));
|
||||
// additional functions
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Additional flags:"));
|
||||
helpMessage += QString("%1 -d --debug - %2\n")
|
||||
.arg(isParametrEnable(debug))
|
||||
.arg(QApplication::translate("MainWindow", "print debug information"));
|
||||
helpMessage += QString("%1 --default - %2\n")
|
||||
.arg(isParametrEnable(defaultSettings))
|
||||
.arg(QApplication::translate("MainWindow", "start with default settings"));
|
||||
helpMessage += QString(" -t %1 --tab %1 - %2\n")
|
||||
.arg(QString::number(tabNumber))
|
||||
.arg(QString::number(tabNumber), -3)
|
||||
.arg(QApplication::translate("MainWindow", "open a tab with number %1").arg(QString::number(tabNumber)));
|
||||
// messages
|
||||
helpMessage += QString("%1\n").arg(QApplication::translate("MainWindow", "Show messages:"));
|
||||
helpMessage += QString(" -v --version - %1\n")
|
||||
.arg(QApplication::translate("MainWindow", "show version and exit"));
|
||||
helpMessage += QString(" -i --info - %1\n")
|
||||
@ -192,7 +233,10 @@ int main(int argc, char *argv[])
|
||||
cout << versionMessage.toUtf8().data();
|
||||
return 0;
|
||||
}
|
||||
MainWindow w(0, debug, defaultSettings, showAbout, showNetctlAuto, showSettings, tabNumber, openProfile);
|
||||
MainWindow w(0,
|
||||
showAbout, showNetctlAuto, showSettings,
|
||||
selectEssid, openProfile, selectProfile,
|
||||
debug, defaultSettings, tabNumber);
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -46,27 +46,30 @@
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent,
|
||||
const bool debugCmd,
|
||||
const bool defaultSettings,
|
||||
const bool showAbout,
|
||||
const bool showNetctlAuto,
|
||||
const bool showSettings,
|
||||
const int tabNum,
|
||||
const QString openProfile)
|
||||
const QString selectEssid,
|
||||
const QString openProfile,
|
||||
const QString selectProfile,
|
||||
const bool debugCmd,
|
||||
const bool defaultSettings,
|
||||
const int tabNum)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
debug(debugCmd)
|
||||
{
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "debug" << debug;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "defaultSettings" << defaultSettings;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "showAbout" << showAbout;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "showNetctlAuto" << showNetctlAuto;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "showSettings" << showSettings;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "tabNum" << tabNum;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "selectEssid" << selectEssid;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "openProfile" << openProfile;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "selectProfile" << selectProfile;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "debug" << debug;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "defaultSettings" << defaultSettings;
|
||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "tabNum" << tabNum;
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
||||
|
||||
// reading configuration
|
||||
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
|
||||
QDir::separator() + QString("netctl-gui.conf");
|
||||
settingsWin = new SettingsWindow(this, debug, configPath);
|
||||
@ -74,8 +77,14 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
settingsWin->setDefault();
|
||||
configuration = settingsWin->getSettings();
|
||||
|
||||
// gui
|
||||
// backend
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
// frontend
|
||||
// windows
|
||||
ui->setupUi(this);
|
||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
||||
aboutWin = new AboutWindow(this, debug);
|
||||
errorWin = new ErrorWindow(this, debug);
|
||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||
@ -102,21 +111,10 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(vlanWid);
|
||||
wirelessWid = new WirelessWidget(this, configuration);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(wirelessWid);
|
||||
// backend
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
|
||||
createActions();
|
||||
setIconsToButtons();
|
||||
updateTabs(ui->tabWidget->currentIndex());
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
||||
|
||||
if (openProfile != QString("PROFILE")) {
|
||||
ui->comboBox_profile->addItem(openProfile);
|
||||
ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1);
|
||||
profileTabLoadProfile();
|
||||
}
|
||||
|
||||
if (showAbout)
|
||||
aboutWin->show();
|
||||
@ -124,6 +122,27 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
netctlAutoWin->showWindow();
|
||||
if (showSettings)
|
||||
settingsWin->showWindow();
|
||||
|
||||
if (selectEssid != QString("ESSID")) {
|
||||
for (int i=0; i<ui->tableWidget_wifi->rowCount(); i++)
|
||||
if (ui->tableWidget_wifi->item(i, 0)->text() == selectEssid)
|
||||
ui->tableWidget_wifi->setCurrentCell(i, 0);
|
||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||
errorWin->showWindow(18, QString("[MainWindow] : [MainWindow]"));
|
||||
}
|
||||
else if (openProfile != QString("PROFILE")) {
|
||||
ui->comboBox_profile->addItem(openProfile);
|
||||
ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1);
|
||||
}
|
||||
else if (selectProfile != QString("PROFILE")) {
|
||||
for (int i=0; i<ui->tableWidget_main->rowCount(); i++)
|
||||
if (ui->tableWidget_main->item(i, 0)->text() == selectProfile)
|
||||
ui->tableWidget_main->setCurrentCell(i, 0);
|
||||
if (ui->tableWidget_main->currentItem() == 0)
|
||||
errorWin->showWindow(17, QString("[MainWindow] : [MainWindow]"));
|
||||
}
|
||||
|
||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
||||
}
|
||||
|
||||
|
||||
@ -608,8 +627,6 @@ void MainWindow::mainTabEditProfile()
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
ui->comboBox_profile->addItem(profile);
|
||||
ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1);
|
||||
|
||||
profileTabLoadProfile();
|
||||
}
|
||||
|
||||
|
||||
@ -1077,7 +1094,11 @@ void MainWindow::profileTabLoadProfile()
|
||||
if (debug) qDebug() << "[MainWindow]" << "[profileTabLoadProfile]";
|
||||
|
||||
QString profile = QFileInfo(ui->comboBox_profile->currentText()).fileName();
|
||||
if (profile.isEmpty())
|
||||
return;
|
||||
QMap<QString, QString> settings = netctlProfile->getSettingsFromProfile(profile);
|
||||
if (settings.isEmpty())
|
||||
return errorWin->showWindow(17, QString("[MainWindow] : [profileTabLoadProfile]"));
|
||||
|
||||
generalWid->setSettings(settings);
|
||||
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||
|
@ -53,13 +53,15 @@ class MainWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const bool defaultSettings = false,
|
||||
const bool showAbout = false,
|
||||
const bool showNetctlAuto = false,
|
||||
const bool showSettings = false,
|
||||
const int tabNum = 1,
|
||||
const QString openProfile = QString("PROFILE"));
|
||||
const QString selectEssid = QString("ESSID"),
|
||||
const QString openProfile = QString("PROFILE"),
|
||||
const QString selectProfile = QString("PROFILE"),
|
||||
const bool debugCmd = false,
|
||||
const bool defaultSettings = false,
|
||||
const int tabNum = 1);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
|
@ -116,19 +116,32 @@ QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profi
|
||||
}
|
||||
|
||||
// getting variables list
|
||||
QMap<QString, QString> settings;
|
||||
// system variables
|
||||
QProcess shell;
|
||||
QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(profile).fileName();
|
||||
QString cmd = QString("env -i bash -c \"source ") + profileUrl + QString("; set\"");
|
||||
QString cmd = QString("env -i bash -c \"set\"");
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]" << ":" << "Run cmd" << cmd;
|
||||
shell.start(cmd);
|
||||
shell.waitForFinished(-1);
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]" << ":" << "Cmd returns" << shell.exitCode();
|
||||
QStringList output = QString(shell.readAllStandardOutput()).trimmed().split(QChar('\n'));
|
||||
QStringList systemVariables;
|
||||
systemVariables.append(QString("PIPESTATUS"));
|
||||
for (int i=0; i<output.count(); i++)
|
||||
systemVariables.append(output[i].split(QChar('='))[0]);
|
||||
// profile variables
|
||||
QMap<QString, QString> settings;
|
||||
QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(profile).fileName();
|
||||
cmd = QString("env -i bash -c \"source ") + profileUrl + QString("; set\"");
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]" << ":" << "Run cmd" << cmd;
|
||||
shell.start(cmd);
|
||||
shell.waitForFinished(-1);
|
||||
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]" << ":" << "Cmd returns" << shell.exitCode();
|
||||
output = QString(shell.readAllStandardOutput()).trimmed().split(QChar('\n'));
|
||||
|
||||
// gettings variables
|
||||
QStringList keys;
|
||||
for (int i=0; i<output.count(); i++)
|
||||
if (!systemVariables.contains(output[i].split(QChar('='))[0]))
|
||||
keys.append(output[i].split(QChar('='))[0]);
|
||||
for (int i=0; i<keys.count(); i++){
|
||||
cmd = QString("env -i bash -c \"source ") + profileUrl +
|
||||
|
Loading…
Reference in New Issue
Block a user