Virtual progress display method and device, computer equipment and storage medium
By encapsulating a virtual progress control class and dynamically adjusting the timer trigger interval, the problems of user anxiety and abrupt progress changes in task progress display are solved, achieving smooth progress changes and a good user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies cannot provide clear progress feedback in task progress display, causing user anxiety while waiting. Furthermore, the progress bar may stagnate or abruptly stop in different business scenarios, affecting the user experience.
A virtual progress control class is encapsulated, defining the default task duration, progress count, and task completion flag. The timer trigger interval is dynamically adjusted through timers and progress calculation slot functions to achieve smooth progress changes.
In situations where the actual progress of a task cannot be obtained, providing continuous progress data updates reduces user anxiety, ensures a smooth transition in progress display, and optimizes the user interaction experience.
Smart Images

Figure CN121833115A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer software, in particular to a virtual progress display method and device, computer equipment and a storage medium. BACKGROUND
[0002] In the field of interactive design of time-consuming tasks of software and systems, to alleviate user anxiety and improve the interactive experience, real-time feedback of task execution progress to users is a core design strategy. However, in actual applications, when the system cannot obtain the actual execution progress data of the task, two alternative solutions are generally used in the industry: one is to display the task in the execution state through a loading animation; the second is to preset the longest execution time of the task, and plan the progress bar pace based on the time, if the task is completed ahead of schedule within the preset time, the progress display process is directly ended, if the task is not completed within the preset longest time, the progress value is stopped at the progress node corresponding to the preset time, and the progress is directly set to the completion state when the task is finally executed. However, the above two solutions have obvious experience defects: the loading animation solution lacks explicit progress change feedback, and cannot make the user perceive the progress of the task execution, which easily causes user anxiety and user loss; and the progress bar solution with preset longest time often has the problem of abrupt progress stagnation in different business scenarios, or the progress bar directly jumps from the middle position to the completion state due to the task being completed ahead of schedule, and the overall progress transition process is not smooth, which is difficult to guarantee good user interactive experience. SUMMARY
[0003] The embodiments of the present application provide a virtual progress display method, device, computer equipment and storage medium, which aims to improve the virtual progress display effect.
[0004] In a first aspect, the embodiments of the present application provide a virtual progress display method, comprising: encapsulating a virtual progress control class and defining core member variables of the virtual progress control class; wherein the core member variables include a default task duration, a progress count and a task completion identifier; configuring a timer and a progress calculation slot function in the virtual progress control class, then establishing an association between the timer trigger signal and the progress calculation slot function, and providing a task start interface and a task end interface; when the task is started through the task start interface, the timer is started and the progress calculation slot function is triggered according to a preset initial trigger interval; in the progress calculation slot function, the progress count is updated, and a current virtual progress value is calculated based on the progress count and the default task duration, then it is judged whether the progress count reaches the default task duration; If it is determined that the progress count does not reach the default task duration, the timer triggering interval is dynamically adjusted according to the interval in which the current virtual progress value is located, so that the virtual progress presents a smooth change trend. When the task is terminated through the task end interface, the timer triggering interval is adjusted according to the interval in which the current virtual progress value is located, so that the virtual progress smoothly transitions to 100% and then ends the process.
[0005] In a second aspect, an embodiment of the present application provides a virtual progress display device, comprising: A package definition unit is configured to package a virtual progress control class and define core member variables of the virtual progress control class, wherein the core member variables include a default task duration, a progress count and a task completion identifier. A class configuration unit is configured to configure a timer and a progress calculation slot function in the virtual progress control class, then establish an association between a timer triggering signal and the progress calculation slot function, and provide a task start interface and a task end interface. A start triggering unit is configured to start the timer and trigger the progress calculation slot function according to an initial triggering interval when the task is started through the task start interface. A calculation and judgment unit is configured to update the progress count in the progress calculation slot function, calculate a current virtual progress value based on the progress count and the default task duration, and then determine whether the progress count reaches the default task duration. A first adjustment unit is configured to dynamically adjust the timer triggering interval according to the interval in which the current virtual progress value is located if it is determined that the progress count does not reach the default task duration, so that the virtual progress presents a smooth change trend. A second adjustment unit is configured to adjust the timer triggering interval according to the interval in which the current virtual progress value is located when the task is terminated through the task end interface, so that the virtual progress smoothly transitions to 100% and then ends the process.
[0006] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the virtual progress display method of the first aspect when executing the computer program.
[0007] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement the virtual progress display method of the first aspect.
[0008] The embodiment of the present application provides a virtual progress display method, device, computer equipment and storage medium, the method comprises the following steps: encapsulating a virtual progress control class, and defining core member variables of the virtual progress control class; wherein the core member variables comprise a default task duration, a progress count and a task completion identifier; a timer and a progress calculation slot function are configured in the virtual progress control class, then an association relationship between a timer trigger signal and the progress calculation slot function is established, and a task starting interface and a task ending interface are provided; when the task starting interface is used to start a task, the timer is started and the progress calculation slot function is triggered according to a preset initial trigger interval; in the progress calculation slot function, the progress count is updated, a current virtual progress value is calculated based on the progress count and the default task duration, then whether the progress count reaches the default task duration is judged; if it is judged that the progress count does not reach the default task duration, the timer trigger interval is dynamically adjusted according to an interval in which the current virtual progress value is located, so that the virtual progress presents a smooth change trend; when the task ending interface is used to terminate the task, the timer trigger interval is adjusted according to an interval in which the current virtual progress value is located, so that the virtual progress is smoothly transitioned to 100% and the process is ended. The embodiment of the present application can effectively improve the virtual progress display effect, in the scene where actual progress of a task cannot be obtained, continuous progress data change can be provided, the user can clearly perceive the task advancing state, and waiting anxiety is significantly reduced; meanwhile, the timer trigger interval is dynamically adjusted in intervals, so that the overall progress presents a smooth transition rhythm of fast in the front and slow in the back, the problem that progress is suddenly stagnant or directly jumps to completion in the traditional scheme is avoided, and user interaction experience is greatly optimized. BRIEF DESCRIPTION OF DRAWINGS
[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0010] Figure 1 A flowchart of a virtual progress display method provided by the embodiment of the present application is shown in the figure. Figure 2 Another flowchart of a virtual progress display method provided by the embodiment of the present application is shown in the figure. Figure 3 A schematic block diagram of a virtual progress display device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0011] With reference to the drawings and embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0012] It should be understood that, when used in the specification and the appended claims, the terms "comprise" and "include" indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not exclude one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0013] It should also be understood that the terms used in the present application specification are only for the purpose of describing particular embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms, unless the context clearly indicates otherwise.
[0014] It should be further understood that the term "and / or" used in the present application specification and the appended claims means one or more of the associated listed items as well as all possible combinations of the items.
[0015] Please see Figure 1 The virtual progress display method provided by the embodiments of the present application specifically includes steps S101-S106.
[0016] In step S101, a virtual progress control class is packaged, and core member variables of the virtual progress control class are defined. The core member variables include a default task duration, a progress count, and a task completion identifier. In this step, the EVirtualProgress class is encapsulated so that this module can be used elsewhere. As long as an object is created and set, the virtual progress function can be realized. Specifically, the EVirtualProgress class can be encapsulated as the virtual progress control class, and the default task duration member variable m_totalInstallTime, the progress count member variable m_timeCount, and the task completion member variable m_isCompleted which is false by default are defined. Here, m_totalInstallTime can be set to 30000 milliseconds, and the initial value of the progress count member variable m_timeCount is 0. It should be noted that 30000 milliseconds here is defined for the scenario where the download installation time ranges from 20 seconds to 4 minutes. Through the ladder progress design, it can be ensured that the progress changes smoothly whether the actual task is completed within 20 seconds or takes 4 minutes. If the time range of the task is further expanded, the parameter values need to be dynamically adjusted, and the core purpose is to adapt to more application scenarios.
[0017] Step S102, configure a timer and a progress calculation slot function in the virtual progress control class, then establish an association between the timer trigger signal and the progress calculation slot function, and provide a task start interface and a task end interface; In this step, a QTimer timer can be declared and defined in the virtual progress control class EVirtualProgress, and the timer trigger interval is set to 100 milliseconds. A caculateProgressValue() slot function is defined as the progress calculation slot function, and it is associated with the timeout output signal of the timer.
[0018] In addition, the task start interface and the task end interface are provided in the EVirtualProgress class, and a m_isCompleted member variable is declared and defined, which is false by default.
[0019] Step S103, when the task is started through the task start interface, the timer is started and the progress calculation slot function is triggered according to the preset initial trigger interval; In this step, when the task start interface is called, the m_isCompleted member variable is false by default, indicating that the task starts, and the timer is started. The progress calculation slot function caculateProgressValue() can be triggered according to the preset 100 millisecond initial trigger interval.
[0020] Step S104, in the progress calculation slot function, updating the progress count, and calculating a current virtual progress value based on the progress count and the default task duration, and then judging whether the progress count reaches the default task duration; Specifically, the step S104 includes: The progress count member variable m_timeCount of the progress calculation slot function and the current trigger interval of the timer are accumulated to obtain an updated progress count; The value of m_timeCount*1.0f / m_totalInstallTime*100 is calculated as the current virtual progress value in combination with the default task duration member variable m_totalInstallTime and the progress count member variable m_timeCount, and then it is judged whether the progress count is greater than or equal to the default task duration.
[0021] In this step, the timer updates the progress count each time the progress calculation slot function is triggered. For example, the first time the progress count member variable m_timeCount is initially 0, and after adding the current trigger interval of the timer of 100 milliseconds, the updated progress count becomes 100 milliseconds. Each time the trigger is performed, the current trigger interval of the timer is continuously added to the previously updated progress count. After obtaining the updated progress count, the current virtual progress value can be calculated in combination with the default task duration member variable m_totalInstallTime. Taking m_totalInstallTime set to 30000 milliseconds as an example, if the updated progress count m_timeCount is 3000 milliseconds, then the current virtual progress value is 3000*1.0f / 30000*100=10%.
[0022] After calculating the current virtual progress value, it is necessary to judge whether the progress count is greater than or equal to the default task duration. If the progress count is less than the default task duration, it means that the task has not reached the preset default completion time, and at this time the next step needs to be processed; if the progress count is greater than or equal to the default task duration, it means that the task has reached or exceeded the preset default completion time in time, and corresponding processing is also needed. In this way, the progress count and the current virtual progress value can be continuously updated, thereby providing a basis for subsequent dynamic adjustment of the timer trigger interval, ensuring that the virtual progress can present a smooth change trend, and improving the user experience in the process of waiting for task execution.
[0023] Further, the judgment of whether the progress count is greater than or equal to the default task duration includes: If it is determined that the progress count is greater than or equal to the default task duration, it is determined whether the task completion member variable m_isCompleted is true; When the task completion member variable m_isCompleted is true, it is determined that the task is completed. When the task completion member variable m_isCompleted is false, it is determined that the task is timed out, and a timeout prompt is issued.
[0024] This step determines whether the external installation task is completed (i.e., whether m_isCompleted is true) when it is determined that the progress count is greater than or equal to the default task duration (i.e., m_timeCount is greater than or equal to m_totalInstallTime). This is because even if the progress count reaches or exceeds the default task duration, it cannot be directly determined that the task is completed, and it is also necessary to combine the information whether the task is actually completed. When the task completion member variable m_isCompleted is true, it indicates that the task has been logically truly completed, at which time it can be determined that the task is completed, and subsequent operations after the task is completed can be performed, such as releasing related resources, prompting the user that the task is completed, etc. When the task completion member variable m_isCompleted is false, it means that although the time has reached or exceeded the preset default completion time, the task is actually not completed, which belongs to the case of task timeout. At this time, a timeout prompt can be issued to inform the user that the task may have an exception and is not completed within the expected time.
[0025] In this way, accurate judgment and corresponding processing can be made according to different situations, further improving the user experience. At the same time, for the case of task timeout, the reason for timeout can be further analyzed, such as whether it is resource shortage, task complexity exceeding expectation, etc., so as to optimize and adjust the task subsequently. In addition, after issuing the timeout prompt, some optional operations can be provided, such as continuing to wait, canceling the task, etc., so that the user can make a selection according to the actual situation.
[0026] If it is determined that the progress count does not reach the default task duration, the timer trigger interval is dynamically adjusted according to the interval in which the current virtual progress value is located, so that the virtual progress presents a smooth change trend. The step dynamically adjusts the triggering interval of the timer according to the interval in which the current virtual progress value is located when the progress count does not reach the default task duration. The step divides the entire progress interval into multiple sub-intervals, and each sub-interval corresponds to a different timer triggering interval adjustment strategy. By dynamically adjusting the timer triggering interval in this way, the virtual progress presents a smooth change trend. The problem of sudden progress stagnation or direct jump completion in the traditional scheme is avoided, so that the user can continuously see the progress change during the task execution waiting process, clearly perceive the task promotion state, significantly reduce the waiting anxiety, and greatly optimize the user interaction experience.
[0027] Specifically, the step S105 includes: determining the interval in which the current virtual progress value is located; if the interval in which the current virtual progress value is located is a first interval threshold, adjusting the triggering interval of the timer according to a first preset strategy; if the interval in which the current virtual progress value is located is a second interval threshold, adjusting the triggering interval of the timer according to a second preset strategy; wherein the second interval threshold is greater than the first interval threshold, and the adjustment degree of the second preset strategy is greater than that of the first preset strategy; if the interval in which the current virtual progress value is located is a third interval threshold, adjusting the triggering interval of the timer according to a third preset strategy; wherein the third interval threshold is greater than the second interval threshold, and the adjustment degree of the third preset strategy is greater than that of the second preset strategy.
[0028] By setting the first interval threshold, the second interval threshold, and the third interval threshold, and the corresponding first preset strategy, the second preset strategy, and the third preset strategy, this step realizes fine adjustment in intervals. For example, the first interval threshold can be set to 0-20% of the progress value. In this interval, in order to enable the user to quickly see the progress promotion and enhance the initial experience of the user, the first preset strategy can be used to appropriately shorten the timer triggering interval, such as adjusting from the initial 100 milliseconds to 80 milliseconds, so that the progress presents a faster growth trend in the initial stage. When the virtual progress value enters the second interval threshold, such as 21%-60%, the task has already made some progress at this time. In order to maintain the user's attention and avoid the feeling that the subsequent progress promotion is slow due to the progress growth being too fast, the second preset strategy can be used to appropriately lengthen the timer triggering interval, such as adjusting to 120 milliseconds, so that the progress growth speed is slowed down, but still maintains a continuous promotion. When the virtual progress value reaches the third interval threshold, such as 61%-100%, the task is close to completion. In order to create a sense of urgency that the task is about to be completed, while ensuring that the progress can smoothly transition to 100%, the third preset strategy can be used to further lengthen the timer triggering interval, such as adjusting to 150 milliseconds, so that the progress presents a smooth transition rhythm of fast at the beginning and slow at the end.
[0029] By dynamically adjusting the timer trigger interval in this segmented manner, the virtual progress can exhibit a smooth and reasonable trend throughout the entire task process. This allows users to clearly perceive the progress of the task while waiting for it to be executed, effectively reducing waiting anxiety and greatly optimizing the user interaction experience.
[0030] In practical applications, more range thresholds and corresponding preset strategies can be set to achieve more refined adjustments. For example, if the current virtual progress value is ≤33%, the timer trigger interval can be set to 100 milliseconds (i.e., the initial trigger interval). If 33% < current virtual progress value ≤ 60%, then set the timer trigger interval to 2 × 100 milliseconds; If 60% < current virtual progress value ≤ 80%, then set the timer trigger interval to 80 × 100 milliseconds; If 80% < current virtual progress value ≤ 93%, then set the timer trigger interval to 20 × 100 milliseconds; If the current virtual progress value is greater than 93%, then set the timer trigger interval to 50 × 100 milliseconds.
[0031] It's important to note that a longer timer trigger interval results in slower progress. For example, setting it to 8 * 100 milliseconds will be 8 times slower than the default 100 milliseconds, but there will still be a smoother data change. Through the above operations, the first 33% of the progress will be completed in 9.9 seconds, 33%-60% in 16.2 seconds, 60%-80% in 48 seconds, 80%-93% in 78 seconds, and 93%-100% in 105 seconds. The original 30-second time has been extended to 257 seconds, showing an overall pace that is fast at the beginning and slows down later, while ensuring a smooth change in progress.
[0032] Step S106: When the task is terminated through the task end interface, the timer trigger interval is adjusted according to the current virtual progress value range so that the virtual progress smoothly transitions to 100% and then the process ends.
[0033] When the task completion interface is called in this step, it means that the actual external task has ended. At this point, it is necessary to ensure that the virtual progress smoothly transitions to 100%, thus achieving a satisfactory completion. Similarly, the timer trigger interval is adjusted in different ways depending on the current range of the virtual progress value.
[0034] Specifically, step S106 includes: Determine the range in which the current virtual progress value is located; If the current virtual progress value is in the fourth interval threshold, then the trigger interval of the timer is adjusted according to the fourth preset strategy; If the current virtual progress value is in the fifth interval threshold, the trigger interval of the timer is adjusted according to the fifth preset strategy; wherein, the fifth interval threshold is greater than the fourth interval threshold, and the adjustment degree of the fifth preset strategy is greater than the adjustment degree of the fourth preset strategy. If the current virtual progress value is in the sixth interval threshold, the trigger interval of the timer is adjusted according to the sixth preset strategy; wherein the sixth interval threshold is greater than the fifth interval threshold, and the adjustment degree of the sixth preset strategy is greater than the adjustment degree of the fifth preset strategy.
[0035] This step, by setting the fourth, fifth, and sixth interval thresholds and their corresponding fourth, fifth, and sixth preset strategies, enables fine-tuning of the virtual progress at the end of the task. For example, the fourth interval threshold can be set to a progress value of 0-30%. Within this range, since the progress is still far from 100%, the fourth preset strategy significantly shortens the timer trigger interval, such as adjusting it from the current interval to 20 milliseconds, to allow the progress to grow rapidly. When the virtual progress value enters the fifth interval threshold, such as 31%-70%, the progress has made some progress but is still not close to completion. To ensure the rationality and stability of progress growth, the fifth preset strategy appropriately shortens the timer trigger interval, such as adjusting it to 50 milliseconds, allowing the progress to steadily advance towards 100%. When the virtual progress value reaches the sixth interval threshold, such as 71%-100%, the task is nearing completion. To ensure a smooth transition to 100%, the sixth preset strategy appropriately lengthens the timer trigger interval, such as adjusting it to 80 milliseconds, to prevent the progress from suddenly jumping to 100%.
[0036] By dynamically adjusting the timer trigger interval in this segmented manner, the virtual progress can be smoothly transitioned to 100% upon task completion, providing the user with a smooth ending experience. It should be noted that the first interval threshold and the fourth region threshold described in this embodiment can be the same or different. Correspondingly, the second interval threshold and the fifth region threshold, the third interval threshold and the sixth region threshold, as well as the corresponding first preset strategy and the fourth preset strategy, the second preset strategy and the fifth preset strategy, and the third preset strategy and the sixth preset strategy can all be the same or different.
[0037] In practical applications, more interval thresholds and corresponding preset strategies can be set according to specific needs to achieve more detailed and precise progress adjustments. For example, if the current virtual progress value is ≤33%, the timer trigger interval can be set to 0.1×100 milliseconds; If 33% < current virtual progress value ≤ 60%, set the timer trigger interval to 0.3 × 100 milliseconds; If 60% < current virtual progress value ≤ 80%, set the timer trigger interval to 0.5 × 100 milliseconds; If 80% < current virtual progress value ≤ 93%, set the timer trigger interval to 0.8 × 100 milliseconds; If the current virtual progress value is greater than 93%, set the timer trigger interval to 1×100 milliseconds.
[0038] Here, the shorter the timer's trigger interval, the faster the progress. The purpose of this setting is to ensure a smooth completion of the installation tasks at different stages. For example, for an installation task that needs to be completed within 20 seconds, the progress calculated according to step 8 at 20 seconds should be 49.8%, and the remaining 50.2% will be completed at twice the speed.
[0039] In this embodiment, combined with Figure 2 Firstly, the entire virtual progress display process is effectively managed and controlled by encapsulating a virtual progress control class. By defining core member variables, such as the default task duration, a time base is provided for progress calculation, giving the calculation a clear range; the progress counter is used to record the time progress during task execution and is a key factor in calculating the current virtual progress value; the task completion flag clearly indicates whether the task has been completed, facilitating subsequent judgment and processing.
[0040] When configuring the timer and progress calculation slot function, the timer can trigger the progress calculation slot function at preset time intervals to ensure that progress calculation is performed on schedule. The progress calculation slot function is responsible for updating the progress count and calculating the current virtual progress value based on the progress count and the default task duration. By establishing the association between the timer trigger signal and the progress calculation slot function, the timer trigger can accurately call the progress calculation slot function, ensuring the timeliness and accuracy of progress calculation. Simultaneously, this embodiment provides a task start interface and a task end interface, allowing external programs to easily control the start and termination of tasks. Thus, when a task is started through the task start interface, the timer begins working and triggers the progress calculation slot function according to the initial trigger interval, starting the progress calculation and update. In the progress calculation slot function, the progress count is continuously updated, the current virtual progress value is calculated based on the progress count and the default task duration, and it is determined whether the progress count has reached the default task duration. If not, the timer trigger interval is dynamically adjusted according to the current virtual progress value's range, thus ensuring a smooth change in virtual progress and avoiding abrupt progress changes.
[0041] When a task is terminated via the task end interface, the timer trigger interval is adjusted according to the current virtual progress value range, ensuring a smooth transition to 100% before the process ends. This effectively improves the virtual progress display, providing continuous progress data changes in scenarios where the actual task progress cannot be obtained, allowing users to clearly perceive the task's progress and significantly reducing waiting anxiety. Furthermore, by dynamically adjusting the timer trigger interval in segments, the overall progress exhibits a smooth transition rhythm, with faster progress at the beginning and slower at the end, avoiding the problems of sudden progress halts or abrupt jumps to completion found in traditional solutions, thus greatly optimizing the user experience.
[0042] Figure 3 This is a schematic block diagram of a virtual progress display device 300 provided in an embodiment of the present invention. The device 300 includes: Encapsulation definition unit 301 is used to encapsulate the virtual progress control class and define the core member variables of the virtual progress control class; wherein, the core member variables include default task duration, progress count and task completion identifier; The configuration unit 302 is used to configure timers and progress calculation slot functions in the virtual progress control class, then establish the association between the timer trigger signal and the progress calculation slot function, and provide a task start interface and a task end interface. The start trigger unit 303 is used to start a timer and trigger the progress calculation slot function according to the initial trigger interval when the task is started through the task start interface; The calculation and judgment unit 304 is used to update the progress count in the progress calculation slot function, calculate the current virtual progress value based on the progress count and the default task duration, and then determine whether the progress count has reached the default task duration. The first adjustment unit 305 is used to dynamically adjust the timer trigger interval according to the current virtual progress value interval if it is determined that the progress count has not reached the default task duration, so that the virtual progress shows a smooth change trend. The second adjustment unit 306 is used to adjust the timer trigger interval according to the current virtual progress value range when the task is terminated through the task end interface, so that the virtual progress smoothly transitions to 100% and then the process ends.
[0043] In one embodiment, the encapsulation definition unit 301 includes: The variable definition unit is used to encapsulate the EVirtualProgress class as the virtual progress control class, and defines a default task duration member variable m_totalInstallTime, a progress count member variable m_timeCount, and a task completion member variable m_isCompleted, which is false by default.
[0044] In one embodiment, the class configuration unit 302 includes: Define an association unit for defining a QTimer timer in the virtual progress control class and setting the initial trigger interval of the timer; And define the caculateProgressValue() slot function as the progress calculation slot function, and associate the caculateProgressValue() slot function with the trigger signal of the timer.
[0045] In one embodiment, the calculation and judgment unit 304 includes: The variable accumulation unit is used to accumulate the progress count member variable m_timeCount of the progress calculation slot function with the current trigger interval of the timer to obtain the updated progress count; The progress calculation unit is used to combine the default task duration member variable m_totalInstallTime and the progress count member variable m_timeCount to calculate the value of m_timeCount*1.0f / m_totalInstallTime*100, and use it as the current virtual progress value. Then, it determines whether the progress count is greater than or equal to the default task duration.
[0046] In one embodiment, the progress calculation unit includes: The completion judgment unit is used to determine whether the task completion member variable m_isCompleted is true if the progress count is greater than or equal to the default task duration. The first determination unit is used to determine that the task is completed when the task completion member variable m_isCompleted is true; The second determination unit is used to determine that the task has timed out and issue a timeout prompt when the task completion member variable m_isCompleted is false.
[0047] In one embodiment, the first adjustment unit 305 includes: The first interval determination unit is used to determine the interval in which the current virtual progress value is located; The first adjustment unit is used to adjust the trigger interval of the timer according to the first preset strategy if the current virtual progress value is in the range of the first range threshold. The second adjustment unit is used to adjust the trigger interval of the timer according to a second preset strategy if the current virtual progress value is in the range of the second range threshold; wherein the second range threshold is greater than the first range threshold, and the adjustment degree of the second preset strategy is greater than the adjustment degree of the first preset strategy. The third adjustment unit is used to adjust the trigger interval of the timer according to the third preset strategy if the current virtual progress value is in the interval of the third interval threshold; wherein the third interval threshold is greater than the second interval threshold, and the adjustment degree of the third preset strategy is greater than the adjustment degree of the second preset strategy.
[0048] In one embodiment, the second adjustment unit 306 includes: The second interval determination unit is used to determine the interval in which the current virtual progress value is located; The fourth adjustment unit is used to adjust the trigger interval of the timer according to the fourth preset strategy if the current virtual progress value is in the interval of the fourth interval threshold. The fifth adjustment unit is used to adjust the trigger interval of the timer according to the fifth preset strategy if the current virtual progress value is in the interval of the fifth interval threshold; wherein the fifth interval threshold is greater than the fourth interval threshold, and the adjustment degree of the fifth preset strategy is greater than the adjustment degree of the fourth preset strategy. The sixth adjustment unit is used to adjust the trigger interval of the timer according to the sixth preset strategy if the current virtual progress value is in the sixth interval threshold; wherein the sixth interval threshold is greater than the fifth interval threshold, and the adjustment degree of the sixth preset strategy is greater than the adjustment degree of the fifth preset strategy.
[0049] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0050] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0051] This invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.
[0052] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0053] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for displaying virtual progress, characterized in that, include: A virtual progress control class is encapsulated, and the core member variables of the virtual progress control class are defined; wherein, the core member variables include the default task duration, progress count, and task completion flag; Configure timers and progress calculation slot functions in the virtual progress control class, then establish the association between the timer trigger signal and the progress calculation slot function, and provide task start interface and task end interface; When a task is started through the task initiation interface, the timer is started and the progress calculation slot function is triggered according to the preset initial trigger interval; In the progress calculation slot function, the progress count is updated, and the current virtual progress value is calculated based on the progress count and the default task duration. Then, it is determined whether the progress count has reached the default task duration. If it is determined that the progress count has not reached the default task duration, the timer trigger interval is dynamically adjusted according to the current virtual progress value range to make the virtual progress show a smooth change trend. When a task is terminated through the task end interface, the timer trigger interval is adjusted according to the current virtual progress value range, so that the virtual progress smoothly transitions to 100% and then the process ends.
2. The virtual progress display method according to claim 1, characterized in that, The encapsulated virtual progress control class is defined, and its core member variables are defined, including: The EVirtualProgress class is encapsulated as the virtual progress control class, and a default task duration member variable m_totalInstallTime, a progress count member variable m_timeCount, and a task completion member variable m_isCompleted (which defaults to false) are defined.
3. The virtual progress display method according to claim 2, characterized in that, The virtual progress control class configures timers and progress calculation slot functions, establishes the association between timer trigger signals and progress calculation slot functions, and provides task start and task end interfaces, including: Define a QTimer in the virtual progress control class and set the initial trigger interval of the timer; And define the caculateProgressValue() slot function as the progress calculation slot function, and associate the caculateProgressValue() slot function with the trigger signal of the timer.
4. The virtual progress display method according to claim 2, characterized in that, In the progress calculation slot function, the progress count is updated, and the current virtual progress value is calculated based on the progress count and the default task duration. Then, it is determined whether the progress count has reached the default task duration, including: The progress count member variable m_timeCount of the progress calculation slot function is added to the current trigger interval of the timer to obtain the updated progress count; Combining the default task duration member variable m_totalInstallTime and the progress count member variable m_timeCount, calculate the value of m_timeCount*1.0f / m_totalInstallTime*100, and use it as the current virtual progress value. Then, determine whether the progress count is greater than or equal to the default task duration.
5. The virtual progress display method according to claim 4, characterized in that, The step of determining whether the progress count is greater than or equal to the default task duration includes: If the progress count is determined to be greater than or equal to the default task duration, then it is determined whether the task completion member variable m_isCompleted is true; The task is considered complete when the task completion member variable m_isCompleted is true. When the task completion member variable m_isCompleted is false, the task is determined to have timed out, and a timeout message is issued.
6. The virtual progress display method according to claim 1, characterized in that, If it is determined that the progress count has not reached the default task duration, the timer trigger interval is dynamically adjusted according to the current virtual progress value's interval to make the virtual progress show a smooth change trend, including: Determine the range in which the current virtual progress value is located; If the current virtual progress value is in the range of the first range threshold, then the trigger interval of the timer is adjusted according to the first preset strategy; If the current virtual progress value is in the range of the second range threshold, then the trigger interval of the timer is adjusted according to the second preset strategy; wherein, the second range threshold is greater than the first range threshold, and the adjustment degree of the second preset strategy is greater than the adjustment degree of the first preset strategy; If the current virtual progress value is in the third interval threshold, the trigger interval of the timer is adjusted according to the third preset strategy; wherein the third interval threshold is greater than the second interval threshold, and the adjustment degree of the third preset strategy is greater than the adjustment degree of the second preset strategy.
7. The virtual progress display method according to claim 1, characterized in that, When terminating a task through the task end interface, adjusting the timer trigger interval based on the current virtual progress value's range to smoothly transition the virtual progress to 100% and then end the process includes: Determine the range in which the current virtual progress value is located; If the current virtual progress value is in the fourth interval threshold, then the trigger interval of the timer is adjusted according to the fourth preset strategy; If the current virtual progress value is in the range of the fifth range threshold, then the trigger interval of the timer is adjusted according to the fifth preset strategy; wherein, the fifth range threshold is greater than the fourth range threshold, and the adjustment degree of the fifth preset strategy is greater than the adjustment degree of the fourth preset strategy. If the current virtual progress value is in the sixth interval threshold, the trigger interval of the timer is adjusted according to the sixth preset strategy; wherein the sixth interval threshold is greater than the fifth interval threshold, and the adjustment degree of the sixth preset strategy is greater than the adjustment degree of the fifth preset strategy.
8. A virtual progress display device, characterized in that, include: An encapsulation definition unit is used to encapsulate a virtual progress control class and define the core member variables of the virtual progress control class; wherein, the core member variables include the default task duration, progress count, and task completion flag; The class configuration unit is used to configure timers and progress calculation slot functions in the virtual progress control class, then establish the association between the timer trigger signal and the progress calculation slot function, and provide task start interface and task end interface; A start triggering unit is used to start a timer and trigger the progress calculation slot function according to the initial trigger interval when a task is started through the task start interface; The calculation and judgment unit is used to update the progress count in the progress calculation slot function, calculate the current virtual progress value based on the progress count and the default task duration, and then determine whether the progress count has reached the default task duration. The first adjustment unit is used to dynamically adjust the timer trigger interval according to the current virtual progress value interval if the progress count is determined to be less than the default task duration, so that the virtual progress shows a smooth change trend. The second adjustment unit is used to adjust the timer trigger interval according to the current virtual progress value range when the task is terminated through the task end interface, so that the virtual progress smoothly transitions to 100% and then the process ends.
9. A computer device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the virtual progress display method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the virtual progress display method as described in any one of claims 1 to 7.