From 040bce8ec7484a7ff60d0daf89759f657136830d Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 17 Apr 2023 16:46:52 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD=20=D0=B8=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-bootloader.cc | 66 +++++++++-------------- source/ubl-settings-bootloader.h | 7 +-- ubl-settings-bootloader.glade | 90 +++++++------------------------ ubl-settings-bootloader_ru.po | 13 +++-- 4 files changed, 56 insertions(+), 120 deletions(-) diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 1a1c8eb..ce9b768 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -228,21 +228,19 @@ void MainWindow::set_download_mode() { } void MainWindow::set_security_login() { - int index = chbSecurityLogin->get_active_row_number(); + bool index = chbSecurityLogin->get_active(); string key = ""; - if (index == 0) { + if (index == false) { key = ""; } - else if (index == 1) { + else if (index == true) { key = entrySecurityLogin->get_text(); } - else if (index == -1) { - key = ""; - } map_cmd_selection["GRUB_USER"] = key; } void MainWindow::get_security_login(std::map &map_temp) { + // Todo; std::map :: iterator iter_map_data; iter_map_data = map_temp.find("GRUB_USER"); if (iter_map_data != map_temp.end()) { @@ -268,23 +266,17 @@ void MainWindow::get_security_login(std::map &map_temp) { } void MainWindow::set_password_protec() { - int index = chbPasswordProtecc->get_active_row_number(); + bool index = chbPasswordProtecc->get_active(); string key = ""; - if (index == 0){ + if (index == false){ key = ""; } - else if (index == 1) { + else if (index == true) { key = entryPasswordProtecc->get_text(); } - else if (index == -1) { - key = ""; - } - if (key!= "************") { + if (key != "************") { map_cmd_selection["GRUB_PASSWORD"] = key; } - else { - key = ""; - } } void MainWindow::get_password_protec(std::map &map_temp) { @@ -393,8 +385,6 @@ void MainWindow::get_builder(){ builder->get_widget("imgBG", imgBG); builder->get_widget("overHead", overHead); builder->get_widget("lblDownloadMode", lblDownloadMode); - builder->get_widget("lblSecurityLogin", lblSecurityLogin); - builder->get_widget("lblPasswordProtec", lblPasswordProtec); builder->get_widget("cmbDownloadMode", cmbDownloadMode); builder->get_widget("chbSecurityLogin", chbSecurityLogin); builder->get_widget("chbPasswordProtecc", chbPasswordProtecc); @@ -426,7 +416,7 @@ void MainWindow::localization(){ lblLoadMenu->set_text(_("Download menu")); lblInfoInputTerminal->set_text(_("Terminal for input")); lblInfoOutputTerminal->set_text(_("Terminal for output")); - chbLoadVariantSelectionTimer->set_label(_("Load option timer")); + chbLoadVariantSelectionTimer->set_label(_("Boot selection menu timer")); btnSynopsis->set_label(_("Help")); btnAbout->set_label(_("About")); btnSaveLocalGlob->set_label(_("Save to global and local configuration")); @@ -437,14 +427,14 @@ void MainWindow::localization(){ btnSave->set_label(_("Save")); btnLoad->set_label(_("Load")); this->set_title(_("ubl-settings-bootloader")); - lblSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode")); - lblDownloadMode->set_text(_("Load screen display mode:")); - lblSecurityLogin->set_text(_("Load menu user name:")); - lblPasswordProtec->set_text(_("Load menu user password:")); - chbSecurityLogin->append(_("Not available")); - chbSecurityLogin->append(_("Manually")); - chbPasswordProtecc->append(_("Not available")); - chbPasswordProtecc->append(_("Manually")); + // Todo: check + entrySecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode")); + entryPasswordProtecc->set_tooltip_text(gettext("User password to enter boot configuration edit mode")); + chbSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode")); + chbPasswordProtecc->set_tooltip_text(gettext("User password to enter boot configuration edit mode")); + lblDownloadMode->set_text(_("Boot screen display mode:")); + chbSecurityLogin->set_label(_("Boot menu user name:")); + chbPasswordProtecc->set_label(_("Boot menu user password:")); cmbDownloadMode->append(_("Loading animation with the magazine")); cmbDownloadMode->append(_("Loading animation without a magazine")); cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал")); @@ -587,8 +577,8 @@ void MainWindow::event(){ entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT)); entrySecurityLogin->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_login)); entryPasswordProtecc->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_password)); - chbPasswordProtecc->signal_changed().connect([&]() {change_password_protecc();}); - chbSecurityLogin->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::change_security_login)); + chbPasswordProtecc->signal_toggled().connect([&]() {change_password_protecc();}); + chbSecurityLogin->signal_toggled().connect([&]() {change_security_login();}); if (this->check_root() == 0) { Glib::RefPtr treeViewKernelModel = treeViewKernel->get_model(); treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel)); @@ -610,8 +600,8 @@ bool MainWindow::gui_exit(GdkEventAny*) { } void MainWindow::change_security_login() { - int index = chbSecurityLogin->get_active_row_number(); - if (index == 0) { + bool index = chbSecurityLogin->get_active(); + if (index == false) { entrySecurityLogin->set_sensitive(false); entrySecurityLogin->set_text(""); boxSave->set_sensitive(true); @@ -619,16 +609,11 @@ void MainWindow::change_security_login() { imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU); lblWarning->set_text(""); } - else if (index == 1) { + else if (index == true) { entrySecurityLogin->set_sensitive(true); entrySecurityLogin->set_text(""); boxSave->set_sensitive(true); } - else { - entrySecurityLogin->set_sensitive(false); - entrySecurityLogin->set_text(""); - boxSave->set_sensitive(true); - } } void MainWindow::get_default_load(std::map &map_temp) { @@ -649,8 +634,9 @@ void MainWindow::get_default_load(std::map &map_temp) { } void MainWindow::change_password_protecc() { - int index = chbPasswordProtecc->get_active_row_number(); - if (index == 0 || index == 2 || index == -1) { + // Todo; + bool index = chbPasswordProtecc->get_active(); + if (index == false) { entryPasswordProtecc->set_sensitive(false); entryPasswordProtecc->set_text(""); boxSave->set_sensitive(true); @@ -658,7 +644,7 @@ void MainWindow::change_password_protecc() { imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU); lblWarning->set_text(""); } - else if (index == 1) { + else if (index == true) { entryPasswordProtecc->set_sensitive(true); entryPasswordProtecc->set_text(""); boxSave->set_sensitive(true); diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index eab3aa6..aea4d16 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -93,8 +93,8 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Overlay *overHead; Gtk::ComboBoxText *cmbDefaultDonw; Gtk::ComboBoxText *cmbDownloadMode; - Gtk::ComboBoxText *chbSecurityLogin; - Gtk::ComboBoxText *chbPasswordProtecc; + Gtk::CheckButton *chbSecurityLogin; + Gtk::CheckButton *chbPasswordProtecc; Gtk::Entry *entrySecurityLogin; Gtk::Entry *entryPasswordProtecc; @@ -114,9 +114,6 @@ class MainWindow : public Gtk::ApplicationWindow { std::map map_local_cmd_selection; Gtk::Label *lblDownloadMode; - Gtk::Label *lblSecurityLogin; - Gtk::Label *lblPasswordProtec; - Lib_save::Save obj_save = Lib_save::Save(); Lib_Load::Load obj_load = Lib_Load::Load(); vector vec_param_names; diff --git a/ubl-settings-bootloader.glade b/ubl-settings-bootloader.glade index aa7a1fc..3f57d18 100644 --- a/ubl-settings-bootloader.glade +++ b/ubl-settings-bootloader.glade @@ -1,11 +1,13 @@ - + both True + + False О Программе @@ -318,7 +320,7 @@ specified priority False - Load variant selection timer + Boot selection menu timer True True False @@ -481,20 +483,18 @@ specified priority True False - + + Boot menu user name: True - False - User name to enter boot configuration editing mode - start - 5 + True + False + 2 5 - 5 + 2 5 6 6 - Load menu user name: - start - 0 + True False @@ -502,23 +502,6 @@ specified priority 0 - - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - - - True - True - 1 - - True @@ -548,19 +531,18 @@ specified priority True False - + + Boot menu user password: True - False - start - 5 + True + False + 2 5 - 5 + 2 5 6 6 - Load menu user password: - start - 0 + True False @@ -568,23 +550,6 @@ specified priority 0 - - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - - - True - True - 1 - - True @@ -1202,27 +1167,12 @@ specified priority both True - - - - - - - - - - - - - - - - - + + diff --git a/ubl-settings-bootloader_ru.po b/ubl-settings-bootloader_ru.po index 36a1c5f..95b5c2b 100644 --- a/ubl-settings-bootloader_ru.po +++ b/ubl-settings-bootloader_ru.po @@ -164,19 +164,19 @@ msgid "Load local configuration" msgstr "Загрузить локальную конфигурацию" #: source/ubl-settings-bootloader.cc:442 -msgid "Load menu user name:" +msgid "Boot menu user name:" msgstr "Имя пользователя меню загрузки:" #: source/ubl-settings-bootloader.cc:443 -msgid "Load menu user password:" +msgid "Boot menu user password:" msgstr "Пароль пользователя меню загрузки:" #: source/ubl-settings-bootloader.cc:429 source/ubl-settings-bootloader.cc:298 -msgid "Load option timer" -msgstr "Таймер выбора варианта загрузки" +msgid "Boot selection menu timer" +msgstr "Таймер меню выбора варианта загрузки" #: source/ubl-settings-bootloader.cc:441 -msgid "Load screen display mode:" +msgid "Boot screen display mode:" msgstr "Режим отображения экрана загрузки:" #: source/ubl-settings-bootloader.cc:448 @@ -316,6 +316,9 @@ msgstr "UBConfig - Загрузка" msgid "USB Keyboard (HID Boot protocol)" msgstr "Клавиатура USB Keyboard (протокол HID Boot)" +msgid "User password to enter boot configuration edit mode" +msgstr "Пароль пользователя для входа в режим редактирования конфигурации загрузки" + #: source/ubl-settings-bootloader.cc:440 msgid "User name to enter boot configuration editing mode" msgstr ""