added flag --config

updated translations
This commit is contained in:
arcan1s
2014-07-15 20:40:20 +04:00
parent 8b91f43f0b
commit 3542901781
12 changed files with 1682 additions and 659 deletions

View File

@ -102,6 +102,11 @@ int main(int argc, char *argv[])
i++;
}
// additional functions
// config path
else if (QString(argv[i]) == QString("--config")) {
configPath = QString(argv[i+1]);
i++;
}
// debug
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
debug = true;
@ -157,8 +162,8 @@ int main(int argc, char *argv[])
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 ] [ --set-opts OPTIONS ]\n");
helpMessage += QString(" [ -t NUM | --tab NUM ]\n");
helpMessage += QString(" [ --config FILE ] [ -d | --debug ] [ --default ]\n");
helpMessage += QString(" [ --set-opts OPTIONS ] [ -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
@ -254,7 +259,7 @@ int main(int argc, char *argv[])
MainWindow w(0,
showAbout, showNetctlAuto, showSettings,
selectEssid, openProfile, selectProfile,
debug, defaultSettings, options, tabNumber);
configPath, debug, defaultSettings, options, tabNumber);
w.show();
return a.exec();
}

View File

@ -52,6 +52,7 @@ MainWindow::MainWindow(QWidget *parent,
const QString selectEssid,
const QString openProfile,
const QString selectProfile,
const QString configPath,
const bool debugCmd,
const bool defaultSettings,
const QString options,
@ -72,8 +73,6 @@ MainWindow::MainWindow(QWidget *parent,
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "tabNum" << tabNum;
// reading configuration
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
QDir::separator() + QString("netctl-gui.conf");
settingsWin = new SettingsWindow(this, debug, configPath);
if (defaultSettings)
settingsWin->setDefault();
@ -403,8 +402,11 @@ void MainWindow::updateMainTab()
ui->tableWidget_main->setRowCount(profiles.count());
// create header
ui->tableWidget_main->setHorizontalHeaderLabels(QApplication::translate("MainWindow", "Name==Description==Status")
.split(QString("==")));
QStringList headerList;
headerList.append(QApplication::translate("MainWindow", "Name"));
headerList.append(QApplication::translate("MainWindow", "Description"));
headerList.append(QApplication::translate("MainWindow", "Status"));
ui->tableWidget_main->setHorizontalHeaderLabels(headerList);
// create items
for (int i=0; i<profiles.count(); i++) {
// name
@ -513,8 +515,12 @@ void MainWindow::updateWifiTab()
ui->tableWidget_wifi->setRowCount(scanResults.count());
// create header
ui->tableWidget_wifi->setHorizontalHeaderLabels(QApplication::translate("MainWindow", "Name==Status==Signal==Security")
.split(QString("==")));
QStringList headerList;
headerList.append(QApplication::translate("MainWindow", "Name"));
headerList.append(QApplication::translate("MainWindow", "Status"));
headerList.append(QApplication::translate("MainWindow", "Signal"));
headerList.append(QApplication::translate("MainWindow", "Security"));
ui->tableWidget_wifi->setHorizontalHeaderLabels(headerList);
// create items
for (int i=0; i<scanResults.count(); i++) {
// name

View File

@ -59,6 +59,7 @@ public:
const QString selectEssid = QString("ESSID"),
const QString openProfile = QString("PROFILE"),
const QString selectProfile = QString("PROFILE"),
const QString configPath = QString(""),
const bool debugCmd = false,
const bool defaultSettings = false,
const QString options = QString("OPTIONS"),

View File

@ -116,8 +116,12 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
ui->tableWidget->setRowCount(profiles.count());
// create header
ui->tableWidget->setHorizontalHeaderLabels(QApplication::translate("NetctlAutoWindow", "Name==Description==Active==Disabled")
.split(QString("==")));
QStringList headerList;
headerList.append(QApplication::translate("NetctlAutoWindow", "Name"));
headerList.append(QApplication::translate("NetctlAutoWindow", "Description"));
headerList.append(QApplication::translate("NetctlAutoWindow", "Active"));
headerList.append(QApplication::translate("NetctlAutoWindow", "Disabled"));
ui->tableWidget->setHorizontalHeaderLabels(headerList);
// create items
for (int i=0; i<profiles.count(); i++) {
// name

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>netctl-auto</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
@ -78,7 +78,9 @@
<string>Refresh</string>
</property>
<property name="icon">
<iconset theme="stock-refresh"/>
<iconset theme="stock-refresh">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -114,7 +116,9 @@
<string>Switch</string>
</property>
<property name="icon">
<iconset theme="dialog-apply"/>
<iconset theme="dialog-apply">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -187,7 +191,9 @@
</action>
<action name="actionEnableAll">
<property name="icon">
<iconset theme="edit-add"/>
<iconset theme="edit-add">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Enable all profiles</string>
@ -195,7 +201,9 @@
</action>
<action name="actionDisableAll">
<property name="icon">
<iconset theme="edit-delete"/>
<iconset theme="edit-delete">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Disable all profiles</string>
@ -218,7 +226,9 @@
</action>
<action name="actionRefresh">
<property name="icon">
<iconset theme="stock-refresh"/>
<iconset theme="stock-refresh">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Refresh</string>