diff --git a/source/menu_os.cc b/source/menu_os.cc new file mode 100644 index 0000000..560d332 --- /dev/null +++ b/source/menu_os.cc @@ -0,0 +1,26 @@ +#include "menu_os.h" + + +menu_os::menu_os(/* args */) +{ +} + +menu_os::~menu_os() +{ +} + +void menu_os::init() { + this->m_box(Gtk::ORIENTATION_VERTICAL); + for (auto& [key, value]: map_list_os) { + Gtk::Button *button = new Gtk::button(); + Gtk::Revealer *revealer = new Gtk::Revealer(); + std::map map_buttons_level_2; + + map_buttons_level_1[key] = struct_menu_os_button{button, revealer} + + } +} + +void menu_os::crete_menu_level_2(string key, std::map &map_buttons_level_2) { + map_buttons_level_2[key] = +} \ No newline at end of file diff --git a/source/menu_os.h b/source/menu_os.h new file mode 100644 index 0000000..4b5d1c5 --- /dev/null +++ b/source/menu_os.h @@ -0,0 +1,27 @@ +#include + +class menu_os +{ +private: + struct struct_menu_os_button_v_2{ + Gtk::Button* button; + }; + + struct struct_menu_os_button{ + Gtk::Button* button; + Gtk::Revealer* revealer; + std::map map_buttons_level_2; + }; + std::map map_buttons_level_1; + std::map map_list_os; + Gtk::Box m_box; + Gtk::Revealer* level_1; +public: + menu_os(/* args */); + void set_popover(Gtk::Popover *popover); + void set_map(std::map map_list_os); + void crete_menu_level_2(string key, std::map &map_buttons_level_2); + void init(); + ~menu_os(); +}; + diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 16fb008..27a320e 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -347,40 +347,28 @@ void MainWindow::get_password_protec(std::map &map_temp) { string MainWindow::template_item_selected(int size, Glib::RefPtr &list_store, string key) { string cmds = map_cmd_selection[key]; - string param = ""; - string str_del = ""; + Utils::str_replace_all(cmds, "\"", ""); for (int index = 0; index < size; index++) { Gtk::TreeModel::Row row = list_store->children()[index]; if(row) { - param = row[m_columns.name] + ""; + string param = 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 + " "; - } - + 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); - } + if (row[m_columns.check_button] == false && cmds.find(param) != string::npos) { + string param_del = " " + param; + Utils::str_remove(cmds, param_del); + Utils::str_remove(cmds, param); } } } - cmds = "\"" + cmds + "\""; Utils::str_replace_all(cmds, " ", " "); - Utils::str_replace_all(cmds, "\" ", "\""); + if (cmds.length() > 0) { + if (cmds[0] == ' ') { + cmds = cmds.substr(1, cmds.length() - 1); + } + } + cmds = "\"" + cmds + "\""; return cmds; } @@ -603,10 +591,10 @@ bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) { return true; } -void MainWindow::set_entry_to_tree_view(Glib::RefPtr &list_store, Gtk::Entry &entry, std::vector &vec_Option, int size, string key) { +void MainWindow::set_entry_to_tree_view(Glib::RefPtr &list_store, Gtk::Entry &entry, std::vector &vec_Option, int size, string key) { flag_blocked_tree_view = true; vector vec_params; - string text = entry.get_text(); + std::string text = entry.get_text(); Utils::str_replace_all(text, " ", ""); vec_params = Utils::split(text, ','); for (auto &name: vec_Option) { @@ -615,10 +603,20 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr &list_store for (auto &name: vec_params) { this->set_row(list_store, size, name, true); } + Utils::str_remove(text, ","); + if (text.length() > 0) { + if (text[0] == ' ') { + text = text.substr(1, text.length() - 1); + } + } + if (text.find("\"") == string::npos && text.length() != 0) { + text = "\"" + text + "\""; + } + + map_cmd_selection[key] = text; 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 &map_temp) { @@ -688,11 +686,26 @@ void MainWindow::event(){ entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel)); entryIPT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_IPT)); entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT)); + entryKernel->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view)); + entryIPT->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view)); + entryOTT->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view)); } + 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)); } +bool MainWindow::focus_tree_view(GdkEventFocus*) { + treeViewKernel->set_can_focus(false); + treeViewIPT->set_can_focus(false); + treeViewOTT->set_can_focus(false); + treeViewKernel->collapse_all(); + treeViewIPT->collapse_all(); + treeViewOTT->collapse_all(); + + return true; +} + bool MainWindow::gui_exit(GdkEventAny*) { exit(1); return true; diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index 07a9926..17782b7 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -294,6 +294,7 @@ class MainWindow : public Gtk::ApplicationWindow { bool focus_out_txt_IPT(GdkEventFocus*); bool focus_out_txt_OTT(GdkEventFocus*); void fill_in_view(); + bool focus_tree_view(GdkEventFocus*); void set_security_login(); void get_security_login(std::map &map_temp); bool check_flag_save(string flag_save); diff --git a/ubl-settings-bootloader.glade b/ubl-settings-bootloader.glade index c7a83df..20b9f6e 100644 --- a/ubl-settings-bootloader.glade +++ b/ubl-settings-bootloader.glade @@ -7,6 +7,16 @@ True + + False + + + True + True + True + + + True @@ -48,6 +58,109 @@ + + False + + + True + False + + + True + False + none + + + True + False + label + + + + + True + True + 0 + + + + + True + False + vertical + + + True + False + none + + + True + False + label111 + + + + + False + True + 0 + + + + + True + False + none + + + True + False + label2222 + + + + + False + True + 1 + + + + + True + False + none + + + True + False + label333 + + + + + False + True + 2 + + + + + False + True + 1 + + + + + + + False + + + + False False @@ -487,6 +600,22 @@ specified priority 1 + + + True + True + False + True + + + + + + False + True + 2 + + False