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