translation improvement

This commit is contained in:
xueyan hu
2021-12-28 18:23:02 +08:00
parent f43fd26411
commit 656f46c17e
32 changed files with 1620 additions and 914 deletions

View File

@@ -32,8 +32,16 @@
// args << "-c" << cmd;
// myProcess->start("/bin/sh", args);
//}
host NetworkManager::getLocalHost()
{
return JsonObject::Instance()->getServer(JsonObject::LOCAL);
}
bool NetworkManager::setLocalHost(const host& h)
{
JsonObject::Instance()->setServer(JsonObject::LOCAL, h);
return true;
}
QString NetworkManager::interfaceName()
{
return JsonObject::Instance()->interfaceName();
@@ -67,7 +75,7 @@ bool NetworkManager::restart(QString& err_info)
QProcess* myProcess = new QProcess;
QString inface = JsonObject::Instance()->interfaceName();
QString pwd = JsonObject::Instance()->passWord();
QString cmd = QString("echo %1 | sudo -S rcnetwork restart %2").arg(pwd).arg(inface);
QString cmd = QString("echo %1 | sudo -S rcnetwork restart %2").arg(pwd).arg(inface);
QStringList args;
args << "-c" << cmd;
connect(myProcess, SIGNAL(finished(int)), myProcess, SLOT(deleteLater()));
@@ -206,12 +214,12 @@ bool NetworkManager::setDefaultGateway(const QString& gw, QString& err_info)
}
bool NetworkManager::checkPassWord(const QString &pwd,QString& err_info)
bool NetworkManager::checkPassWord(const QString& pwd, QString& err_info)
{
QProcess* myProcess = new QProcess;
//QString pwd = JsonObject::Instance()->passWord();
QString cmd = QString("echo %1 | sudo -S -k whoami").arg(pwd);
//QString pwd = JsonObject::Instance()->passWord();
QString cmd = QString("echo %1 | sudo -S -k whoami").arg(pwd);
QStringList args;
args << "-c" << cmd;
connect(myProcess, SIGNAL(finished(int)), myProcess, SLOT(deleteLater()));

View File

@@ -10,6 +10,8 @@ class NetworkManager : public QObject
{
Q_OBJECT
public:
static host getLocalHost();
static bool setLocalHost(const host& h);
//static NetworkManager* Instance();
//static void qIfConfig(const localhost& lhost);
static QString interfaceName();
@@ -20,7 +22,7 @@ public:
static QList<QStringList> getIpRouteList();
//static void setInterfaceName(const QString& name);
static bool checkPassWord(const QString &pwd,QString& err_info);
static bool checkPassWord(const QString& pwd, QString& err_info);
static bool restart(QString& err_info);
static bool setJsonDHCP(bool enable);