|
|
|
|
@ -75,6 +75,7 @@ void MainWindow::settings(){
|
|
|
|
|
vec_param_names.push_back("GRUB_PASSWORD");
|
|
|
|
|
vec_param_names.push_back("GRUB_DEFAULT");
|
|
|
|
|
vec_param_names.push_back("GRUB_PLAY");
|
|
|
|
|
vec_param_names.push_back("GRUB_SUPERUSERS");
|
|
|
|
|
this->get_builder();
|
|
|
|
|
this->localization();
|
|
|
|
|
this->add_CSS();
|
|
|
|
|
@ -105,6 +106,7 @@ void MainWindow::settings(){
|
|
|
|
|
this->download_local_cfg();
|
|
|
|
|
this->download_globl_cfg();
|
|
|
|
|
this->view_add_colums_music(*treeViewMusic);
|
|
|
|
|
this->view_add_colums_user(*treeViewUser);
|
|
|
|
|
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_map(map_list_os);
|
|
|
|
|
@ -200,13 +202,9 @@ void MainWindow::fill_in_view() {
|
|
|
|
|
list_store_kernel = Gtk::ListStore::create(m_columns);
|
|
|
|
|
list_store_IPT = Gtk::ListStore::create(m_columns);
|
|
|
|
|
list_store_OTT = Gtk::ListStore::create(m_columns);
|
|
|
|
|
list_store_user = Gtk::ListStore::create(m_columns_user);
|
|
|
|
|
treeViewKernel->set_model(list_store_kernel);
|
|
|
|
|
treeViewIPT->set_model(list_store_IPT);
|
|
|
|
|
treeViewOTT->set_model(list_store_OTT);
|
|
|
|
|
treeViewUser->set_model(list_store_user);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vec_Option_kernel = this->read_file_and_view(kernel_csv, row_kernel, list_store_kernel);
|
|
|
|
|
vec_Option_IPT = this->read_file_and_view(IPT_csv, row_IPT, list_store_IPT);
|
|
|
|
|
vec_Option_OTT = this->read_file_and_view(OTT_csv, row_OTT, list_store_OTT);
|
|
|
|
|
@ -216,7 +214,6 @@ void MainWindow::fill_in_view() {
|
|
|
|
|
this->view_add_colums(*treeViewKernel);
|
|
|
|
|
this->view_add_colums(*treeViewIPT);
|
|
|
|
|
this->view_add_colums(*treeViewOTT);
|
|
|
|
|
this->view_add_colums_user(*treeViewUser);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::view_add_colums_user(Gtk::TreeView &treeView) {
|
|
|
|
|
@ -439,7 +436,6 @@ string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cmds = "\"" + cmds + "\"";
|
|
|
|
|
cout << cmds << endl;
|
|
|
|
|
return cmds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -733,7 +729,6 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map_cmd_selection[key] = text;
|
|
|
|
|
cout << text << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_menu_boot(std::map <string, string> &map_temp) {
|
|
|
|
|
@ -845,25 +840,69 @@ void get_tree_view_music() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::set_init_data_user(std::map<string, string> &map_temp) {
|
|
|
|
|
treeViewUser->reset_expander_column();
|
|
|
|
|
list_store_user = Gtk::ListStore::create(m_columns_user);
|
|
|
|
|
treeViewUser->set_model(list_store_user);
|
|
|
|
|
vector<string> vec_users;
|
|
|
|
|
string buf_key = "";
|
|
|
|
|
string password = "";
|
|
|
|
|
for (auto& [key, value]: map_temp) {
|
|
|
|
|
if (key.find("GRUB_PASSWORD[") != string::npos) {
|
|
|
|
|
buf_key = key;
|
|
|
|
|
vec_param_names.push_back(buf_key);
|
|
|
|
|
Utils::str_remove(buf_key,"GRUB_PASSWORD[");
|
|
|
|
|
Utils::str_remove(buf_key,"]");
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
password = "************";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
password = "";
|
|
|
|
|
}
|
|
|
|
|
this->set_add_data_user(row_user, false, buf_key, password);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_init_data_superuser(std::map<string, string> &map_temp) {
|
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewKernelUser = treeViewUser->get_model();
|
|
|
|
|
string names_superusers = map_temp["GRUB_SUPERUSERS"];
|
|
|
|
|
vector<string> vec_superusers = Utils::split(names_superusers, ',');
|
|
|
|
|
Gtk::TreeModel::Children children = treeViewKernelUser->children();
|
|
|
|
|
for (string& str_superuser: vec_superusers) {
|
|
|
|
|
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter){
|
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
|
if (row[m_columns_user.name] == str_superuser) {
|
|
|
|
|
row[m_columns_user.check_button] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_add_data_user(Gtk::TreeModel::Row &row, bool flag, string &name, string &password) {
|
|
|
|
|
row = *(list_store_user->append());
|
|
|
|
|
row[m_columns_user.check_button] = flag;
|
|
|
|
|
row[m_columns_user.name] = name;
|
|
|
|
|
row[m_columns_user.password] = password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_init_data_music(std::map<string, string> &map_temp) {
|
|
|
|
|
treeViewMusic->reset_expander_column();
|
|
|
|
|
list_store_music = Gtk::ListStore::create(m_columns_music);
|
|
|
|
|
treeViewMusic->set_model(list_store_music);
|
|
|
|
|
string path_name = "";
|
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-music.csv";
|
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-beeplist.csv";
|
|
|
|
|
vector<tuple<string, string>> vec_music = Utils::read_csv_music(path_name);
|
|
|
|
|
bool flag = false;
|
|
|
|
|
string cgf_code_music = map_temp["GRUB_PLAY"];
|
|
|
|
|
cout << cgf_code_music << endl;
|
|
|
|
|
for (tuple<string, string>& tuple_music: vec_music) {
|
|
|
|
|
string name = get<0>(tuple_music);
|
|
|
|
|
string code = get<1>(tuple_music);
|
|
|
|
|
flag = (cgf_code_music == code);
|
|
|
|
|
this->set_add_data_music(row_music, flag, name, code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_add_data_music(Gtk::TreeModel::Row &row, bool flag, string &name, string &code) {
|
|
|
|
|
@ -1112,7 +1151,9 @@ void MainWindow::load_template(std::map<string, string>* map_temp, string cmd) {
|
|
|
|
|
this->set_entry(entryIPT, *map_temp, "GRUB_TERMINAL_INPUT");
|
|
|
|
|
this->set_entry(entryOTT, *map_temp, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
|
string str_last_launched_os_ubconfig = (*map_temp)["GRUB_DEFAULT"];
|
|
|
|
|
this->set_init_data_user(*map_temp);
|
|
|
|
|
this->set_init_data_music(*map_temp);
|
|
|
|
|
this->set_init_data_superuser(*map_temp);
|
|
|
|
|
if (str_last_launched_os_ubconfig.length() != 0) {
|
|
|
|
|
entrListOS->set_text(str_last_launched_os_ubconfig);
|
|
|
|
|
}
|
|
|
|
|
@ -1146,6 +1187,7 @@ void MainWindow::init_dict(string flag_load) {
|
|
|
|
|
map_cmd_selection_n["GRUB_PASSWORD"] = "";
|
|
|
|
|
map_cmd_selection_n["GRUB_DEFAULT"] = "";
|
|
|
|
|
map_cmd_selection_n["GRUB_PLAY"] = "";
|
|
|
|
|
map_cmd_selection_n["GRUB_SUPERUSERS"] = "";
|
|
|
|
|
map_cmd_selection = map_cmd_selection_n;
|
|
|
|
|
if (flag_load == "global") {
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection_n;
|
|
|
|
|
|