|
|
|
@ -79,10 +79,13 @@ void MainWindow::settings(){
|
|
|
|
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
|
|
|
|
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
|
|
|
|
if (this->check_root() == 0) {
|
|
|
|
if (this->check_root() == 0) {
|
|
|
|
this->fill_in_view();
|
|
|
|
this->fill_in_view();
|
|
|
|
|
|
|
|
this->download_local_cfg();
|
|
|
|
|
|
|
|
this->download_globl_cfg();
|
|
|
|
this->event();
|
|
|
|
this->event();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
|
|
|
|
this->event();
|
|
|
|
boxWidgetAll->set_sensitive(false);
|
|
|
|
boxWidgetAll->set_sensitive(false);
|
|
|
|
btnLoad->set_sensitive(false);
|
|
|
|
btnLoad->set_sensitive(false);
|
|
|
|
boxSave->set_sensitive(false);
|
|
|
|
boxSave->set_sensitive(false);
|
|
|
|
@ -111,26 +114,39 @@ void MainWindow::fill_in_view() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&)
|
|
|
|
void MainWindow::item_selected_kernel(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
|
|
|
|
{
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
template_item_selected(path, list_store_kernel);
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
|
|
|
|
template_item_selected(map_cmd_selection_kernel, path, list_store_kernel);\
|
|
|
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection_kernel,map_global_cmd_selection_kernel,map_local_cmd_selection_kernel);
|
|
|
|
|
|
|
|
entryKernel->set_text(str_flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&)
|
|
|
|
void MainWindow::item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
|
|
|
|
{
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
template_item_selected(path, list_store_OTT);
|
|
|
|
auto selection_IPT = treeViewIPT->get_selection();
|
|
|
|
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
|
|
|
|
selection_IPT->unselect_all();
|
|
|
|
|
|
|
|
template_item_selected(map_cmd_selection_OTT , path, list_store_OTT);
|
|
|
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection_OTT, map_global_cmd_selection_OTT,map_local_cmd_selection_OTT);
|
|
|
|
|
|
|
|
entryOTT->set_text(str_flags);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&)
|
|
|
|
void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&) {
|
|
|
|
{
|
|
|
|
auto selection_kernel = treeViewKernel->get_selection();
|
|
|
|
template_item_selected(path, list_store_IPT);
|
|
|
|
auto selection_OTT = treeViewOTT->get_selection();
|
|
|
|
|
|
|
|
selection_kernel->unselect_all();
|
|
|
|
|
|
|
|
selection_OTT->unselect_all();
|
|
|
|
|
|
|
|
template_item_selected(map_cmd_selection_IPT , path, list_store_IPT);
|
|
|
|
|
|
|
|
string str_flags = this->dynamic_update_entry(map_cmd_selection_IPT, map_global_cmd_selection_IPT,map_local_cmd_selection_IPT);
|
|
|
|
|
|
|
|
entryIPT->set_text(str_flags);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::template_item_selected(const Gtk::TreeModel::Path& path, Glib::RefPtr<Gtk::ListStore> &list_store) {
|
|
|
|
void MainWindow::template_item_selected(std::map<string, string> &map_view, const Gtk::TreeModel::Path& path, Glib::RefPtr<Gtk::ListStore> &list_store) {
|
|
|
|
|
|
|
|
|
|
|
|
const auto iter = list_store->get_iter(path);
|
|
|
|
const auto iter = list_store->get_iter(path);
|
|
|
|
if(iter) {
|
|
|
|
if(iter) {
|
|
|
|
const auto row = *iter;
|
|
|
|
const auto row = *iter;
|
|
|
|
@ -146,10 +162,28 @@ void MainWindow::template_item_selected(const Gtk::TreeModel::Path& path, Glib::
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Glib::ustring name = row[m_columns.name];
|
|
|
|
Glib::ustring name = row[m_columns.name];
|
|
|
|
cout << cmd << " " << name << endl;
|
|
|
|
cout << cmd << " " << name << endl;
|
|
|
|
cmd_selection_global[name] = cmd;
|
|
|
|
map_view[name] = cmd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string MainWindow::dynamic_update_entry(std::map<string, string> &map_view, std::map<string, string> &map_global_view, std::map<string, string> &map_local_view) {
|
|
|
|
|
|
|
|
string keys = "";
|
|
|
|
|
|
|
|
for(auto &it: map_view) {
|
|
|
|
|
|
|
|
string key = it.first;
|
|
|
|
|
|
|
|
if (flag_load == true && map_global_view.find(key) != map_global_view.end()) {
|
|
|
|
|
|
|
|
if (map_global_view[key] != map_view[key]){
|
|
|
|
|
|
|
|
keys += string(key) + ", ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (flag_load == false && map_local_view.find(key) != map_local_view.end()) {
|
|
|
|
|
|
|
|
if (map_local_view[key] != map_view[key]){
|
|
|
|
|
|
|
|
keys += string(key) + ", ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return keys;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m) {
|
|
|
|
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::array<std::vector<std::string>, 5> arr_view = read_csv(path_resources + "/" + file_name);
|
|
|
|
@ -208,8 +242,8 @@ void MainWindow::get_builder(){
|
|
|
|
|
|
|
|
|
|
|
|
builder->get_widget("spbSecond", spbSecond);
|
|
|
|
builder->get_widget("spbSecond", spbSecond);
|
|
|
|
builder->get_widget("entryKernel", entryKernel);
|
|
|
|
builder->get_widget("entryKernel", entryKernel);
|
|
|
|
builder->get_widget("entryIT", entryIT);
|
|
|
|
builder->get_widget("entryIPT", entryIPT);
|
|
|
|
builder->get_widget("entryOT", entryOT);
|
|
|
|
builder->get_widget("entryOTT", entryOTT);
|
|
|
|
|
|
|
|
|
|
|
|
builder->get_widget("boxColor", boxColor);
|
|
|
|
builder->get_widget("boxColor", boxColor);
|
|
|
|
builder->get_widget("boxWidgetAll", boxWidgetAll);
|
|
|
|
builder->get_widget("boxWidgetAll", boxWidgetAll);
|
|
|
|
@ -295,24 +329,70 @@ void MainWindow::event(){
|
|
|
|
treeViewOTTModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_OTT));
|
|
|
|
treeViewOTTModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_OTT));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
void MainWindow::save_global_local_cfg() {
|
|
|
|
|
|
|
|
if (flag_save_global == false) {
|
|
|
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (flag_save_local == false) {
|
|
|
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
info_status_app("boxInfoMessOK");
|
|
|
|
|
|
|
|
lblWarning->set_text(gettext("Nothing to save!"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
info_warning_error(4);
|
|
|
|
info_warning_error(4);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_global_cfg(){
|
|
|
|
void MainWindow::save_global_cfg() {
|
|
|
|
|
|
|
|
if (flag_save_global == false) {
|
|
|
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
info_status_app("boxInfoMessOK");
|
|
|
|
|
|
|
|
lblWarning->set_text(gettext("Nothing to save!"));
|
|
|
|
|
|
|
|
}
|
|
|
|
info_warning_error(3);
|
|
|
|
info_warning_error(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_local_cfg(){
|
|
|
|
void MainWindow::save_local_cfg() {
|
|
|
|
|
|
|
|
if (flag_save_local == false) {
|
|
|
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
info_status_app("boxInfoMessOK");
|
|
|
|
|
|
|
|
lblWarning->set_text(gettext("Nothing to save!"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
info_warning_error(2);
|
|
|
|
info_warning_error(2);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg(){
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
|
|
|
flag_load = true;
|
|
|
|
info_warning_error(1);
|
|
|
|
info_warning_error(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg(){
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
|
|
|
flag_load = false;
|
|
|
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
|
|
|
flag_save_all = true;
|
|
|
|
info_warning_error(0);
|
|
|
|
info_warning_error(0);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|