Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
progress_info.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UTILS_PROGRESS_INFO_H__
11#define __UTILS_PROGRESS_INFO_H__
12
13#include <stdbool.h>
14
21typedef enum ProgressStatus
22{
23 PROGRESS_STATUS_PENDING_START,
24 PROGRESS_STATUS_PENDING_CANCELLATION,
25 PROGRESS_STATUS_RUNNING,
26 PROGRESS_STATUS_COMPLETED,
27} ProgressStatus;
28
29typedef enum ProgressCompletionType
30{
31 PROGRESS_COMPLETED_CANCELLED,
32 PROGRESS_COMPLETED_HAS_WARNING,
33 PROGRESS_COMPLETED_HAS_ERROR,
34 PROGRESS_COMPLETED_SUCCESS,
35} ProgressCompletionType;
36
37typedef struct ProgressInfo ProgressInfo;
38
39ProgressInfo *
40progress_info_new (void);
41
42ProgressStatus
43progress_info_get_status (ProgressInfo * self);
44
45ProgressCompletionType
46progress_info_get_completion_type (ProgressInfo * self);
47
51void
53
57void
59 ProgressInfo * self,
60 ProgressCompletionType type,
61 const char * msg);
62
66char *
67progress_info_get_message (ProgressInfo * self);
68
72void
73progress_info_get_progress (ProgressInfo * self, double * progress, char ** str);
74
78void
80 ProgressInfo * self,
81 double progress,
82 const char * msg);
83
84bool
85progress_info_pending_cancellation (ProgressInfo * self);
86
87void
88progress_info_free (ProgressInfo * self);
89
94#endif
void progress_info_update_progress(ProgressInfo *self, double progress, const char *msg)
To be called by the task itself.
void progress_info_mark_completed(ProgressInfo *self, ProgressCompletionType type, const char *msg)
To be called by the task itself.
char * progress_info_get_message(ProgressInfo *self)
Returns a newly allocated string.
void progress_info_request_cancellation(ProgressInfo *self)
To be called by the task caller.
void progress_info_get_progress(ProgressInfo *self, double *progress, char **str)
To be called by the task caller.