|
|
|
@ -11,7 +11,7 @@ bool flag_load_global = false;
|
|
|
|
bool flag_lock_help = false;
|
|
|
|
bool flag_lock_help = false;
|
|
|
|
string version_application = "1.0";
|
|
|
|
string version_application = "1.0";
|
|
|
|
|
|
|
|
|
|
|
|
CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help)
|
|
|
|
CmdArgParser::CmdArgParser(const string& p_name, const string& p_description, const string& p_help)
|
|
|
|
: Glib::OptionGroup{p_name, p_description, p_help} {
|
|
|
|
: Glib::OptionGroup{p_name, p_description, p_help} {
|
|
|
|
Glib::OptionEntry socketIDArg;
|
|
|
|
Glib::OptionEntry socketIDArg;
|
|
|
|
socketIDArg.set_long_name("socket-id");
|
|
|
|
socketIDArg.set_long_name("socket-id");
|
|
|
|
@ -181,7 +181,7 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::Tr
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
string str_flags = template_item_selected(size_kernel, list_store_kernel);
|
|
|
|
string str_flags = template_item_selected(size_kernel, list_store_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
map_cmd_selection["GRUB_CMDLINE_LINUX"] = str_flags;
|
|
|
|
map_cmd_selection["GRUB_CMDLINE_LINUX"] = str_flags;
|
|
|
|
@ -196,7 +196,7 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeM
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
string str_flags = template_item_selected(size_OTT, list_store_OTT);
|
|
|
|
string str_flags = template_item_selected(size_OTT, list_store_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags;
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = str_flags;
|
|
|
|
@ -210,7 +210,7 @@ void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path&, const Gtk::TreeM
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
if (flag_blocked_tree_view == false) {
|
|
|
|
string str_flags = template_item_selected(size_IPT, list_store_IPT);
|
|
|
|
string str_flags = template_item_selected(size_IPT, list_store_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, " \"", "\"");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
Utils::str_replace_all(str_flags, "\"", "");
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_INPUT"] = str_flags;
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_INPUT"] = str_flags;
|
|
|
|
@ -345,24 +345,49 @@ void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store) {
|
|
|
|
string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key) {
|
|
|
|
string cmds = "";
|
|
|
|
string cmds = map_cmd_selection[key];
|
|
|
|
|
|
|
|
string param = "";
|
|
|
|
|
|
|
|
string str_del = "";
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
Gtk::TreeModel::Row row = list_store->children()[index];
|
|
|
|
Gtk::TreeModel::Row row = list_store->children()[index];
|
|
|
|
if(row) {
|
|
|
|
if(row) {
|
|
|
|
if (row[m_columns.check_button] == true) {
|
|
|
|
param = row[m_columns.name] + "";
|
|
|
|
cmds += row[m_columns.name] + " ";
|
|
|
|
if (row[m_columns.check_button] == true && cmds.find(param) == string::npos) {
|
|
|
|
|
|
|
|
if (cmds.length() > 0) {
|
|
|
|
|
|
|
|
if (cmds[cmds.length() - 1] == ' ') {
|
|
|
|
|
|
|
|
cmds = cmds + param + " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
cmds = cmds + " " + param + " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
cmds = cmds + param + " ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (row[m_columns.check_button] == false) {
|
|
|
|
|
|
|
|
if (cmds.find(param) != string::npos) {
|
|
|
|
|
|
|
|
str_del = ", " + param;
|
|
|
|
|
|
|
|
Utils::str_remove(cmds, str_del);
|
|
|
|
|
|
|
|
str_del = "," + param;
|
|
|
|
|
|
|
|
Utils::str_remove(cmds, str_del);
|
|
|
|
|
|
|
|
Utils::str_remove(cmds, param);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmds = "\"" + cmds + "\"";
|
|
|
|
cmds = "\"" + cmds + "\"";
|
|
|
|
|
|
|
|
Utils::str_replace_all(cmds, " ", " ");
|
|
|
|
|
|
|
|
Utils::str_replace_all(cmds, "\" ", "\"");
|
|
|
|
return cmds;
|
|
|
|
return cmds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m) {
|
|
|
|
vector<string> MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m) {
|
|
|
|
std::array<std::vector<std::string>, 5> arr_view = Utils::read_csv(string(path_resources) + "/" + file_name);
|
|
|
|
std::array<std::vector<string>, 5> arr_view = Utils::read_csv(string(path_resources) + "/" + file_name);
|
|
|
|
std::vector<std::string> vec_Option = arr_view[0];
|
|
|
|
std::vector<string> vec_Option = arr_view[0];
|
|
|
|
for (size_t index = 0; index < vec_Option.size(); index++) {
|
|
|
|
for (size_t index = 0; index < vec_Option.size(); index++) {
|
|
|
|
|
|
|
|
|
|
|
|
this->view_add_cell(row, list_store_m , arr_view, index);
|
|
|
|
this->view_add_cell(row, list_store_m , arr_view, index);
|
|
|
|
@ -376,7 +401,7 @@ void MainWindow::view_add_colums(Gtk::TreeView &treeView) {
|
|
|
|
treeView.append_column(str_description, m_columns.description);
|
|
|
|
treeView.append_column(str_description, m_columns.description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<std::string>, 5> &arr_view , size_t index) {
|
|
|
|
void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<string>, 5> &arr_view , size_t index) {
|
|
|
|
row = *(list_store_m->append());
|
|
|
|
row = *(list_store_m->append());
|
|
|
|
bool flag_chb = false;
|
|
|
|
bool flag_chb = false;
|
|
|
|
string name = arr_view[0][index];
|
|
|
|
string name = arr_view[0][index];
|
|
|
|
@ -565,23 +590,23 @@ bool MainWindow::focus_out_txt_login(GdkEventFocus*) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
|
|
|
|
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel);
|
|
|
|
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
|
|
|
|
this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT);
|
|
|
|
this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
|
|
|
|
this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT);
|
|
|
|
this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<std::string> &vec_Option, int size) {
|
|
|
|
void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<string> &vec_Option, int size, string key) {
|
|
|
|
flag_blocked_tree_view = true;
|
|
|
|
flag_blocked_tree_view = true;
|
|
|
|
vector<string> vec_params;
|
|
|
|
vector<string> vec_params;
|
|
|
|
std::string text = entry.get_text();
|
|
|
|
string text = entry.get_text();
|
|
|
|
Utils::str_replace_all(text, " ", "");
|
|
|
|
Utils::str_replace_all(text, " ", "");
|
|
|
|
vec_params = Utils::split(text, ',');
|
|
|
|
vec_params = Utils::split(text, ',');
|
|
|
|
for (auto &name: vec_Option) {
|
|
|
|
for (auto &name: vec_Option) {
|
|
|
|
@ -591,6 +616,9 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store
|
|
|
|
this->set_row(list_store, size, name, true);
|
|
|
|
this->set_row(list_store, size, name, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
|
|
|
|
Utils::str_replace_all(text, " \"", "\"");
|
|
|
|
|
|
|
|
Utils::str_replace_all(text, "\"", "");
|
|
|
|
|
|
|
|
map_cmd_selection[key] = text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_menu_boot(std::map <string, string> &map_temp) {
|
|
|
|
void MainWindow::get_menu_boot(std::map <string, string> &map_temp) {
|
|
|
|
@ -828,12 +856,14 @@ void MainWindow::set_data_cfg() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
|
|
|
str_flag_load = "global";
|
|
|
|
this->load_template(&map_global_cmd_selection, global_load);
|
|
|
|
this->load_template(&map_global_cmd_selection, global_load);
|
|
|
|
info_warning_error(1);
|
|
|
|
info_warning_error(1);
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
|
|
|
str_flag_load = "system";
|
|
|
|
this->load_template(&map_local_cmd_selection, system_load);
|
|
|
|
this->load_template(&map_local_cmd_selection, system_load);
|
|
|
|
info_warning_error(0);
|
|
|
|
info_warning_error(0);
|
|
|
|
map_cmd_selection = map_local_cmd_selection;
|
|
|
|
map_cmd_selection = map_local_cmd_selection;
|
|
|
|
@ -888,7 +918,7 @@ void MainWindow::set_entry(Gtk::Entry* entry , std::map<string, string> &map_tem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::init_dict(string flag_load) {
|
|
|
|
void MainWindow::init_dict(string flag_load) {
|
|
|
|
std::map<std::string, std::string> map_cmd_selection_n;
|
|
|
|
std::map<string, string> map_cmd_selection_n;
|
|
|
|
map_cmd_selection_n["GRUB_TIMEOUT"] = "";
|
|
|
|
map_cmd_selection_n["GRUB_TIMEOUT"] = "";
|
|
|
|
map_cmd_selection_n["GRUB_CMDLINE_LINUX"] = "";
|
|
|
|
map_cmd_selection_n["GRUB_CMDLINE_LINUX"] = "";
|
|
|
|
map_cmd_selection_n["GRUB_TERMINAL_INPUT"] = "";
|
|
|
|
map_cmd_selection_n["GRUB_TERMINAL_INPUT"] = "";
|
|
|
|
@ -918,7 +948,7 @@ void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox) {
|
|
|
|
void MainWindow::set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, string name, bool flag_chbox) {
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
Gtk::TreeModel::Row row = list_store->children()[index];
|
|
|
|
Gtk::TreeModel::Row row = list_store->children()[index];
|
|
|
|
if(row) {
|
|
|
|
if(row) {
|
|
|
|
@ -957,7 +987,7 @@ void MainWindow::template_open_browser() {
|
|
|
|
auto size = static_cast<size_t>(size_s);
|
|
|
|
auto size = static_cast<size_t>(size_s);
|
|
|
|
std::unique_ptr<char[]> buf(new char[ size ]);
|
|
|
|
std::unique_ptr<char[]> buf(new char[ size ]);
|
|
|
|
std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() );
|
|
|
|
std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() );
|
|
|
|
cmd = std::string( buf.get(), buf.get() + size - 1 );
|
|
|
|
cmd = string( buf.get(), buf.get() + size - 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index_error = system(cmd.c_str());
|
|
|
|
index_error = system(cmd.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|