Исправлен баг с TreeView

pull/11/head
Igor Belitskiy 3 years ago
parent daf43d2e8b
commit c6a8dd96fd

@ -34,7 +34,6 @@ bool Save::check_save(string flag_save, string key_name) {
}
iter_map_data = (*map_gui).find(key_name);
iter_map_data_old = (*map_data_old).find(key_name);
cout << iter_map_data->second << " ||| " << iter_map_data_old->second << endl;
if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) {
return true;
}
@ -77,7 +76,6 @@ void Save::save(string sections, string str_flag_save) {
else {
cmd = "";
}
cout << cmd << endl;
if (cmd.length() != 0) {
process.call(cmd, "");
this->flag_no_save = false;

@ -205,7 +205,7 @@ void MainWindow::get_download_mode(std::map <string, string> &map_temp) {
}
}
void MainWindow::set_download_mode(string cmd="") {
void MainWindow::set_download_mode() {
int index = cmbDownloadMode->get_active_row_number();
string key = "";
if (index == 0) {
@ -223,42 +223,20 @@ void MainWindow::set_download_mode(string cmd="") {
else{
return;
}
if (cmd.length() !=0 ) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
map_cmd_selection["GRUB_BOOT_SILENT"] = key;
}
void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") {
void MainWindow::set_security_login() {
int index = chbSecurityLogin->get_active_row_number();
string key = "";
if (index == 0) {
key = "";
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == 1) {
key = entrySecurityLogin->get_text();
if (cmd.length() != 0) {
entrySecurityLogin->set_text(key);
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == -1) {
return;
key = "";
}
map_cmd_selection["GRUB_USER"] = key;
}
@ -288,36 +266,24 @@ void MainWindow::get_security_login(std::map <string, string> &map_temp) {
}
}
void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
void MainWindow::set_password_protec() {
int index = chbPasswordProtecc->get_active_row_number();
string key = "";
if (index == 0){
key = "";
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == 1) {
key = entryPasswordProtecc->get_text();
if (cmd.length() != 0 and key != "************") {
entryPasswordProtecc->set_text(key);
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index == -1) {
return;
key = "";
}
if (key!= "************") {
map_cmd_selection["GRUB_PASSWORD"] = key;
}
else {
key = "";
}
}
void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
@ -519,8 +485,8 @@ vector<string> MainWindow::get_setting_entry_all(string key, Gtk::Entry &entry_t
Utils::str_replace_all(value, " ", ", ");
entry_text.set_text(value);
for (auto &param: vec_params) {
map_cmd_selection[param] = "1";
map_temp[param] = "1";
map_cmd_selection[key+"_" + param] = "1";
map_temp[key + "_" + param] = "1";
}
Utils::str_remove(value, ",");
map_temp[key] = value;
@ -681,33 +647,6 @@ void MainWindow::change_security_login() {
boxSave->set_sensitive(true);
}
}
void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
int index = cmbDefaultDonw->get_active_row_number();
if (index == 0) {
if (cmd.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
else if (index > 0) {
if (cmd_remove.length() != 0) {
}
else {
flag_save_local = true;
flag_save_global = true;
flag_save_all = true;
}
}
if (index != 0 && index != -1) {
map_cmd_selection["GRUB_DEFAULT"] = cmbDefaultDonw->get_active_text();
}
else {
map_cmd_selection["GRUB_DEFAULT"] = "";
}
}
void MainWindow::get_default_load(std::map <string, string> &map_temp) {
std::map <string, string>:: iterator iter_map_data;
@ -845,8 +784,13 @@ void MainWindow::set_data_cfg() {
else {
map_cmd_selection["GRUB_TIMEOUT"] = "";
}
this->set_default_load();
int index = cmbDefaultDonw->get_active_row_number();
if (index != 0 && index != -1) {
map_cmd_selection["GRUB_DEFAULT"] = cmbDefaultDonw->get_active_text();
}
else {
map_cmd_selection["GRUB_DEFAULT"] = "";
}
this->set_download_mode();
this->set_security_login();
this->set_password_protec();
@ -867,12 +811,12 @@ void MainWindow::download_globl_cfg() {
map_local_cmd_selection = obj_load.get_load_data(map_global_cmd_selection, "global");
this->get_menu_boot(map_global_cmd_selection);
this->get_setting_entry_all("GRUB_CMDLINE_LINUX",*entryKernel, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_INPUT",*entryIPT, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_global_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_global_cmd_selection);
this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
this->get_download_mode(map_global_cmd_selection);
this->get_security_login(map_global_cmd_selection);
this->get_password_protec(map_global_cmd_selection);
@ -914,9 +858,9 @@ void MainWindow::download_local_cfg() {
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_local_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_local_cmd_selection);
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_local_cmd_selection);
this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel, "GRUB_CMDLINE_LINUX");
this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT, "GRUB_TERMINAL_INPUT");
this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT, "GRUB_TERMINAL_OUTPUT");
this->get_download_mode(map_local_cmd_selection);
this->get_security_login(map_local_cmd_selection);
this->get_password_protec(map_local_cmd_selection);
@ -926,9 +870,9 @@ void MainWindow::download_local_cfg() {
}
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size) {
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key="") {
for (auto &name: list_params) {
if (map_cmd.find(name) != map_cmd.end()){
if (map_cmd.find(key + "_" + name) != map_cmd.end()){
this->set_row(list_store, size, name, true);
}
else {

@ -144,8 +144,7 @@ class MainWindow : public Gtk::ApplicationWindow {
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
void get_menu_boot(std::map <string, string> &map_temp);
void set_default_load(string cmd, string cmd_remove);
void set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size);
void set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key);
void set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox);
void get_builder();
void init_dict();
@ -181,17 +180,17 @@ class MainWindow : public Gtk::ApplicationWindow {
bool focus_out_txt_IPT(GdkEventFocus*);
bool focus_out_txt_OTT(GdkEventFocus*);
void fill_in_view();
void set_security_login(string cmd, string cmd_remove);
void set_security_login();
void get_security_login(std::map <string, string> &map_temp);
bool check_flag_save(string flag_save);
void set_download_mode(string cmd);
void set_download_mode();
void change_password_protecc();
bool focus_out_txt_login(GdkEventFocus*);
void change_security_login();
void get_default_load(std::map <string, string> &map_temp);
bool focus_out_txt_password(GdkEventFocus*);
void get_password_protec(std::map <string, string> &map_temp);
void set_password_protec(string cmd, string cmd_remove);
void set_password_protec();
vector<string> get_setting_entry_all(string key, Gtk::Entry &entry_text, std::map <string, string> &map_temp);
void cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove);
string dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed);

@ -254,6 +254,20 @@ specified priority</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkOverlay" id="overHead">
<property name="visible">True</property>
@ -273,18 +287,9 @@ specified priority</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="boxWidgetAll">
<property name="visible">True</property>
@ -624,7 +629,7 @@ specified priority</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -658,9 +663,6 @@ specified priority</property>
<property name="height-request">-1</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -741,7 +743,7 @@ specified priority</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -774,9 +776,6 @@ 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>
@ -857,7 +856,7 @@ specified priority</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -890,9 +889,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewOTT">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -973,7 +969,14 @@ specified priority</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>

@ -169,6 +169,11 @@ msgstr "Справка"
msgid "Terminal for input"
msgstr "Терминал для ввода"
#: source/ubl-settings-bootloader.cc:295
#, fuzzy
msgid "Terminal for output"
msgstr "Терминал для вывода"
#: source/ubl-settings-bootloader.cc:308
msgid "Load"
msgstr "Загрузить"

Loading…
Cancel
Save