|
|
|
@ -98,7 +98,6 @@ void MainWindow::settings() {
|
|
|
|
this->download_local_cfg();
|
|
|
|
this->download_local_cfg();
|
|
|
|
this->download_globl_cfg();
|
|
|
|
this->download_globl_cfg();
|
|
|
|
//this->view_add_colums_melody(*treeViewMelody);
|
|
|
|
//this->view_add_colums_melody(*treeViewMelody);
|
|
|
|
this->view_add_colums_user(*treeViewUser);
|
|
|
|
|
|
|
|
std::map<string, vector<string>> map_list_os = format_os_list(os_control_list);
|
|
|
|
std::map<string, vector<string>> map_list_os = format_os_list(os_control_list);
|
|
|
|
obj_menu_os.set_builder(builder, path_glade);
|
|
|
|
obj_menu_os.set_builder(builder, path_glade);
|
|
|
|
obj_menu_os.set_map(map_list_os);
|
|
|
|
obj_menu_os.set_map(map_list_os);
|
|
|
|
@ -125,7 +124,6 @@ map<string, vector<string>> MainWindow::format_os_list(vector<string> &os_contro
|
|
|
|
std::map<string, vector<string>> map_list_os;
|
|
|
|
std::map<string, vector<string>> map_list_os;
|
|
|
|
set<string> set_key;
|
|
|
|
set<string> set_key;
|
|
|
|
for (string& name_os : os_control_list) {
|
|
|
|
for (string& name_os : os_control_list) {
|
|
|
|
|
|
|
|
|
|
|
|
if (name_os.find(">") != string::npos) {
|
|
|
|
if (name_os.find(">") != string::npos) {
|
|
|
|
set_key.insert(name_os.substr(0,name_os.find(">")+1));
|
|
|
|
set_key.insert(name_os.substr(0,name_os.find(">")+1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -219,10 +217,10 @@ void MainWindow::view_add_colums_melody(Gtk::TreeView &treeView) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
treeViewOTT->get_selection()->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
treeViewMelody->get_selection()->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, "GRUB_CMDLINE_LINUX");
|
|
|
|
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, " \"", "\"");
|
|
|
|
@ -234,10 +232,10 @@ void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::Tr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
treeViewKernel->get_selection()->unselect_all();
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
treeViewMelody->get_selection()->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, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
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, " \"", "\"");
|
|
|
|
@ -250,9 +248,10 @@ void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeM
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) {
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
treeViewKernel->get_selection()->unselect_all();
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
treeViewOTT->get_selection()->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewMelody->get_selection()->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, "GRUB_TERMINAL_INPUT");
|
|
|
|
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, " \"", "\"");
|
|
|
|
@ -505,8 +504,8 @@ vector<string> MainWindow::get_setting_entry_all(string key, std::map <string, s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
treeViewKernel->get_selection()->unselect_all();
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
@ -514,8 +513,8 @@ bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
this->set_entry_to_tree_view(list_store_IPT, *entryIPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
@ -523,8 +522,8 @@ bool MainWindow::focus_out_txt_IPT(GdkEventFocus*) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
|
|
|
|
bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
|
|
|
|
auto selection_OTT = treeViewIPT->get_selection();
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
this->set_entry_to_tree_view(list_store_OTT, *entryOTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
this->set_row_all(map_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
@ -652,6 +651,8 @@ void MainWindow::event() {
|
|
|
|
void MainWindow::set_tree_view_user() {
|
|
|
|
void MainWindow::set_tree_view_user() {
|
|
|
|
string key = "";
|
|
|
|
string key = "";
|
|
|
|
string users_root = "";
|
|
|
|
string users_root = "";
|
|
|
|
|
|
|
|
string password = "";
|
|
|
|
|
|
|
|
bool flag_available = false;
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewUser_model = treeViewUser->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewUser_model = treeViewUser->get_model();
|
|
|
|
Gtk::TreeModel::Children children = treeViewUser_model->children();
|
|
|
|
Gtk::TreeModel::Children children = treeViewUser_model->children();
|
|
|
|
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
@ -659,9 +660,20 @@ void MainWindow::set_tree_view_user() {
|
|
|
|
if(row) {
|
|
|
|
if(row) {
|
|
|
|
string superuser_name = row[m_columns_user.name] + "";
|
|
|
|
string superuser_name = row[m_columns_user.name] + "";
|
|
|
|
if (row[m_columns_user.check_button] && superuser_name.length() != 0) {
|
|
|
|
if (row[m_columns_user.check_button] && superuser_name.length() != 0) {
|
|
|
|
key = "GRUB_PASSWORD[" + superuser_name + "]=";
|
|
|
|
key = "GRUB_PASSWORD[" + superuser_name + "]";
|
|
|
|
if ((row[m_columns_user.password] + "") != "************") {
|
|
|
|
password = row[m_columns_user.password] + "";
|
|
|
|
map_cmd_selection[key] = row[m_columns_user.password] + "";
|
|
|
|
if (password != "************") {
|
|
|
|
|
|
|
|
map_cmd_selection[key] = password;
|
|
|
|
|
|
|
|
flag_available = false;
|
|
|
|
|
|
|
|
for (size_t index = 0; index < vec_param_names.size(); index++) {
|
|
|
|
|
|
|
|
if (vec_param_names[index] == map_cmd_selection[key]) {
|
|
|
|
|
|
|
|
flag_available = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_available == false) {
|
|
|
|
|
|
|
|
vec_param_names.push_back(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// map_cmd_selection[key] = "";
|
|
|
|
// map_cmd_selection[key] = "";
|
|
|
|
@ -680,6 +692,9 @@ void MainWindow::set_tree_view_user() {
|
|
|
|
if (users_root.length() != 0) {
|
|
|
|
if (users_root.length() != 0) {
|
|
|
|
map_cmd_selection["GRUB_SUPERUSERS"] = users_root;
|
|
|
|
map_cmd_selection["GRUB_SUPERUSERS"] = users_root;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
map_cmd_selection["GRUB_SUPERUSERS"] = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_init_data_user(std::map<string, string> &map_temp) {
|
|
|
|
void MainWindow::set_init_data_user(std::map<string, string> &map_temp) {
|
|
|
|
@ -799,8 +814,17 @@ void MainWindow::set_add_data_melody(Gtk::TreeModel::Row &row, bool flag, string
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_user() {
|
|
|
|
void MainWindow::remove_user() {
|
|
|
|
if (flag_validate_del_user && list_store_user->iter_is_valid(iter_user_del)) {
|
|
|
|
if (flag_validate_del_user && list_store_user->iter_is_valid(iter_user_del)) {
|
|
|
|
|
|
|
|
Gtk::TreeModel::Row row = *iter_user_del;
|
|
|
|
|
|
|
|
if(row) {
|
|
|
|
|
|
|
|
string name = row[m_columns_user.name] + "";
|
|
|
|
|
|
|
|
string key = "GRUB_PASSWORD[" + name + "]";
|
|
|
|
|
|
|
|
map_cmd_selection[key] = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
list_store_user->erase(iter_user_del);
|
|
|
|
list_store_user->erase(iter_user_del);
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
|
|
|
|
info_status_app(info_box_ok_css);
|
|
|
|
|
|
|
|
imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU);
|
|
|
|
|
|
|
|
lblWarning->set_text("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -809,11 +833,18 @@ void MainWindow::remove_melody() {
|
|
|
|
if (flag_validate_del_melody && list_store_melody->iter_is_valid(iter_melody_del)) {
|
|
|
|
if (flag_validate_del_melody && list_store_melody->iter_is_valid(iter_melody_del)) {
|
|
|
|
list_store_melody->erase(iter_melody_del);
|
|
|
|
list_store_melody->erase(iter_melody_del);
|
|
|
|
flag_validate_del_melody = false;
|
|
|
|
flag_validate_del_melody = false;
|
|
|
|
|
|
|
|
info_status_app(info_box_ok_css);
|
|
|
|
|
|
|
|
imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU);
|
|
|
|
|
|
|
|
lblWarning->set_text("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flag_validate_del_melody = false;
|
|
|
|
flag_validate_del_melody = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
|
|
|
|
treeViewKernel->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewOTT->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewMelody->get_selection()->unselect_all();
|
|
|
|
iter_user_del = iter;
|
|
|
|
iter_user_del = iter;
|
|
|
|
flag_validate_del_user = true;
|
|
|
|
flag_validate_del_user = true;
|
|
|
|
bool flag_error = false;
|
|
|
|
bool flag_error = false;
|
|
|
|
@ -825,7 +856,7 @@ void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
name = row[m_columns_user.name] + "";
|
|
|
|
name = row[m_columns_user.name] + "";
|
|
|
|
password = row[m_columns_user.password] + "";
|
|
|
|
password = row[m_columns_user.password] + "";
|
|
|
|
if (name.length() == 0 && password.length() == 0) {
|
|
|
|
if (name.length() == 0 || password.length() == 0) {
|
|
|
|
flag_error = true;
|
|
|
|
flag_error = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -843,16 +874,22 @@ void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
void MainWindow::remove_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
|
|
|
|
treeViewKernel->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewOTT->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewIPT->get_selection()->unselect_all();
|
|
|
|
|
|
|
|
treeViewUser->get_selection()->unselect_all();
|
|
|
|
iter_melody_del = iter;
|
|
|
|
iter_melody_del = iter;
|
|
|
|
flag_validate_del_melody = true;
|
|
|
|
flag_validate_del_melody = true;
|
|
|
|
string code_melodyes = "";
|
|
|
|
string code_melodyes = "";
|
|
|
|
|
|
|
|
string melody_title = "";
|
|
|
|
bool flag_error = false;
|
|
|
|
bool flag_error = false;
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMelody_model = treeViewMelody->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMelody_model = treeViewMelody->get_model();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMelody_model->children();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMelody_model->children();
|
|
|
|
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
code_melodyes = row[m_columns_melody.melody_code] + "";
|
|
|
|
code_melodyes = row[m_columns_melody.melody_code] + "";
|
|
|
|
if (code_melodyes.length() == 0 && (row[m_columns_melody.title] + "").length() == 0) {
|
|
|
|
melody_title = row[m_columns_melody.title] + "";
|
|
|
|
|
|
|
|
if (code_melodyes.length() == 0 || melody_title.length() == 0) {
|
|
|
|
flag_error = true;
|
|
|
|
flag_error = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|