Исправлен баг с регионами

pull/71/head
Igor Belitskiy 3 years ago
parent c83ae40f4c
commit 51a3ae6785

@ -13,7 +13,7 @@ find_package(ICU REQUIRED COMPONENTS uc dt in io)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
-O2 -pipe -fno-plt -fexceptions \ -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection") -fstack-clash-protection -fcf-protection -g")
set(SOURCE_FILES set(SOURCE_FILES
ubl-util-standard.h ubl-util-standard.h

@ -836,7 +836,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("/"));
@ -845,6 +845,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] = "";
@ -940,11 +944,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)){
@ -952,13 +958,14 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
if (_str_zone!=""){ if (_str_zone!=""){
if (zone_offest == _str_zone){ if (zone_offest == _str_zone){
tmpCbZone->set_active(index); tmpCbZone->set_active(index);
}
} }
}
index+=1; index+=1;
} }
} }
if (region=="Etc" && zone==""){ if (region=="Etc" && zone==""){
warning_info-=1; warning_info-=1;
tmpCbZone->set_active(index);
} }
else if (region=="" && zone==""){ else if (region=="" && zone==""){
warning_info+=1; warning_info+=1;
@ -991,15 +998,17 @@ 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();
string str_region = array_region[index]; if (index!=-1){
string zone_mixing=""; string str_region = array_region[index];
string path_dir=""; string zone_mixing="";
if(str_region.length()!=0){ string path_dir="";
for (const auto &_str_zone : time_reg_map_local.at(str_region)){ if(str_region.length()!=0){
cbZone->append(Glib::ustring(_str_zone)); for (const auto &_str_zone : time_reg_map_local.at(str_region)){
cbZone->append(Glib::ustring(_str_zone));
}
} }
cbZone->set_active(0);
} }
cbZone->set_active(0);
} }
void MainWindow::update_time_date(){ void MainWindow::update_time_date(){

@ -176,7 +176,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);

Loading…
Cancel
Save