Merge pull request 'master' (#33) from Igor1/ubl-settings-datetime:master into develop

Reviewed-on: #33
pull/35/head
Dmitry Razumov 3 years ago
commit c54f466578

@ -122,6 +122,7 @@ int MainWindow::check_root(){
}
void MainWindow::lacalization(){
txtDate->set_tooltip_text(_("Date of\nFormat: DD.MM.YYYY"));
txtNtpServer->set_tooltip_text(_("Enter the name of the ntp server or its ip address.\nWhen entering multiple addresses, separate them with spaces."));
lblSynchronizebChkGLob->set_text(_("Synchronize via NTP"));
cbDhcp->append(_("By default"));
cbDhcp->append(_("DHCP"));
@ -290,15 +291,21 @@ void MainWindow::wind_close_ntp(){
void MainWindow::stop_ntp(){
windowsNnpClose->hide();
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; "
"SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; "
"SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "
"SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; ";
system(cmd.c_str());
cmd ="SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
system(cmd.c_str());
cmd ="SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
system(cmd.c_str());
cmd = "SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
system(cmd.c_str());
cmd ="SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; ";
system(cmd.c_str());
cmd ="SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
system(cmd.c_str());
cmd ="SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
system(cmd.c_str());
this->update_time_date();
}
@ -463,8 +470,6 @@ void MainWindow::get_config(){
this->update_hour_minute();
this->update_calendar();
this->enry_dhcp_mess();
string read_reg_zon_cfg = this->call("/usr/bin/ubconfig get clock ZONE");
if ((read_reg_zon_cfg != "") && (strstr(read_reg_zon_cfg.c_str() ,"(null)")==NULL)){
read_reg_zon_cfg = read_reg_zon_cfg.substr(read_reg_zon_cfg.find("=")+1,read_reg_zon_cfg.length());
@ -688,7 +693,6 @@ void MainWindow::update_time_date(){
cmd = "date +%Y%m%d -s \"" + to_string(year)+
str_month+str_day+"\"";
system(cmd.c_str());
txtDate->set_text(str_data);
year=0;
month=0;
@ -794,7 +798,6 @@ void MainWindow::read_file(){
}
in1.close();
}
time_reg_map.insert({key_reg, zone});
time_reg_map_local.insert({key_reg, zone_local});
}}}}
@ -805,7 +808,6 @@ void MainWindow::read_file(){
}
string MainWindow::zone_file_read(string zone){
if (zone.length()==1){
return "";
}

@ -807,6 +807,7 @@ Format: DD.MM.YYYY</property>
<property name="width-request">-1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Enter the name of the ntp server or its ip address. When entering multiple addresses, separate them with spaces.</property>
<property name="valign">center</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>

@ -1593,3 +1593,6 @@ msgstr "Майотта"
msgid "BajaSur"
msgstr "Южная Нижняя Калифорния"
msgid "Enter the name of the ntp server or its ip address.\nWhen entering multiple addresses, separate them with spaces."
msgstr "Введите имя ntp-сервера или его ip-адрес.\nПри вводе нескольких адресов, разделяйте их пробелами."

Loading…
Cancel
Save