Исправлены ошибки

pull/16/head
Igor Belitskiy 3 years ago
parent b6c8c1117e
commit f4b959be70

@ -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,17 +477,42 @@ void MainWindow::update_time_date(){
else{
str_day = to_string(day);
}
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_day+"." + str_month+"." + to_string(year));
_txtDate->set_text(str_data);
year=0;
month=0;
day=0;
}
else{
this->post_entry_data();
}
}
else{
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){
@ -505,19 +531,6 @@ void MainWindow::update_time_date(){
_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(){
time_t now = time(0);

@ -47,6 +47,7 @@ class MainWindow : public Gtk::ApplicationWindow {
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
virtual ~MainWindow() = default;
void post_entry_data();
void lacalization();
void settings();
void flag_block_gui();

Loading…
Cancel
Save