Дополнена локализация

pull/31/head
Igor Belitskiy 3 years ago
parent b79957160d
commit bf45c57066

@ -36,8 +36,7 @@ bool flag_ntp = false;
bool flag_update = false;
CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help)
: Glib::OptionGroup{p_name, p_description, p_help}
{
: Glib::OptionGroup{p_name, p_description, p_help}{
Glib::OptionEntry socketIDArg;
socketIDArg.set_long_name("socket-id");
socketIDArg.set_short_name('s');
@ -98,7 +97,6 @@ void MainWindow::settings(){
lblRegGlob->set_sensitive(false);
lblZone1Glob->set_sensitive(false);
lblDateTimeSetting->set_sensitive(false);
}
}
@ -110,6 +108,7 @@ int MainWindow::check_root(){
}
return 0;
}
void MainWindow::lacalization(){
txtDate->set_tooltip_text(gettext("Date of\nFormat: DD.MM.YYYY"));
lblSynchronizebChkGLob->set_text(gettext("Synchronize via NTP"));
@ -136,14 +135,10 @@ void MainWindow::lacalization(){
lblBanerStopNtp->set_text(gettext("Active service detected\nAutomatic time and date synchronization service detected"));
lblNtpStop->set_text(gettext("Stop the synchronization service"));
lblNtpClose->set_text(gettext("Close"));
//_lblSynchronizebChk->set_text(gettext("Synchronize via NTP"));
}
void MainWindow::flag_block_gui(){
if (flag_datetime==true){
//numTimeHrs->set_sensitive(false);
//numTimeMin->set_sensitive(false);
//txtDate->set_sensitive(false);
btnUpdateDateTime->set_sensitive(false);
numTimeHrs->set_sensitive(false);
numTimeMin->set_sensitive(false);
@ -153,14 +148,12 @@ void MainWindow::flag_block_gui(){
btnHardwareTime->set_sensitive(false);
lblTime->set_sensitive(false);
lblData->set_sensitive(false);
//cbxSynchronizeNtpGlob->set_sensitive(false);
}
if (flag_timezone==true){
cbRegion->set_sensitive(false);
cbZone->set_sensitive(false);
cbRegionGlob->set_sensitive(false);
cbZoneGlob->set_sensitive(false);
//btnChooseDate->set_sensitive(false);
cbDhcp->set_sensitive(false);
}
if (flag_ntp==true){
@ -170,7 +163,6 @@ void MainWindow::flag_block_gui(){
}
if (flag_update==true){
lblDateTimeSettingGlob->set_sensitive(false);
//lblSynchronizebChkGLob->set_sensitive(false);
cbxSynchronizeNtpGlob->set_sensitive(false);
lblTimeZoneGlob->set_sensitive(false);
lblRegGlob->set_sensitive(false);
@ -186,8 +178,8 @@ void MainWindow::add_CSS(){
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
cssProvider->load_from_path(path_css);
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();//get default screen
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
Glib::RefPtr<Gtk::StyleContext> context = boxColor->get_style_context();
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context();
context->add_class("cssboxColor1");
@ -224,7 +216,6 @@ void MainWindow::get_builder(){
builder->get_widget("lblRegGlob",lblRegGlob);
builder->get_widget("lblZone1Glob",lblZone1Glob);
builder->get_widget("lblTimeZoneGlob",lblTimeZoneGlob);
//builder->get_widget("lblSynchronizebChk",_lblSynchronizebChk);
builder->get_widget("lblSynchronizebChkGLob",lblSynchronizebChkGLob);
builder->get_widget("lblSynchronizeBtn",lblSynchronizeBtn);
builder->get_widget("lblDateTimeSettingGlob",lblDateTimeSettingGlob);
@ -239,11 +230,9 @@ void MainWindow::get_builder(){
builder->get_widget("lblNtpStop",lblNtpStop);
builder->get_widget("lblNtpClose",lblNtpClose);
builder->get_widget("lblBanerStopNtp",lblBanerStopNtp);
//builder->get_widget("cbxSynchronizeNtp",cbxSynchronizeNtp);
this->add_CSS();
}
void MainWindow::gui_exit(){
exit(1);
}
@ -274,6 +263,7 @@ void MainWindow::event(){
btnNtpWinClose->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::wind_close_ntp));
btnNtpStop->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::stop_ntp));
}
void MainWindow::wind_close_ntp(){
windowsNnpClose->hide();
}
@ -292,7 +282,6 @@ void MainWindow::stop_ntp(){
this->call(cmd.c_str());
}
}
system(cmd.c_str());
this->update_time_date();
@ -318,7 +307,6 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
cmd = "/usr/bin/ubconfig set network NTPSERVERS=" + txtNtpServer->get_text();
this->call(cmd.c_str());
}
return true;
}
@ -459,8 +447,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());
@ -555,6 +541,7 @@ void MainWindow::append_region_zone(string region, string zone){
}
}
string MainWindow::call(string cmd){
FILE *fp;
int status;
@ -564,7 +551,6 @@ string MainWindow::call(string cmd){
exit(1);
}
while (fgets(path, PATH_MAX, fp) != NULL){
//printf("%s", path);
break;
}
status = pclose(fp);
@ -609,7 +595,6 @@ void MainWindow::wrapper_update_time_date(){
}
void MainWindow::update_time_date(){
//this->enter_zone();
string cmd = "";
if ((year!=0) && (month !=0) && (day !=0)){
string str_month = "";
@ -657,24 +642,29 @@ void MainWindow::update_time_date(){
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);
string str_month = data.substr(3,2);
string str_year = data.substr(6,data.length());
cmd = "date +%Y%m%d -s \"" + str_year+
str_month+str_day+"\"";
string str_error_clock = this->call(cmd);
size_t index = str_error_clock.find("date: ");
if (index==std::string::npos){
}
string data = txtDate->get_text();
if (data.length()==10){
string str_day = data.substr(0,2);
string str_month = data.substr(3,2);
string str_year = data.substr(6,data.length());
cmd = "date +%Y%m%d -s \"" + str_year+
str_month+str_day+"\"";
string str_error_clock = this->call(cmd);
size_t index = str_error_clock.find("date: ");
if (index==std::string::npos){
}
else{
lblMessage->set_text(gettext("Incorrect date format"));
mess_dchp->show();
}
}
else{
lblMessage->set_text(gettext("Incorrect date format"));
mess_dchp->show();
}
}
void MainWindow::update_hour_minute(){
@ -713,7 +703,7 @@ void MainWindow::read_file(){
std::string line;
namespace fs = std::filesystem;
for (const auto & entry : fs::directory_iterator("/usr/share/zoneinfo/")){
std::ifstream in(entry.path()); // окрываем файл для чтения
std::ifstream in(entry.path());
if (in.is_open()){
string key_reg = entry.path().filename().string();
string path_dir = "/usr/share/zoneinfo/"+key_reg;
@ -725,7 +715,7 @@ void MainWindow::read_file(){
vector<string> zone;
zone.push_back("");
for (const auto & entry_zone : fs::directory_iterator(path_dir)){
std::ifstream in1(entry_zone.path()); // окрываем файл для чтения
std::ifstream in1(entry_zone.path());
if (in1.is_open()){
string key_zone = entry_zone.path().filename().string();
if (key_zone.length()!=0 || key_zone!=" "){
@ -734,7 +724,6 @@ void MainWindow::read_file(){
}
in1.close();
}
key_reg = string(gettext(key_reg.c_str()));
time_reg_map.insert({key_reg, zone});
}}}}
@ -755,8 +744,7 @@ vector<std::string> MainWindow::split(const std::string &s, char delim){
}
SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder)
: Gtk::Plug{p_socketID}
{
: Gtk::Plug{p_socketID}{
builder->get_widget("plugBox", plugBox);
plugBox->get_parent()->remove(*plugBox);
add(*plugBox);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save