Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CFileOperationJob Class Reference

#include <FileOperationJob.h>

Inheritance diagram for CFileOperationJob:
CProgressJob CJob

Public Types

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...
 

Public Member Functions

 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.
 
const char * GetType () const override
 Function that returns the type of job.
 
bool operator== (const CJob *job) const override
 
void SetFileOperation (FileAction action, const 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.
 
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.
 
bool DoModal ()
 Executes the job showing a modal progress dialog.
 
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.
 
bool HasProgressIndicator () const
 
- Public Member Functions inherited from CJob
 CJob ()
 
virtual ~CJob ()=default
 Destructor for job objects.
 

Static Public Member Functions

static std::string GetActionString (FileAction action)
 

Friends

class CFileOperation
 

Additional Inherited Members

- Protected Member Functions inherited from CProgressJob
 CProgressJob ()
 
 CProgressJob (CGUIDialogProgressBarHandle *progressBar)
 
bool IsModal () const
 Whether the job is being run modally or in the background.
 
CGUIDialogProgressBarHandleGetProgressBar () const
 Returns the progress bar indicating the progress of the job.
 
void SetProgressBar (CGUIDialogProgressBarHandle *progress)
 Sets the progress bar indicating the progress of the job.
 
CGUIDialogProgressGetProgressDialog () const
 Returns the progress dialog indicating the progress of the job.
 
void SetProgressDialog (CGUIDialogProgress *progressDialog)
 Sets the progress bar indicating the progress of the job.
 
bool GetAutoClose ()
 Whether to automatically close the progress indicator in MarkFinished().
 
void SetAutoClose (bool autoClose)
 Set whether to automatically close the progress indicator in MarkFinished().
 
bool GetUpdateProgress ()
 Whether to update the progress bar or not.
 
void SetUpdateProgress (bool updateProgress)
 Set whether to update the progress bar or not.
 
bool GetUpdateInformation ()
 Whether to update the progress information or not.
 
void SetUpdateInformation (bool updateInformation)
 Set whether to update the progress information or not.
 
void ShowProgressDialog () const
 Makes sure that the modal dialog is being shown.
 
void SetTitle (const std::string &title)
 Sets the given title as the title of the progress bar.
 
void SetText (const std::string &text)
 Sets the given text as the description of the progress bar.
 
void SetProgress (float percentage) const
 Sets the progress of the progress bar to the given value in percentage.
 
void SetProgress (int currentStep, int totalSteps) const
 Sets the progress of the progress bar to the given value.
 
void MarkFinished ()
 Marks the progress as finished by setting it to 100%.
 
bool IsCancelled () const
 Checks if the progress dialog has been cancelled.
 

Member Enumeration Documentation

◆ FileAction

Enumerator
ActionCopy 
ActionMove 
ActionDelete 
ActionReplace 

Copy, emptying any existing destination directories first.

ActionCreateFolder 
ActionDeleteFolder 

Constructor & Destructor Documentation

◆ CFileOperationJob() [1/2]

CFileOperationJob::CFileOperationJob ( )

◆ CFileOperationJob() [2/2]

CFileOperationJob::CFileOperationJob ( FileAction action,
CFileItemList & items,
const std::string & strDestFile,
bool displayProgress = false,
int errorHeading = 0,
int errorLine = 0 )

Member Function Documentation

◆ DoWork()

bool CFileOperationJob::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()

Implements CJob.

◆ GetAction()

FileAction CFileOperationJob::GetAction ( ) const
inline

◆ GetActionString()

std::string CFileOperationJob::GetActionString ( FileAction action)
static

◆ GetAverageSpeed()

const std::string & CFileOperationJob::GetAverageSpeed ( ) const
inline

◆ GetCurrentFile()

const std::string & CFileOperationJob::GetCurrentFile ( ) const
inline

◆ GetCurrentOperation()

const std::string & CFileOperationJob::GetCurrentOperation ( ) const
inline

◆ GetHeading()

int CFileOperationJob::GetHeading ( ) const
inline

◆ GetItems()

const CFileItemList & CFileOperationJob::GetItems ( ) const
inline

◆ GetLine()

int CFileOperationJob::GetLine ( ) const
inline

◆ GetType()

const char * CFileOperationJob::GetType ( ) const
inlineoverridevirtual

Function that returns the type of job.

CJob subclasses may optionally implement this function to specify the type of job. This is useful for the CJobManager::AddLIFOJob() routine, which preempts similar jobs with the new job.

Returns
a unique character string describing the job.
See also
CJobManager

Reimplemented from CJob.

◆ operator==()

bool CFileOperationJob::operator== ( const CJob * job) const
overridevirtual

Reimplemented from CJob.

◆ SetFileOperation()

void CFileOperationJob::SetFileOperation ( FileAction action,
const CFileItemList & items,
const std::string & strDestFile )

Friends And Related Symbol Documentation

◆ CFileOperation

friend class CFileOperation
friend

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