Начата работа по реализации сохранения

pull/11/head
Igor Belitskiy 3 years ago
parent 633dead36d
commit 00423cdc76

File diff suppressed because it is too large Load Diff

@ -125,6 +125,9 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path& path, const Gt
auto selection_OTT = treeViewOTT->get_selection(); auto selection_OTT = treeViewOTT->get_selection();
selection_IPT->unselect_all(); selection_IPT->unselect_all();
selection_OTT->unselect_all(); selection_OTT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection, path, list_store_kernel); template_item_selected(map_cmd_selection, path, list_store_kernel);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_kernel); string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_kernel);
@ -137,6 +140,9 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::
auto selection_IPT = treeViewIPT->get_selection(); auto selection_IPT = treeViewIPT->get_selection();
selection_kernel->unselect_all(); selection_kernel->unselect_all();
selection_IPT->unselect_all(); selection_IPT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection , path, list_store_OTT); template_item_selected(map_cmd_selection , path, list_store_OTT);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_OTT); string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_OTT);
@ -150,6 +156,9 @@ void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::
auto selection_OTT = treeViewOTT->get_selection(); auto selection_OTT = treeViewOTT->get_selection();
selection_kernel->unselect_all(); selection_kernel->unselect_all();
selection_OTT->unselect_all(); selection_OTT->unselect_all();
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
if (flag_blocked_tree_view == false) { if (flag_blocked_tree_view == false) {
template_item_selected(map_cmd_selection , path, list_store_IPT); template_item_selected(map_cmd_selection , path, list_store_IPT);
string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_IPT); string str_flags = this->dynamic_update_entry(map_cmd_selection, vec_Option_IPT);
@ -372,7 +381,8 @@ void MainWindow::get_menu_boot(string cmd) {
} }
void MainWindow::set_menu_boot(string cmd) { void MainWindow::set_menu_boot(string cmd) {
std::string seconds = to_string(spbSecond->get_value()); int value = spbSecond->get_value();
std::string seconds = to_string(value);
cmd += seconds; cmd += seconds;
struct Result<string> res_response = this->wrapper_call(cmd); struct Result<string> res_response = this->wrapper_call(cmd);
if (res_response.error == 0) { if (res_response.error == 0) {
@ -389,16 +399,19 @@ void MainWindow::set_menu_boot(string cmd) {
void MainWindow::cmd_entry_all(string cmd_settings_kernel,string cmd_settings_IPT,string cmd_settings_OTT) { void MainWindow::cmd_entry_all(string cmd_settings_kernel,string cmd_settings_IPT,string cmd_settings_OTT) {
string cmd_kernel = entryKernel->get_text(); string cmd_kernel = entryKernel->get_text();
string cmd_IPT = entryIPT->get_text(); string cmd_IPT = entryIPT->get_text();
string cmd_OTT = entryIPT->get_text(); string cmd_OTT = entryOTT->get_text();
str_remove(cmd_kernel, ","); str_remove(cmd_kernel, ",");
str_remove(cmd_IPT, ","); str_remove(cmd_IPT, ",");
str_remove(cmd_OTT, ","); str_remove(cmd_OTT, ",");
cmd_settings_kernel += "\"" + cmd_kernel + "\""; cmd_settings_kernel += "\"" + cmd_kernel + "\"";
this->wrapper_call(cmd_settings_kernel);
cmd_settings_IPT += "\"" + cmd_IPT + "\""; cmd_settings_IPT += "\"" + cmd_IPT + "\"";
this->wrapper_call(cmd_settings_IPT);
cmd_settings_OTT += "\"" + cmd_OTT + "\""; cmd_settings_OTT += "\"" + cmd_OTT + "\"";
this->wrapper_call(cmd_settings_OTT); str_replace_all(cmd_settings_kernel, " \"", "\"");
str_replace_all(cmd_settings_IPT, " \"", "\"");
str_replace_all(cmd_settings_OTT, " \"", "\"");
this->wrapper_system(cmd_settings_kernel, "");
this->wrapper_system(cmd_settings_IPT, "");
this->wrapper_system(cmd_settings_OTT, "");
} }
void MainWindow::event(){ void MainWindow::event(){
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
@ -427,24 +440,24 @@ void MainWindow::event(){
void MainWindow::save_global_local_cfg() { void MainWindow::save_global_local_cfg() {
if (flag_save_global == false) { if (flag_save_global) {
std::string cmd_boot_time = "sudo ubconfig --default --source global set boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --target global set boot GRUB_TIMEOUT=";
this->set_menu_boot(cmd_boot_time); this->set_menu_boot(cmd_boot_time);
string cmd_settings_kernel = "sudo ubconfig --default --source global set boot GRUB_BOOT_SILENT="; string cmd_settings_kernel = "sudo ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
string cmd_settings_IPT = "sudo ubconfig --default --source global set boot GRUB_TERMINAL_OUTPUT="; string cmd_settings_IPT = "sudo ubconfig --target global set boot GRUB_TERMINAL_OUTPUT=";
string cmd_settings_OTT = "sudo ubconfig --default --source global set boot GRUB_TERMINAL_INPUT="; string cmd_settings_OTT = "sudo ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT); this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT);
flag_save_all = true; flag_save_all = false;
} }
else if (flag_save_local == false) { else if (flag_save_local) {
std::string cmd_boot_time = "sudo ubconfig --default --source system set boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --target global set boot GRUB_TIMEOUT=";
this->set_menu_boot(cmd_boot_time); this->set_menu_boot(cmd_boot_time);
string cmd_settings_kernel = "sudo ubconfig --default --source system set boot GRUB_BOOT_SILENT="; string cmd_settings_kernel = "sudo ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
string cmd_settings_IPT = "sudo ubconfig --default --source system set boot GRUB_TERMINAL_OUTPUT="; string cmd_settings_IPT = "sudo ubconfig --target global set boot GRUB_TERMINAL_OUTPUT=";
string cmd_settings_OTT = "sudo ubconfig --default --source system set boot GRUB_TERMINAL_INPUT="; string cmd_settings_OTT = "sudo ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT); this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT);
flag_save_all = true; flag_save_all = false;
} }
else{ else{
info_status_app("boxInfoMessOK"); info_status_app("boxInfoMessOK");
@ -456,15 +469,15 @@ void MainWindow::save_global_local_cfg() {
} }
void MainWindow::save_global_cfg() { void MainWindow::save_global_cfg() {
if (flag_save_global == false) { if (flag_save_global) {
if (flag_save_all == false) { if (flag_save_all) {
std::string cmd_boot_time = "sudo ubconfig --default --source global set boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --target global set boot GRUB_TIMEOUT=";
this->set_menu_boot(cmd_boot_time); this->set_menu_boot(cmd_boot_time);
string cmd_settings_kernel = "sudo ubconfig --default --source global set boot GRUB_BOOT_SILENT="; string cmd_settings_kernel = "sudo ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
string cmd_settings_IPT = "sudo ubconfig --default --source global set boot GRUB_TERMINAL_OUTPUT"; string cmd_settings_IPT = "sudo ubconfig --target global set boot GRUB_TERMINAL_OUTPUT";
string cmd_settings_OTT = "sudo ubconfig --default --source global set boot GRUB_TERMINAL_INPUT="; string cmd_settings_OTT = "sudo ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT); this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT);
flag_save_global = true; flag_save_global = false;
} }
} }
else{ else{
@ -475,13 +488,13 @@ void MainWindow::save_global_cfg() {
} }
void MainWindow::save_local_cfg() { void MainWindow::save_local_cfg() {
if (flag_save_local == false) { if (flag_save_local) {
if (flag_save_all == false) { if (flag_save_all) {
std::string cmd_boot_time = "sudo ubconfig --default --source system set boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --target system set boot GRUB_TIMEOUT=";
this->set_menu_boot(cmd_boot_time); this->set_menu_boot(cmd_boot_time);
string cmd_settings_kernel = "sudo ubconfig --default --source system set boot GRUB_BOOT_SILENT="; string cmd_settings_kernel = "sudo ubconfig --target system set boot GRUB_CMDLINE_LINUX=";
string cmd_settings_IPT = "sudo ubconfig --default --source system set boot GRUB_TERMINAL_OUTPUT"; string cmd_settings_IPT = "sudo ubconfig --target system set boot GRUB_TERMINAL_OUTPUT";
string cmd_settings_OTT = "sudo ubconfig --default --source system set boot GRUB_TERMINAL_INPUT="; string cmd_settings_OTT = "sudo ubconfig --target system set boot GRUB_TERMINAL_INPUT=";
this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT); this->cmd_entry_all(cmd_settings_kernel,cmd_settings_IPT,cmd_settings_OTT);
flag_save_local = true; flag_save_local = true;
} }
@ -497,21 +510,21 @@ void MainWindow::download_globl_cfg() {
entryKernel->set_text(""); entryKernel->set_text("");
entryOTT->set_text(""); entryOTT->set_text("");
entryIPT->set_text(""); entryIPT->set_text("");
flag_save_local = true; flag_save_local = false;
flag_save_global = true; flag_save_global = false;
flag_save_all = true; flag_save_all = false;
flag_load = true; flag_load = true;
std::string cmd_boot_time = "sudo ubconfig --default --source global get boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --default --source global get boot GRUB_TIMEOUT";
this->get_menu_boot(cmd_boot_time); this->get_menu_boot(cmd_boot_time);
string cmd_kernel_entry = "sudo ubconfig --default --source global get boot GRUB_BOOT_SILENT"; string cmd_kernel_entry = "sudo ubconfig --default --source global get boot GRUB_CMDLINE_LINUX";
this->get_setting_entry_all(cmd_kernel_entry, *entryKernel, map_global_cmd_selection); this->get_setting_entry_all(cmd_kernel_entry, *entryKernel, map_global_cmd_selection);
string cmd_ipt_entry = "sudo ubconfig --default --source global get boot GRUB_TERMINAL_INPUT"; string cmd_ipt_entry = "sudo ubconfig --default --source global get boot GRUB_TERMINAL_INPUT";
this->get_setting_entry_all(cmd_ipt_entry, *entryIPT, map_global_cmd_selection); this->get_setting_entry_all(cmd_ipt_entry, *entryIPT, map_global_cmd_selection);
string cmd_opt_entry = "sudo ubconfig --default --source global get boot GRUB_TERMINAL_OUTPUT"; string cmd_opt_entry = "sudo ubconfig --default --source global get boot GRUB_TERMINAL_OUTPUT";
this->get_setting_entry_all(cmd_opt_entry, *entryOTT, map_global_cmd_selection); this->get_setting_entry_all(cmd_opt_entry, *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);
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);
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);
info_warning_error(1); info_warning_error(1);
} }
@ -519,21 +532,21 @@ void MainWindow::download_local_cfg() {
entryKernel->set_text(""); entryKernel->set_text("");
entryOTT->set_text(""); entryOTT->set_text("");
entryIPT->set_text(""); entryIPT->set_text("");
flag_save_local = false;
flag_save_global = false;
flag_save_all = false;
flag_load = false; flag_load = false;
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
std::string cmd_boot_time = "sudo ubconfig --default --source system get boot GRUB_TIMEOUT"; std::string cmd_boot_time = "sudo ubconfig --default --source system get boot GRUB_TIMEOUT";
this->get_menu_boot(cmd_boot_time); this->get_menu_boot(cmd_boot_time);
string cmd_kernel_entry = "sudo ubconfig --default --source system get boot GRUB_BOOT_SILENT"; string cmd_kernel_entry = "sudo ubconfig --default --source system get boot GRUB_CMDLINE_LINUX";
this->get_setting_entry_all(cmd_kernel_entry, *entryKernel, map_local_cmd_selection); this->get_setting_entry_all(cmd_kernel_entry, *entryKernel, map_local_cmd_selection);
string cmd_ipt_entry = "sudo ubconfig --default --source system get boot GRUB_TERMINAL_INPUT"; string cmd_ipt_entry = "sudo ubconfig --default --source system get boot GRUB_TERMINAL_INPUT";
this->get_setting_entry_all(cmd_ipt_entry, *entryIPT, map_local_cmd_selection); this->get_setting_entry_all(cmd_ipt_entry, *entryIPT, map_local_cmd_selection);
string cmd_opt_entry = "sudo ubconfig --default --source system get boot GRUB_TERMINAL_OUTPUT"; string cmd_opt_entry = "sudo ubconfig --default --source system get boot GRUB_TERMINAL_OUTPUT";
this->get_setting_entry_all(cmd_opt_entry, *entryOTT, map_local_cmd_selection); this->get_setting_entry_all(cmd_opt_entry, *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);
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);
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);
info_warning_error(0); info_warning_error(0);
} }
@ -644,6 +657,7 @@ struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd) {
response = response.substr(0,response.find("\n")); response = response.substr(0,response.find("\n"));
obj_result.response = response; obj_result.response = response;
obj_result.error = 0; obj_result.error = 0;
} }
else { else {
obj_result.response = response; obj_result.response = response;
@ -670,7 +684,8 @@ struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd) {
return obj_result; return obj_result;
} }
void MainWindow::log_mess_error(string &cmd){ void MainWindow::log_mess_error(string &cmd) {
cout << cmd << endl;
string key = ""; string key = "";
if (map_cmd_error.find(cmd) != map_cmd_error.end()){ if (map_cmd_error.find(cmd) != map_cmd_error.end()){
str_cmd_error = map_cmd_error[cmd]; str_cmd_error = map_cmd_error[cmd];
@ -686,6 +701,7 @@ void MainWindow::log_mess_error(string &cmd){
} }
} }
void MainWindow::fn_event_intelMax1(){ void MainWindow::fn_event_intelMax1(){
chbintelMax4->set_active(false); chbintelMax4->set_active(false);
} }

Loading…
Cancel
Save