|
|
|
|
@ -75,7 +75,7 @@ void MainWindow::settings(){
|
|
|
|
|
this->parse_text_date();
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::lacalization(){
|
|
|
|
|
_txtDate->set_tooltip_text("Date of\nFormat: DD.MM.YYYY");
|
|
|
|
|
_txtDate->set_tooltip_text(gettext("Date of\nFormat: DD.MM.YYYY"));
|
|
|
|
|
_lblSynchronizebChk->set_text(gettext("Synchronize via NTP"));
|
|
|
|
|
_cbDhcp->append(gettext("DHCP"));
|
|
|
|
|
_cbDhcp->append(gettext("Manually"));
|
|
|
|
|
@ -167,7 +167,7 @@ void MainWindow::get_builder(){
|
|
|
|
|
|
|
|
|
|
void MainWindow::event(){
|
|
|
|
|
_btnMessClose->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::gui_mess_close));
|
|
|
|
|
_cldrDate->signal_day_selected().connect(sigc::mem_fun(*this, &MainWindow::get_calendar));
|
|
|
|
|
//_cldrDate->signal_day_selected().connect(sigc::mem_fun(*this, &MainWindow::get_calendar));
|
|
|
|
|
_cbxSynchronizeNtp->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle));
|
|
|
|
|
_btnUpdateDateTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::update_time_date));
|
|
|
|
|
_btnChooseDate->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::calendar_show));
|
|
|
|
|
@ -177,9 +177,10 @@ void MainWindow::event(){
|
|
|
|
|
_cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone));
|
|
|
|
|
_cbZoneGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone_glob));
|
|
|
|
|
_txtNtpServer->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_ntp));
|
|
|
|
|
//_cldrDate->signal_day_selected_double_click().connect(sigc::mem_fun(*this, &MainWindow::get_calendar));
|
|
|
|
|
_cldrDate->signal_day_selected_double_click().connect(sigc::mem_fun(*this, &MainWindow::get_calendar));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::gui_mess_close(){
|
|
|
|
|
_mess_dchp->hide();
|
|
|
|
|
}
|
|
|
|
|
@ -476,18 +477,43 @@ void MainWindow::update_time_date(){
|
|
|
|
|
else{
|
|
|
|
|
str_day = to_string(day);
|
|
|
|
|
}
|
|
|
|
|
cmd = "date +%Y%m%d -s \"" + to_string(year)+
|
|
|
|
|
str_month+str_day+"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
cmd = "hwclock --systohc";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
_txtDate->set_text(str_day+"." + str_month+"." + to_string(year));
|
|
|
|
|
year=0;
|
|
|
|
|
month=0;
|
|
|
|
|
day=0;
|
|
|
|
|
string str_data = "";
|
|
|
|
|
str_data = str_day+"." + str_month+"." + to_string(year);
|
|
|
|
|
string str_data_entry = _txtDate->get_text();
|
|
|
|
|
if (str_data==str_data_entry){
|
|
|
|
|
cmd = "date +%Y%m%d -s \"" + to_string(year)+
|
|
|
|
|
str_month+str_day+"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
cmd = "hwclock --systohc";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
_txtDate->set_text(str_data);
|
|
|
|
|
year=0;
|
|
|
|
|
month=0;
|
|
|
|
|
day=0;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this->post_entry_data();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
string cmd = "";
|
|
|
|
|
this->post_entry_data();
|
|
|
|
|
}
|
|
|
|
|
if (flag==false){
|
|
|
|
|
hour = _numTimeHrs->get_value_as_int();
|
|
|
|
|
minute = _numTimeMin->get_value_as_int();
|
|
|
|
|
time_t now = time(0);
|
|
|
|
|
tm *ltm = localtime(&now);
|
|
|
|
|
cmd = "date +%T -s \""+
|
|
|
|
|
to_string(hour) + ":" + to_string(minute)
|
|
|
|
|
+ ":" + to_string(ltm->tm_sec) +"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
cmd = "hwclock --systohc";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::post_entry_data(){
|
|
|
|
|
string cmd = "";
|
|
|
|
|
string data = _txtDate->get_text();
|
|
|
|
|
if (data.length()==10){
|
|
|
|
|
string str_day = data.substr(0,2);
|
|
|
|
|
@ -504,19 +530,6 @@ void MainWindow::update_time_date(){
|
|
|
|
|
_lblMessage->set_text(gettext("Incorrect date format"));
|
|
|
|
|
_mess_dchp->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag==false){
|
|
|
|
|
hour = _numTimeHrs->get_value_as_int();
|
|
|
|
|
minute = _numTimeMin->get_value_as_int();
|
|
|
|
|
time_t now = time(0);
|
|
|
|
|
tm *ltm = localtime(&now);
|
|
|
|
|
cmd = "date +%T -s \""+
|
|
|
|
|
to_string(hour) + ":" + to_string(minute)
|
|
|
|
|
+ ":" + to_string(ltm->tm_sec) +"\"";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
cmd = "hwclock --systohc";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::update_hour_minute(){
|
|
|
|
|
|