Kodi Development  20.0
for Binary and Script based Add-Ons
Dialog Progress

Detailed Description

Class: kodi::gui::dialogs::CProgress

Progress dialog shown in center
The with #include <kodi/gui/dialogs/Progress.h> given class are basically used to create Kodi's progress dialog with named text fields.

Example:

#include <kodi/gui/dialogs/Progress.h>
progress->SetHeading("Test progress");
progress->SetLine(1, "line 1");
progress->SetLine(2, "line 2");
progress->SetLine(3, "line 3");
progress->SetCanCancel(true);
progress->ShowProgressBar(true);
progress->Open();
for (unsigned int i = 0; i < 100; i += 10)
{
progress->SetPercentage(i);
sleep(1);
}
delete progress;
Definition: Progress.h:53
void SetPercentage(int percentage)
Get the current progress position as percent.
Definition: Progress.h:158
void SetCanCancel(bool canCancel)
To enable and show cancel button on dialog.
Definition: Progress.h:130
void ShowProgressBar(bool onOff)
To show or hide progress bar dialog.
Definition: Progress.h:186
void Open()
To open the dialog.
Definition: Progress.h:87
void SetLine(unsigned int iLine, const std::string &line)
To set the line text field on dialog from 0 - 2.
Definition: Progress.h:116
void SetHeading(const std::string &heading)
Set the heading title of dialog.
Definition: Progress.h:101
sleep(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...

Function Documentation

◆ CProgress()

CProgress ( )
inline

Construct a new dialog.

◆ ~CProgress()

~CProgress ( )
inline

Destructor.

◆ Open()

void Open ( )
inline

To open the dialog.

◆ SetHeading()

void SetHeading ( const std::string &  heading)
inline

Set the heading title of dialog.

Parameters
[in]headingTitle string to use

◆ SetLine()

void SetLine ( unsigned int  iLine,
const std::string &  line 
)
inline

To set the line text field on dialog from 0 - 2.

Parameters
[in]iLineLine number
[in]lineText string

◆ SetCanCancel()

void SetCanCancel ( bool  canCancel)
inline

To enable and show cancel button on dialog.

Parameters
[in]canCancelif true becomes it shown

◆ IsCanceled()

bool IsCanceled ( ) const
inline

To check dialog for clicked cancel button.

Returns
True if canceled

◆ SetPercentage()

void SetPercentage ( int  percentage)
inline

Get the current progress position as percent.

Parameters
[in]percentagePosition to use from 0 to 100

◆ GetPercentage()

int GetPercentage ( ) const
inline

To set the current progress position as percent.

Returns
Current Position used from 0 to 100

◆ ShowProgressBar()

void ShowProgressBar ( bool  onOff)
inline

To show or hide progress bar dialog.

Parameters
[in]onOffIf true becomes it shown

◆ SetProgressMax()

void SetProgressMax ( int  max)
inline

Set the maximum position of progress, needed if SetProgressAdvance(...) is used.

Parameters
[in]maxBiggest usable position to use

◆ SetProgressAdvance()

void SetProgressAdvance ( int  steps = 1)
inline

To increase progress bar by defined step size until reach of maximum position.

Parameters
[in]stepsStep size to increase, default is 1

◆ Abort()

bool Abort ( )
inline

To check progress was canceled on work.

Returns
True if aborted