diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a8e6163..dc55e84 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -13,10 +13,8 @@ find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) option(WEBKIT_FOUND "No" OFF) find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) -message("${WEBKIT_LIBRARIES_FOUND}") if(WEBKIT_LIBRARIES_FOUND) option(WEBKIT_FOUND "Yes" ON) - message("Webkit is located at ${WEBKIT_LIBRARIES_FOUND}") PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0) include_directories(${WEBKIT_INCLUDE_DIRS}) link_directories(${WEBKIT_LIBRARY_DIRS}) @@ -33,6 +31,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection") set(SOURCE_FILES + ubl-settings-bootloader-cm.h ubl-settings-bootloader.h ubl-settings-bootloader.cc my_cmd.h @@ -53,9 +52,9 @@ set(LIBRARIES pthread) add_executable(ubl-settings-bootloader ${SOURCE_FILES}) -if(WEBKIT_LIBRARIES_FOUND) - target_link_libraries(ubl-settings-bootloader ${LIBRARIES} ${WEBKIT_LIBRARIES}) -else() - target_link_libraries(ubl-settings-bootloader ${LIBRARIES}) -endif() +target_link_libraries(ubl-settings-bootloader PUBLIC ${WEBKIT_LIBRARIES} ${LIBRARIES}) +target_include_directories(ubl-settings-bootloader PUBLIC + "${PROJECT_BINARY_DIR}" + ${WEBKIT_INCLUDE_DIRS} + ) install(TARGETS ubl-settings-bootloader DESTINATION bin) diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index a3fa4e0..ab57923 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -428,6 +428,15 @@ void MainWindow::get_builder() { builder->get_widget("wndWeb", wndWeb); #endif builder->get_widget("lblHeadeWndWeb", lblHeadeWndWeb); + + builder->get_widget("lblwebHeaderName", lblwebHeaderName); + builder->get_widget("lblhelpText", lblhelpText); + builder->get_widget("lblhelpHeader", lblhelpHeader); + builder->get_widget("chkAlwaysOpenHelp", chkAlwaysOpenHelp); + builder->get_widget("btnReadHelp", btnReadHelp); + builder->get_widget("btnCancelHelp", btnCancelHelp); + builder->get_widget("wndShowWeb", wndShowWeb); + } void MainWindow::localization(){ @@ -479,6 +488,14 @@ void MainWindow::localization(){ cmbDownloadMode->append(_("Нет анимации загрузки, полный журнал")); cmbDownloadMode->append(_("Lack of loading animation with the output of the abbreviated log")); cmbDefaultDonw->append(_("Last successful upload")); + + lblhelpHeader->set_text(_("Would you like to read documentation in the Web?")); + lblhelpText->set_text(_("You will be redirected to documentation site, where user help pages are " + "translated and supported by community.")); + btnReadHelp->set_label(_("Read online")); + btnCancelHelp->set_label(_("Cancel")); + chkAlwaysOpenHelp->set_label(_("Always redirect")); + lblwebHeaderName->set_label(_("ubl-settings-bootloader")); } vector MainWindow::get_setting_entry_all(string key, std::map * map_temp) { @@ -604,6 +621,9 @@ void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cm } void MainWindow::event(){ + btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); + chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); + btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_browser)); btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); btnLoadLocal->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::download_local_cfg)); @@ -890,6 +910,16 @@ void MainWindow::set_row(Glib::RefPtr &list_store, int size, std } void MainWindow::synopsis_show() { + if (flag_open_browser == true) { + this->open_browser(); + } + else { + wndShowWeb->show_all(); + } + +} + +void MainWindow::open_browser() { #ifdef WEBKIT_FOUND webkit_web_view_load_uri(one, link_doc); wndWeb->show_all(); @@ -904,12 +934,10 @@ void MainWindow::synopsis_show() { std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); cmd = std::string( buf.get(), buf.get() + size - 1 ); } - obj_process_system.call(cmd, "&"); + obj_process_system.call(cmd, "&"); #endif - } - void MainWindow::info_status_app(string stule) { boxInfo->remove_class("boxInfoMessOK"); boxInfo->remove_class("boxInfoMessError"); diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index 38bd07c..0557ade 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -17,6 +17,7 @@ #include "util.h" #include "save.h" #include "load.h" +#include "ubl-settings-bootloader-cm.h" #ifdef WEBKIT_FOUND #include #endif @@ -109,7 +110,15 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Entry *entrySecurityLogin; Gtk::Entry *entryPasswordProtecc; Gtk::Label *lblHeadeWndWeb; - + + Gtk::Label *lblwebHeaderName; + Gtk::Label *lblhelpText; + Gtk::Label *lblhelpHeader; + Gtk::CheckButton *chkAlwaysOpenHelp; + Gtk::Button *btnReadHelp; + Gtk::Button *btnCancelHelp; + Gtk::Window *wndShowWeb; + std::vector vec_Option_kernel; std::vector vec_Option_IPT; std::vector vec_Option_OTT; @@ -141,6 +150,7 @@ class MainWindow : public Gtk::ApplicationWindow { bool flag_save_all = false; bool flag_blocked_tree_view = false; bool flag_save_block = false; + bool flag_open_browser = false; size_t size_kernel = 0; size_t size_IPT = 0; size_t size_OTT = 0; @@ -156,6 +166,7 @@ class MainWindow : public Gtk::ApplicationWindow { MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); MainWindow(Glib::RefPtr const& builder); ~MainWindow(); + void open_browser(); void get_menu_boot(std::map &map_temp); void set_row_all(std::map &map_cmd, Glib::RefPtr &list_store, vector &list_params, size_t size,string key); void set_row(Glib::RefPtr &list_store, int size, std::string name, bool flag_chbox); diff --git a/ubl-settings-bootloader.glade b/ubl-settings-bootloader.glade index 2f182ae..075d966 100644 --- a/ubl-settings-bootloader.glade +++ b/ubl-settings-bootloader.glade @@ -1,5 +1,5 @@ - + @@ -1290,6 +1290,205 @@ specified priority + + False + start + start + False + 450 + 250 + dialog-question-symbolic + + + True + False + vertical + + + True + False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + start + 10 + 5 + Would you like to read documentation in the Web? + True + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + 10 + 10 + You will be redirected to documentation website where documentation is translated and supported by community. + True + 0 + + + + True + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + 10 + True + + + + False + True + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 30 + True + + + Cancel + True + True + True + + + + True + True + 0 + + + + + Read Online + True + True + True + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + + + True + False + ubl-settings-bootloader + + + + + + + + True + False + 32 + dialog-question-symbolic + + + + + 800 600 diff --git a/ubl-settings-bootloader.pot b/ubl-settings-bootloader.pot index d3c66ce..c0b9030 100644 --- a/ubl-settings-bootloader.pot +++ b/ubl-settings-bootloader.pot @@ -17,6 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" + +msgid "Would you like to read documentation in the Web?" +msgstr "" + +msgid "" +"You will be redirected to documentation site, where user help pages are " +"translated and supported by community." +msgstr "" + +msgid "Cancel" +msgstr "" + +msgid "Read online" +msgstr "" + +msgid "Always redirect" +msgstr "" + #: source/ubl-settings-bootloader.cc:431 source/ubl-settings-bootloader.cc:301 msgid "About" msgstr "" diff --git a/ubl-settings-bootloader_ru.po b/ubl-settings-bootloader_ru.po index 3073ef9..6d412a4 100644 --- a/ubl-settings-bootloader_ru.po +++ b/ubl-settings-bootloader_ru.po @@ -17,6 +17,25 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Would you like to read documentation in the Web?" +msgstr "Вы хотите прочитать справку в Сети?" + +msgid "" +"You will be redirected to documentation site, where user help pages are " +"translated and supported by community." +msgstr "" +"Вы будете перенаправлены на сайт с документацией где страницы помощи " +"переводятся и поддерживаются сообществом." + +msgid "Cancel" +msgstr "Отменить" + +msgid "Always redirect" +msgstr "Всегда перенаправлять" + +msgid "Read online" +msgstr "Прочитать онлайн" + msgid "About ubl-settings-bootloader" msgstr "О программе Загрузка системы"