Исправлен дизайн и баг в логике при выборе по умолчанию

pull/30/head
Igor Belitskiy 3 years ago
parent 06bee15e03
commit 0600ec95de

@ -315,7 +315,9 @@ void MainWindow::event_entry_cbDhcp(){
system(cmd.c_str());
txtNtpServer->set_sensitive(false);
cbDhcp->set_active(activ_index);
txtNtpServer->set_text("");
string response = this->call("/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT");
this->str_remove(response, "\n");
txtNtpServer->set_text(response);
}
else if (activ_index==1){
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
@ -326,8 +328,9 @@ void MainWindow::event_entry_cbDhcp(){
}
else if (activ_index==2){
txtNtpServer->set_sensitive(true);
txtNtpServer->set_text("");
string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS");
if ((str_dhcp!="") && (str_dhcp!="(null)") && (str_dhcp!="default")){
if ((str_dhcp!="") && (str_dhcp!="(null)") && (str_dhcp.find("default")==std::string::npos)){
str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length());
str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n"));
if (str_dhcp!="dhcp" && str_dhcp!="(null)"){
@ -343,6 +346,15 @@ void MainWindow::event_entry_cbDhcp(){
cbDhcp->set_active(0);
}
}
string MainWindow::str_remove(std::string& source, const std::string to_remove){
auto begin = source.find(to_remove);
if (begin!=std::string::npos){
int len_to_remove = to_remove.length();
source.erase(begin, begin+len_to_remove);
}
return source;
}
void MainWindow::get_calendar(){
string str_month = "";
@ -397,7 +409,7 @@ void MainWindow::enry_dhcp_mess(){
}
else if (str_dhcp=="default"){
cbDhcp->set_active(0);
txtNtpServer->set_text("");
txtNtpServer->set_text(str_dhcp);
txtNtpServer->set_sensitive(false);
}
else{

@ -81,6 +81,7 @@ class MainWindow : public Gtk::ApplicationWindow {
void stop_ntp();
void wind_close_ntp();
void wrapper_update_time_date();
string str_remove(std::string& source, const std::string to_remove);
vector<std::string> split(const std::string &s, char delim);
private:
Glib::RefPtr<Gtk::Builder> builder;

@ -598,10 +598,10 @@ Format: DD.MM.YYYY</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-start">8</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
<property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property>
</object>
@ -620,7 +620,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
</object>
<packing>
<property name="expand">False</property>
@ -637,7 +637,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-start">10</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property>
</object>
@ -656,7 +656,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
</object>
<packing>
<property name="expand">False</property>
@ -858,12 +858,12 @@ Format: DD.MM.YYYY</property>
<object class="GtkLabel" id="lblRegGlob">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-left">8</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-start">8</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
<property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property>
</object>
@ -881,8 +881,8 @@ Format: DD.MM.YYYY</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">8</property>
<property name="margin-top">6</property>
<property name="margin-bottom">13</property>
</object>
<packing>
<property name="expand">False</property>
@ -899,7 +899,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-start">10</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">8</property>
<property name="margin-bottom">13</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property>
</object>
@ -917,7 +917,8 @@ Format: DD.MM.YYYY</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">8</property>
<property name="margin-top">6</property>
<property name="margin-bottom">13</property>
</object>
<packing>
<property name="expand">False</property>

Loading…
Cancel
Save