[Little White Course] Analysis of the principles of the openKylin User Manual, one trick to teach you how to customize!

The openKylin user manual is a manual that describes the functions and user interface of the openKylin operating system in detail, allowing users to understand how to use the software. By reading the openKylin user manual, you can get started and use the openKylin operating system faster and better. Today, I will take you to briefly understand the implementation principle of the openKylin user manual and how to customize the content of the user manual.

1. Introduction to the realization principle of the user manual

1. Introduction to QtWebkit

The start, display, and jump of the user manual on the openKylin operating system are realized on the basis of QtWebkit. Let's briefly introduce QtWebkit.

The QtWebkit module provides an engine for using web browser in qt, which makes it easy for us to use the content on the World Wide Web in qt applications, and the control of its web content can also be realized through native controls.

QtWebKit provides tools for rendering Hypertext Markup Language (HTML), Extensible Hypertext Markup Language (XHTML), and Scalable Vector Graphics (SVG) documents, which are styled using Cascading Style Sheets (CSS) and written in JavaScript script.

2. User manual jump interface

In order to facilitate the user to jump to the help document of the corresponding component, the user manual provides an interface, so that after other components call the interface to pass parameters, they can directly open the corresponding content of the user manual, and the component can be called by clicking F1 and the menu-help option.

  • DaemonIpcDbus::showGuide

DaemonIpcDbus::showGuide provides the dbus interface, and the component only needs to pass the corresponding parameters to call. The manual will open the user manual and jump to the corresponding content according to the parameters.

3. User manual operation process

The user manual jump interface is introduced above, and the following will focus on the general flow of the user manual operation.

  • First, you need to instantiate QWebView, enable and disable some settings, and load the user manual webpage file.

  • Send a signal when loading html, and pass the QObject object to JS, so that JS can call the public slots function of QObject

  • The web end calls the qt interface to obtain document information and directory structure, and dynamically generates the home page application.

The js side calls the qt side function to obtain information:

The qt terminal obtains the manual file structure, obtains the icon name and folder name of the homepage, and the corresponding document path:

Through the obtained image name, document path, folder name; loading icon information, complete the loading of the home page application.

The loading process of the homepage of the openKylin user manual is roughly as described above, but it actually involves the rendering and display of the Markdown file, the following effect of the directory and content; the jump to the directory level of the manual; the automatic reading of the update date of the document, etc., here I won't introduce them one by one.

2. User manual content customization

When your system integrates new components, you hope that after adding new components, the content of the corresponding component manual will be automatically added to the user manual, and you can jump; then here is how to integrate your own manual content!

1. Folder structure

It needs to contain a language folder and an icon; the folder name and the icon name are consistent, and will be used for home page icon display and user manual dbus interface call parameters.

2. Markdown file structure

Here, the first-level title of the Markdown document will be used as the display name of the homepage application .

3. Modify the install file

Put the prepared folder under the resource file of the user manual. When the user manual is loaded, it will be automatically read, loaded and displayed on the home page.

Follow the above steps to complete the customization of the content of the user manual, and realize the simultaneous increase and decrease of the content of the system component manual! Have you learned it?

The openKylin (Open Kylin) community aims to take "co-creation" as the core, on the basis of open source, voluntariness, equality, and collaboration, to build a partner ecosystem with enterprises in an open source and open way, and to jointly create a top-level desktop operating system community. Promote the prosperity and development of Linux open source technology and its software and hardware ecology.

The first batch of council member units in the community include Kylin Software, Puhua Basic Software, Zhongke Fangde, Kylin Principal, Meditation Software, Yiming Software, ZTE New Fulcrum, Yuanxin Technology, China Electronics 32, Jide System, Beijing Lin Zhuo, Advanced Operating System Innovation Center and other 13 industry colleagues and industry organizations.

Source: Xie Jiahua

Review: openKylin

Guess you like

Origin blog.csdn.net/openKylin/article/details/128641035