diff --git a/boot-options.csv b/boot-options.csv index e69de29..1aba2df 100644 --- a/boot-options.csv +++ b/boot-options.csv @@ -0,0 +1,14 @@ +Option,Description +quiet,Downloading without text messages +splash,Show welcome window +noplymouth,Disable Plymouth +acpi=off,Disable ACPI +noapic,Disable APIC +nolapic,Disable local APIC +single,Single User Mode +nomodeset,Disable kernel selection and loading of video drivers +915.enable_dc=0,Disable GPU power management +ahci.mobile_lpm_policy=1,"Maximum performance, power management" +snd-intel-dspcfg.dsp_driver=1,Forced selection of an Intel sound device driver +intel_idle.max_cstate=1,Prevents the processor from going into a deep sleep state +intel_idle.max_cstate=4,Eliminates flickering laptop display on Ultra Voltage processors diff --git a/input-options.csv b/input-options.csv index e69de29..4bd7f47 100644 --- a/input-options.csv +++ b/input-options.csv @@ -0,0 +1,6 @@ +Option,Description +console,PC BIOS & EFI console +serial,Serial terminal +ofconsole,Open Firmware Console +at_keyboard,PC AT Keyboard (Coreboot) +usb_keyboard,USB Keyboard (HID Boot protocol) diff --git a/output-options.csv b/output-options.csv index e69de29..30453d6 100644 --- a/output-options.csv +++ b/output-options.csv @@ -0,0 +1,6 @@ +Option,Description +console,PC BIOS & EFI console +serial,Serial terminal +ofconsole,Open Firmware Console +gfxterm,Output in graphical mode +vga_text,VGA text output (Coreboot) diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 604b71f..ca98efc 100644 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -2,10 +2,11 @@ #include "ubl-settings-bootloader.h" using namespace std; -string path_app= "/usr/bin/"; +string path_app = "/usr/bin/"; string path_glade= "/usr/share/ubl-settings-bootloader/ui/ubl-settings-bootloader.glade"; string path_css = "/usr/share/ubl-settings-bootloader/css/style.css"; string app_name = "ubl-settings-bootloader"; +string path_resources = "/usr/share/ubl-settings-bootloader"; int socket_ext_id_I = 0; int socket_trd_id_I = 0; @@ -71,13 +72,12 @@ void MainWindow::settings(){ this->add_CSS(); this->event(); + btnBoxAboutDialog->set_visible(false); ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I); if (this->check_root() == 0) { - this->add_colums(treeViewKernel, columns_Kernel); - this->add_colums(treeViewIPT, columns_IPT); - this->add_colums(treeViewOTT, columns_OTT); - this->add_cell(treeViewKernel, columns_Kernel, true, "name", "text"); + this->fill_in_view(); + } else{ boxWidgetAll->set_sensitive(false); @@ -87,25 +87,61 @@ void MainWindow::settings(){ info_status_app("boxInfoMessError"); lblWarning->set_text(_("The program must be run as root")); } +} + +void MainWindow::fill_in_view() { + list_store_kernel = Gtk::ListStore::create(columns_kernel); + list_store_IPT = Gtk::ListStore::create(columns_IPT); + list_store_OTT = Gtk::ListStore::create(columns_OTT); + treeViewKernel->set_model(list_store_kernel); + treeViewIPT->set_model(list_store_IPT); + treeViewOTT->set_model(list_store_OTT); + Gtk::TreeModel::Row row_kernel = *(list_store_kernel->append()); + Gtk::TreeModel::Row row_IPT = *(list_store_IPT->append()); + Gtk::TreeModel::Row row_OTT = *(list_store_OTT->append()); + + this->read_file_and_view("boot-options.csv",row_kernel, list_store_kernel , columns_kernel); + this->read_file_and_view("input-options.csv",row_IPT, list_store_IPT , columns_IPT); + this->read_file_and_view("output-options.csv", row_OTT, list_store_OTT , columns_OTT); + + this->view_add_colums(*treeViewKernel, columns_kernel); + this->view_add_colums(*treeViewIPT, columns_IPT); + this->view_add_colums(*treeViewOTT, columns_OTT); } -void MainWindow::add_colums(Gtk::TreeView *treeView, ModelColumns *m_columns) { - treeView->append_column(_("Active"), m_columns->check_button); - treeView->append_column(_("Option"), m_columns->name); - treeView->append_column(_("Description"), m_columns->description); + +void MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , ModelColumns &m_colum) { + count_append_cell = 0; + std::array, 2> arr_view = read_csv(path_resources + "/" + file_name); + std::vector vec_Option = arr_view[0]; + std::vector vec_Description = arr_view[1]; + for (size_t index = 0; index < vec_Option.size(); index++) { + string str_option = _(vec_Option[index].c_str()); + string str_description = _(vec_Description[index].c_str()); + this->view_add_cell(row, list_store_m , m_colum, true, str_option, str_description); + } } -void MainWindow::add_cell(Gtk::TreeView *tree_view, ModelColumns *m_colum, bool flag_chk_btn, string name, string desc) { - cout << flag_chk_btn << endl; - Glib::RefPtr list_store; - list_store = Gtk::ListStore::create(*m_colum); - tree_view->set_model(list_store); - Gtk::TreeModel::Row row = *(list_store->append()); - row[m_colum->check_button] = "flag_chk_btn"; - row[m_colum->name] = name; - row[m_colum->description] = desc; +void MainWindow::view_add_colums(Gtk::TreeView &treeView, ModelColumns &m_columns) { + treeView.append_column(_("Active"), m_columns.check_button); + treeView.append_column(_("Option"), m_columns.name); + treeView.append_column(_("Description"), m_columns.description); + +} + +void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , ModelColumns &m_colum, bool flag_chk_btn, string name, string desc) { + ; + if (count_append_cell != 0) { + row = *(list_store_m->append()); + } + row[m_colum.check_button] = flag_chk_btn; + row[m_colum.name] = name; + row[m_colum.description] = desc; + + count_append_cell += 1; + } void MainWindow::get_monitor_size(){ diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index a070ffc..68721fa 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -38,13 +38,13 @@ class MainWindow : public Gtk::ApplicationWindow { public: ModelColumns() {add(check_button), add(name); add(description); } //Gtk::TreeModelColumn check_button; - Gtk::TreeModelColumn check_button; + Gtk::TreeModelColumn check_button; Gtk::TreeModelColumn name; Gtk::TreeModelColumn description; }; - ModelColumns *columns_Kernel; - ModelColumns *columns_IPT; - ModelColumns *columns_OTT; + ModelColumns columns_kernel; + ModelColumns columns_IPT; + ModelColumns columns_OTT; Glib::RefPtr builder; Gtk::SpinButton *spbSecond; Gtk::Label *lblInfoSeconds; @@ -87,11 +87,18 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::TreeView *treeViewKernel; Gtk::TreeView *treeViewIPT; Gtk::TreeView *treeViewOTT; - + + Gtk::TreeModel::Row row_kernel; + Gtk::TreeModel::Row row_IPT; + Gtk::TreeModel::Row row_OT; + Glib::RefPtr list_store_kernel; + Glib::RefPtr list_store_IPT; + Glib::RefPtr list_store_OTT; int width; int heigh; int screen_width; int screen_hight; + int count_append_cell = 0; string version_application = "1.0"; int index_error = 0; string str_cmd_error = ""; @@ -113,19 +120,21 @@ class MainWindow : public Gtk::ApplicationWindow { void fn_event_intelMax4(); void get_monitor_size(); void synopsis_show(); - void add_cell(Gtk::TreeView *tree_view, ModelColumns *m_colum, bool flag_chk_btn, string name, string desc); + void view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , ModelColumns &m_colum, bool flag_chk_btn, string name, string desc); void wrapper_system(string cmd, string thread_str); struct Result wrapper_call(string cmd); void log_mess_error(string &cmd); void save_global_local_cfg(); void save_local_cfg(); - void add_colums(Gtk::TreeView *treeView, ModelColumns *m_columns); + void view_add_colums(Gtk::TreeView &treeView, ModelColumns &m_columns); void save_global_cfg(); + void read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , ModelColumns &m_colum); void download_local_cfg(); void download_globl_cfg(); void info_status_app(string stule); void info_warning_error(int mess); int check_root(); + void fill_in_view(); }; diff --git a/ubl-settings-bootloader.glade b/ubl-settings-bootloader.glade index d400fab..ad6223a 100644 --- a/ubl-settings-bootloader.glade +++ b/ubl-settings-bootloader.glade @@ -460,6 +460,7 @@ specified priority vertical + 100 True True in @@ -469,6 +470,7 @@ specified priority False + -1 True True @@ -573,6 +575,7 @@ specified priority vertical + 100 True True in @@ -584,6 +587,9 @@ specified priority True True + + + @@ -683,6 +689,7 @@ specified priority vertical + 100 True True in