Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
Batch Class Reference

#include <Batch.h>

Inheritance diagram for Batch:
Inheritance graph

Public Types

enum  EndTask {
  DO_NOTHING = 0, CLOSE_PTBATCHERGUI = 1, SHUTDOWN = 2, SUSPEND = 3,
  HIBERNATE = 4
}
 

Public Member Functions

 Batch (wxFrame *parent)
 Main constructor. More...
 
 ~Batch ()
 destructor More...
 
void AddAppToBatch (wxString app)
 Adds an application entry in the batch list. More...
 
void AddProjectToBatch (wxString projectFile, wxString outputFile=wxEmptyString, wxString userDefinedSequence=wxEmptyString, Project::Target target=Project::STITCHING)
 Adds a project entry in the batch list. More...
 
bool AllDone ()
 Returns true if there are no more projects pending execution. More...
 
void AppendBatchFile (wxString file)
 Appends projects from file to batch list. More...
 
void CancelBatch ()
 Stops batch run, failing projects in progress. More...
 
void CancelProject (int index)
 Cancels project at index in batch, failing it. More...
 
void ChangePrefix (int index, wxString newPrefix)
 Changes output prefix for project at index. More...
 
void ChangeUserDefined (int index, wxString newUserDefined)
 Changes user defined sequence for project at index. More...
 
int ClearBatch ()
 Clears batch list and returns 0 if succesful. More...
 
bool CompareProjectsInLists (int stitchListIndex, int batchListIndex)
 Compares two project at indexes in both lists and returns true if they have identical project ids. More...
 
int GetFirstAvailable ()
 Returns index of first waiting project in batch. More...
 
int GetIndex (int id)
 Returns index of project with selected id. More...
 
ProjectGetProject (int index)
 Returns project at index. More...
 
int GetProjectCount ()
 Returns number of projects in batch list. More...
 
int GetProjectCountByPath (wxString path)
 Returns number of projects in batch list with the input file path. More...
 
int GetRunningCount ()
 Returns number of projects currently in progress. More...
 
Project::Status GetStatus (int index)
 Returns current status of project at index. More...
 
bool IsRunning ()
 return true, if batch is running More...
 
bool IsPaused ()
 Returns true if batch execution is currently paused. More...
 
int LoadBatchFile (wxString file)
 Clears current batch list and loads projects from batch file. More...
 
int LoadTemp ()
 Loads temporary batch file. More...
 
bool NoErrors ()
 Returns true if there are no failed projects in batch. More...
 
void OnProcessTerminate (wxProcessEvent &event)
 Called internally when all running processes have completed and need to be removed from running list. More...
 
bool OnStitch (wxString scriptFile, wxString outname, wxString userDefinedOutput, int id)
 Called to start stitch of project with input scriptFile. More...
 
bool OnDetect (wxString scriptFile, wxString userDefinedAssistant, int id)
 called to start detecting More...
 
void PauseBatch ()
 Pauses and continues batch execution. More...
 
void RemoveProject (int id)
 Removes project with id from batch list. More...
 
void RemoveProjectAtIndex (int selIndex)
 Removes project at index from batch list. More...
 
void RunBatch ()
 Starts batch execution. More...
 
void RunNextInBatch ()
 Starts execution of next waiting project in batch. More...
 
void SaveBatchFile (wxString file)
 Saves batch list to file. More...
 
wxString GetBatchFilename ()
 returns the filename of the default queue file More...
 
void SaveTemp ()
 Saves batch list to temporary file. More...
 
void SetStatus (int index, Project::Status status)
 Used internally to set status of selected project. More...
 
void SwapProject (int index)
 Swaps position in batch of project at index with project at index+1. More...
 
void ShowOutput (bool isVisible=true)
 Set visibility of all running projects. More...
 
size_t GetFailedProjectsCount ()
 returns number of failed projects More...
 
wxString GetFailedProjectName (unsigned int i)
 returns project file name of failed project with index i More...
 
wxString GetFailedProjectLog (unsigned int i)
 returns log file name of failed project with index i More...
 

Public Attributes

bool deleteFiles
 
EndTask atEnd
 
bool overwrite
 
bool verbose
 
bool autostitch
 
bool autoremove
 
bool saveLog
 

Private Attributes

wxConfigBase * m_config
 
ProjectArray m_projList
 
FrameArray m_stitchFrames
 
bool m_cancelled
 
bool m_paused
 
bool m_running
 
bool m_clearedInProgress
 
std::vector< FailedProjectm_failedProjects
 

Detailed Description

Definition at line 48 of file Batch.h.

Member Enumeration Documentation

Enumerator
DO_NOTHING 
CLOSE_PTBATCHERGUI 
SHUTDOWN 
SUSPEND 
HIBERNATE 

Definition at line 51 of file Batch.h.

Constructor & Destructor Documentation

Batch::Batch ( wxFrame *  parent)
explicit

Main constructor.

Definition at line 57 of file Batch.cpp.

References atEnd, autoremove, autostitch, deleteFiles, DO_NOTHING, m_cancelled, m_clearedInProgress, m_paused, m_running, overwrite, saveLog, and verbose.

