Исправлено открытие справки

pull/11/head
Igor Belitskiy 3 years ago
parent 7d536ceeb6
commit 96872d00da

@ -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)

@ -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<string> MainWindow::get_setting_entry_all(string key, std::map <string, string>* 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<Gtk::ListStore> &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");

@ -17,6 +17,7 @@
#include "util.h"
#include "save.h"
#include "load.h"
#include "ubl-settings-bootloader-cm.h"
#ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h>
#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<std::string> vec_Option_kernel;
std::vector<std::string> vec_Option_IPT;
std::vector<std::string> 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<Gtk::Builder> const& builder);
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
~MainWindow();
void open_browser();
void get_menu_boot(std::map <string, string> &map_temp);
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);

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkSizeGroup">
@ -1290,6 +1290,205 @@ specified priority</property>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="wndShowWeb">
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="resizable">False</property>
<property name="default-width">450</property>
<property name="default-height">250</property>
<property name="icon-name">dialog-question-symbolic</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<property name="xpad">20</property>
<property name="ypad">20</property>
<property name="icon-name">dialog-question-symbolic</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lblhelpHeader">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-top">10</property>
<property name="margin-bottom">5</property>
<property name="label" context="Would you like to read documentation in the Net?" comments="Would you like to read documentation in the Net?">Would you like to read documentation in the Web?</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblhelpText">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin-right">10</property>
<property name="margin-end">10</property>
<property name="label" context="You will be redirected to documentation web site, where documentation are translated and supported by community." comments="You will be redirected to documentation web site, where documentation are translated and supported by community.">You will be redirected to documentation website where documentation is translated and supported by community.</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chkAlwaysOpenHelp">
<property name="label" translatable="yes">Always redirect to online documentation</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">end</property>
<property name="margin-bottom">10</property>
<property name="draw-indicator">True</property>
<style>
<class name="label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<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">5</property>
<property name="margin-bottom">5</property>
<property name="spacing">30</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="btnCancelHelp">
<property name="label">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<style>
<class name="button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnReadHelp">
<property name="label">Read Online</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<style>
<class name="button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="SettingsBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child type="title">
<object class="GtkLabel" id="lblwebHeaderName">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">ubl-settings-bootloader</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">dialog-question-symbolic</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="wndWeb">
<property name="width-request">800</property>
<property name="height-request">600</property>

@ -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 ""

@ -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 "О программе Загрузка системы"

Loading…
Cancel
Save