Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
hugin1/ptbatcher/Batch.h
Go to the documentation of this file.00001 // -*- c-basic-offset: 4 -*- 00002 00027 #ifndef BATCH_H 00028 #define BATCH_H 00029 00030 #include <string> 00031 #include "ProjectArray.h" 00032 #include <wx/dir.h> 00033 #ifndef __WXMSW__ 00034 #include <sys/wait.h> 00035 #endif 00036 //#include <wx/wfstream.h> 00037 //#include <wx/event.h> 00038 #include "RunStitchFrame.h" 00039 //#include <hugin_config.h> 00040 00041 #ifndef FRAMEARRAY 00042 #define FRAMEARRAY 00043 WX_DEFINE_ARRAY_PTR(RunStitchFrame*,FrameArray); 00044 #endif 00045 00046 using namespace std; 00047 00048 class Batch : public wxFrame 00049 { 00050 public: 00051 bool parallel; 00052 bool deleteFiles; 00053 bool shutdown; 00054 bool overwrite; 00055 bool verbose; 00056 bool gui; 00057 00058 //Main constructor 00059 Batch(wxFrame* parent, wxString path, bool bgui); 00060 00061 //Adds an application entry in the batch list 00062 void AddAppToBatch(wxString app); 00063 //Adds a project entry in the batch list 00064 void AddProjectToBatch(wxString projectFile, wxString outputFile = _T("")); 00065 //Returns true if there are no more projects pending execution 00066 bool AllDone(); 00067 //Appends projects from file to batch list 00068 void AppendBatchFile(wxString file); 00069 //Stops batch run, failing projects in progress 00070 void CancelBatch(); 00071 //Cancels project at index in batch, failing it 00072 void CancelProject(int index); 00073 //Changes output prefix for project at index 00074 void ChangePrefix(int index, wxString newPrefix); 00075 //Called internally in console mode. Waits for running projects to complete and then runs next in batch 00076 bool CheckProjectExistence(); 00077 //Clears batch list and returns 0 if succesful 00078 int ClearBatch(); 00079 //Compares two project at indexes in both lists and returns true if they have identical project ids 00080 bool CompareProjectsInLists(int stitchListIndex, int batchListIndex); 00081 //Returns index of first waiting project in batch 00082 int GetFirstAvailable(); 00083 //Returns index of project with selected id 00084 int GetIndex(int id); 00085 //Returns project at index 00086 Project* GetProject(int index); 00087 //Returns number of projects in batch list 00088 int GetProjectCount(); 00089 //Returns number of projects in batch list with the input file path 00090 int GetProjectCountByPath(wxString path); 00091 //Returns number of projects currently in progress 00092 int GetRunningCount(); 00093 //Returns current status of project at index 00094 Project::Status GetStatus(int index); 00095 //Returns true if batch execution is currently paused 00096 bool IsPaused(); 00097 //Returns last saved batch file 00098 const wxString GetLastFile() { return m_lastFile; }; 00099 wxDateTime GetLastFileDate() { return m_lastmod; }; 00100 //Used in console mode. Prints out all projects and their statuses to the console 00101 void ListBatch(); 00102 //Clears current batch list and loads projects from batch file 00103 int LoadBatchFile(wxString file); 00104 //Loads temporary batch file 00105 int LoadTemp(); 00106 //Returns true if there are no failed projects in batch 00107 bool NoErrors(); 00108 //Called internally when all running processes have completed and need to be removed from running list 00109 void OnProcessTerminate(wxProcessEvent & event); 00110 //Called to start stitch of project with input scriptFile 00111 bool OnStitch(wxString scriptFile, wxString outname, int id); 00112 //Pauses and continues batch execution 00113 void PauseBatch(); 00114 //Removes project with id from batch list 00115 void RemoveProject(int id); 00116 //Removes project at index from batch list 00117 void RemoveProjectAtIndex(int selIndex); 00118 //Starts batch execution 00119 void RunBatch(); 00120 //Starts execution of next waiting project in batch 00121 void RunNextInBatch(); 00122 //Saves batch list to file 00123 void SaveBatchFile(wxString file); 00124 //Saves batch list to temporary file 00125 void SaveTemp(); 00126 //Used internally to set status of selected project 00127 void SetStatus(int index,Project::Status status); 00128 //Swaps position in batch of project at index with project at index+1 00129 void SwapProject(int index); 00133 void ShowOutput(bool isVisible=true); 00134 00135 private: 00136 //environment config objects 00137 wxConfigBase* m_config; 00138 //internal list of projects in batch 00139 ProjectArray m_projList; 00140 //list of projects in progress 00141 FrameArray m_stitchFrames; 00142 //last saved ptbt file 00143 wxString m_lastFile; 00144 wxDateTime m_lastmod; 00145 00146 //batch state flags 00147 bool m_cancelled; 00148 bool m_paused; 00149 bool m_running; 00150 bool m_clearedInProgress; 00151 00152 //external program config 00153 PTPrograms progs; 00154 00155 DECLARE_EVENT_TABLE() 00156 }; 00157 00158 #endif //BATCH_H
1.3.9.1