Batch::~Batch ( )

destructor

Definition at line 76 of file Batch.cpp.

Member Function Documentation

void Batch::AddAppToBatch ( wxString  app)

Adds an application entry in the batch list.

Definition at line 86 of file Batch.cpp.

References m_projList.

Referenced by AppendBatchFile(), and BatchFrame::OnButtonAddCommand().

void Batch::AddProjectToBatch ( wxString  projectFile,
wxString  outputFile = wxEmptyString,
wxString  userDefinedSequence = wxEmptyString,
Project::Target  target = Project::STITCHING 
)

Adds a project entry in the batch list.

Definition at line 92 of file Batch.cpp.

References Project::DETECTING, and m_projList.

Referenced by BatchFrame::AddArrayToList(), BatchFrame::AddDirToList(), BatchFrame::AddToList(), AppendBatchFile(), and OnProcessTerminate().

bool Batch::AllDone ( )

Returns true if there are no more projects pending execution.

Definition at line 112 of file Batch.cpp.

References m_projList, Project::PAUSED, Project::RUNNING, and Project::WAITING.

Referenced by OnProcessTerminate(), and RunNextInBatch().

void Batch::AppendBatchFile ( wxString  file)
void Batch::CancelBatch ( )

Stops batch run, failing projects in progress.

Definition at line 196 of file Batch.cpp.

References CancelProject(), GetRunningCount(), m_cancelled, and m_running.

Referenced by ClearBatch(), and BatchFrame::OnButtonCancel().

void Batch::CancelProject ( int  index)

Cancels project at index in batch, failing it.

Definition at line 212 of file Batch.cpp.

References GetRunningCount(), m_paused, m_running, and m_stitchFrames.

Referenced by CancelBatch(), and BatchFrame::OnButtonSkip().

void Batch::ChangePrefix ( int  index,
wxString  newPrefix 
)

Changes output prefix for project at index.

Definition at line 225 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::ChangePrefix().

void Batch::ChangeUserDefined ( int  index,
wxString  newUserDefined 
)

Changes user defined sequence for project at index.

Definition at line 230 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::ChangeUserDefined(), and BatchFrame::OnButtonChangeUserDefinedSequence().

int Batch::ClearBatch ( )

Clears batch list and returns 0 if succesful.

Definition at line 235 of file Batch.cpp.

References CancelBatch(), Project::idGenerator, m_clearedInProgress, m_projList, and m_stitchFrames.

Referenced by LoadBatchFile(), BatchFrame::OnButtonClear(), and BatchFrame::OnClose().

bool Batch::CompareProjectsInLists ( int  stitchListIndex,
int  batchListIndex 
)

Compares two project at indexes in both lists and returns true if they have identical project ids.

Definition at line 269 of file Batch.cpp.

References m_projList, and m_stitchFrames.

Referenced by BatchFrame::OnButtonSkip().

wxString Batch::GetBatchFilename ( )

returns the filename of the default queue file

Definition at line 908 of file Batch.cpp.

References hugin_utils::GetUserAppDataDir().

Referenced by LoadTemp(), and SaveTemp().

wxString Batch::GetFailedProjectLog ( unsigned int  i)

returns log file name of failed project with index i

Definition at line 963 of file Batch.cpp.

References m_failedProjects.

Referenced by FailedProjectsDialog::OnSelectProject().

wxString Batch::GetFailedProjectName ( unsigned int  i)

returns project file name of failed project with index i

Definition at line 951 of file Batch.cpp.

References m_failedProjects.

size_t Batch::GetFailedProjectsCount ( )
inline

returns number of failed projects

Definition at line 147 of file Batch.h.

References m_failedProjects.

Referenced by BatchFrame::OnBatchFailed().

int Batch::GetFirstAvailable ( )

Returns index of first waiting project in batch.

Definition at line 274 of file Batch.cpp.

References m_projList, and Project::WAITING.

Referenced by RunNextInBatch().

int Batch::GetIndex ( int  id)

Returns index of project with selected id.

Definition at line 299 of file Batch.cpp.

References m_projList.

Referenced by OnProcessTerminate(), and RemoveProject().

Project * Batch::GetProject ( int  index)
int Batch::GetProjectCount ( )
int Batch::GetProjectCountByPath ( wxString  path)

Returns number of projects in batch list with the input file path.

Definition at line 321 of file Batch.cpp.

References m_projList.

int Batch::GetRunningCount ( )
Project::Status Batch::GetStatus ( int  index)
bool Batch::IsPaused ( )

Returns true if batch execution is currently paused.

Definition at line 357 of file Batch.cpp.

References m_paused.

Referenced by BatchFrame::IsPaused(), BatchFrame::OnButtonPause(), BatchFrame::OnButtonRunBatch(), BatchFrame::UpdateTaskBarProgressBar(), and BatchFrame::UpdateTrayIcon().

bool Batch::IsRunning ( )

return true, if batch is running

Definition at line 352 of file Batch.cpp.

References m_running.

