Исправлен дизайн

pull/30/head
Igor Belitskiy 3 years ago
parent d889903740
commit 1d6c75b516

@ -114,6 +114,7 @@ void MainWindow::lacalization(){
_txtDate->set_tooltip_text(gettext("Date of\nFormat: DD.MM.YYYY")); _txtDate->set_tooltip_text(gettext("Date of\nFormat: DD.MM.YYYY"));
_lblSynchronizebChkGLob->set_text(gettext("Synchronize via NTP")); _lblSynchronizebChkGLob->set_text(gettext("Synchronize via NTP"));
_cbDhcp->append(gettext("By default"));
_cbDhcp->append(gettext("DHCP")); _cbDhcp->append(gettext("DHCP"));
_cbDhcp->append(gettext("Manually")); _cbDhcp->append(gettext("Manually"));
_lblDateTimeSetting->set_text(gettext("Local Configuration")); _lblDateTimeSetting->set_text(gettext("Local Configuration"));
@ -228,7 +229,11 @@ void MainWindow::get_builder(){
builder->get_widget("mess_sudo",_mess_sudo); builder->get_widget("mess_sudo",_mess_sudo);
builder->get_widget("lblMessageSudo",_lblMessageSudo); builder->get_widget("lblMessageSudo",_lblMessageSudo);
builder->get_widget("btnMessCloseSudo",_btnMessCloseSudo); builder->get_widget("btnMessCloseSudo",_btnMessCloseSudo);
builder->get_widget("windowsNnpClose",_windowsNnpClose);
builder->get_widget("btnNtpStop",_btnNtpStop);
builder->get_widget("btnNtpWinClose",_btnNtpWinClose);
builder->get_widget("lblNtpStop",_lblNtpStop);
builder->get_widget("lblNtpClose",_lblNtpClose);
//builder->get_widget("cbxSynchronizeNtp",_cbxSynchronizeNtp); //builder->get_widget("cbxSynchronizeNtp",_cbxSynchronizeNtp);
@ -261,8 +266,18 @@ void MainWindow::event(){
_txtNtpServer->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_ntp)); _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));
_mess_sudo->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit_2)); _mess_sudo->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit_2));
_btnNtpWinClose->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::wind_close_ntp));
_btnNtpStop->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::stop_ntp));
}
void MainWindow::wind_close_ntp(){
_windowsNnpClose->hide();
} }
void MainWindow::stop_ntp(){
}
void MainWindow::set_ntp_toggle(){ void MainWindow::set_ntp_toggle(){
bool flag = _cbxSynchronizeNtpGlob->get_active(); bool flag = _cbxSynchronizeNtpGlob->get_active();
if (flag_ntp==true || flag_datetime==true){ if (flag_ntp==true || flag_datetime==true){
@ -315,15 +330,23 @@ 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 activ_index = _cbDhcp->get_id_column();
if (str_dhcp.length()!=0){ if (str_dhcp.length()!=0){
if (str_dhcp=="DHCP"){ if (activ_index==0){
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=default";
system(cmd.c_str());
_txtNtpServer->set_sensitive(false);
_cbDhcp->set_active(activ_index);
_txtNtpServer->set_text("");
}
else if (activ_index==1){
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp"; string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
system(cmd.c_str()); system(cmd.c_str());
_txtNtpServer->set_sensitive(false); _txtNtpServer->set_sensitive(false);
_cbDhcp->set_active(0); _cbDhcp->set_active(activ_index);
_txtNtpServer->set_text(""); _txtNtpServer->set_text("");
} }
else{ else if (activ_index==2){
string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS");
if ((str_dhcp!="") && (str_dhcp!="(null)") ){ if ((str_dhcp!="") && (str_dhcp!="(null)") ){
str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length());
@ -332,7 +355,7 @@ void MainWindow::event_entry_cbDhcp(){
_txtNtpServer->set_text(str_dhcp); _txtNtpServer->set_text(str_dhcp);
} }
_txtNtpServer->set_sensitive(true); _txtNtpServer->set_sensitive(true);
_cbDhcp->set_active(1); _cbDhcp->set_active(activ_index);
} }
} }
} }

@ -78,6 +78,8 @@ class MainWindow : public Gtk::ApplicationWindow {
int check_root(); int check_root();
void gui_exit(); void gui_exit();
bool gui_exit_2(GdkEventAny* event); bool gui_exit_2(GdkEventAny* event);
void stop_ntp();
void wind_close_ntp();
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
private: private:
Glib::RefPtr<Gtk::Builder> builder; Glib::RefPtr<Gtk::Builder> builder;
@ -119,6 +121,11 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::Label *_lblTimeBios; Gtk::Label *_lblTimeBios;
Gtk::Button *_btnHardwareTime; Gtk::Button *_btnHardwareTime;
Gtk::CheckButton *_cbxSynchronizeNtp; Gtk::CheckButton *_cbxSynchronizeNtp;
Gtk::Window *_windowsNnpClose;
Gtk::Button *_btnNtpStop;
Gtk::Button *_btnNtpWinClose;
Gtk::Label *_lblNtpStop;
Gtk::Label *_lblNtpClose;
std::map <string, vector<string>> time_reg_map; std::map <string, vector<string>> time_reg_map;
unsigned int year=0; unsigned int year=0;
unsigned int month=0; unsigned int month=0;

@ -298,6 +298,7 @@
<property name="width-request">160</property> <property name="width-request">160</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="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>
@ -380,6 +381,7 @@
<property name="width-request">160</property> <property name="width-request">160</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="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>
@ -598,6 +600,7 @@ Format: DD.MM.YYYY</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-top">6</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Region" comments="Region">Region</property> <property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property> <property name="xalign">0</property>
@ -616,6 +619,7 @@ Format: DD.MM.YYYY</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-top">6</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
</object> </object>
<packing> <packing>
@ -632,6 +636,7 @@ Format: DD.MM.YYYY</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-top">6</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Area</property> <property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property> <property name="xalign">0</property>
@ -650,6 +655,7 @@ Format: DD.MM.YYYY</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-top">6</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
</object> </object>
<packing> <packing>
@ -744,39 +750,51 @@ Format: DD.MM.YYYY</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkCheckButton" id="cbxSynchronizeNtpGlob">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes" context="Automatic time synchronization" comments="Automatic time synchronization">Автоматическая синхронизация времени</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="draw-indicator">True</property>
<child> <child>
<object class="GtkCheckButton" id="cbxSynchronizeNtpGlob"> <object class="GtkLabel" id="lblSynchronizebChkGLob">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">False</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes" context="Automatic time synchronization" comments="Automatic time synchronization">Автоматическая синхронизация времени</property>
<property name="margin-left">5</property> <property name="margin-left">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-top">6</property> <property name="margin-top">6</property>
<property name="draw-indicator">True</property> <property name="margin-bottom">6</property>
<child> <property name="label" translatable="yes" context="Synchronize via NTP" comments="Synchronize via NTP">Synchronize via NTP</property>
<object class="GtkLabel" id="lblSynchronizebChkGLob">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="Synchronize via NTP" comments="Synchronize via NTP">Synchronize via NTP</property>
</object>
</child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child> </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child> <child>
<object class="GtkComboBoxText" id="cbDhcp"> <object class="GtkComboBoxText" id="cbDhcp">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</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-top">6</property>
<property name="margin-bottom">5</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -795,6 +813,7 @@ Format: DD.MM.YYYY</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-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">5</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@ -806,7 +825,7 @@ Format: DD.MM.YYYY</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -843,6 +862,7 @@ Format: DD.MM.YYYY</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-top">6</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Region" comments="Region">Region</property> <property name="label" translatable="yes" context="Region" comments="Region">Region</property>
<property name="xalign">0</property> <property name="xalign">0</property>
@ -861,6 +881,7 @@ Format: DD.MM.YYYY</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-top">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
</object> </object>
<packing> <packing>
@ -873,10 +894,11 @@ Format: DD.MM.YYYY</property>
<object class="GtkLabel" id="lblZone1Glob"> <object class="GtkLabel" id="lblZone1Glob">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">10</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-top">5</property>
<property name="margin-bottom">8</property> <property name="margin-bottom">8</property>
<property name="label" translatable="yes" context="Zone" comments="Zone">Area</property> <property name="label" translatable="yes" context="Zone" comments="Zone">Area</property>
<property name="xalign">0</property> <property name="xalign">0</property>
@ -912,6 +934,8 @@ Format: DD.MM.YYYY</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">15</property> <property name="margin-start">15</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -932,7 +956,7 @@ Format: DD.MM.YYYY</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
@ -984,4 +1008,178 @@ Format: DD.MM.YYYY</property>
</object> </object>
</child> </child>
</object> </object>
<object class="GtkWindow" id="windowsNnpClose">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<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="pixel-size">50</property>
<property name="icon-name">emblem-important</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<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">Обнаружен активный сервис
автоматической синхронизации времени и даты</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkButton" id="btnNtpStop">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</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>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<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="icon-name">media-playback-stop</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblNtpStop">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Остановить сервис синхронизации</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnNtpWinClose">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</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>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">6</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="icon-name">window-close</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblNtpClose">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Закрыть</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface> </interface>

@ -6,6 +6,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
msgid "By default"
msgstr "По умолчанию"
msgid "The program must be run with \nsuperuser privileges!" msgid "The program must be run with \nsuperuser privileges!"
msgstr "Программа должна быть запущена с правами \nсуперпользователя!" msgstr "Программа должна быть запущена с правами \nсуперпользователя!"

Loading…
Cancel
Save