Merge pull request 'master' (#71) from Igor1/ubl-settings-datetime:master into develop

Reviewed-on: #71
pull/72/head
Dmitry Razumov 3 years ago
commit e903d01fea

@ -21,6 +21,11 @@ all: init build
init: init:
@echo "Initialize ..."; \ @echo "Initialize ..."; \
version="$$(cat VERSION.md)"; \
version=$${version:8}; \
search="s/string version_application.*$&"; \
replace="string version_application = \"$${version}\";"; \
sed -i -e "$$search/$$replace/gi" source/ubl-settings-datetime.h; \
echo "-- Build path: ${CMAKE_BUILD_DIR}" echo "-- Build path: ${CMAKE_BUILD_DIR}"
depend: depend:

@ -16,5 +16,3 @@ if [[ -z ${VER} ]] ; then
fi fi
echo ":: Updated VERSION ${CURRENT} to ${VER}" echo ":: Updated VERSION ${CURRENT} to ${VER}"
find ../ -maxdepth 2 -type f -iname "${FILE_VERSION}" -exec echo ":: Insert version in file: {}" \; -exec sed "s/VERSION *[[:digit:]]*.*/VERSION ${VER}/" -i {} \; find ../ -maxdepth 2 -type f -iname "${FILE_VERSION}" -exec echo ":: Insert version in file: {}" \; -exec sed "s/VERSION *[[:digit:]]*.*/VERSION ${VER}/" -i {} \;

@ -2,11 +2,11 @@
#include "ubl-settings-datetime.h" #include "ubl-settings-datetime.h"
using namespace std; using namespace std;
string path_app= "/usr/bin/"; const string path_app = "/usr/bin/";
string path_glade= "/usr/share/ubl-settings-datetime/ui/"; const string path_glade = "/usr/share/ubl-settings-datetime/ui/";
string app_name = "ubl-settings-datetime"; const string app_name = "ubl-settings-datetime";
string path_locale = "/usr/share/locale/"; const string path_locale = "/usr/share/locale/";
string path_css = "/usr/share/ubl-settings-datetime/css/style.css"; const string path_css = "/usr/share/ubl-settings-datetime/css/style.css";
bool flag_datetime = false; bool flag_datetime = false;
bool flag_timezone = false; bool flag_timezone = false;
bool flag_ntp_mode = false; bool flag_ntp_mode = false;
@ -55,21 +55,12 @@ MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
} }
void MainWindow::settings() { void MainWindow::settings() {
Gtk::Widget *standartHead;
Gtk::Widget *plugBox;
Gtk::Window *window;
Gtk::Widget *boxButton;
Gtk::Widget *boxSave;
builder->get_widget("standartHead",standartHead);
builder->get_widget("plugBox",plugBox);
builder->get_widget("window",window);
builder->get_widget("boxButton",boxButton);
builder->get_widget("boxSave",boxSave);
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
year=0, month=0, day=0;
this->get_builder(); this->get_builder();
this->add_CSS();
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
year = 0;
month = 0;
day = 0;
this->lacalization(); this->lacalization();
if (this->check_root() == 0) { if (this->check_root() == 0) {
numTimeHrs->set_range(0, 23); numTimeHrs->set_range(0, 23);
@ -101,7 +92,6 @@ void MainWindow::settings(){
lblSynchronizebChkGLob->set_sensitive(false); lblSynchronizebChkGLob->set_sensitive(false);
cbDhcp->set_sensitive(false); cbDhcp->set_sensitive(false);
txtNtpServer->set_sensitive(false); txtNtpServer->set_sensitive(false);
lblZone1Glob->set_sensitive(false);
lblDateTimeSetting->set_sensitive(false); lblDateTimeSetting->set_sensitive(false);
btnBoxAboutDialog->set_visible(false); btnBoxAboutDialog->set_visible(false);
this->event(); this->event();
@ -121,14 +111,9 @@ int MainWindow::check_root(){
} }
void MainWindow::lacalization() { void MainWindow::lacalization() {
//btnSynopsis->set_label(_("Synopsis"));
//btnAbout->set_label(_("About the program"));
//btnDonwlodLocal->set_label(_("Download local"));
//btnDonwlolGlob->set_label(_("Download global"));
//btnSaveGlob->set_label(_("Save to Global configuration"));
//btnSaveLocal->set_label(_("Save to local configuration"));
//btnSaveLocalGlob->set_label(_("Save to global and local configuration"));
aboutWindows->set_comments(_("Setting the date and time")); aboutWindows->set_comments(_("Setting the date and time"));
aboutWindows->set_website(_("https://wiki.ublinux.com"));
aboutWindows->set_version(_(version_application.c_str()));
aboutWindows->set_website_label(_("Project Home Page")); aboutWindows->set_website_label(_("Project Home Page"));
lblSave->set_label(_("Save")); lblSave->set_label(_("Save"));
lblDownload->set_label(_("Download")); lblDownload->set_label(_("Download"));
@ -139,7 +124,6 @@ void MainWindow::lacalization(){
cbDhcp->append(_("DHCP")); cbDhcp->append(_("DHCP"));
cbDhcp->append(_("Manual")); cbDhcp->append(_("Manual"));
cbDhcp->append(_("Disabled")); cbDhcp->append(_("Disabled"));
lblDateTimeSetting->set_text(_("Current date and time")); lblDateTimeSetting->set_text(_("Current date and time"));
lblHead->set_text(_("Setting the date and time")); lblHead->set_text(_("Setting the date and time"));
lblTime->set_text(_("Time")); lblTime->set_text(_("Time"));
@ -207,6 +191,33 @@ void MainWindow::add_CSS(){
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context(); Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context();
context->add_class("cssboxColor1"); context->add_class("cssboxColor1");
context_lbl_head->add_class("textHead"); context_lbl_head->add_class("textHead");
/*
Glib::RefPtr<Gtk::StyleContext> boxButton_css = boxButton->get_style_context();
Glib::RefPtr<Gtk::StyleContext> boxSave_css = boxSave->get_style_context();
Glib::RefPtr<Gtk::StyleContext> btnDownload_css = btnDownload->get_style_context();
Glib::RefPtr<Gtk::StyleContext> lblDownload_css = lblDownload->get_style_context();
Glib::RefPtr<Gtk::StyleContext> imgDonwload_css = imgDonwload->get_style_context();
Glib::RefPtr<Gtk::StyleContext> headerBar_css = headerBar->get_style_context();
headerBar_css->add_class("bkim");
imgDonwload_css->add_class("bkim");
lblDownload_css->add_class("bkim");
btnDownload_css->add_class("bkim");
boxButton_css->add_class("bkim");
boxSave_css->add_class("bkim");
double opacity= 1.0;
headerBar->set_opacity(opacity);
boxButton->set_opacity(opacity);
boxSave->set_opacity(opacity);
btnDownload->set_opacity(opacity);
lblDownload->set_opacity(opacity);
imgDonwload->set_opacity(opacity);
btnSave->set_opacity(opacity);
lblSave->set_opacity(opacity);
btnSettings->set_opacity(opacity);
imgSave->set_opacity(opacity);
imgSettings->set_opacity(opacity);
*/
} }
@ -269,14 +280,26 @@ void MainWindow::get_builder(){
builder->get_widget("lblHW", lblHW); builder->get_widget("lblHW", lblHW);
builder->get_widget("cbHw", cbHw); builder->get_widget("cbHw", cbHw);
builder->get_widget("popCalendar", popCalendar); builder->get_widget("popCalendar", popCalendar);
this->add_CSS(); builder->get_widget("boxDateTime", boxDateTime);
builder->get_widget("boxButton", boxButton);
builder->get_widget("boxSave", boxSave);
builder->get_widget("standartHead", standartHead);
builder->get_widget("plugBox", plugBox);
builder->get_widget("window" ,window);
builder->get_widget("imgDonwload", imgDonwload);
builder->get_widget("imgDonwload", imgDonwload);
builder->get_widget("imgSettings", imgSettings);
builder->get_widget("imgSave", imgSave);
} }
void MainWindow::gui_exit() { void MainWindow::gui_exit() {
exit(1); exit(1);
} }
bool MainWindow::gui_exit_2(GdkEventAny* event) { bool MainWindow::gui_exit_2(GdkEventAny* event) {
if (event!=NULL){} if (event != NULL) {
}
exit(1); exit(1);
return true; return true;
} }
@ -316,28 +339,30 @@ void MainWindow::download_local_cfg(){
this->fill_in_reg_zone(cmd); this->fill_in_reg_zone(cmd);
this->update_hour_minute(); this->update_hour_minute();
this->update_calendar(); this->update_calendar();
string cmd_get_dhcp = "/usr/bin/ubconfig --source system get network NTPSERVERS"; string cmd_get_dhcp = "/usr/bin/ubconfig --default --source system get network NTPSERVERS";
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT"; string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp); this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
string hw = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC"; string hw = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw); string hw_default = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw, hw_default);
info_warning_error(0); info_warning_error(0);
} }
void MainWindow::download_globl_cfg() { void MainWindow::download_globl_cfg() {
string cmd_get_dhcp = "/usr/bin/ubconfig --target global get network NTPSERVERS"; string cmd_get_dhcp = "/usr/bin/ubconfig --default --source global get network NTPSERVERS";
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT"; string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp); this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE"; string cmd_zone = "/usr/bin/ubconfig --default --source global get clock ZONE";
this->fill_in_reg_zone(cmd); this->fill_in_reg_zone(cmd_zone);
string hw = "/usr/bin/ubconfig get clock HWCLOCK_SYNC"; string hw = "/usr/bin/ubconfig --default --source global get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw); string hw_default = "/usr/bin/ubconfig --default --source global get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw, hw_default);
info_warning_error(1); info_warning_error(1);
} }
void MainWindow::save_local_cfg() { void MainWindow::save_local_cfg() {
string cmd = "/usr/bin/ubconfig --target system set clock ZONE="; string cmd_zone = "/usr/bin/ubconfig --target system set clock ZONE=";
this->enter_zone(cmd); this->enter_zone(cmd_zone);
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default"; string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp"; string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\""; string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
@ -362,6 +387,7 @@ void MainWindow::save_global_cfg(){
this->hardware_clock_global(local, hw); this->hardware_clock_global(local, hw);
info_warning_error(3); info_warning_error(3);
} }
void MainWindow::save_global_local_cfg() { void MainWindow::save_global_local_cfg() {
string cmd = ""; string cmd = "";
string cmd_default = ""; string cmd_default = "";
@ -370,7 +396,6 @@ void MainWindow::save_global_local_cfg(){
string remove = ""; string remove = "";
if (flag_save_global == false) { if (flag_save_global == false) {
this->save_local_cfg(); this->save_local_cfg();
} }
if (flag_save_local == false) { if (flag_save_local == false) {
this->save_global_cfg(); this->save_global_cfg();
@ -441,20 +466,53 @@ void MainWindow::hardware_clock_global(string &local, string &etc){
} }
} }
void MainWindow::entry_hardware_clock(string &cmd){ void MainWindow::entry_hardware_clock_default(string &cmd_default) {
int error = warning_info;
struct Result<string> obj_result_default = this->wrapper_call(cmd_default);
if (obj_result_default.error == 0) {
if (obj_result_default.response.find("localtime") !=string::npos) {
cbHw->set_active(0);
}
else if (obj_result_default.response.find("utc") !=string::npos) {
cbHw->set_active(1);
}
}
else if (obj_result_default.error == 3) {
if (error != warning_info) {
warning_info = error;
}
cbHw->set_active(-1);
}
}
void MainWindow::entry_hardware_clock(string &cmd, string &cmd_default) {
int error = warning_info;
struct Result<string> obj_result = this->wrapper_call(cmd); struct Result<string> obj_result = this->wrapper_call(cmd);
if (obj_result.error == 0) { if (obj_result.error == 0) {
if (obj_result.response == "localtime"){ if (obj_result.response.find("localtime") !=string::npos) {
cbHw->set_active(0); cbHw->set_active(0);
} }
else if (obj_result.response == "etc"){ else if (obj_result.response.find("utc") !=string::npos) {
cbHw->set_active(1); cbHw->set_active(1);
} }
else {
this->entry_hardware_clock_default(cmd_default);
}
} }
else if (obj_result.error == 3) { else if (obj_result.error == 3) {
warning_info-=1; if (error != warning_info) {
warning_info = error;
}
cbHw->set_active(-1); cbHw->set_active(-1);
this->entry_hardware_clock_default(cmd_default);
}
else {
this->entry_hardware_clock_default(cmd_default);
} }
} }
void MainWindow::hardware_clock() { void MainWindow::hardware_clock() {
@ -504,8 +562,6 @@ bool MainWindow::focus_ntp(string &cmd_set_ntp){
} }
} }
return true; return true;
} }
@ -548,7 +604,6 @@ bool MainWindow::check_ntp(string &str_ntp){
flag_error = false; flag_error = false;
char_ntp[0] = str_ntp[i]; char_ntp[0] = str_ntp[i];
for (int index = 0; index < 11; index++) { for (int index = 0; index < 11; index++) {
if (index == 10) { if (index == 10) {
simvol = "."; simvol = ".";
} }
@ -557,7 +612,6 @@ bool MainWindow::check_ntp(string &str_ntp){
} }
if (simvol == char_ntp) { if (simvol == char_ntp) {
flag_error=false; flag_error=false;
break; break;
} }
else { else {
@ -610,6 +664,7 @@ struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd){
} }
return obj_result; return obj_result;
} }
void MainWindow::event_entry_cbDhcp() { void MainWindow::event_entry_cbDhcp() {
string str_dhcp = cbDhcp->get_active_text(); string str_dhcp = cbDhcp->get_active_text();
string cmd = ""; string cmd = "";
@ -645,10 +700,10 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
int activ_index = cbDhcp->get_active_row_number(); int activ_index = cbDhcp->get_active_row_number();
string str_dhcp = cbDhcp->get_active_text(); string str_dhcp = cbDhcp->get_active_text();
if (str_dhcp.length() == 0) { if (str_dhcp.length() == 0) {
} }
else if (activ_index == 0) { else if (activ_index == 0) {
wrapper_system(cmd_default, "&"); wrapper_system(cmd_default, "&");
} }
else if (activ_index == 1) { else if (activ_index == 1) {
wrapper_system(cmd_dhcp, "&"); wrapper_system(cmd_dhcp, "&");
@ -768,8 +823,9 @@ void MainWindow::calendar_show(){
} }
popCalendar->show(); popCalendar->show();
} }
void MainWindow::fill_in_reg_zone(string &cmd){
void MainWindow::fill_in_reg_zone(string &cmd) {
int error = warning_info;
struct Result<string> obj_result_1 = this->wrapper_call(cmd); struct Result<string> obj_result_1 = this->wrapper_call(cmd);
if (obj_result_1.error== 0) { if (obj_result_1.error== 0) {
auto arr_reg_zone = this->split_region_zone(obj_result_1.response); auto arr_reg_zone = this->split_region_zone(obj_result_1.response);
@ -783,6 +839,11 @@ void MainWindow::fill_in_reg_zone(string &cmd){
else { else {
this->append_region_zone("", "", cbRegion, cbZone); this->append_region_zone("", "", cbRegion, cbZone);
} }
if (obj_result_1.error == 3) {
if (error != warning_info) {
warning_info = error;
}
}
} }
@ -793,7 +854,7 @@ void MainWindow::get_config(){
this->update_calendar(); this->update_calendar();
} }
array<string, 2> MainWindow::split_region_zone(string read_reg_zon_cfg){ array<string, 2> MainWindow::split_region_zone(string &read_reg_zon_cfg) {
array<string, 2> arr; array<string, 2> arr;
if (read_reg_zon_cfg.find("/") !=std::string::npos) { if (read_reg_zon_cfg.find("/") !=std::string::npos) {
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("/"));
@ -802,6 +863,10 @@ array<string, 2> MainWindow::split_region_zone(string read_reg_zon_cfg){
arr[0] = str_filling_reg; arr[0] = str_filling_reg;
arr[1] = str_filling_zon; arr[1] = str_filling_zon;
} }
else if (read_reg_zon_cfg.length() != 0) {
arr[0] = read_reg_zon_cfg;
arr[1] = "";
}
else { else {
arr[0] = ""; arr[0] = "";
arr[1] = ""; arr[1] = "";
@ -864,9 +929,9 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
} }
// Cортировка пузырьком // Cортировка пузырьком
if (size_vec == 0) { if (size_vec == 0) {
size_vec = array_region_local.size(); int size_vec_sort = array_region_local.size();
for (int i = 0; i < size_vec; i++) { for (int i = 0; i < size_vec_sort; i++) {
for (int j = 0; j < size_vec-1; j++) { for (int j = 0; j < size_vec_sort-1; j++) {
if (array_region_local[j] > array_region_local[j + 1]) { if (array_region_local[j] > array_region_local[j + 1]) {
auto b = array_region_local[j]; auto b = array_region_local[j];
array_region_local[j] = array_region_local[j + 1]; array_region_local[j] = array_region_local[j + 1];
@ -878,8 +943,11 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
} }
} }
} }
for (string &reg : array_region_local) { for (string &reg : array_region_local) {
if (size_vec == 0) {
tmpCbReg->append(Glib::ustring(reg)); tmpCbReg->append(Glib::ustring(reg));
}
if (reg == string(_(region.c_str()))) { if (reg == string(_(region.c_str()))) {
tmpCbReg->set_active_text(reg); tmpCbReg->set_active_text(reg);
} }
@ -894,11 +962,13 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
if (region == "") { if (region == "") {
tmpCbZone->append(" "); tmpCbZone->append(" ");
tmpCbZone->set_active(0); tmpCbZone->set_active(0);
tmpCbReg->set_active(-1);
return; return;
} }
if (time_reg_map_local.find(region) == time_reg_map_local.end()) { if (time_reg_map_local.find(region) == time_reg_map_local.end()) {
tmpCbZone->append(" "); tmpCbZone->append(" ");
tmpCbZone->set_active(0); tmpCbZone->set_active(0);
tmpCbReg->set_active(-1);
} }
else { else {
for (string &_str_zone: time_reg_map_local.at(region)) { for (string &_str_zone: time_reg_map_local.at(region)) {
@ -913,9 +983,14 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
} }
if (region == "Etc" && zone == "") { if (region == "Etc" && zone == "") {
warning_info -= 1; warning_info -= 1;
tmpCbZone->set_active(index);
} }
else if (region==""){ else if (region == "" && zone== "") {
warning_info += 1; warning_info += 1;
int error = warning_info;
if (warning_info != error) {
warning_info = error;
}
} }
} }
@ -941,6 +1016,7 @@ string MainWindow::call(string cmd){
void MainWindow::append_zone() { void MainWindow::append_zone() {
cbZone->remove_all(); cbZone->remove_all();
int index = cbRegion->get_active_row_number(); int index = cbRegion->get_active_row_number();
if (index!=-1) {
string str_region = array_region[index]; string str_region = array_region[index];
string zone_mixing= ""; string zone_mixing= "";
string path_dir= ""; string path_dir= "";
@ -951,6 +1027,7 @@ void MainWindow::append_zone(){
} }
cbZone->set_active(0); cbZone->set_active(0);
} }
}
void MainWindow::update_time_date() { void MainWindow::update_time_date() {
string cmd = ""; string cmd = "";
@ -1071,7 +1148,6 @@ void MainWindow::read_file(){
std::ifstream in1(entry_zone.path()); std::ifstream in1(entry_zone.path());
if (in1.is_open()) { if (in1.is_open()) {
string key_zone = entry_zone.path().filename().string(); string key_zone = entry_zone.path().filename().string();
if (fs::is_directory(path_dir + "/" + key_zone)) { if (fs::is_directory(path_dir + "/" + key_zone)) {
string reg_reg_zone = path_dir + "/" + key_zone; string reg_reg_zone = path_dir + "/" + key_zone;
for (const auto & entry_reg_reg_zone : fs::directory_iterator(reg_reg_zone)) { for (const auto & entry_reg_reg_zone : fs::directory_iterator(reg_reg_zone)) {

@ -20,11 +20,11 @@
using namespace std; using namespace std;
extern string path_app; extern const string path_app;
extern string path_glade; extern const string path_glade;
extern string app_name; extern const string app_name;
extern string path_locale; extern const string path_locale;
extern string path_css; extern const string path_css;
extern bool flag_datetime; extern bool flag_datetime;
extern bool flag_timezone; extern bool flag_timezone;
extern bool flag_ntp_mode; extern bool flag_ntp_mode;
@ -72,7 +72,6 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::Label *lblTimeZone; Gtk::Label *lblTimeZone;
Gtk::Label *lblReg; Gtk::Label *lblReg;
Gtk::Label *lblZone; Gtk::Label *lblZone;
Gtk::Label *lblZone1Glob;
Gtk::Label *lblSynchronizebChk; Gtk::Label *lblSynchronizebChk;
Gtk::Label *lblSynchronizebChkGLob; Gtk::Label *lblSynchronizebChkGLob;
Gtk::Label *lblSynchronizeBtn; Gtk::Label *lblSynchronizeBtn;
@ -105,9 +104,20 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::Label *lblHeader; Gtk::Label *lblHeader;
Gtk::Label *lblHW; Gtk::Label *lblHW;
Gtk::ComboBoxText *cbHw; Gtk::ComboBoxText *cbHw;
Gtk::Box *boxDateTime;
Gtk::Widget *boxButton;
Gtk::Widget *boxSave;
Gtk::Widget *standartHead;
Gtk::Widget *plugBox;
Gtk::Window *window;
Gtk::Image *imgDonwload;
Gtk::Image *imgSave;
Gtk::Image *imgSettings;
unsigned int year = 0; unsigned int year = 0;
unsigned int month = 0; unsigned int month = 0;
unsigned int day = 0; unsigned int day = 0;
string version_application = "1.3";
int error_info = 0; int error_info = 0;
int warning_info = 0; int warning_info = 0;
int hour; int hour;
@ -130,7 +140,8 @@ class MainWindow : public Gtk::ApplicationWindow {
void hardware_clock_global(string &local, string &etc); void hardware_clock_global(string &local, string &etc);
void info_warning_error(int mess); void info_warning_error(int mess);
void synopsis_show(); void synopsis_show();
void entry_hardware_clock(string &cmd); void entry_hardware_clock(string &cmd, string &cmd_default);
void entry_hardware_clock_default(string &cmd_default);
void save_global_local_cfg(); void save_global_local_cfg();
void fill_in_reg_zone(string &cmd); void fill_in_reg_zone(string &cmd);
void download_globl_cfg(); void download_globl_cfg();
@ -174,7 +185,7 @@ class MainWindow : public Gtk::ApplicationWindow {
void wrapper_update_time_date(); void wrapper_update_time_date();
string zone_file_read(string zone); string zone_file_read(string zone);
void sort_zone(vector<string> *time_reg_map_local,vector<string> *time_reg_map); void sort_zone(vector<string> *time_reg_map_local,vector<string> *time_reg_map);
array<string, 2> split_region_zone(string read_reg_zon_cfg); array<string, 2> split_region_zone(string &read_reg_zon_cfg);
string str_remove(std::string& source, const std::string to_remove); string str_remove(std::string& source, const std::string to_remove);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
struct Result<string> wrapper_call(string cmd); struct Result<string> wrapper_call(string cmd);

@ -26,60 +26,56 @@
padding: 3px 10px 5px 5px; padding: 3px 10px 5px 5px;
} }
.menuitemtop:hover { .menuitemtop:hover {
border-radius:3px;
background:@theme_bg_color; background:@theme_bg_color;
} }
.menuitemmiddle:hover { .menuitemmiddle:hover {
border-radius:3px;
background:@theme_bg_color; background:@theme_bg_color;
} }
.menuitembottom:hover { .menuitembottom:hover {
border-radius:3px;
background:@theme_bg_color; background:@theme_bg_color;
} }
.menuitemtop:hover* { .menuitemtop:hover* {
border-radius:3px;
margin:2px 2px 0 2px; margin:2px 2px 0 2px;
padding: 5px 10px 3px 5px; padding: 5px 10px 3px 5px;
background:@theme_selected_bg_color; background:@theme_selected_bg_color;
border-radius:2px;
border-color:transparent; border-color:transparent;
} }
.menuitemmiddle:hover* { .menuitemmiddle:hover* {
border-radius:3px;
margin:0 2px 0 2px; margin:0 2px 0 2px;
padding: 3px 10px 3px 5px; padding: 3px 10px 3px 5px;
background:@theme_selected_bg_color; background:@theme_selected_bg_color;
border-radius:2px;
border-color:transparent; border-color:transparent;
} }
.menuitembottom:hover* { .menuitembottom:hover* {
border-radius:3px;
margin:0 2px 2px 2px; margin:0 2px 2px 2px;
padding: 3px 10px 5px 5px; padding: 3px 10px 5px 5px;
background:@theme_selected_bg_color; background:@theme_selected_bg_color;
border-radius:2px;
border-color:transparent; border-color:transparent;
} }
.menuitembottom{ .menuitembottom{
margin-top:0px; margin-top:0px;
border-color:alpha(@theme_text_color, 0.4);
border-style:solid;
border-radius:0 0 5px 5px;
border-left-width:1px;
border-bottom-width:1px;
border-right-width:1px;
} }
.menuitemmiddle{ .menuitemmiddle{
margin-top:0px; margin-top:0px;
margin-bottom:0px; margin-bottom:0px;
border-color:alpha(@theme_text_color, 0.4);
border-style:solid;
border-left-width:1px;
border-right-width:1px;
} }
.menuitemtop{ .menuitemtop{
margin-bottom:0px; margin-bottom:0px;
border-color:alpha(@theme_text_color, 0.4); }
border-style:solid;
border-radius:5px 5px 0 0; .bkim{
border-left-width:1px; background-image: -gtk-gradient(linear,
border-top-width:1px; left top, left bottom,
border-right-width:1px; from(@entry_background_a),
color-stop(0.20, @entry_background_b),
color-stop(0.85, @entry_background_c),
to(@entry_background_d));
} }

@ -88,7 +88,7 @@
<object class="GtkMenuItem" id="btnSynopsis"> <object class="GtkMenuItem" id="btnSynopsis">
<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">Synopsis</property> <property name="label" translatable="yes">Help</property>
<property name="use-underline">True</property> <property name="use-underline">True</property>
<style> <style>
<class name="menuitemtop"/> <class name="menuitemtop"/>
@ -323,7 +323,7 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox" id="boxDateTime">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
@ -457,7 +457,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">5</property> <property name="position">5</property>
</packing> </packing>
@ -550,7 +550,7 @@ Format: DD.MM.YYYY</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
@ -680,7 +680,6 @@ Format: DD.MM.YYYY</property>
</child> </child>
<child> <child>
<object class="GtkEntry" id="txtNtpServer"> <object class="GtkEntry" id="txtNtpServer">
<property name="width-request">-1</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">Enter the name of the ntp server or its ip address. When entering multiple addresses, separate them with spaces.</property> <property name="tooltip-text" translatable="yes">Enter the name of the ntp server or its ip address. When entering multiple addresses, separate them with spaces.</property>
@ -754,19 +753,31 @@ Format: DD.MM.YYYY</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin-left">8</property> <property name="margin-left">8</property>
<property name="margin-right">31</property> <property name="margin-right">5</property>
<property name="margin-start">8</property> <property name="margin-start">8</property>
<property name="margin-end">31</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">13</property> <property name="margin-bottom">13</property>
<property name="label" translatable="yes">Synchronize hardware time:</property> <property name="label" translatable="yes">Synchronize hardware time:</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-end">55</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkComboBoxText" id="cbHw"> <object class="GtkComboBoxText" id="cbHw">
<property name="visible">True</property> <property name="visible">True</property>
@ -783,7 +794,7 @@ Format: DD.MM.YYYY</property>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</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>
@ -817,7 +828,7 @@ Format: DD.MM.YYYY</property>
<property name="margin-start">8</property> <property name="margin-start">8</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">6</property> <property name="margin-bottom">13</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>
</object> </object>
@ -829,7 +840,6 @@ Format: DD.MM.YYYY</property>
</child> </child>
<child> <child>
<object class="GtkComboBoxText" id="cbRegion"> <object class="GtkComboBoxText" id="cbRegion">
<property name="width-request">167</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-left">5</property>
@ -842,7 +852,7 @@ Format: DD.MM.YYYY</property>
<property name="vexpand">False</property> <property name="vexpand">False</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">3</property> <property name="position">3</property>
</packing> </packing>
@ -851,9 +861,9 @@ Format: DD.MM.YYYY</property>
<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="margin-left">10</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">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">13</property> <property name="margin-bottom">13</property>
@ -956,11 +966,11 @@ Format: DD.MM.YYYY</property>
<object class="GtkLabel" id="lblHeader"> <object class="GtkLabel" id="lblHeader">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</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">2</property>
<property name="hexpand">False</property> <property name="hexpand">False</property>
<property name="label" translatable="yes">ubl-settings-datetime</property> <property name="label" translatable="yes">ubl-settings-datetime</property>
<attributes> <attributes>
@ -1014,7 +1024,7 @@ Format: DD.MM.YYYY</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkImage"> <object class="GtkImage" id="imgDonwload">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="icon-name">pan-down-symbolic</property> <property name="icon-name">pan-down-symbolic</property>
@ -1079,7 +1089,7 @@ Format: DD.MM.YYYY</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkImage"> <object class="GtkImage" id="imgSave">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="icon-name">pan-down-symbolic</property> <property name="icon-name">pan-down-symbolic</property>
@ -1109,7 +1119,7 @@ Format: DD.MM.YYYY</property>
<property name="popup">menu1</property> <property name="popup">menu1</property>
<property name="direction">none</property> <property name="direction">none</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage" id="imgSettings">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="icon-name">open-menu-symbolic</property> <property name="icon-name">open-menu-symbolic</property>
@ -1134,6 +1144,30 @@ Format: DD.MM.YYYY</property>
</object> </object>
</child> </child>
</object> </object>
<object class="GtkSizeGroup">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="cbRegion"/>
<widget name="cbZone"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="btnUpdateDateTime"/>
<widget name="lblHW"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="cbHw"/>
<widget name="cbZone"/>
</widgets>
</object>
<object class="GtkPopover" id="popCalendar"> <object class="GtkPopover" id="popCalendar">
<property name="width-request">240</property> <property name="width-request">240</property>
<property name="height-request">185</property> <property name="height-request">185</property>

@ -19,6 +19,9 @@ msgstr ""
msgid "Select the method of hardware time synchronization" msgid "Select the method of hardware time synchronization"
msgstr "Выберите способ синхронизации аппаратного времени" msgstr "Выберите способ синхронизации аппаратного времени"
msgid "https://wiki.ublinux.com"
msgstr "https://wiki.ublinux.ru"
msgid "Local time" msgid "Local time"
msgstr "Локальное время" msgstr "Локальное время"
@ -1759,7 +1762,7 @@ msgstr "Андорра"
msgid "About the program" msgid "About the program"
msgstr "О программе" msgstr "О программе"
msgid "Synopsis" msgid "Help"
msgstr "Справка" msgstr "Справка"
msgid "Local configuration reading error" msgid "Local configuration reading error"

Loading…
Cancel
Save