Исправлен дизайн и локализация дизайна. И точка по умолчанию Омск, удалены cout-ы

pull/18/head
Igor Belitskiy 3 years ago
parent 3c037a52d0
commit c3109de13e

@ -95,7 +95,7 @@ void MainWindow::lacalization(){
this->set_title(gettext("ubl-settings-datetime")); this->set_title(gettext("ubl-settings-datetime"));
_mess_dchp->set_title(gettext("Warning!")); _mess_dchp->set_title(gettext("Warning!"));
_lblTimeBios->set_text(gettext("Synchronize hardware time")); _lblTimeBios->set_text(gettext("Synchronize hardware time"));
_lblSynchronizebChk->set_text(gettext("Synchronize via NTP")); //_lblSynchronizebChk->set_text(gettext("Synchronize via NTP"));
} }
void MainWindow::flag_block_gui(){ void MainWindow::flag_block_gui(){
@ -112,7 +112,7 @@ void MainWindow::flag_block_gui(){
_btnHardwareTime->set_sensitive(false); _btnHardwareTime->set_sensitive(false);
_lblTime->set_sensitive(false); _lblTime->set_sensitive(false);
_lblData->set_sensitive(false); _lblData->set_sensitive(false);
//_cbxSynchronizeNtp->set_sensitive(false); //_cbxSynchronizeNtpGlob->set_sensitive(false);
} }
if (flag_timezone==true){ if (flag_timezone==true){
_cbRegion->set_sensitive(false); _cbRegion->set_sensitive(false);
@ -126,11 +126,10 @@ void MainWindow::flag_block_gui(){
_cbxSynchronizeNtpGlob->set_sensitive(false); _cbxSynchronizeNtpGlob->set_sensitive(false);
_cbDhcp->set_sensitive(false); _cbDhcp->set_sensitive(false);
_txtNtpServer->set_sensitive(false); _txtNtpServer->set_sensitive(false);
_cbxSynchronizeNtp->set_sensitive(false);
} }
if (flag_update==true){ if (flag_update==true){
_lblDateTimeSettingGlob->set_sensitive(false); _lblDateTimeSettingGlob->set_sensitive(false);
_lblSynchronizebChkGLob->set_sensitive(false); //_lblSynchronizebChkGLob->set_sensitive(false);
_cbxSynchronizeNtpGlob->set_sensitive(false); _cbxSynchronizeNtpGlob->set_sensitive(false);
_lblTimeZoneGlob->set_sensitive(false); _lblTimeZoneGlob->set_sensitive(false);
_lblRegGlob->set_sensitive(false); _lblRegGlob->set_sensitive(false);
@ -155,6 +154,7 @@ void MainWindow::add_CSS(){
} }
void MainWindow::get_builder(){ void MainWindow::get_builder(){
builder->set_translation_domain(path_app);
builder->get_widget("boxColor", _boxColor); builder->get_widget("boxColor", _boxColor);
builder->get_widget("btnUpdateDateTime", _btnUpdateDateTime); builder->get_widget("btnUpdateDateTime", _btnUpdateDateTime);
builder->get_widget("btnChooseDate", _btnChooseDate); builder->get_widget("btnChooseDate", _btnChooseDate);
@ -183,19 +183,19 @@ void MainWindow::get_builder(){
builder->get_widget("lblRegGlob",_lblRegGlob); builder->get_widget("lblRegGlob",_lblRegGlob);
builder->get_widget("lblZone1Glob",_lblZone1Glob); builder->get_widget("lblZone1Glob",_lblZone1Glob);
builder->get_widget("lblTimeZoneGlob",_lblTimeZoneGlob); builder->get_widget("lblTimeZoneGlob",_lblTimeZoneGlob);
builder->get_widget("lblSynchronizebChk",_lblSynchronizebChk); //builder->get_widget("lblSynchronizebChk",_lblSynchronizebChk);
builder->get_widget("lblSynchronizebChkGLob",_lblSynchronizebChkGLob); builder->get_widget("lblSynchronizebChkGLob",_lblSynchronizebChkGLob);
builder->get_widget("lblSynchronizeBtn",_lblSynchronizeBtn); builder->get_widget("lblSynchronizeBtn",_lblSynchronizeBtn);
builder->get_widget("lblDateTimeSettingGlob",_lblDateTimeSettingGlob); builder->get_widget("lblDateTimeSettingGlob",_lblDateTimeSettingGlob);
builder->get_widget("lblTimeBios",_lblTimeBios); builder->get_widget("lblTimeBios",_lblTimeBios);
builder->get_widget("btnHardwareTime",_btnHardwareTime); builder->get_widget("btnHardwareTime",_btnHardwareTime);
builder->get_widget("cbxSynchronizeNtp",_cbxSynchronizeNtp); //builder->get_widget("cbxSynchronizeNtp",_cbxSynchronizeNtp);
this->add_CSS(); this->add_CSS();
} }
void MainWindow::event(){ void MainWindow::event(){
_cbxSynchronizeNtp->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle)); //_cbxSynchronizeNtpGlob->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle));
_btnHardwareTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::hardware_clock)); _btnHardwareTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::hardware_clock));
_btnMessClose->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::gui_mess_close)); _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));
@ -212,7 +212,7 @@ void MainWindow::event(){
} }
void MainWindow::set_ntp_toggle(){ void MainWindow::set_ntp_toggle(){
bool flag = _cbxSynchronizeNtp->get_active(); bool flag = _cbxSynchronizeNtpGlob->get_active();
if (flag_ntp==true || flag_datetime==true){ if (flag_ntp==true || flag_datetime==true){
} }
else { else {
@ -263,8 +263,6 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
void MainWindow::event_entry_cbDhcp(){ void MainWindow::event_entry_cbDhcp(){
Glib::ustring str_dhcp = _cbDhcp->get_active_text(); Glib::ustring str_dhcp = _cbDhcp->get_active_text();
int index_activ = _cbDhcp->get_entry_text_column();
cout << index_activ << endl;
if (str_dhcp.length()!=0){ if (str_dhcp.length()!=0){
if (str_dhcp=="DHCP"){ if (str_dhcp=="DHCP"){
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp"; string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
@ -372,7 +370,7 @@ void MainWindow::get_config(){
this->enry_dhcp_mess(); this->enry_dhcp_mess();
string str_ntp = this->call("systemctl status ntpd.service systemd-timesyncd.service | grep \"Active: active\""); string str_ntp = this->call("systemctl status ntpd.service systemd-timesyncd.service | grep \"Active: active\"");
if (str_ntp.length()<50) { if (str_ntp.length()<50) {
_cbxSynchronizeNtp->set_active(false); _cbxSynchronizeNtpGlob->set_active(false);
_numTimeHrs->set_sensitive(true); _numTimeHrs->set_sensitive(true);
_numTimeMin->set_sensitive(true); _numTimeMin->set_sensitive(true);
_btnChooseDate->set_sensitive(true); _btnChooseDate->set_sensitive(true);
@ -380,7 +378,7 @@ void MainWindow::get_config(){
_lblTimeBios->set_sensitive(true); _lblTimeBios->set_sensitive(true);
} }
else{ else{
_cbxSynchronizeNtp->set_active(true); _cbxSynchronizeNtpGlob->set_active(true);
_numTimeHrs->set_sensitive(false); _numTimeHrs->set_sensitive(false);
_numTimeMin->set_sensitive(false); _numTimeMin->set_sensitive(false);
_btnChooseDate->set_sensitive(false); _btnChooseDate->set_sensitive(false);
@ -388,7 +386,7 @@ void MainWindow::get_config(){
_lblTimeBios->set_sensitive(false); _lblTimeBios->set_sensitive(false);
} }
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 != "") && (read_reg_zon_cfg !="(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());
read_reg_zon_cfg = read_reg_zon_cfg.substr(0,read_reg_zon_cfg.find("\n")); read_reg_zon_cfg = read_reg_zon_cfg.substr(0,read_reg_zon_cfg.find("\n"));
string str_filling_reg = read_reg_zon_cfg.substr(0,read_reg_zon_cfg.find("/")); string str_filling_reg = read_reg_zon_cfg.substr(0,read_reg_zon_cfg.find("/"));
@ -398,7 +396,7 @@ void MainWindow::get_config(){
this->append_region_zone(str_filling_reg,str_filling_zon); this->append_region_zone(str_filling_reg,str_filling_zon);
} }
else { else {
this->append_region_zone("Asia","Omsk"); this->append_region_zone("Africa","Abidjan");
} }
} }
@ -432,9 +430,8 @@ void MainWindow::enter_zone_glob(){
Glib::ustring zone_text = _cbZoneGlob->get_active_text(); Glib::ustring zone_text = _cbZoneGlob->get_active_text();
Glib::ustring reg_text = _cbRegionGlob->get_active_text(); Glib::ustring reg_text = _cbRegionGlob->get_active_text();
if(!(zone_text.empty()) && !(reg_text.empty())){ if(!(zone_text.empty()) && !(reg_text.empty())){
str_zoneGlob = zone_text.substr(zone_text.find(") ")+2,zone_text.length()); //str_zoneGlob = zone_text.substr(zone_text.find(") ")+2,zone_text.length());
str_region_glob = reg_text; string cmd = "/usr/bin/ubconfig set clock ZONE=" +reg_text +"/" + zone_text;
string cmd = "/usr/bin/ubconfig set clock ZONE=" +str_region_glob +"/" + str_zoneGlob;
system(cmd.c_str()); system(cmd.c_str());
} }
else{ else{
@ -444,6 +441,7 @@ void MainWindow::enter_zone_glob(){
} }
void MainWindow::set_ntp_toggle_glob(){ void MainWindow::set_ntp_toggle_glob(){
this->set_ntp_toggle();
bool flag = _cbxSynchronizeNtpGlob->get_active(); bool flag = _cbxSynchronizeNtpGlob->get_active();
if (flag==false){ if (flag==false){
system("/usr/bin/ubconfig remove network NTPSERVERS"); system("/usr/bin/ubconfig remove network NTPSERVERS");
@ -469,13 +467,12 @@ void MainWindow::append_region_zone(string region, string zone){
index+=1; index+=1;
} }
index = 0; index = 0;
string cheek_zone = ""; cout << zone;
for (const auto &_str_zone : time_reg_map.at(region)){ for (const auto &_str_zone : time_reg_map.at(region)){
_cbZone->append(_str_zone); _cbZone->append(_str_zone);
_cbZoneGlob->append(_str_zone); _cbZoneGlob->append(_str_zone);
if (_str_zone!=""){ if (_str_zone!=""){
cheek_zone = _str_zone.substr(_str_zone.find(") ")+2,_str_zone.length()); if (_str_zone == zone){
if (cheek_zone == zone){
_cbZone->set_active(index); _cbZone->set_active(index);
_cbZoneGlob->set_active(index); _cbZoneGlob->set_active(index);
} }
@ -529,7 +526,7 @@ void MainWindow::append_zone_glob(){
void MainWindow::update_time_date(){ void MainWindow::update_time_date(){
//this->enter_zone(); //this->enter_zone();
bool flag = _cbxSynchronizeNtp->get_active(); bool flag = _cbxSynchronizeNtpGlob->get_active();
string cmd = ""; string cmd = "";
if ((year!=0) && (month !=0) && (day !=0)){ if ((year!=0) && (month !=0) && (day !=0)){
string str_month = ""; string str_month = "";
@ -692,5 +689,4 @@ void help(){
g_print(" --lock-ntp Disable ntp field editing\n"); g_print(" --lock-ntp Disable ntp field editing\n");
g_print(" --lock-datetime Disable datetime field editing\n"); g_print(" --lock-datetime Disable datetime field editing\n");
g_print(" --lock-update Disable save changes\n"); g_print(" --lock-update Disable save changes\n");
cout << "Параметры командной строки --lock-datetime\n --lock-timezone\n --lock-ntp\n --lock-update\n" << endl;
} }

@ -129,7 +129,7 @@
<property name="width-request">255</property> <property name="width-request">255</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Настройки даты и времени</property> <property name="label" translatable="yes">Date and time settings</property>
<attributes> <attributes>
<attribute name="font-desc" value="URW Gothic Semi-Bold 10"/> <attribute name="font-desc" value="URW Gothic Semi-Bold 10"/>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
@ -205,38 +205,6 @@
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="cbxSynchronizeNtp">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="draw-indicator">True</property>
<child>
<object class="GtkLabel" id="lblSynchronizebChk">
<property name="width-request">145</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="Synchronize via NTP" comments="Synchronize via NTP">Синхронизировать через NTP</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
@ -251,7 +219,7 @@
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="Time" comments="Time">Время</property> <property name="label" translatable="yes" context="Time" comments="Time">Time</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
@ -333,7 +301,7 @@
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes" context="Date" comments="Date">Дата</property> <property name="label" translatable="yes" context="Date" comments="Date">Date</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
@ -348,8 +316,8 @@
<property name="width-request">191</property> <property name="width-request">191</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes" context="Date of&#10;Format: DD.MM.YYYY" comments="Date of&#10;Format: DD.MM.YYYY">Дата <property name="tooltip-text" translatable="yes" context="Date of&#10;Format: DD.MM.YYYY" comments="Date of&#10;Format: DD.MM.YYYY">Date
Формат: ДД.ММ.ГГГГ</property> Format: DD.MM.YYYY</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -439,7 +407,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Синхронизировать</property> <property name="label" translatable="yes">Sync by</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -495,7 +463,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Синхронизировать аппаратное время</property> <property name="label" translatable="yes">Synchronize hardware time</property>
</object> </object>
</child> </child>
</object> </object>
@ -542,13 +510,12 @@
<object class="GtkLabel" id="lblReg"> <object class="GtkLabel" id="lblReg">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes" context="Region" comments="Region">Регион</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Region" comments="Region">Регион</property> <property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -577,13 +544,12 @@
<object class="GtkLabel" id="lblZone"> <object class="GtkLabel" id="lblZone">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes" context="Zone" comments="Zone">Зона</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">10</property> <property name="margin-start">10</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Зона</property> <property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -637,7 +603,7 @@
<object class="GtkLabel" id="lblTimeZone"> <object class="GtkLabel" id="lblTimeZone">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Часовой пояс</property> <property name="label" translatable="yes">Time Zone</property>
</object> </object>
</child> </child>
</object> </object>
@ -653,7 +619,7 @@
<object class="GtkLabel" id="lblDateTimeSetting"> <object class="GtkLabel" id="lblDateTimeSetting">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes" context="Setting the date and time" comments="Setting the date and time">Локальная настройка</property> <property name="label" translatable="yes" context="Setting the date and time" comments="Setting the date and time">Local Configuration</property>
</object> </object>
</child> </child>
</object> </object>
@ -712,7 +678,7 @@
<object class="GtkLabel" id="lblSynchronizebChkGLob"> <object class="GtkLabel" id="lblSynchronizebChkGLob">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes" context="Synchronize via NTP" comments="Synchronize via NTP">Синхронизировать через NTP</property> <property name="label" translatable="yes" context="Synchronize via NTP" comments="Synchronize via NTP">Synchronize via NTP</property>
</object> </object>
</child> </child>
</object> </object>
@ -794,7 +760,7 @@
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Region" comments="Region">Регион</property> <property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -828,7 +794,7 @@
<property name="margin-start">10</property> <property name="margin-start">10</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Зона</property> <property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -891,7 +857,7 @@
<object class="GtkLabel" id="lblDateTimeSettingGlob"> <object class="GtkLabel" id="lblDateTimeSettingGlob">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes" context="Setting date and time in global configuration" comments="Setting date and time in global configuration">Глобальная настройка</property> <property name="label" translatable="yes" context="Setting date and time in global configuration" comments="Setting date and time in global configuration">Global customization</property>
</object> </object>
</child> </child>
</object> </object>

Loading…
Cancel
Save