|
|
|
@ -29,6 +29,7 @@ string path_app= "/home/superadmin/Документы/Проект/ubconfig_new/
|
|
|
|
string path_glade= "/home/superadmin/Документы/Проект/ubconfig_new/ubl-settings-datetime/";
|
|
|
|
string path_glade= "/home/superadmin/Документы/Проект/ubconfig_new/ubl-settings-datetime/";
|
|
|
|
string app_name = "ubl-settings-datetime";
|
|
|
|
string app_name = "ubl-settings-datetime";
|
|
|
|
string path_reg = "/home/superadmin/Документы/Проект/ubconfig_new/ubl-settings-datetime/reg/";
|
|
|
|
string path_reg = "/home/superadmin/Документы/Проект/ubconfig_new/ubl-settings-datetime/reg/";
|
|
|
|
|
|
|
|
string path_locale = "/usr/share/locale/";
|
|
|
|
bool flag_datetime = false;
|
|
|
|
bool flag_datetime = false;
|
|
|
|
bool flag_timezone = false;
|
|
|
|
bool flag_timezone = false;
|
|
|
|
bool flag_ntp = false;
|
|
|
|
bool flag_ntp = false;
|
|
|
|
@ -139,12 +140,15 @@ void MainWindow::event(){
|
|
|
|
_cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone));
|
|
|
|
_cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone));
|
|
|
|
_cbZoneGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone_glob));
|
|
|
|
_cbZoneGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone_glob));
|
|
|
|
_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));
|
|
|
|
|
|
|
|
//_btnMessClose->signal_day_selected_double_click().connect(sigc::mem_fun(*this, &MainWindow::close_calendar));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::gui_mess_close(){
|
|
|
|
void MainWindow::gui_mess_close(){
|
|
|
|
_mess_dchp->hide();
|
|
|
|
_mess_dchp->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::close_calendar(){
|
|
|
|
|
|
|
|
_popCalendar->hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_ntp(GdkEventFocus* event){
|
|
|
|
bool MainWindow::focus_ntp(GdkEventFocus* event){
|
|
|
|
if (event!=NULL){}
|
|
|
|
if (event!=NULL){}
|
|
|
|
@ -280,6 +284,7 @@ void MainWindow::get_config(){
|
|
|
|
string str_filling_zon = read_reg_zon_cfg.substr(read_reg_zon_cfg.find("/")+1,read_reg_zon_cfg.length());
|
|
|
|
string str_filling_zon = read_reg_zon_cfg.substr(read_reg_zon_cfg.find("/")+1,read_reg_zon_cfg.length());
|
|
|
|
str_filling_zon = str_filling_zon.substr(0,str_filling_zon.find("\n"));
|
|
|
|
str_filling_zon = str_filling_zon.substr(0,str_filling_zon.find("\n"));
|
|
|
|
string str_zone_check = "";
|
|
|
|
string str_zone_check = "";
|
|
|
|
|
|
|
|
cout << str_filling_zon << endl;
|
|
|
|
this->append_region_zone(str_filling_reg,str_filling_zon);
|
|
|
|
this->append_region_zone(str_filling_reg,str_filling_zon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
@ -523,51 +528,46 @@ void MainWindow::update_calendar(){
|
|
|
|
string date = str_day + '.' + str_month + '.' + to_string(year1);
|
|
|
|
string date = str_day + '.' + str_month + '.' + to_string(year1);
|
|
|
|
_txtDate->set_text(date);
|
|
|
|
_txtDate->set_text(date);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
void MainWindow::read_file(){
|
|
|
|
|
|
|
|
string cmd_reg = "find /usr/share/zoneinfo/* -maxdepth 0 -type d -not \\( -name posix -o -name right \\) -printf \"%f\n\"";
|
|
|
|
|
|
|
|
string str_reg_all = this->call(cmd_reg);
|
|
|
|
|
|
|
|
cout << 222 << endl;
|
|
|
|
|
|
|
|
cout << 222 << endl;
|
|
|
|
|
|
|
|
cout << str_reg_all << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char delim = '\n';
|
|
|
|
|
|
|
|
vector<std::string> vector_reg=this->split(str_reg_all, delim);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string str_zone_all = "";
|
|
|
|
|
|
|
|
string cmd_zone = "";
|
|
|
|
|
|
|
|
string key_reg = "";
|
|
|
|
|
|
|
|
for (const auto &str_reg : vector_reg){
|
|
|
|
|
|
|
|
cmd_zone = "find /usr/share/zoneinfo/"+str_reg+"/* -type f -printf \"%f\n\" | sort -u";
|
|
|
|
|
|
|
|
str_zone_all=this->call(cmd_zone);
|
|
|
|
|
|
|
|
vector<std::string> vector_zone = this->split(str_zone_all, delim);
|
|
|
|
|
|
|
|
vector<string> zone;
|
|
|
|
|
|
|
|
zone.push_back("");
|
|
|
|
|
|
|
|
for (const auto &str_zone : vector_zone){
|
|
|
|
|
|
|
|
zone.push_back(string(gettext(str_zone.c_str())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key_reg = string(gettext(key_reg.c_str()));
|
|
|
|
|
|
|
|
time_reg_map.insert({str_reg, zone});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void MainWindow::read_file(){
|
|
|
|
void MainWindow::read_file(){
|
|
|
|
std::string line;
|
|
|
|
std::string line;
|
|
|
|
|
|
|
|
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
for (const auto & entry : fs::directory_iterator(path_reg)){
|
|
|
|
for (const auto & entry : fs::directory_iterator("/usr/share/zoneinfo/")){
|
|
|
|
std::ifstream in(entry.path()); // окрываем файл для чтения
|
|
|
|
std::ifstream in(entry.path()); // окрываем файл для чтения
|
|
|
|
if (in.is_open())
|
|
|
|
if (in.is_open())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
vector<string> zone;
|
|
|
|
|
|
|
|
zone.push_back("");
|
|
|
|
|
|
|
|
while (getline(in, line))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
zone.push_back(string(gettext(line.c_str())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
string key_reg = entry.path().filename().string();
|
|
|
|
string key_reg = entry.path().filename().string();
|
|
|
|
key_reg = string(gettext(key_reg.c_str()));
|
|
|
|
|
|
|
|
time_reg_map.insert({key_reg, zone});
|
|
|
|
string path_dir = "/usr/share/zoneinfo/"+key_reg;
|
|
|
|
|
|
|
|
if (fs::is_directory(path_dir)){
|
|
|
|
|
|
|
|
vector<string> zone;
|
|
|
|
|
|
|
|
zone.push_back("");
|
|
|
|
|
|
|
|
for (const auto & entry_zone : fs::directory_iterator(path_dir)){
|
|
|
|
|
|
|
|
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!=" "){
|
|
|
|
|
|
|
|
zone.push_back(string(gettext(key_zone.c_str())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
in1.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key_reg = string(gettext(key_reg.c_str()));
|
|
|
|
|
|
|
|
time_reg_map.insert({key_reg, zone});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (getline(in, line))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.close();
|
|
|
|
in.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|