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 "RunStitchFrame.h"
00037 
00038 #ifndef FRAMEARRAY
00039 #define FRAMEARRAY
00040 WX_DEFINE_ARRAY_PTR(RunStitchFrame*,FrameArray);
00041 #endif
00042 
00043 using namespace std;
00044 
00045 struct FailedProject
00046 {
00047     wxString project;
00048     wxString logfile;
00049 };
00050 
00051 class Batch : public wxFrame
00052 {
00053 public:
00054     bool parallel;
00055     bool deleteFiles;
00056     bool shutdown;
00057     bool overwrite;
00058     bool verbose;
00059     bool autostitch;
00060     bool autoremove;
00061     bool saveLog;
00062 
00064     Batch(wxFrame* parent, wxString path);
00065 
00067     void  AddAppToBatch(wxString app);
00069     void  AddProjectToBatch(wxString projectFile, wxString outputFile = _T(""), Project::Target target=Project::STITCHING);
00071     bool  AllDone();
00073     void  AppendBatchFile(wxString file);
00075     void  CancelBatch();
00077     void  CancelProject(int index);
00079     void  ChangePrefix(int index, wxString newPrefix);
00081     int   ClearBatch();
00083     bool  CompareProjectsInLists(int stitchListIndex, int batchListIndex);
00085     int   GetFirstAvailable();
00087     int   GetIndex(int id);
00089     Project* GetProject(int index);
00091     int   GetProjectCount();
00093     int   GetProjectCountByPath(wxString path);
00095     int   GetRunningCount();
00097     Project::Status GetStatus(int index);
00099     bool IsRunning();
00101     bool  IsPaused();
00103     const wxString GetLastFile()
00104     {
00105         return m_lastFile;
00106     };
00107     wxDateTime GetLastFileDate()
00108     {
00109         return m_lastmod;
00110     };
00112     void  ListBatch();
00114     int  LoadBatchFile(wxString file);
00116     int   LoadTemp();
00118     bool  NoErrors();
00120     void  OnProcessTerminate(wxProcessEvent& event);
00122     bool  OnStitch(wxString scriptFile, wxString outname, int id);
00124     bool OnDetect(wxString scriptFile, int id);
00126     void  PauseBatch();
00128     void  RemoveProject(int id);
00130     void  RemoveProjectAtIndex(int selIndex);
00132     void  RunBatch();
00134     void  RunNextInBatch();
00136     void  SaveBatchFile(wxString file);
00138     void  SaveTemp();
00140     void  SetStatus(int index,Project::Status status);
00142     void  SwapProject(int index);
00146     void ShowOutput(bool isVisible=true);
00148     size_t GetFailedProjectsCount()
00149     {
00150         return m_failedProjects.size();
00151     };
00153     wxString GetFailedProjectName(unsigned int i);
00155     wxString GetFailedProjectLog(unsigned int i);
00156 
00157 private:
00158     // environment config objects
00159     wxConfigBase* m_config;
00160     //internal list of projects in batch
00161     ProjectArray  m_projList;
00162     //list of projects in progress
00163     FrameArray    m_stitchFrames;
00164     //last saved ptbt file
00165     wxString m_lastFile;
00166     wxDateTime m_lastmod;
00167 
00168     //batch state flags
00169     bool m_cancelled;
00170     bool m_paused;
00171     bool m_running;
00172     bool m_clearedInProgress;
00173 
00174     //vector, which stores the failed projects and filename of saved logfile
00175     std::vector<FailedProject> m_failedProjects;
00176 
00177     //external program config
00178     PTPrograms progs;
00179     AssistantPrograms progsAss;
00180 
00181     DECLARE_EVENT_TABLE()
00182 };
00183 
00184 #if _WINDOWS && defined Hugin_shared
00185 DECLARE_LOCAL_EVENT_TYPE(EVT_BATCH_FAILED,-1)
00186 DECLARE_LOCAL_EVENT_TYPE(EVT_INFORMATION,-1)
00187 DECLARE_LOCAL_EVENT_TYPE(EVT_UPDATE_PARENT, -1)
00188 #else
00189 DECLARE_EVENT_TYPE(EVT_BATCH_FAILED,-1)
00190 DECLARE_EVENT_TYPE(EVT_INFORMATION,-1)
00191 DECLARE_EVENT_TYPE(EVT_UPDATE_PARENT, -1)
00192 #endif
00193 
00194 #endif //BATCH_H

Generated on Sat Aug 30 01:25:37 2014 for Hugintrunk by  doxygen 1.3.9.1