Исправлен дизайн и функционал

pull/11/head
Igor Belitskiy 3 years ago
parent 6549b28a3b
commit 040bce8ec7

@ -228,21 +228,19 @@ void MainWindow::set_download_mode() {
} }
void MainWindow::set_security_login() { void MainWindow::set_security_login() {
int index = chbSecurityLogin->get_active_row_number(); bool index = chbSecurityLogin->get_active();
string key = ""; string key = "";
if (index == 0) { if (index == false) {
key = ""; key = "";
} }
else if (index == 1) { else if (index == true) {
key = entrySecurityLogin->get_text(); key = entrySecurityLogin->get_text();
} }
else if (index == -1) {
key = "";
}
map_cmd_selection["GRUB_USER"] = key; map_cmd_selection["GRUB_USER"] = key;
} }
void MainWindow::get_security_login(std::map <string, string> &map_temp) { void MainWindow::get_security_login(std::map <string, string> &map_temp) {
// Todo;
std::map <string, string>:: iterator iter_map_data; std::map <string, string>:: iterator iter_map_data;
iter_map_data = map_temp.find("GRUB_USER"); iter_map_data = map_temp.find("GRUB_USER");
if (iter_map_data != map_temp.end()) { if (iter_map_data != map_temp.end()) {
@ -268,23 +266,17 @@ void MainWindow::get_security_login(std::map <string, string> &map_temp) {
} }
void MainWindow::set_password_protec() { void MainWindow::set_password_protec() {
int index = chbPasswordProtecc->get_active_row_number(); bool index = chbPasswordProtecc->get_active();
string key = ""; string key = "";
if (index == 0){ if (index == false){
key = ""; key = "";
} }
else if (index == 1) { else if (index == true) {
key = entryPasswordProtecc->get_text(); key = entryPasswordProtecc->get_text();
} }
else if (index == -1) { if (key != "************") {
key = "";
}
if (key!= "************") {
map_cmd_selection["GRUB_PASSWORD"] = key; map_cmd_selection["GRUB_PASSWORD"] = key;
} }
else {
key = "";
}
} }
void MainWindow::get_password_protec(std::map <string, string> &map_temp) { void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
@ -393,8 +385,6 @@ void MainWindow::get_builder(){
builder->get_widget("imgBG", imgBG); builder->get_widget("imgBG", imgBG);
builder->get_widget("overHead", overHead); builder->get_widget("overHead", overHead);
builder->get_widget("lblDownloadMode", lblDownloadMode); builder->get_widget("lblDownloadMode", lblDownloadMode);
builder->get_widget("lblSecurityLogin", lblSecurityLogin);
builder->get_widget("lblPasswordProtec", lblPasswordProtec);
builder->get_widget("cmbDownloadMode", cmbDownloadMode); builder->get_widget("cmbDownloadMode", cmbDownloadMode);
builder->get_widget("chbSecurityLogin", chbSecurityLogin); builder->get_widget("chbSecurityLogin", chbSecurityLogin);
builder->get_widget("chbPasswordProtecc", chbPasswordProtecc); builder->get_widget("chbPasswordProtecc", chbPasswordProtecc);
@ -426,7 +416,7 @@ void MainWindow::localization(){
lblLoadMenu->set_text(_("Download menu")); lblLoadMenu->set_text(_("Download menu"));
lblInfoInputTerminal->set_text(_("Terminal for input")); lblInfoInputTerminal->set_text(_("Terminal for input"));
lblInfoOutputTerminal->set_text(_("Terminal for output")); lblInfoOutputTerminal->set_text(_("Terminal for output"));
chbLoadVariantSelectionTimer->set_label(_("Load option timer")); chbLoadVariantSelectionTimer->set_label(_("Boot selection menu timer"));
btnSynopsis->set_label(_("Help")); btnSynopsis->set_label(_("Help"));
btnAbout->set_label(_("About")); btnAbout->set_label(_("About"));
btnSaveLocalGlob->set_label(_("Save to global and local configuration")); btnSaveLocalGlob->set_label(_("Save to global and local configuration"));
@ -437,14 +427,14 @@ void MainWindow::localization(){
btnSave->set_label(_("Save")); btnSave->set_label(_("Save"));
btnLoad->set_label(_("Load")); btnLoad->set_label(_("Load"));
this->set_title(_("ubl-settings-bootloader")); this->set_title(_("ubl-settings-bootloader"));
lblSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode")); // Todo: check
lblDownloadMode->set_text(_("Load screen display mode:")); entrySecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode"));
lblSecurityLogin->set_text(_("Load menu user name:")); entryPasswordProtecc->set_tooltip_text(gettext("User password to enter boot configuration edit mode"));
lblPasswordProtec->set_text(_("Load menu user password:")); chbSecurityLogin->set_tooltip_text(gettext("User name to enter boot configuration editing mode"));
chbSecurityLogin->append(_("Not available")); chbPasswordProtecc->set_tooltip_text(gettext("User password to enter boot configuration edit mode"));
chbSecurityLogin->append(_("Manually")); lblDownloadMode->set_text(_("Boot screen display mode:"));
chbPasswordProtecc->append(_("Not available")); chbSecurityLogin->set_label(_("Boot menu user name:"));
chbPasswordProtecc->append(_("Manually")); chbPasswordProtecc->set_label(_("Boot menu user password:"));
cmbDownloadMode->append(_("Loading animation with the magazine")); cmbDownloadMode->append(_("Loading animation with the magazine"));
cmbDownloadMode->append(_("Loading animation without a magazine")); cmbDownloadMode->append(_("Loading animation without a magazine"));
cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал")); cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал"));
@ -587,8 +577,8 @@ void MainWindow::event(){
entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT)); 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)); 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)); entryPasswordProtecc->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_password));
chbPasswordProtecc->signal_changed().connect([&]() {change_password_protecc();}); chbPasswordProtecc->signal_toggled().connect([&]() {change_password_protecc();});
chbSecurityLogin->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::change_security_login)); chbSecurityLogin->signal_toggled().connect([&]() {change_security_login();});
if (this->check_root() == 0) { if (this->check_root() == 0) {
Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model(); Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model();
treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel)); 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() { void MainWindow::change_security_login() {
int index = chbSecurityLogin->get_active_row_number(); bool index = chbSecurityLogin->get_active();
if (index == 0) { if (index == false) {
entrySecurityLogin->set_sensitive(false); entrySecurityLogin->set_sensitive(false);
entrySecurityLogin->set_text(""); entrySecurityLogin->set_text("");
boxSave->set_sensitive(true); 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); imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text(""); lblWarning->set_text("");
} }
else if (index == 1) { else if (index == true) {
entrySecurityLogin->set_sensitive(true); entrySecurityLogin->set_sensitive(true);
entrySecurityLogin->set_text(""); entrySecurityLogin->set_text("");
boxSave->set_sensitive(true); boxSave->set_sensitive(true);
} }
else {
entrySecurityLogin->set_sensitive(false);
entrySecurityLogin->set_text("");
boxSave->set_sensitive(true);
}
} }
void MainWindow::get_default_load(std::map <string, string> &map_temp) { void MainWindow::get_default_load(std::map <string, string> &map_temp) {
@ -649,8 +634,9 @@ void MainWindow::get_default_load(std::map <string, string> &map_temp) {
} }
void MainWindow::change_password_protecc() { void MainWindow::change_password_protecc() {
int index = chbPasswordProtecc->get_active_row_number(); // Todo;
if (index == 0 || index == 2 || index == -1) { bool index = chbPasswordProtecc->get_active();
if (index == false) {
entryPasswordProtecc->set_sensitive(false); entryPasswordProtecc->set_sensitive(false);
entryPasswordProtecc->set_text(""); entryPasswordProtecc->set_text("");
boxSave->set_sensitive(true); 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); imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text(""); lblWarning->set_text("");
} }
else if (index == 1) { else if (index == true) {
entryPasswordProtecc->set_sensitive(true); entryPasswordProtecc->set_sensitive(true);
entryPasswordProtecc->set_text(""); entryPasswordProtecc->set_text("");
boxSave->set_sensitive(true); boxSave->set_sensitive(true);

@ -93,8 +93,8 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::Overlay *overHead; Gtk::Overlay *overHead;
Gtk::ComboBoxText *cmbDefaultDonw; Gtk::ComboBoxText *cmbDefaultDonw;
Gtk::ComboBoxText *cmbDownloadMode; Gtk::ComboBoxText *cmbDownloadMode;
Gtk::ComboBoxText *chbSecurityLogin; Gtk::CheckButton *chbSecurityLogin;
Gtk::ComboBoxText *chbPasswordProtecc; Gtk::CheckButton *chbPasswordProtecc;
Gtk::Entry *entrySecurityLogin; Gtk::Entry *entrySecurityLogin;
Gtk::Entry *entryPasswordProtecc; Gtk::Entry *entryPasswordProtecc;
@ -114,9 +114,6 @@ class MainWindow : public Gtk::ApplicationWindow {
std::map <string, string> map_local_cmd_selection; std::map <string, string> map_local_cmd_selection;
Gtk::Label *lblDownloadMode; Gtk::Label *lblDownloadMode;
Gtk::Label *lblSecurityLogin;
Gtk::Label *lblPasswordProtec;
Lib_save::Save obj_save = Lib_save::Save(); Lib_save::Save obj_save = Lib_save::Save();
Lib_Load::Load obj_load = Lib_Load::Load(); Lib_Load::Load obj_load = Lib_Load::Load();
vector<string> vec_param_names; vector<string> vec_param_names;

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 --> <!-- Generated with glade 3.40.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<object class="GtkSizeGroup"> <object class="GtkSizeGroup">
<property name="mode">both</property> <property name="mode">both</property>
<property name="ignore-hidden">True</property> <property name="ignore-hidden">True</property>
</object> </object>
<object class="GtkSizeGroup"/>
<object class="GtkSizeGroup"/>
<object class="GtkAboutDialog" id="aboutWindows"> <object class="GtkAboutDialog" id="aboutWindows">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="title" translatable="yes">О Программе</property> <property name="title" translatable="yes">О Программе</property>
@ -318,7 +320,7 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkCheckButton" id="chbLoadVariantSelectionTimer"> <object class="GtkCheckButton" id="chbLoadVariantSelectionTimer">
<property name="label" translatable="yes">Load variant selection timer</property> <property name="label" translatable="yes">Boot selection menu timer</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">False</property> <property name="receives-default">False</property>
@ -481,20 +483,18 @@ specified priority</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkLabel" id="lblSecurityLogin"> <object class="GtkCheckButton" id="chbSecurityLogin">
<property name="label" translatable="yes">Boot menu user name:</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">User name to enter boot configuration editing mode</property> <property name="receives-default">False</property>
<property name="halign">start</property> <property name="margin-left">2</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">2</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Load menu user name:</property> <property name="draw-indicator">True</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -502,23 +502,6 @@ specified priority</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBoxText" id="chbSecurityLogin">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="entrySecurityLogin"> <object class="GtkEntry" id="entrySecurityLogin">
<property name="visible">True</property> <property name="visible">True</property>
@ -548,19 +531,18 @@ specified priority</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkLabel" id="lblPasswordProtec"> <object class="GtkCheckButton" id="chbPasswordProtecc">
<property name="label" translatable="yes">Boot menu user password:</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">True</property>
<property name="halign">start</property> <property name="receives-default">False</property>
<property name="margin-left">5</property> <property name="margin-left">2</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">2</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Load menu user password:</property> <property name="draw-indicator">True</property>
<property name="ellipsize">start</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -568,23 +550,6 @@ specified priority</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBoxText" id="chbPasswordProtecc">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="entryPasswordProtecc"> <object class="GtkEntry" id="entryPasswordProtecc">
<property name="visible">True</property> <property name="visible">True</property>
@ -1202,27 +1167,12 @@ specified priority</property>
<object class="GtkSizeGroup"> <object class="GtkSizeGroup">
<property name="mode">both</property> <property name="mode">both</property>
<property name="ignore-hidden">True</property> <property name="ignore-hidden">True</property>
<widgets>
<widget name="cmbDefaultDonw"/>
<widget name="chbSecurityLogin"/>
<widget name="chbPasswordProtecc"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<widgets>
<widget name="lblInfoDefaultDonw"/>
<widget name="lblDownloadMode"/>
<widget name="lblSecurityLogin"/>
<widget name="lblPasswordProtec"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<widgets> <widgets>
<widget name="chbLoadVariantSelectionTimer"/> <widget name="chbLoadVariantSelectionTimer"/>
<widget name="lblInfoDefaultDonw"/> <widget name="lblInfoDefaultDonw"/>
<widget name="lblDownloadMode"/> <widget name="lblDownloadMode"/>
<widget name="lblSecurityLogin"/> <widget name="chbSecurityLogin"/>
<widget name="lblPasswordProtec"/> <widget name="chbPasswordProtecc"/>
</widgets> </widgets>
</object> </object>
<object class="GtkWindow" id="mess_sudo"> <object class="GtkWindow" id="mess_sudo">

@ -164,19 +164,19 @@ msgid "Load local configuration"
msgstr "Загрузить локальную конфигурацию" msgstr "Загрузить локальную конфигурацию"
#: source/ubl-settings-bootloader.cc:442 #: source/ubl-settings-bootloader.cc:442
msgid "Load menu user name:" msgid "Boot menu user name:"
msgstr "Имя пользователя меню загрузки:" msgstr "Имя пользователя меню загрузки:"
#: source/ubl-settings-bootloader.cc:443 #: source/ubl-settings-bootloader.cc:443
msgid "Load menu user password:" msgid "Boot menu user password:"
msgstr "Пароль пользователя меню загрузки:" msgstr "Пароль пользователя меню загрузки:"
#: source/ubl-settings-bootloader.cc:429 source/ubl-settings-bootloader.cc:298 #: source/ubl-settings-bootloader.cc:429 source/ubl-settings-bootloader.cc:298
msgid "Load option timer" msgid "Boot selection menu timer"
msgstr "Таймер выбора варианта загрузки" msgstr "Таймер меню выбора варианта загрузки"
#: source/ubl-settings-bootloader.cc:441 #: source/ubl-settings-bootloader.cc:441
msgid "Load screen display mode:" msgid "Boot screen display mode:"
msgstr "Режим отображения экрана загрузки:" msgstr "Режим отображения экрана загрузки:"
#: source/ubl-settings-bootloader.cc:448 #: source/ubl-settings-bootloader.cc:448
@ -316,6 +316,9 @@ msgstr "UBConfig - Загрузка"
msgid "USB Keyboard (HID Boot protocol)" msgid "USB Keyboard (HID Boot protocol)"
msgstr "Клавиатура USB Keyboard (протокол HID Boot)" msgstr "Клавиатура USB Keyboard (протокол HID Boot)"
msgid "User password to enter boot configuration edit mode"
msgstr "Пароль пользователя для входа в режим редактирования конфигурации загрузки"
#: source/ubl-settings-bootloader.cc:440 #: source/ubl-settings-bootloader.cc:440
msgid "User name to enter boot configuration editing mode" msgid "User name to enter boot configuration editing mode"
msgstr "" msgstr ""

Loading…
Cancel
Save