Referenced by BatchFrame::IsRunning(), and BatchFrame::UpdateTrayIcon().

int Batch::LoadBatchFile ( wxString  file)

Clears current batch list and loads projects from batch file.

Definition at line 362 of file Batch.cpp.

References AppendBatchFile(), and ClearBatch().

Referenced by BatchFrame::OnButtonOpenBatch().

int Batch::LoadTemp ( )

Loads temporary batch file.

Definition at line 382 of file Batch.cpp.

References AppendBatchFile(), hugin_utils::FileExists(), and GetBatchFilename().

bool Batch::NoErrors ( )

Returns true if there are no failed projects in batch.

Definition at line 393 of file Batch.cpp.

References Project::FAILED, and m_projList.

Referenced by BatchFrame::OnButtonRemoveComplete(), and OnProcessTerminate().

bool Batch::OnDetect ( wxString  scriptFile,
wxString  userDefinedAssistant,
int  id 
)

called to start detecting

Definition at line 685 of file Batch.cpp.

References RunStitchFrame::DetectProject(), m_stitchFrames, RunStitchFrame::SetProjectId(), and verbose.

Referenced by RunNextInBatch().

void Batch::OnProcessTerminate ( wxProcessEvent &  event)
bool Batch::OnStitch ( wxString  scriptFile,
wxString  outname,
wxString  userDefinedOutput,
int  id 
)

Called to start stitch of project with input scriptFile.

Definition at line 602 of file Batch.cpp.

References m_stitchFrames, RunStitchFrame::m_stitchPanel, overwrite, RunStitchPanel::SetOverwrite(), RunStitchFrame::SetProjectId(), RunStitchFrame::StitchProject(), and verbose.

Referenced by RunNextInBatch().

void Batch::PauseBatch ( )

Pauses and continues batch execution.

Definition at line 713 of file Batch.cpp.

References GetRunningCount(), m_paused, m_projList, m_stitchFrames, Project::PAUSED, and Project::RUNNING.

Referenced by BatchFrame::OnButtonPause().

void Batch::RemoveProject ( int  id)

Removes project with id from batch list.

Definition at line 747 of file Batch.cpp.

References GetIndex(), and RemoveProjectAtIndex().

void Batch::RemoveProjectAtIndex ( int  selIndex)

Removes project at index from batch list.

Definition at line 759 of file Batch.cpp.

References deleteFiles, Project::FINISHED, Project::idGenerator, and m_projList.

Referenced by BatchFrame::OnButtonRemoveComplete(), BatchFrame::OnButtonRemoveFromList(), OnProcessTerminate(), and RemoveProject().

void Batch::RunBatch ( )

Starts batch execution.

Definition at line 782 of file Batch.cpp.

References m_failedProjects, m_running, and RunNextInBatch().

Referenced by BatchFrame::RunBatch().

void Batch::RunNextInBatch ( )
void Batch::SaveBatchFile ( wxString  file)

Saves batch list to file.

Definition at line 871 of file Batch.cpp.

References Project::DETECTING, Project::idGenerator, m_projList, and Project::STITCHING.

Referenced by BatchFrame::OnButtonSaveBatch(), and SaveTemp().

void Batch::SaveTemp ( )
void Batch::SetStatus ( int  index,
Project::Status  status 
)

Used internally to set status of selected project.

Definition at line 925 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::OnButtonReset(), BatchFrame::OnButtonResetAll(), BatchFrame::OnButtonSkip(), and BatchFrame::OnUpdateListBox().

void Batch::ShowOutput ( bool  isVisible = true)

Set visibility of all running projects.

Parameters
isVisibleIf true display the project output, otherwise hide it.

Definition at line 943 of file Batch.cpp.

References m_stitchFrames.

Referenced by BatchFrame::OnCheckVerbose(), BatchFrame::OnMinimize(), and BatchFrame::UpdateBatchVerboseStatus().

void Batch::SwapProject ( int  index)

Swaps position in batch of project at index with project at index+1.

Definition at line 937 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::SwapProject().

Member Data Documentation

EndTask Batch::atEnd
bool Batch::autoremove
bool Batch::autostitch
bool Batch::deleteFiles

Definition at line 59 of file Batch.h.

Referenced by Batch(), and RemoveProjectAtIndex().

bool Batch::m_cancelled
private

Definition at line 165 of file Batch.h.

Referenced by Batch(), CancelBatch(), and OnProcessTerminate().

bool Batch::m_clearedInProgress
private

Definition at line 168 of file Batch.h.

Referenced by Batch(), ClearBatch(), and OnProcessTerminate().

wxConfigBase* Batch::m_config
private

Definition at line 158 of file Batch.h.

std::vector<FailedProject> Batch::m_failedProjects
private
bool Batch::m_paused
private

Definition at line 166 of file Batch.h.

Referenced by Batch(), CancelProject(), IsPaused(), OnProcessTerminate(), and PauseBatch().

ProjectArray Batch::m_projList
private
bool Batch::m_running
private
FrameArray Batch::m_stitchFrames
private
bool Batch::overwrite
bool Batch::saveLog
bool Batch::verbose

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