|
|
|
|
@ -70,13 +70,12 @@ void MainWindow::settings(){
|
|
|
|
|
this->get_builder();
|
|
|
|
|
this->localization();
|
|
|
|
|
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->fill_in_view();
|
|
|
|
|
this->event();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
@ -90,57 +89,76 @@ void MainWindow::settings(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
list_store_kernel = Gtk::ListStore::create(m_columns);
|
|
|
|
|
list_store_IPT = Gtk::ListStore::create(m_columns);
|
|
|
|
|
list_store_OTT = Gtk::ListStore::create(m_columns);
|
|
|
|
|
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);
|
|
|
|
|
this->read_file_and_view("boot-options.csv", row_kernel, list_store_kernel);
|
|
|
|
|
this->read_file_and_view("input-options.csv", row_IPT, list_store_IPT);
|
|
|
|
|
this->read_file_and_view("output-options.csv", row_OTT, list_store_OTT);
|
|
|
|
|
this->view_add_colums(*treeViewKernel);
|
|
|
|
|
this->view_add_colums(*treeViewIPT);
|
|
|
|
|
this->view_add_colums(*treeViewOTT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&)
|
|
|
|
|
{
|
|
|
|
|
const auto iter = list_store_kernel->get_iter(path);
|
|
|
|
|
if(iter) {
|
|
|
|
|
const auto row = *iter;
|
|
|
|
|
Glib::ustring cmd;
|
|
|
|
|
bool check_btn = row[m_columns.check_button];
|
|
|
|
|
if (check_btn) {
|
|
|
|
|
cmd = row[m_columns.cmd_set_true];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cmd = row[m_columns.cmd_set_false];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Glib::ustring name = row[m_columns.name];
|
|
|
|
|
cout << cmd << " " << name << endl;
|
|
|
|
|
cmd_selection_global[name] = cmd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_row_changed(const Gtk::TreeModel::Path &, const Gtk::TreeModel::iterator &) {
|
|
|
|
|
cout << "item selected" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m) {
|
|
|
|
|
std::array<std::vector<std::string>, 5> arr_view = read_csv(path_resources + "/" + file_name);
|
|
|
|
|
std::vector<std::string> vec_Option = arr_view[3];
|
|
|
|
|
std::vector<std::string> vec_Description = arr_view[4];
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
this->view_add_cell(row, list_store_m , arr_view, index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::view_add_colums(Gtk::TreeView &treeView, ModelColumns &m_columns) {
|
|
|
|
|
treeView.append_column(_("Active"), m_columns.check_button);
|
|
|
|
|
void MainWindow::view_add_colums(Gtk::TreeView &treeView) {
|
|
|
|
|
treeView.append_column_editable(_("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;
|
|
|
|
|
void MainWindow::view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<std::string>, 5> &arr_view , size_t index) {
|
|
|
|
|
row = *(list_store_m->append());
|
|
|
|
|
bool flag_chb = true;
|
|
|
|
|
row[m_columns.cmd_get] = arr_view[0][index];
|
|
|
|
|
row[m_columns.cmd_set_true] = arr_view[1][index];
|
|
|
|
|
row[m_columns.cmd_set_false] = arr_view[2][index];
|
|
|
|
|
row[m_columns.check_button] = flag_chb;
|
|
|
|
|
row[m_columns.name] = _(arr_view[3][index].c_str());
|
|
|
|
|
row[m_columns.description] = _(arr_view[4][index].c_str());
|
|
|
|
|
|
|
|
|
|
count_append_cell += 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -245,6 +263,11 @@ void MainWindow::event(){
|
|
|
|
|
btnSaveLocalGlob->signal_activate().connect([&]() {save_global_local_cfg();});
|
|
|
|
|
btnSaveLocal->signal_activate().connect([&]() {save_local_cfg();});
|
|
|
|
|
btnSaveGlob->signal_activate().connect([&]() {save_global_cfg();});
|
|
|
|
|
//TreeView_TreeSelection = treeViewKernel->get_selection();
|
|
|
|
|
//TreeView_TreeSelection->signal_changed().connect(sigc::mem_fun(treeViewKernel, &MainWindow::item_selected) );
|
|
|
|
|
Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model();
|
|
|
|
|
treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
|
|