Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
CAddonInstallJob Class Reference

#include <AddonInstaller.h>

Inheritance diagram for CAddonInstallJob:
CFileOperationJob CProgressJob CJob

Public Member Functions

 CAddonInstallJob (const ADDON::AddonPtr &addon, const ADDON::RepositoryPtr &repo, bool isAutoUpdate)
 
bool DoWork () override
 Main workhorse function of CJob instances. More...
 
const char * GetType () const override
 Returns the current processing type in the installation job. More...
 
- Public Member Functions inherited from CFileOperationJob
 CFileOperationJob ()
 
 CFileOperationJob (FileAction action, CFileItemList &items, const std::string &strDestFile, bool displayProgress=false, int errorHeading=0, int errorLine=0)
 
bool DoWork () override
 Main workhorse function of CJob instances. More...
 
const char * GetType () const override
 Function that returns the type of job. More...
 
bool operator== (const CJob *job) const override
 
void SetFileOperation (FileAction action, CFileItemList &items, const std::string &strDestFile)
 
const std::string & GetAverageSpeed () const
 
const std::string & GetCurrentOperation () const
 
const std::string & GetCurrentFile () const
 
const CFileItemListGetItems () const
 
FileAction GetAction () const
 
int GetHeading () const
 
int GetLine () const
 
- Public Member Functions inherited from CProgressJob
 ~CProgressJob () override
 
const char * GetType () const override
 Function that returns the type of job. More...
 
bool operator== (const CJob *job) const override
 
bool ShouldCancel (unsigned int progress, unsigned int total) const override
 Function for longer jobs to report progress and check whether they have been cancelled. More...
 
bool DoModal ()
 Executes the job showing a modal progress dialog. More...
 
void SetProgressIndicators (CGUIDialogProgressBarHandle *progressBar, CGUIDialogProgress *progressDialog, bool updateProgress=true, bool updateInformation=true)
 Sets the given progress indicators to be used during execution of the job. More...
 
bool HasProgressIndicator () const
 
- Public Member Functions inherited from CJob
 CJob ()
 
virtual ~CJob ()=default
 Destructor for job objects. More...
 

Static Public Member Functions

static bool GetAddon (const std::string &addonID, ADDON::RepositoryPtr &repo, ADDON::AddonPtr &addon)
 Find the add-on and its repository for the given add-on ID. More...
 
- Static Public Member Functions inherited from CFileOperationJob
static std::string GetActionString (FileAction action)
 

Static Public Attributes

static constexpr const char * TYPE_DOWNLOAD = "DOWNLOAD"
 
static constexpr const char * TYPE_INSTALL = "INSTALL"
 

Additional Inherited Members

- Public Types inherited from CFileOperationJob
enum  FileAction {
  ActionCopy = 1 , ActionMove , ActionDelete , ActionReplace ,
  ActionCreateFolder , ActionDeleteFolder
}
 
- Public Types inherited from CJob
enum  PRIORITY {
  PRIORITY_LOW_PAUSABLE = 0 , PRIORITY_LOW , PRIORITY_NORMAL , PRIORITY_HIGH ,
  PRIORITY_DEDICATED
}
 Priority levels for jobs, specified by clients when adding jobs to the CJobManager. More...
 
- Protected Member Functions inherited from CProgressJob
 CProgressJob ()
 
 CProgressJob (CGUIDialogProgressBarHandle *progressBar)
 
bool IsModal () const
 Whether the job is being run modally or in the background. More...
 
CGUIDialogProgressBarHandleGetProgressBar () const
 Returns the progress bar indicating the progress of the job. More...
 
void SetProgressBar (CGUIDialogProgressBarHandle *progress)
 Sets the progress bar indicating the progress of the job. More...
 
CGUIDialogProgressGetProgressDialog () const
 Returns the progress dialog indicating the progress of the job. More...
 
void SetProgressDialog (CGUIDialogProgress *progressDialog)
 Sets the progress bar indicating the progress of the job. More...
 
bool GetAutoClose ()
 Whether to automatically close the progress indicator in MarkFinished(). More...
 
void SetAutoClose (bool autoClose)
 Set whether to automatically close the progress indicator in MarkFinished(). More...
 
bool GetUpdateProgress ()
 Whether to update the progress bar or not. More...
 
void SetUpdateProgress (bool updateProgress)
 Set whether to update the progress bar or not. More...
 
bool GetUpdateInformation ()
 Whether to update the progress information or not. More...
 
void SetUpdateInformation (bool updateInformation)
 Set whether to update the progress information or not. More...
 
void ShowProgressDialog () const
 Makes sure that the modal dialog is being shown. More...
 
void SetTitle (const std::string &title)
 Sets the given title as the title of the progress bar. More...
 
void SetText (const std::string &text)
 Sets the given text as the description of the progress bar. More...
 
void SetProgress (float percentage) const
 Sets the progress of the progress bar to the given value in percentage. More...
 
void SetProgress (int currentStep, int totalSteps) const
 Sets the progress of the progress bar to the given value. More...
 
void MarkFinished ()
 Marks the progress as finished by setting it to 100%. More...
 
bool IsCancelled () const
 Checks if the progress dialog has been cancelled. More...
 

Constructor & Destructor Documentation

◆ CAddonInstallJob()

CAddonInstallJob::CAddonInstallJob ( const ADDON::AddonPtr addon,
const ADDON::RepositoryPtr repo,
bool  isAutoUpdate 
)

Member Function Documentation

◆ DoWork()

bool CAddonInstallJob::DoWork ( )
overridevirtual

Main workhorse function of CJob instances.

All CJob subclasses must implement this function, performing all processing. Once this function is complete, the OnJobComplete() callback is called, and the job is then destroyed.

See also
CJobManager, IJobCallback::OnJobComplete()
Todo:
fix design flaw in file copying: We use CFileOperationJob to download the package from the internet

Implements CJob.

◆ GetAddon()

bool CAddonInstallJob::GetAddon ( const std::string &  addonID,
ADDON::RepositoryPtr repo,
ADDON::AddonPtr addon 
)
static

Find the add-on and its repository for the given add-on ID.

Parameters
addonIDID of the add-on to find
[out]repothe repository to use
[out]addonAdd-on with the given add-on ID
Returns
True if the add-on and its repository were found, false otherwise.

◆ GetType()

const char * CAddonInstallJob::GetType ( ) const
inlineoverridevirtual

Returns the current processing type in the installation job.

Returns
The current processing type as string, can be TYPE_DOWNLOAD or TYPE_INSTALL

Reimplemented from CJob.

Member Data Documentation

◆ TYPE_DOWNLOAD

constexpr const char* CAddonInstallJob::TYPE_DOWNLOAD = "DOWNLOAD"
staticconstexpr

◆ TYPE_INSTALL

constexpr const char* CAddonInstallJob::TYPE_INSTALL = "INSTALL"
staticconstexpr

The documentation for this class was generated from the following files: