|
|
|
@ -101,7 +101,7 @@ void MainWindow::settings(){
|
|
|
|
|
|
|
|
|
|
|
|
this->download_local_cfg();
|
|
|
|
this->download_local_cfg();
|
|
|
|
this->download_globl_cfg();
|
|
|
|
this->download_globl_cfg();
|
|
|
|
this->view_add_colums_music(*treeViewMusic);
|
|
|
|
this->view_add_colums_melody(*treeViewMusic);
|
|
|
|
this->view_add_colums_user(*treeViewUser);
|
|
|
|
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);
|
|
|
|
@ -218,10 +218,10 @@ void MainWindow::view_add_colums_user(Gtk::TreeView &treeView) {
|
|
|
|
treeView.append_column_editable(str_password, m_columns_user.password);
|
|
|
|
treeView.append_column_editable(str_password, m_columns_user.password);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::view_add_colums_music(Gtk::TreeView &treeView) {
|
|
|
|
void MainWindow::view_add_colums_melody(Gtk::TreeView &treeView) {
|
|
|
|
treeView.append_column_editable(str_active, m_columns_music.check_button);
|
|
|
|
treeView.append_column_editable(str_active, m_columns_melody.check_button);
|
|
|
|
treeView.append_column_editable(str_option, m_columns_music.title);
|
|
|
|
treeView.append_column_editable(str_option, m_columns_melody.title);
|
|
|
|
treeView.append_column_editable(str_melody_code, m_columns_music.melody_code);
|
|
|
|
treeView.append_column_editable(str_melody_code, m_columns_melody.melody_code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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&) {
|
|
|
|
@ -632,11 +632,11 @@ void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cm
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::event() {
|
|
|
|
void MainWindow::event() {
|
|
|
|
btnRemoveUser->signal_clicked().connect([&]() {remove_user();});
|
|
|
|
btnRemoveUser->signal_clicked().connect([&]() {remove_user();});
|
|
|
|
btnRemoveMusic->signal_clicked().connect([&]() {remove_music();});
|
|
|
|
btnRemoveMusic->signal_clicked().connect([&]() {remove_melody();});
|
|
|
|
btnAddUser->signal_clicked().connect([&]() {string name = "", passwd = "";
|
|
|
|
btnAddUser->signal_clicked().connect([&]() {string name = "", passwd = "";
|
|
|
|
set_add_data_user(row_user, false, name, passwd);});
|
|
|
|
set_add_data_user(row_user, false, name, passwd);});
|
|
|
|
btnAddMusic->signal_clicked().connect([&]() {string code = "", name = "";
|
|
|
|
btnAddMusic->signal_clicked().connect([&]() {string code = "", name = "";
|
|
|
|
set_add_data_music(row_music, false,name, code);});
|
|
|
|
set_add_data_melody(row_melody, false,name, code);});
|
|
|
|
btnOpenMenuOS->signal_clicked().connect([&]() {obj_menu_os.show();});
|
|
|
|
btnOpenMenuOS->signal_clicked().connect([&]() {obj_menu_os.show();});
|
|
|
|
btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();});
|
|
|
|
btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();});
|
|
|
|
chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;});
|
|
|
|
chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;});
|
|
|
|
@ -667,7 +667,7 @@ void MainWindow::event() {
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewUserModel = treeViewUser->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewUserModel = treeViewUser->get_model();
|
|
|
|
treeViewUserModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::remove_line_user));
|
|
|
|
treeViewUserModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::remove_line_user));
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusicModel = treeViewMusic->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusicModel = treeViewMusic->get_model();
|
|
|
|
treeViewMusicModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::remove_line_music));
|
|
|
|
treeViewMusicModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::remove_line_melody));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit));
|
|
|
|
this->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit));
|
|
|
|
chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second));
|
|
|
|
chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second));
|
|
|
|
@ -742,28 +742,28 @@ void MainWindow::set_init_data_superuser(std::map<string, string> &map_temp) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_data_csv_music() {
|
|
|
|
void MainWindow::set_data_csv_melody() {
|
|
|
|
string path_name = "";
|
|
|
|
string path_name = "";
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-beeplist.csv";
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-melodylist.csv";
|
|
|
|
string line;
|
|
|
|
string line;
|
|
|
|
string all_music = "";
|
|
|
|
string all_melody = "";
|
|
|
|
string all_music_old = "";
|
|
|
|
string all_melody_old = "";
|
|
|
|
string code_melodies = "";
|
|
|
|
string code_melodyes = "";
|
|
|
|
ifstream in(path_name);
|
|
|
|
ifstream in(path_name);
|
|
|
|
if (in.is_open()) {
|
|
|
|
if (in.is_open()) {
|
|
|
|
while (getline(in, line)){
|
|
|
|
while (getline(in, line)){
|
|
|
|
all_music_old += line + "\n";
|
|
|
|
all_melody_old += line + "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusic_model = treeViewMusic->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusic_model = treeViewMusic->get_model();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMusic_model->children();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMusic_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_melodies = row[m_columns_music.melody_code] + "";
|
|
|
|
code_melodyes = row[m_columns_melody.melody_code] + "";
|
|
|
|
if (code_melodies.length() != 0 && (row[m_columns_music.title] + "").length() != 0) {
|
|
|
|
if (code_melodyes.length() != 0 && (row[m_columns_melody.title] + "").length() != 0) {
|
|
|
|
all_music += row[m_columns_music.title] + "," + code_melodies + "\n";
|
|
|
|
all_melody += row[m_columns_melody.title] + "," + code_melodyes + "\n";
|
|
|
|
if (row[m_columns_music.check_button]) {
|
|
|
|
if (row[m_columns_melody.check_button]) {
|
|
|
|
map_cmd_selection["GRUB_PLAY"] = code_melodies + "";
|
|
|
|
map_cmd_selection["GRUB_PLAY"] = code_melodyes + "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
map_cmd_selection["GRUB_PLAY"] = "";
|
|
|
|
map_cmd_selection["GRUB_PLAY"] = "";
|
|
|
|
@ -772,13 +772,13 @@ void MainWindow::set_data_csv_music() {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU);
|
|
|
|
imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU);
|
|
|
|
info_status_app(info_box_error_css);
|
|
|
|
info_status_app(info_box_error_css);
|
|
|
|
lblWarning->set_text(str_null_music_name);
|
|
|
|
lblWarning->set_text(str_null_melody_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (all_music_old != all_music) {
|
|
|
|
if (all_melody_old != all_melody) {
|
|
|
|
ofstream fout(path_name, ios_base::out | ios_base::trunc);
|
|
|
|
ofstream fout(path_name, ios_base::out | ios_base::trunc);
|
|
|
|
if (fout.is_open()) {
|
|
|
|
if (fout.is_open()) {
|
|
|
|
fout << all_music;
|
|
|
|
fout << all_melody;
|
|
|
|
fout.close();
|
|
|
|
fout.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -791,28 +791,28 @@ void MainWindow::set_add_data_user(Gtk::TreeModel::Row &row, bool flag, string &
|
|
|
|
row[m_columns_user.password] = password;
|
|
|
|
row[m_columns_user.password] = password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_init_data_music(std::map<string, string> &map_temp) {
|
|
|
|
void MainWindow::set_init_data_melody(std::map<string, string> &map_temp) {
|
|
|
|
treeViewMusic->reset_expander_column();
|
|
|
|
treeViewMusic->reset_expander_column();
|
|
|
|
list_store_music = Gtk::ListStore::create(m_columns_music);
|
|
|
|
list_store_melody = Gtk::ListStore::create(m_columns_melody);
|
|
|
|
treeViewMusic->set_model(list_store_music);
|
|
|
|
treeViewMusic->set_model(list_store_melody);
|
|
|
|
string path_name = "";
|
|
|
|
string path_name = "";
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-beeplist.csv";
|
|
|
|
path_name = path_name + path_resources + "/" + "grub-melodylist.csv";
|
|
|
|
vector<tuple<string, string>> vec_music = Utils::read_csv_music(path_name);
|
|
|
|
vector<tuple<string, string>> vec_melody = Utils::read_csv_melody(path_name);
|
|
|
|
bool flag = false;
|
|
|
|
bool flag = false;
|
|
|
|
string cgf_code_music = map_temp["GRUB_PLAY"];
|
|
|
|
string cgf_code_melody = map_temp["GRUB_PLAY"];
|
|
|
|
for (tuple<string, string>& tuple_music: vec_music) {
|
|
|
|
for (tuple<string, string>& tuple_melody: vec_melody) {
|
|
|
|
string name = get<0>(tuple_music);
|
|
|
|
string name = get<0>(tuple_melody);
|
|
|
|
string code = get<1>(tuple_music);
|
|
|
|
string code = get<1>(tuple_melody);
|
|
|
|
flag = (cgf_code_music == code);
|
|
|
|
flag = (cgf_code_melody == code);
|
|
|
|
this->set_add_data_music(row_music, flag, name, code);
|
|
|
|
this->set_add_data_melody(row_melody, flag, name, code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_add_data_music(Gtk::TreeModel::Row &row, bool flag, string &name, string &code) {
|
|
|
|
void MainWindow::set_add_data_melody(Gtk::TreeModel::Row &row, bool flag, string &name, string &code) {
|
|
|
|
row = *(list_store_music->append());
|
|
|
|
row = *(list_store_melody->append());
|
|
|
|
row[m_columns_music.check_button] = flag;
|
|
|
|
row[m_columns_melody.check_button] = flag;
|
|
|
|
row[m_columns_music.title] = name;
|
|
|
|
row[m_columns_melody.title] = name;
|
|
|
|
row[m_columns_music.melody_code] = code;
|
|
|
|
row[m_columns_melody.melody_code] = code;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_user() {
|
|
|
|
void MainWindow::remove_user() {
|
|
|
|
@ -823,12 +823,12 @@ void MainWindow::remove_user() {
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
flag_validate_del_user = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_music() {
|
|
|
|
void MainWindow::remove_melody() {
|
|
|
|
if (flag_validate_del_music && list_store_music->iter_is_valid(iter_music_del)) {
|
|
|
|
if (flag_validate_del_melody && list_store_melody->iter_is_valid(iter_melody_del)) {
|
|
|
|
list_store_music->erase(iter_music_del);
|
|
|
|
list_store_melody->erase(iter_melody_del);
|
|
|
|
flag_validate_del_music = false;
|
|
|
|
flag_validate_del_melody = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
flag_validate_del_music = 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) {
|
|
|
|
@ -860,17 +860,17 @@ void MainWindow::remove_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::remove_line_music(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
void MainWindow::remove_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
|
|
|
|
iter_music_del = iter;
|
|
|
|
iter_melody_del = iter;
|
|
|
|
flag_validate_del_music = true;
|
|
|
|
flag_validate_del_melody = true;
|
|
|
|
string code_melodies = "";
|
|
|
|
string code_melodyes = "";
|
|
|
|
bool flag_error = false;
|
|
|
|
bool flag_error = false;
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusic_model = treeViewMusic->get_model();
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewMusic_model = treeViewMusic->get_model();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMusic_model->children();
|
|
|
|
Gtk::TreeModel::Children children = treeViewMusic_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_melodies = row[m_columns_music.melody_code] + "";
|
|
|
|
code_melodyes = row[m_columns_melody.melody_code] + "";
|
|
|
|
if (code_melodies.length() == 0 && (row[m_columns_music.title] + "").length() == 0) {
|
|
|
|
if (code_melodyes.length() == 0 && (row[m_columns_melody.title] + "").length() == 0) {
|
|
|
|
flag_error = true;
|
|
|
|
flag_error = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -878,7 +878,7 @@ void MainWindow::remove_line_music(const Gtk::TreeModel::Path&, const Gtk::TreeM
|
|
|
|
if (flag_error == true) {
|
|
|
|
if (flag_error == true) {
|
|
|
|
imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU);
|
|
|
|
imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU);
|
|
|
|
info_status_app(info_box_error_css);
|
|
|
|
info_status_app(info_box_error_css);
|
|
|
|
lblWarning->set_text(str_null_music_name);
|
|
|
|
lblWarning->set_text(str_null_melody_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
info_status_app(info_box_ok_css);
|
|
|
|
info_status_app(info_box_ok_css);
|
|
|
|
@ -1020,7 +1020,7 @@ void MainWindow::set_data_cfg() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->set_download_mode();
|
|
|
|
this->set_download_mode();
|
|
|
|
this->set_tree_view_user();
|
|
|
|
this->set_tree_view_user();
|
|
|
|
this->set_data_csv_music();
|
|
|
|
this->set_data_csv_melody();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
@ -1062,7 +1062,7 @@ void MainWindow::load_template(std::map<string, string>* map_temp, string cmd) {
|
|
|
|
this->set_entry(entryOTT, *map_temp, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
this->set_entry(entryOTT, *map_temp, "GRUB_TERMINAL_OUTPUT");
|
|
|
|
string str_last_launched_os_ubconfig = (*map_temp)["GRUB_DEFAULT"];
|
|
|
|
string str_last_launched_os_ubconfig = (*map_temp)["GRUB_DEFAULT"];
|
|
|
|
this->set_init_data_user(*map_temp);
|
|
|
|
this->set_init_data_user(*map_temp);
|
|
|
|
this->set_init_data_music(*map_temp);
|
|
|
|
this->set_init_data_melody(*map_temp);
|
|
|
|
this->set_init_data_superuser(*map_temp);
|
|
|
|
this->set_init_data_superuser(*map_temp);
|
|
|
|
if (str_last_launched_os_ubconfig.length() != 0) {
|
|
|
|
if (str_last_launched_os_ubconfig.length() != 0) {
|
|
|
|
entrListOS->set_text(str_last_launched_os_ubconfig);
|
|
|
|
entrListOS->set_text(str_last_launched_os_ubconfig);
|
|
|
|
|