Interface preview method and device, electronic equipment and storage medium
By adding operation and configuration parameters of configuration items in the preview window in QtCreator, dynamically update the interface preview, solving the limitations of dynamically modifying content preview, and achieving flexibility and efficiency improvement of interface preview.
Patent Information
- Application Number
- CN202411113321.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-12
AI Technical Summary
The existing QtCreator has limitations in previewing dynamic modification content (such as style changes, signal slot binding, etc.), which affects the user interface design experience and cannot dynamically develop and preview the preview interface.
By responsive to the preview window addition operation, the preview configuration window corresponding to the target dynamic library is displayed, and in response to the parameter configuration operation of the preview configuration item, the target preview parameters are determined, and the target preview subwindow is updated when the source code file to be detected changes occur. The displayed interface realizes dynamic development and preview of the preview interface.
It enhances the flexibility and convenience of the interface preview process, improves the efficiency of interface development, and allows developers to quickly browse the modified interface effects.
Smart Images

Figure CN118939365A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface design, and in particular to an interface preview method, device, electronic device and storage medium. Background Art
[0002] Qt is a cross-platform C++ application development framework, widely used in GUI development. QtCreator is Qt's official integrated development environment, which provides a visual user interface design tool. Developers can build user interfaces by dragging and dropping controls, and can directly preview the design effects.
[0003] In the related technology, QtCreator can preview static UI interface effects, but has certain limitations in previewing dynamically modified content (such as style changes, signal slot binding, etc.), which affects the user's interface design experience. Summary of the invention
[0004] The present invention provides an interface preview method, device, electronic device and storage medium to achieve the effect of dynamically developing and previewing a preview interface in an interface preview scenario, so that developers can quickly browse the modified interface effect, enhance the flexibility and convenience of the interface preview process, and further improve the interface development efficiency.
[0005] According to one aspect of the present invention, there is provided an interface preview method, the method comprising:
[0006] In response to the preview window adding operation, a preview configuration window corresponding to the target dynamic library is displayed; wherein the target dynamic library contains source code files corresponding to the interface to be previewed; the source code files include at least one source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed; the preview configuration window includes at least one preview configuration item;
[0007] In response to a parameter configuration operation for at least one of the preview configuration items, a target preview parameter is determined, and based on the target preview parameter, the interface to be previewed is displayed in a target preview sub-window; wherein the target preview sub-window is a preview sub-window added to the target preview window for displaying the interface to be previewed;
[0008] When it is detected that at least one of the source code files to be detected has changed, the interface to be previewed displayed in the target preview sub-window is updated based on the changed source code file.
[0009] According to another aspect of the present invention, there is provided an interface preview device, the device comprising:
[0010] A configuration window display module, configured to display a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library includes a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed; the preview configuration window includes at least one preview configuration item;
[0011] A preview interface display module, configured to determine a target preview parameter in response to a parameter configuration operation for at least one of the preview configuration items, and display the interface to be previewed in a target preview sub-window based on the target preview parameter; wherein the target preview sub-window is a preview sub-window added to the target preview window for displaying the interface to be previewed;
[0012] The interface updating module is used to update the interface to be previewed displayed in the target preview subwindow based on the changed source code file when it is detected that at least one of the source code files to be detected has changed.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the interface preview method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface preview method described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present invention displays a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library contains a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the preview configuration window includes at least one preview configuration item; further, in response to a parameter configuration operation for at least one preview configuration item, a target preview parameter is determined, and the interface to be previewed is displayed in a target preview sub-window based on the target preview parameter; further, when a change in the source code file to be detected is detected, the interface to be previewed displayed in the target preview sub-window is updated based on the changed source code file, thereby solving the problem that only static UI interface effects can be previewed in the related art and there are certain limitations in previewing dynamically modified content, and realizing the effect of dynamically developing and previewing the interface to be previewed in the interface preview scenario, so that developers can quickly browse the modified interface effects, enhance the flexibility and convenience of the interface preview process, and thus improve the interface development efficiency.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 is a flowchart of an interface preview method provided according to Embodiment 1 of the present invention;
[0022] Figure 2 is a flowchart of an interface preview method provided according to Embodiment 2 of the present invention;
[0023] Figure 3 is a structural diagram of an interface preview device provided according to Embodiment 3 of the present invention;
[0024] Figure 4 The structure diagram of the electronic device implementing the interface preview method of the embodiment of the present invention is DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Embodiment 1
[0028] Figure 1 This is a flow chart of an interface preview method provided by the first embodiment of the present invention. This embodiment is applicable to the case of previewing a designed user interface. The method can be executed by an interface preview device. The interface preview device can be implemented in the form of hardware and / or software. The interface preview device can be configured in a terminal and / or a server. Figure 1 As shown, the method includes:
[0029] S110. In response to the preview window adding operation, a preview configuration window corresponding to the target dynamic library is displayed; wherein the target dynamic library contains a source code file corresponding to the interface to be previewed; the source code file includes at least one source code file to be detected; and the preview configuration window includes at least one preview configuration item.
[0030] It should be noted that the technical solution provided in the embodiment of the present invention can be applied to Qt applications. It can be understood that Qt applications are a cross-platform C++ application development framework that is widely used in graphical user interface (GUI) development. QtCreator is the official integrated development environment of Qt, which provides a visual user interface design tool that allows developers to create user interfaces by dragging and dropping components or editing code.
[0031] Among them, the preview window adding operation can be understood as an operation of adding an interface preview window in the preview area of the relevant application software. Among them, the interface preview window can be a window for previewing the interface effect of the designed user interface, that is, a display window for displaying the created user interface. The preview window adding operation can be any operation that can realize the preview window adding. Optionally, the preview window adding operation can include at least one of the following: triggering a preset preview window adding control; receiving a preview window adding instruction; the received audio information includes a trigger keyword associated with adding a preview window, etc. It can be understood that a dynamic library is a commonly used library file form in software development. It allows the program to dynamically load and use functions and variables in the library at runtime, rather than statically linking to the program at compile time. The dynamic library is loaded when the program is running, which can indicate that the program does not directly contain the code in the library, but contains a reference to the function in the library. Generally, in QtCreator, the user interface can be developed by creating a dynamic library or referencing an external dynamic library. In this embodiment, the target dynamic library can be a collection of source code files that are pre-created and contain the interface to be previewed. Optionally, the target dynamic library can be a dynamic library created in QtCreator and obtained after code editing through a code editor; alternatively, the applied external dynamic library can also be used as the target dynamic library, which is not specifically limited in this embodiment. The interface to be previewed can be a user interface that has been created. A source code file refers to a text file written in a programming language (such as C++, JavaScript, QML, etc.). In QtCreator, the code written by the user is the source code. As an integrated development environment, one of the main functions of QtCreator is to provide various tools required in the development process such as code editing, compiling, and debugging. The user writes and edits the source code file through the QtCreator editor. In this embodiment, the source code file includes at least one pre-set source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed. The source code file to be detected can be a source code file that needs to be detected in the source code file; alternatively, the source code file to be detected can also be understood as a source code file associated with the display content of the interface to be previewed in the source code file.
[0032] It should be noted that, in this embodiment, the advantage of using a dynamic library to create a user interface is that QtCreator can support hot updates during runtime. That is, when the main program is not closed, some functions in the main program are completed by loading the dynamic library, and when some functions in the dynamic library need to be modified, there is no need to close or restart the main program, only the functions in the dynamic library need to be modified, and the main program can be reloaded to complete the function replacement, so that the effect of updating without restarting can be achieved.
[0033] Among them, the preview configuration window can be understood as a visual editing interface that supports users to configure preview parameters. The preview configuration window can be a window of any display form. Optionally, the preview configuration window can be displayed in the interface as a floating window; or, it can also be an independent display interface; or, it can also be displayed in the interface as a display panel, etc. The preview configuration window includes at least one preview configuration item. The preview configuration item can be understood as an operation entry that supports users to edit parameters. The preview configuration item can be used to edit the interface preview parameters. Optionally, the preview configuration item can include at least dynamic library compilation items, dynamic library loading items, detection file path items, and update detection items.
[0034] As an optional implementation of this embodiment, after the created dynamic library is edited by a code editor, a save trigger operation can be input for the edited dynamic library, and a target dynamic library can be obtained. Further, in the case where a trigger operation for adding a preset preview window control is detected, it can be determined that a preview window adding operation is detected. Furthermore, in response to the preview window adding operation, a preview configuration window corresponding to the target dynamic library is displayed in the form of a floating window on the display interface containing the preview window adding control.
[0035] S120: In response to a parameter configuration operation for at least one preview configuration item, determine a target preview parameter, and display the interface to be previewed in a target preview sub-window based on the target preview parameter.
[0036] Among them, the parameter configuration operation can be understood as an operation of editing parameters of the preview configuration items. The target preview subwindow can be understood as a newly added window for displaying the interface to be previewed. The target preview subwindow is a preview subwindow added to the target preview window for displaying the interface to be previewed. The target preview window can be a pre-set window for displaying the preview effect of the user interface. It should be noted that the target preview window can include at least one preview subwindow, and each preview subwindow can be used to preview different user interfaces.
[0037] In this embodiment, when displaying a preview configuration window including at least one preview configuration item, a parameter configuration operation can be input for at least one preview configuration item. Then, in response to the parameter configuration operation, the configured target preview parameters are determined based on the parameter configuration operation. Then, the interface to be previewed can be displayed in the target preview sub-window based on the preview parameters.
[0038] The target preview parameters can be understood as parameters based on which the preview interface in the dynamic library is previewed. Optionally, the target preview parameters can include dynamic library compilation parameters, dynamic library loading parameters, detection file path, and dynamic library update detection parameters.
[0039] In this embodiment, a parameter configuration operation can be input for at least one preview configuration item to input corresponding preview parameters in the input box corresponding to the corresponding preview configuration item. Then, when a trigger operation for saving changes is detected, the target preview parameters can be determined according to the preview parameters entered in the input box corresponding to the preview configuration item. Furthermore, the target dynamic library can be processed according to the target preview parameters to obtain the interface content corresponding to the interface to be previewed. Then, the interface to be previewed can be displayed in the target preview subwindow.
[0040] Optionally, the target preview parameters include dynamic library compilation parameters and dynamic library loading parameters, the dynamic library compilation parameters include dynamic library script path and compilation command; the dynamic library loading parameters include dynamic library path and export function; determining the interface to be previewed based on the target preview parameters, and displaying the interface to be previewed in the target preview subwindow, including: obtaining the compilation script file corresponding to the target dynamic library based on the dynamic library script path, and compiling the compilation script file according to the compilation command to obtain the dynamic library file; executing the dynamic library file based on the main program, and loading the target dynamic library into the main program according to the dynamic library path; obtaining the interface pointer corresponding to the interface to be previewed from the target dynamic library according to the export function based on the main program; adding the interface pointer to the target preview subwindow to display the interface to be previewed pointed to by the interface pointer in the target preview subwindow.
[0041] Among them, the dynamic library compilation parameters can be understood as the parameters based on when the dynamic library is compiled. The dynamic library compilation parameters include the dynamic library script path and the compilation command. The dynamic library script path refers to the directory path used by the system to find the dynamic library script file when the program is running. The dynamic library script path can be used to characterize the specific location of the dynamic library script file. The compilation command can be a pre-written program code, which can be used to compile the dynamic library to convert the source code file in the dynamic library into an executable code file. The dynamic library loading parameters can be understood as the parameters based on when loading the dynamic library. The dynamic library loading parameters can include the dynamic library path and the export function. The dynamic library path can be the directory path used by the system to find and load the dynamic library. The dynamic library path can be used to characterize the specific location of the dynamic library. The export function can refer to a function that is clearly marked as available for other programs or modules to call. It can be understood that the export function is a function marked by a specific mechanism (such as using a specific keyword or compilation option) when the dynamic library is created. These functions can be called by programs or modules outside the library in a preset manner (such as dynamic linking).
[0042] Among them, the compilation script file can be a script for generating, configuring or managing a dynamic library. The dynamic library file can be understood as a dynamic library obtained after the compilation is completed and in a preset file format. The preset file format can be a dynamic library file format supported or executable by the current system. Optionally, the preset file format can be a .so file format. The main program is the core part of the computer program, which can be used to start the program, perform initialization operations, process input and output, and call other modules. The main program can also be understood as the program that will be run first when any application is started, and it is the entry point for other subprograms to execute. In this embodiment, the main program can be a program that executes compilation and loading of dynamic libraries and exports interface pointers. The interface pointer can be understood as a pointer to the interface content of the interface to be previewed. Exemplarily, the interface pointer can be a pointer of QWidget type. It can be understood that in the Qt framework, QWidget is the base class of all user interface objects. In other words, almost all UI components, such as windows, buttons, text boxes, etc., inherit from QWidget.
[0043] As an optional implementation of this embodiment, when the target preview parameters are obtained, the compilation script file corresponding to the target dynamic library can be obtained according to the dynamic library script path in the dynamic library compilation parameters. Afterwards, the compilation script file can be compiled according to the compilation command to obtain a dynamic library file that can be executed by the computer. Further, the dynamic library file can be executed based on the main program, and the target dynamic library can be loaded into the main program based on the dynamic library path in the dynamic library loading parameters. Furthermore, the interface pointer corresponding to the interface to be previewed in the target dynamic library can be obtained based on the export function of the main program. At this time, it can be indicated that the main program has obtained the interface content of the interface to be previewed in the target dynamic library. Further, a visual preview window can be created based on the main program, and the preview window can be used as a target preview subwindow. Afterwards, the interface pointer can be added to the target preview subwindow to display the interface to be previewed pointed to by the interface pointer in the target preview subwindow.
[0044] S130: When it is detected that at least one source code file to be detected has changed, update the interface to be previewed displayed in the target preview subwindow based on the changed source code file.
[0045] The change in the source code file to be detected may include at least one of the following situations: the source code in the file to be detected is modified, deleted, a new source code is added to the source code file to be detected, etc.
[0046] In this embodiment, when the interface to be previewed is displayed in the target preview sub-window, the source code file to be detected in the source code file corresponding to the interface to be previewed and used to indicate the interface content can be detected. Further, when it is detected that the source code file to be detected has changed, it can be indicated that the source code file has also changed. Then, the changed target dynamic library can be recompiled and loaded according to the changed source code file, so as to determine the updated interface to be previewed based on the changed target dynamic library, and the updated interface to be previewed can be displayed in the target preview sub-window.
[0047] It should be noted that when the interface to be previewed is displayed in the target preview sub-window, the user can also modify the source code file corresponding to the interface to be previewed to adjust the interface to be previewed. In actual applications, after the source code related to the interface content in the source code file is modified, the preview window cannot dynamically update the adjusted interface to be previewed, and the entire program needs to be re-executed before the adjusted interface to be previewed can be displayed. In addition, QtCreator only supports the default state after previewing the drag-and-drop control. The interface to be previewed that is adjusted by modifying the source code or configuration file cannot be displayed in real time in the target preview sub-window.
[0048] In view of the above situation, in this embodiment, the code related to the interface to be previewed is compiled into a dynamic library file by means of a dynamic library, and the source code file related to the interface to be previewed is set as the file to be detected in advance. Then, when the interface to be previewed is displayed in the target preview sub-window, the file to be detected can be detected. Then, when it is detected that the file to be detected has changed, the interface to be previewed can be updated based on the changed source code file, and the updated interface to be previewed can be displayed in the target preview sub-window.
[0049] In this embodiment, the update of the preview interface based on the changed source code file may be performed by re-executing the steps of compiling the dynamic library, loading the dynamic library, and obtaining the interface pointer. The specific execution process may refer to the content corresponding to step S120, which will not be described in detail in this embodiment. Further, a new interface pointer may be obtained, and the new interface pointer may be added to the target preview subwindow, so that the preview interface pointed to by the new interface pointer is displayed in the target preview subwindow.
[0050] The technical solution of the embodiment of the present invention displays a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library contains a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the preview configuration window includes at least one preview configuration item; further, in response to a parameter configuration operation for at least one preview configuration item, a target preview parameter is determined, and the interface to be previewed is displayed in a target preview sub-window based on the target preview parameter; further, when a change in the source code file to be detected is detected, the interface to be previewed displayed in the target preview sub-window is updated based on the changed source code file, thereby solving the problem that only static UI interface effects can be previewed in the related art and there are certain limitations in previewing dynamically modified content, and realizing the effect of dynamically developing and previewing the interface to be previewed in the interface preview scenario, so that developers can quickly browse the modified interface effects, enhance the flexibility and convenience of the interface preview process, and thus improve the interface development efficiency.
[0051] Embodiment 2
[0052] Figure 2 This is a flowchart of an interface preview method provided by the second embodiment of the present invention. Based on the above embodiment, before updating the interface to be previewed displayed in the target preview subwindow based on the changed source code file, it also includes: when it is detected that the preset update detection condition is met, at least one source code file to be detected in the source code file is detected. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or similar to the above embodiment are not repeated here.
[0053] like Figure 2 As shown, the method includes:
[0054] S210. In response to the preview window adding operation, a preview configuration window corresponding to the target dynamic library is displayed; wherein the target dynamic library contains a source code file corresponding to the interface to be previewed; the source code file includes at least one source code file to be detected; and the preview configuration window includes at least one preview configuration item.
[0055] S220: In response to a parameter configuration operation for at least one preview configuration item, determine a target preview parameter, and display the interface to be previewed in a target preview sub-window based on the target preview parameter.
[0056] In this embodiment, the target preview parameters may also include a file path of at least one source code file to be detected. It should be noted that in order to be able to subsequently detect the source code file associated with the interface content in the source code file corresponding to the preview interface, and then update the preview interface displayed in the target preview subwindow according to the detection result, the file path of the source code file to be detected that needs to be detected can be input into the edit box corresponding to the corresponding preview configuration item during the preview parameter configuration stage. Furthermore, the system can update and detect the corresponding source code file to be detected based on the input file path of the source code file to be detected.
[0057] In this embodiment, in order to facilitate subsequent modification comparison of the source code file to be detected, after determining the target preview parameters, it also includes: storing the file path of at least one source code file to be detected in a preset file path container; for at least one file path, obtaining the source code file to be detected corresponding to the file path according to the file path, determining the initial code summary corresponding to the source code file to be detected, and storing the initial code summary in a preset summary container.
[0058] The file path container may be a storage space for storing file paths. The initial code summary may be a code summary that is first determined when determining the source code file to be detected. It can be understood that the code summary refers to information obtained after a high-level summary and refinement of the content of the source code file. The code summary can be used to help developers quickly understand the main functions, structure, dependencies, and other information of the code. The summary container may be a storage space for storing the code summary.
[0059] As an optional implementation of this embodiment, after determining the target preview parameters, the file path of the source code file to be detected can be obtained based on the target preview parameters. Afterwards, the obtained file path of the source code file to be detected can be stored in a preset file path container. Further, the source code file to be detected can be obtained based on the file path, and the code summary determination process can be performed on the source code file to be detected. Then, the determined code summary can be used as the initial code summary corresponding to the source code file to be detected. Further, the determined initial code summary can be stored in a preset summary container.
[0060] In this embodiment, the initial file digest of the source code file to be detected can be determined according to a preset code digest determination method. The code digest determination method can be any method that can determine the code digest. Optionally, the code digest method can be to process the source code file to be detected according to the code digest function.
[0061] Optionally, determining an initial code summary corresponding to the source code file to be detected includes: processing the source code file to be detected according to a preset summary extraction function to obtain an initial code summary corresponding to the source code file to be detected.
[0062] The digest extraction function may be a function that can extract a code digest from a code file. Optionally, the digest extraction function may be an MD5 digest extraction function. It is understood that the MD5 digest extraction function generally refers to performing a digest calculation on input data (such as a string, a file, etc.) through the MD5 algorithm and outputting a hash value of a fixed length (usually 128 bits, i.e., 16 bytes, which is 32 characters after hexadecimal encoding).
[0063] As an optional implementation of this embodiment, the source code file to be detected can be processed according to a preset summary extraction function to obtain a code summary corresponding to the source code file to be detected. Furthermore, the obtained code summary can be used as the initial code summary.
[0064] S230: When it is detected that a preset update detection condition is met, detect at least one source code file to be detected among the source code files.
[0065] Among them, the update detection condition may be a pre-set condition for performing update detection on the source code file. Optionally, the update detection condition may include at least one of the following: detecting a code save operation for the source code file; a pre-created timer reaching a preset detection time. The code save operation may be an operation for saving the source code in the source code file. Optionally, the save trigger operation may include triggering a preset code save control, receiving a code save instruction, or receiving a trigger keyword associated with the code save operation in the audio information. It should be noted that the detection of the code save operation for the source code file may include at least two situations: after editing the source code in the source code file, inputting a code save operation to save the edited source code. Alternatively, the source code in the source code file is not edited, and the code save operation is directly input. Regardless of whether the source code in the source code file is edited, as long as the code save operation is detected, it can be determined that the preset update detection condition is met. The timer may be used to trigger the execution of the file update detection task. Optionally, the timer may be a countdown timer; or, it may be a countdown timer. In the case where the timer is a countdown timer, the preset detection time may be zero hours. In the case where the timer is a countdown timer, the preset detection time may be 1 second, 5 seconds, or 10 seconds.
[0066] As an optional implementation of this embodiment, the file path of at least one source code file to be detected that is associated with the interface content and needs to be detected can be pre-determined during the preview configuration process. Further, when the target preview sub-window has displayed the interface to be previewed, the source code contained in the source code file can be displayed in the code editor window. Afterwards, a code editing operation can be input for the displayed source code, and when a code save operation is detected, the edited source code file is determined. Further, the edited source code file can be detected according to the file path of the predetermined source code file to be detected to determine whether the source code file to be detected in the edited source code file has been modified. Further, when it is determined that the source code file to be detected has been modified, the interface to be previewed can be updated according to the edited source code file, and the updated interface to be previewed can be displayed in the target preview sub-window. Wherein, the code editing operation can include a code modification operation, a code addition operation and / or a code deletion operation.
[0067] As another optional implementation of this embodiment, when it is detected that the pre-created timer reaches the preset detection time, the edited source code file can be detected according to the predetermined path of the source code file to be detected to determine whether the source code file to be detected in the edited source code file has been modified. Further, when it is determined that the source code file to be detected has been modified, the interface to be previewed can be updated according to the edited source code file, and the updated interface to be previewed can be displayed in the target preview sub-window.
[0068] Generally, when the code in a source code file changes, the code summary of the source code file will also change accordingly. Further, when detecting whether the source code file to be detected in the source code file has changed, the detection can be performed based on the code summary.
[0069] Optionally, detecting at least one source code file to be detected in the source code files includes: obtaining at least one source code file to be detected according to the file path of the at least one source code file to be detected stored in a preset file path container; determining, for the at least one source code file to be detected, a code summary corresponding to the source code file to be detected, and comparing the code summary with an initial code summary of the corresponding source code file to be detected stored in a preset summary container; if the code summary is inconsistent with the initial code summary, determining that the source code file to be detected has changed; or, if the code summary is consistent with the initial code summary, determining that the source code file to be detected has not changed.
[0070] As an optional implementation of the present embodiment, when detecting a source code file to be detected in a source code file, the file path of the pre-stored source code file to be detected can be obtained from a preset file path container. Then, the source code file to be detected can be obtained according to the file path. Then, the source code file to be detected can be processed according to a preset code summary determination method to obtain a code summary corresponding to the source code file to be detected. Further, an initial code summary corresponding to the source code file to be detected can be obtained from a preset summary container. After that, the code summary can be compared with the initial code summary. Then, when it is determined that any character in the code summary and the initial code summary is inconsistent, it can be determined that the code summary is inconsistent with the initial code summary, and then, it can be determined that the source code file to be detected has changed. Alternatively, when it is determined that all characters included in the code summary and the initial code summary are consistent, it can be determined that the code summary is consistent with the initial code summary, and then, it can be determined that the source code file to be detected has not changed.
[0071] S240: When it is detected that at least one source code file to be detected has changed, update the interface to be previewed displayed in the target preview subwindow based on the changed source code file.
[0072] The technical solution of the embodiment of the present invention is to display a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library contains a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the preview configuration window includes at least one preview configuration item; further, in response to a parameter configuration operation for at least one preview configuration item, a target preview parameter is determined, and the interface to be previewed is displayed in a target preview subwindow based on the target preview parameter; further, in the case of detecting that a preset update detection condition is met, at least one source code file to be detected in the source code file is detected, and then, in the case of detecting that at least one source code file to be detected has changed, the interface to be previewed displayed in the target preview subwindow is updated based on the changed source code file, thereby realizing update detection of the source code file, and then, updating the effect of the displayed interface to be previewed in real time according to the update detection result, so that developers can quickly browse the modified interface effect, enhance the flexibility and convenience of the interface preview process, and then improve the interface development efficiency.
[0073] Embodiment 3
[0074] Figure 3 Schematic diagram of the structure of an interface preview device provided by Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a configuration window display module 310, a preview interface display module 320 and an interface update module 330
[0075] Among them, the configuration window display module 310 is used to display a preview configuration window corresponding to the target dynamic library in response to a preview window adding operation; wherein the target dynamic library contains a source code file corresponding to the interface to be previewed; the source code file includes at least one source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed; the preview configuration window includes at least one preview configuration item; the preview interface display module 320 is used to determine the target preview parameters in response to a parameter configuration operation for at least one of the preview configuration items, and display the interface to be previewed in the target preview sub-window based on the target preview parameters; wherein the target preview sub-window is a preview sub-window added to the target preview window for displaying the interface to be previewed; the interface update module 330 is used to update the interface to be previewed displayed in the target preview sub-window based on the changed source code file when a change is detected in at least one of the source code files to be detected.
[0076] The technical solution of the embodiment of the present invention displays a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library contains a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the preview configuration window includes at least one preview configuration item; further, in response to a parameter configuration operation for at least one preview configuration item, a target preview parameter is determined, and the interface to be previewed is displayed in a target preview sub-window based on the target preview parameter; further, when a change is detected in at least one source code file to be detected, the interface to be previewed displayed in the target preview sub-window is updated based on the changed source code file, thereby solving the problem that only static UI interface effects can be previewed in the related art and there are certain limitations in previewing dynamically modified content, and realizing the effect of dynamically developing and previewing the interface to be previewed in the interface preview scenario, so that developers can quickly browse the modified interface effects, enhance the flexibility and convenience of the interface preview process, and thus improve the interface development efficiency.
[0077] Optionally, the target preview parameters include dynamic library compilation parameters and dynamic library loading parameters, the dynamic library compilation parameters include dynamic library script path and compilation command; the dynamic library loading parameters include dynamic library path and export function; the preview interface display module 320 includes: a dynamic library compilation unit, a dynamic library loading unit, an interface pointer acquisition unit and a preview interface display unit.
[0078] A dynamic library compiling unit, configured to obtain a compiling script file corresponding to the target dynamic library based on the dynamic library script path, and compile the compiling script file according to the compiling command to obtain a dynamic library file;
[0079] A dynamic library loading unit, used to execute the dynamic library file based on the main program, and load the target dynamic library into the main program according to the dynamic library path;
[0080] An interface pointer acquisition unit, used for acquiring an interface pointer corresponding to the interface to be previewed from the target dynamic library based on the main program according to the export function;
[0081] The preview interface display unit is used to add the interface pointer to a pre-created target preview sub-window, so as to display the to-be-previewed interface pointed to by the interface pointer in the target preview sub-window.
[0082] Optionally, the device includes: a file detection module.
[0083] The file detection module is used to detect the at least one source code file to be detected in the source code files when it is detected that a preset update detection condition is met.
[0084] Optionally, the update detection condition includes at least one of the following: a code save operation for the source code file is detected; a pre-created timer reaches a preset detection time.
[0085] Optionally, the file detection module includes: a file acquisition unit, a code summary comparison unit, and a file change determination unit.
[0086] A file acquisition unit, configured to acquire at least one source code file to be detected according to a file path of at least one source code file to be detected stored in a preset file path container;
[0087] a code summary comparison unit, configured to determine, for the at least one source code file to be detected, a code summary corresponding to the source code file to be detected, and compare the code summary with an initial code summary of the corresponding source code file to be detected stored in a preset summary container;
[0088] The file change determination unit is used to determine that the source code file to be detected has changed when the code summary is inconsistent with the initial code summary; or determine that the source code file to be detected has not changed when the code summary is consistent with the initial code summary.
[0089] Optionally, the target preview parameter also includes a file path of at least one source code file to be detected; the device also includes: a file path storage module and a code summary storage module.
[0090] A file path storage module, configured to store the file path of the at least one source code file to be detected into a preset file path container after determining the target preview parameter;
[0091] The code summary storage module is used to obtain a source code file to be detected corresponding to at least one file path according to the file path, determine an initial code summary corresponding to the source code file to be detected, and store the initial code summary in a preset summary container.
[0092] Optionally, the code summary storage module includes: a code summary determination unit.
[0093] The code summary determination unit is used to process the source code file to be detected according to a preset summary extraction function to obtain an initial code summary corresponding to the source code file to be detected.
[0094] The interface preview device provided in the embodiment of the present invention can execute the interface preview method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0095] Embodiment 4
[0096] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0097] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0098] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0099] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the interface preview method.
[0100] In some embodiments, the interface preview method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the interface preview method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the interface preview method in any other appropriate manner (e.g., by means of firmware).
[0101] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0102] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0103] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0105] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0106] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0107] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0108] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An interface preview method, characterized in that: include: In response to the preview window adding operation, a preview configuration window corresponding to the target dynamic library is displayed; wherein the target dynamic library contains source code files corresponding to the interface to be previewed; the source code files include at least one source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed; the preview configuration window includes at least one preview configuration item; In response to a parameter configuration operation for at least one of the preview configuration items, a target preview parameter is determined, and based on the target preview parameter, the interface to be previewed is displayed in a target preview sub-window; wherein the target preview sub-window is a preview sub-window added to the target preview window for displaying the interface to be previewed; When it is detected that at least one of the source code files to be detected has changed, the interface to be previewed displayed in the target preview sub-window is updated based on the changed source code file.
2. The interface preview method according to claim 1, characterized in that: The target preview parameters include dynamic library compilation parameters and dynamic library loading parameters, the dynamic library compilation parameters include dynamic library script path and compilation command; the dynamic library loading parameters include dynamic library path and export function; The step of displaying the interface to be previewed in the target preview sub-window based on the target preview parameter includes: Acquire a compilation script file corresponding to the target dynamic library based on the dynamic library script path, and compile the compilation script file according to the compilation command to obtain a dynamic library file; Execute the dynamic library file based on the main program, and load the target dynamic library into the main program according to the dynamic library path; Based on the main program, acquiring an interface pointer corresponding to the interface to be previewed from the target dynamic library according to the export function; The interface pointer is added to a pre-created target preview sub-window, so that the interface to be previewed pointed to by the interface pointer is displayed in the target preview sub-window.
3. The interface preview method according to claim 1, characterized in that: The method further comprises: When it is detected that a preset update detection condition is met, the at least one source code file to be detected in the source code files is detected.
4. The interface preview method according to claim 3, characterized in that: The update detection condition includes at least one of the following: A code saving operation on the source code file is detected; The pre-created timer reaches the preset detection time.
5. The interface preview method according to claim 3, characterized in that: The detecting the at least one source code file to be detected in the source code files includes: Acquire at least one source code file to be detected according to the file path of at least one source code file to be detected stored in a preset file path container; For the at least one source code file to be detected, determining a code summary corresponding to the source code file to be detected, and comparing the code summary with an initial code summary of the corresponding source code file to be detected stored in a preset summary container; In the case where the code summary is inconsistent with the initial code summary, determining that the source code file to be detected has changed; or, When the code digest is consistent with the initial code digest, it is determined that the source code file to be detected has not changed.
6. The interface preview method according to claim 1, characterized in that: The target preview parameter also includes a file path of at least one source code file to be detected; after determining the target preview parameter, the method further includes: Storing the file path of the at least one source code file to be detected in a preset file path container; For at least one file path, a source code file to be detected corresponding to the file path is obtained according to the file path, an initial code summary corresponding to the source code file to be detected is determined, and the initial code summary is stored in a preset summary container.
7. The interface preview method according to claim 6, characterized in that: The determining of the initial code digest corresponding to the source code file to be detected includes: The source code file to be detected is processed according to a preset summary extraction function to obtain an initial code summary corresponding to the source code file to be detected.
8. An interface preview device, characterized in that: include: A configuration window display module, configured to display a preview configuration window corresponding to a target dynamic library in response to a preview window adding operation; wherein the target dynamic library includes a source code file corresponding to an interface to be previewed; the source code file includes at least one source code file to be detected; the source code file to be detected is used to indicate the interface content of the interface to be previewed; the preview configuration window includes at least one preview configuration item; A preview interface display module, configured to determine a target preview parameter in response to a parameter configuration operation for at least one of the preview configuration items, and display the interface to be previewed in a target preview sub-window based on the target preview parameter; wherein the target preview sub-window is a preview sub-window added to the target preview window for displaying the interface to be previewed; The interface updating module is used to update the interface to be previewed displayed in the target preview subwindow based on the changed source code file when it is detected that at least one of the source code files to be detected has changed.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the interface preview method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface preview method according to any one of claims 1 to 7 when executed.
