|
|
|
|
@ -134,12 +134,9 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path& path, const Gt
|
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
|
template_item_selected(map_cmd_selection, path, list_store_kernel);
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_kernel);
|
|
|
|
|
template_item_selected("GRUB_CMDLINE_LINUX", map_cmd_selection, path, list_store_kernel);
|
|
|
|
|
string str_flags = this->dynamic_update_entry("GRUB_CMDLINE_LINUX", map_cmd_selection, vec_Option_kernel);
|
|
|
|
|
entryKernel->set_text(str_flags);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -149,12 +146,9 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::
|
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
|
template_item_selected(map_cmd_selection , path, list_store_OTT);
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_OTT);
|
|
|
|
|
template_item_selected("GRUB_TERMINAL_OUTPUT", map_cmd_selection , path, list_store_OTT);
|
|
|
|
|
string str_flags = this->dynamic_update_entry("GRUB_TERMINAL_OUTPUT", map_cmd_selection, vec_Option_OTT);
|
|
|
|
|
entryOTT->set_text(str_flags);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -163,12 +157,9 @@ void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::
|
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
|
template_item_selected(map_cmd_selection , path, list_store_IPT);
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_IPT);
|
|
|
|
|
template_item_selected("GRUB_TERMINAL_INPUT", map_cmd_selection , path, list_store_IPT);
|
|
|
|
|
string str_flags = this->dynamic_update_entry("GRUB_TERMINAL_INPUT", map_cmd_selection, vec_Option_IPT);
|
|
|
|
|
entryIPT->set_text(str_flags);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -307,7 +298,7 @@ void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::template_item_selected(std::map<string, string> &map_view, const Gtk::TreeModel::Path& path, Glib::RefPtr<Gtk::ListStore> &list_store) {
|
|
|
|
|
void MainWindow::template_item_selected(string key, std::map<string, string> &map_view, const Gtk::TreeModel::Path& path, Glib::RefPtr<Gtk::ListStore> &list_store) {
|
|
|
|
|
const auto iter = list_store->get_iter(path);
|
|
|
|
|
if(iter) {
|
|
|
|
|
const auto row = *iter;
|
|
|
|
|
@ -322,16 +313,18 @@ void MainWindow::template_item_selected(std::map<string, string> &map_view, con
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Glib::ustring name = row[m_columns.name];
|
|
|
|
|
cout << key + "_" + name << endl;
|
|
|
|
|
map_view[name] = cmd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string MainWindow::dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed) {
|
|
|
|
|
string MainWindow::dynamic_update_entry(string key,std::map<string, string> &map_view, vector<string> &vec_allowed) {
|
|
|
|
|
string keys = "";
|
|
|
|
|
for (auto &key: vec_allowed) {
|
|
|
|
|
if (map_view.find(key) != map_view.end()) {
|
|
|
|
|
if (map_view[key] == "1") {
|
|
|
|
|
keys += string(key) + ", ";
|
|
|
|
|
cout << key << endl;
|
|
|
|
|
for (auto &key_local: vec_allowed) {
|
|
|
|
|
if (map_view.find(key_local) != map_view.end()) {
|
|
|
|
|
if (map_view[key_local] == "1") {
|
|
|
|
|
keys += string(key_local) + ", ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -442,7 +435,6 @@ void MainWindow::localization(){
|
|
|
|
|
lblLoadMenu->set_text(_("Download menu"));
|
|
|
|
|
lblInfoInputTerminal->set_text(_("Terminal for input"));
|
|
|
|
|
lblInfoOutputTerminal->set_text(_("Terminal for output"));
|
|
|
|
|
|
|
|
|
|
chbLoadVariantSelectionTimer->set_label(_("Load option timer"));
|
|
|
|
|
btnSynopsis->set_label(_("Help"));
|
|
|
|
|
btnAbout->set_label(_("About"));
|
|
|
|
|
@ -455,17 +447,13 @@ void MainWindow::localization(){
|
|
|
|
|
btnLoad->set_label(_("Load"));
|
|
|
|
|
this->set_title(_("ubl-settings-bootloader"));
|
|
|
|
|
lblSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode"));
|
|
|
|
|
|
|
|
|
|
lblDownloadMode->set_text(_("Load screen display mode:"));
|
|
|
|
|
lblSecurityLogin->set_text(_("Load menu user name:"));
|
|
|
|
|
lblPasswordProtec->set_text(_("Load menu user password:"));
|
|
|
|
|
|
|
|
|
|
chbSecurityLogin->append(_("Not available"));
|
|
|
|
|
chbSecurityLogin->append(_("Mine"));
|
|
|
|
|
|
|
|
|
|
chbPasswordProtecc->append(_("Not available"));
|
|
|
|
|
chbPasswordProtecc->append(_("Mine"));
|
|
|
|
|
|
|
|
|
|
cmbDownloadMode->append(_("Loading animation with the magazine"));
|
|
|
|
|
cmbDownloadMode->append(_("Loading animation without a magazine"));
|
|
|
|
|
cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал"));
|
|
|
|
|
@ -483,11 +471,12 @@ vector<string> MainWindow::get_setting_entry_all(string key, Gtk::Entry &entry_t
|
|
|
|
|
Utils::str_replace_all(value, "\"", "");
|
|
|
|
|
vec_params = Utils::split(value, ' ');
|
|
|
|
|
Utils::str_replace_all(value, " ", ", ");
|
|
|
|
|
entry_text.set_text(value);
|
|
|
|
|
cout << value << endl;
|
|
|
|
|
for (auto ¶m: vec_params) {
|
|
|
|
|
map_cmd_selection[key+"_" + param] = "1";
|
|
|
|
|
map_temp[key + "_" + param] = "1";
|
|
|
|
|
map_cmd_selection[param] = "1";
|
|
|
|
|
map_temp[param] = "1";
|
|
|
|
|
}
|
|
|
|
|
entry_text.set_text(value);
|
|
|
|
|
Utils::str_remove(value, ",");
|
|
|
|
|
map_temp[key] = value;
|
|
|
|
|
}
|
|
|
|
|
@ -696,11 +685,11 @@ void MainWindow::set_active_boot_second() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_all_cfg() {
|
|
|
|
|
bool _flag_local = this->save_local_cfg();
|
|
|
|
|
bool _flag_global = this->save_global_cfg();
|
|
|
|
|
if (_flag_local && _flag_global) {
|
|
|
|
|
this->set_data_cfg();
|
|
|
|
|
bool _flag_save_global = this->save_global_cfg();
|
|
|
|
|
bool _flag_save_local = this->save_local_cfg();
|
|
|
|
|
if (_flag_save_global && _flag_save_local) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
flag_save_all = false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
@ -720,25 +709,20 @@ void MainWindow::wrapper_save_global_cfg() {
|
|
|
|
|
|
|
|
|
|
bool MainWindow::save_global_cfg() {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
if (flag_save_global) {
|
|
|
|
|
if (flag_save_all) {
|
|
|
|
|
flag_save_global = false;
|
|
|
|
|
obj_save.set_data_local(map_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_local_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "global");
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection;
|
|
|
|
|
obj_save.set_data_local(map_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_global_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "global");
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection;
|
|
|
|
|
return flag_no_save;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_local_cfg() {
|
|
|
|
|
this->set_data_cfg();
|
|
|
|
|
if (this->save_local_cfg()){
|
|
|
|
|
if (this->save_local_cfg()) {
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
@ -748,18 +732,13 @@ void MainWindow::wrapper_save_local_cfg() {
|
|
|
|
|
|
|
|
|
|
bool MainWindow::save_local_cfg() {
|
|
|
|
|
bool flag_no_save = true;
|
|
|
|
|
if (flag_save_local) {
|
|
|
|
|
if (flag_save_all) {
|
|
|
|
|
flag_save_local = false;
|
|
|
|
|
obj_save.set_data_local(map_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_global_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "system");
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
obj_save.set_data_local(map_cmd_selection);
|
|
|
|
|
obj_save.set_data_global(map_local_cmd_selection);
|
|
|
|
|
obj_save.set_data_gui(map_cmd_selection);
|
|
|
|
|
obj_save.set_vec_params(vec_param_names);
|
|
|
|
|
obj_save.save("boot", "system");
|
|
|
|
|
vector<string> obj_vec_error = obj_save.get_error();
|
|
|
|
|
flag_no_save = obj_save.get_state_save();
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection;
|
|
|
|
|
return flag_no_save;
|
|
|
|
|
}
|
|
|
|
|
@ -797,33 +776,35 @@ void MainWindow::set_data_cfg() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
this->load_template(&map_global_cmd_selection, "global");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
this->load_template(&map_local_cmd_selection, "system");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::load_template(std::map<string, string>* map_temp, string str_load) {
|
|
|
|
|
this->init_dict();
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
|
|
|
|
|
vector<string> vec_sections;
|
|
|
|
|
vec_sections.push_back("boot");
|
|
|
|
|
obj_load.set_sections(vec_sections);
|
|
|
|
|
map_local_cmd_selection = obj_load.get_load_data(map_global_cmd_selection, "global");
|
|
|
|
|
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_TERMINAL_INPUT", *entryIPT, 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, "GRUB_CMDLINE_LINUX");
|
|
|
|
|
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, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
|
this->get_download_mode(map_global_cmd_selection);
|
|
|
|
|
this->get_security_login(map_global_cmd_selection);
|
|
|
|
|
this->get_password_protec(map_global_cmd_selection);
|
|
|
|
|
this->get_default_load(map_global_cmd_selection);
|
|
|
|
|
*map_temp = obj_load.get_load_data(*map_temp, str_load);
|
|
|
|
|
this->get_menu_boot(*map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, *map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, *map_temp);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, *map_temp);
|
|
|
|
|
this->set_row_all(*map_temp, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
|
this->set_row_all(*map_temp, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
|
this->set_row_all(*map_temp, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
|
this->get_download_mode(*map_temp);
|
|
|
|
|
this->get_security_login(*map_temp);
|
|
|
|
|
this->get_password_protec(*map_temp);
|
|
|
|
|
this->get_default_load(*map_temp);
|
|
|
|
|
info_warning_error(1);
|
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
|
|
|
|
|
|
map_cmd_selection = *map_temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::init_dict() {
|
|
|
|
|
@ -839,41 +820,20 @@ void MainWindow::init_dict() {
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
this->init_dict();
|
|
|
|
|
|
|
|
|
|
vector<string> vec_sections;
|
|
|
|
|
vec_sections.push_back("boot");
|
|
|
|
|
obj_load.set_sections(vec_sections);
|
|
|
|
|
map_local_cmd_selection = obj_load.get_load_data(map_local_cmd_selection, "system");
|
|
|
|
|
|
|
|
|
|
this->get_menu_boot(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_OUTPUT", *entryOTT, map_local_cmd_selection);
|
|
|
|
|
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, "GRUB_TERMINAL_INPUT");
|
|
|
|
|
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_security_login(map_local_cmd_selection);
|
|
|
|
|
this->get_password_protec(map_local_cmd_selection);
|
|
|
|
|
this->get_default_load(map_local_cmd_selection);
|
|
|
|
|
info_warning_error(0);
|
|
|
|
|
map_cmd_selection = map_local_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
if (map_cmd.find(key + "_" + name) != map_cmd.end()){
|
|
|
|
|
this->set_row(list_store, size, name, true);
|
|
|
|
|
this->set_row(list_store, size, name, false);
|
|
|
|
|
}
|
|
|
|
|
cout << key << endl;
|
|
|
|
|
for (auto &name: list_params) {
|
|
|
|
|
if (map_cmd.find(name) != map_cmd.end()) {
|
|
|
|
|
if (map_cmd[name] == "1") {
|
|
|
|
|
this->set_row(list_store, size, name, true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->set_row(list_store, size, name, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->set_row(list_store, size, name, false);
|
|
|
|
|
|