Исправлен баг с TreeView

pull/11/head
Igor Belitskiy 3 years ago
parent daf43d2e8b
commit c6a8dd96fd

@ -34,7 +34,6 @@ bool Save::check_save(string flag_save, string key_name) {
} }
iter_map_data = (*map_gui).find(key_name); iter_map_data = (*map_gui).find(key_name);
iter_map_data_old = (*map_data_old).find(key_name); iter_map_data_old = (*map_data_old).find(key_name);
cout << iter_map_data->second << " ||| " << iter_map_data_old->second << endl;
if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) { if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) {
return true; return true;
} }
@ -77,7 +76,6 @@ void Save::save(string sections, string str_flag_save) {
else { else {
cmd = ""; cmd = "";
} }
cout << cmd << endl;
if (cmd.length() != 0) { if (cmd.length() != 0) {
process.call(cmd, ""); process.call(cmd, "");
this->flag_no_save = false; this->flag_no_save = false;

@ -205,7 +205,7 @@ void MainWindow::get_download_mode(std::map <string, string> &map_temp) {
} }
} }
void MainWindow::set_download_mode(string cmd="") { void MainWindow::set_download_mode() {
int index = cmbDownloadMode->get_active_row_number(); int index = cmbDownloadMode->get_active_row_number();
string key = ""; string key = "";
if (index == 0) { if (index == 0) {
@ -223,42 +223,20 @@ void MainWindow::set_download_mode(string cmd="") {
else{ else{
return; return;
} }
if (cmd.length() !=0 ) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
map_cmd_selection["GRUB_BOOT_SILENT"] = key; map_cmd_selection["GRUB_BOOT_SILENT"] = key;
} }
void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") { void MainWindow::set_security_login() {
int index = chbSecurityLogin->get_active_row_number(); int index = chbSecurityLogin->get_active_row_number();
string key = ""; string key = "";
if (index == 0) { if (index == 0) {
key = ""; key = "";
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
} }
else if (index == 1) { else if (index == 1) {
key = entrySecurityLogin->get_text(); key = entrySecurityLogin->get_text();
if (cmd.length() != 0) {
entrySecurityLogin->set_text(key);
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
} }
else if (index == -1) { else if (index == -1) {
return; key = "";
} }
map_cmd_selection["GRUB_USER"] = key; map_cmd_selection["GRUB_USER"] = key;
} }
@ -288,36 +266,24 @@ void MainWindow::get_security_login(std::map <string, string> &map_temp) {
} }
} }
void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") { void MainWindow::set_password_protec() {
int index = chbPasswordProtecc->get_active_row_number(); int index = chbPasswordProtecc->get_active_row_number();
string key = ""; string key = "";
if (index == 0){ if (index == 0){
key = ""; key = "";
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
} }
else if (index == 1) { else if (index == 1) {
key = entryPasswordProtecc->get_text(); key = entryPasswordProtecc->get_text();
if (cmd.length() != 0 and key != "************") {
entryPasswordProtecc->set_text(key);
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
} }
else if (index == -1) { else if (index == -1) {
return; key = "";
} }
if (key!= "************") { if (key!= "************") {
map_cmd_selection["GRUB_PASSWORD"] = key; map_cmd_selection["GRUB_PASSWORD"] = key;
} }
else {
key = "";
}
} }
void MainWindow::get_password_protec(std::map <string, string> &map_temp) { void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
@ -519,8 +485,8 @@ vector<string> MainWindow::get_setting_entry_all(string key, Gtk::Entry &entry_t
Utils::str_replace_all(value, " ", ", "); Utils::str_replace_all(value, " ", ", ");
entry_text.set_text(value); entry_text.set_text(value);
for (auto &param: vec_params) { for (auto &param: vec_params) {
map_cmd_selection[param] = "1"; map_cmd_selection[key+"_" + param] = "1";
map_temp[param] = "1"; map_temp[key + "_" + param] = "1";
} }
Utils::str_remove(value, ","); Utils::str_remove(value, ",");
map_temp[key] = value; map_temp[key] = value;
@ -681,33 +647,6 @@ void MainWindow::change_security_login() {
boxSave->set_sensitive(true); boxSave->set_sensitive(true);
} }
} }
void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
int index = cmbDefaultDonw->get_active_row_number();
if (index == 0) {
if (cmd.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index > 0) {
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
if (index != 0 && index != -1) {
map_cmd_selection["GRUB_DEFAULT"] = cmbDefaultDonw->get_active_text();
}
else {
map_cmd_selection["GRUB_DEFAULT"] = "";
}
}
void MainWindow::get_default_load(std::map <string, string> &map_temp) { void MainWindow::get_default_load(std::map <string, string> &map_temp) {
std::map <string, string>:: iterator iter_map_data; std::map <string, string>:: iterator iter_map_data;
@ -845,8 +784,13 @@ void MainWindow::set_data_cfg() {
else { else {
map_cmd_selection["GRUB_TIMEOUT"] = ""; map_cmd_selection["GRUB_TIMEOUT"] = "";
} }
int index = cmbDefaultDonw->get_active_row_number();
this->set_default_load(); if (index != 0 && index != -1) {
map_cmd_selection["GRUB_DEFAULT"] = cmbDefaultDonw->get_active_text();
}
else {
map_cmd_selection["GRUB_DEFAULT"] = "";
}
this->set_download_mode(); this->set_download_mode();
this->set_security_login(); this->set_security_login();
this->set_password_protec(); this->set_password_protec();
@ -867,12 +811,12 @@ void MainWindow::download_globl_cfg() {
map_local_cmd_selection = obj_load.get_load_data(map_global_cmd_selection, "global"); map_local_cmd_selection = obj_load.get_load_data(map_global_cmd_selection, "global");
this->get_menu_boot(map_global_cmd_selection); this->get_menu_boot(map_global_cmd_selection);
this->get_setting_entry_all("GRUB_CMDLINE_LINUX",*entryKernel, map_global_cmd_selection); this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_INPUT",*entryIPT, map_global_cmd_selection); this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_global_cmd_selection); this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_global_cmd_selection);
this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel); this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT); this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT); this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
this->get_download_mode(map_global_cmd_selection); this->get_download_mode(map_global_cmd_selection);
this->get_security_login(map_global_cmd_selection); this->get_security_login(map_global_cmd_selection);
this->get_password_protec(map_global_cmd_selection); this->get_password_protec(map_global_cmd_selection);
@ -914,9 +858,9 @@ void MainWindow::download_local_cfg() {
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_local_cmd_selection); this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_local_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_local_cmd_selection); this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_local_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_local_cmd_selection); this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_local_cmd_selection);
this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel); this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT); this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT); this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
this->get_download_mode(map_local_cmd_selection); this->get_download_mode(map_local_cmd_selection);
this->get_security_login(map_local_cmd_selection); this->get_security_login(map_local_cmd_selection);
this->get_password_protec(map_local_cmd_selection); this->get_password_protec(map_local_cmd_selection);
@ -926,9 +870,9 @@ void MainWindow::download_local_cfg() {
} }
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size) { void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key="") {
for (auto &name: list_params) { for (auto &name: list_params) {
if (map_cmd.find(name) != map_cmd.end()){ if (map_cmd.find(key + "_" + name) != map_cmd.end()){
this->set_row(list_store, size, name, true); this->set_row(list_store, size, name, true);
} }
else { else {

@ -144,8 +144,7 @@ class MainWindow : public Gtk::ApplicationWindow {
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder); MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder); MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
void get_menu_boot(std::map <string, string> &map_temp); void get_menu_boot(std::map <string, string> &map_temp);
void set_default_load(string cmd, string cmd_remove); void set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key);
void set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size);
void set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox); void set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox);
void get_builder(); void get_builder();
void init_dict(); void init_dict();
@ -181,17 +180,17 @@ class MainWindow : public Gtk::ApplicationWindow {
bool focus_out_txt_IPT(GdkEventFocus*); bool focus_out_txt_IPT(GdkEventFocus*);
bool focus_out_txt_OTT(GdkEventFocus*); bool focus_out_txt_OTT(GdkEventFocus*);
void fill_in_view(); void fill_in_view();
void set_security_login(string cmd, string cmd_remove); void set_security_login();
void get_security_login(std::map <string, string> &map_temp); void get_security_login(std::map <string, string> &map_temp);
bool check_flag_save(string flag_save); bool check_flag_save(string flag_save);
void set_download_mode(string cmd); void set_download_mode();
void change_password_protecc(); void change_password_protecc();
bool focus_out_txt_login(GdkEventFocus*); bool focus_out_txt_login(GdkEventFocus*);
void change_security_login(); void change_security_login();
void get_default_load(std::map <string, string> &map_temp); void get_default_load(std::map <string, string> &map_temp);
bool focus_out_txt_password(GdkEventFocus*); bool focus_out_txt_password(GdkEventFocus*);
void get_password_protec(std::map <string, string> &map_temp); void get_password_protec(std::map <string, string> &map_temp);
void set_password_protec(string cmd, string cmd_remove); void set_password_protec();
vector<string> get_setting_entry_all(string key, Gtk::Entry &entry_text, std::map <string, string> &map_temp); vector<string> get_setting_entry_all(string key, Gtk::Entry &entry_text, std::map <string, string> &map_temp);
void cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove); void cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove);
string dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed); string dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed);

File diff suppressed because it is too large Load Diff

@ -169,6 +169,11 @@ msgstr "Справка"
msgid "Terminal for input" msgid "Terminal for input"
msgstr "Терминал для ввода" msgstr "Терминал для ввода"
#: source/ubl-settings-bootloader.cc:295
#, fuzzy
msgid "Terminal for output"
msgstr "Терминал для вывода"
#: source/ubl-settings-bootloader.cc:308 #: source/ubl-settings-bootloader.cc:308
msgid "Load" msgid "Load"
msgstr "Загрузить" msgstr "Загрузить"

Loading…
Cancel
Save