Добавил заполнение параметров TreeView

pull/11/head
Igor Belitskiy 3 years ago
parent f3965cf6ee
commit 6d22273658

@ -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
1 Option Description
1 Option Description
2 quiet Downloading without text messages
3 splash Show welcome window
4 noplymouth Disable Plymouth
5 acpi=off Disable ACPI
6 noapic Disable APIC
7 nolapic Disable local APIC
8 single Single User Mode
9 nomodeset Disable kernel selection and loading of video drivers
10 915.enable_dc=0 Disable GPU power management
11 ahci.mobile_lpm_policy=1 Maximum performance, power management
12 snd-intel-dspcfg.dsp_driver=1 Forced selection of an Intel sound device driver
13 intel_idle.max_cstate=1 Prevents the processor from going into a deep sleep state
14 intel_idle.max_cstate=4 Eliminates flickering laptop display on Ultra Voltage processors

@ -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)
1 Option Description
1 Option Description
2 console PC BIOS & EFI console
3 serial Serial terminal
4 ofconsole Open Firmware Console
5 at_keyboard PC AT Keyboard (Coreboot)
6 usb_keyboard USB Keyboard (HID Boot protocol)

@ -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)
1 Option Description
1 Option Description
2 console PC BIOS & EFI console
3 serial Serial terminal
4 ofconsole Open Firmware Console
5 gfxterm Output in graphical mode
6 vga_text VGA text output (Coreboot)

@ -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<Gtk::ListStore> list_store_m , ModelColumns &m_colum) {
count_append_cell = 0;
std::array<std::vector<std::string>, 2> arr_view = read_csv(path_resources + "/" + file_name);
std::vector<std::string> vec_Option = arr_view[0];
std::vector<std::string> 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<Gtk::ListStore> 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<Gtk::ListStore> 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(){

@ -38,13 +38,13 @@ class MainWindow : public Gtk::ApplicationWindow {
public:
ModelColumns() {add(check_button), add(name); add(description); }
//Gtk::TreeModelColumn<Gtk::CheckButton> check_button;
Gtk::TreeModelColumn<Glib::ustring> check_button;
Gtk::TreeModelColumn<bool> check_button;
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> description;
};
ModelColumns *columns_Kernel;
ModelColumns *columns_IPT;
ModelColumns *columns_OTT;
ModelColumns columns_kernel;
ModelColumns columns_IPT;
ModelColumns columns_OTT;
Glib::RefPtr<Gtk::Builder> 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<Gtk::ListStore> list_store_kernel;
Glib::RefPtr<Gtk::ListStore> list_store_IPT;
Glib::RefPtr<Gtk::ListStore> 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<Gtk::ListStore> list_store_m , ModelColumns &m_colum, bool flag_chk_btn, string name, string desc);
void wrapper_system(string cmd, string thread_str);
struct Result<string> 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<Gtk::ListStore> 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();
};

@ -460,6 +460,7 @@ specified priority</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
@ -469,6 +470,7 @@ specified priority</property>
<property name="can-focus">False</property>
<child>
<object class="GtkTreeView" id="treeViewKernel">
<property name="height-request">-1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
@ -573,6 +575,7 @@ specified priority</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
@ -584,6 +587,9 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewIPT">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -683,6 +689,7 @@ specified priority</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>

Loading…
Cancel
Save