28#include "wx/msw/wrapwin.h"
31#include <wx/stdpaths.h>
35#pragma comment(lib, "PowrProf.lib")
116 if (wxFileName::FileExists(file))
136 const long id =
batchFile.ReadLong(
"Id", 1);
138 const bool skip =
batchFile.ReadBool(
"Skip",
false);
149 if (type.CmpNoCase(
"Stitching") == 0)
156 if (type.CmpNoCase(
"Detecting") == 0)
200 wxCommandEvent
event;
420 while(
logFile.FileExists() &&
i<1000)
422 logFile.SetName(wxString::Format(
"%s_%d",name.c_str(),
i));
434 if (
event.GetExitCode() != 0 ||
event.GetTimestamp()==-1)
465 GetParent()->GetEventHandler()->AddPendingEvent(e);
483 e.SetString(
_(
"Batch successfully completed."));
486 GetParent()->GetEventHandler()->AddPendingEvent(e);
496 GetParent()->GetEventHandler()->AddPendingEvent(e);
513 wxProgressDialog
progress(
_(
"Initializing shutdown..."),
_(
"Shutting down..."), 49,
this,
519 while (
progress.Update(
i,
_(
"Shutting down..."), &skip))
593 _(
"Specify project file"),
595 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
601 config->Write(
"/actualPath",
dlg.GetDirectory());
630 if (
ext.CmpNoCase(
"jpg") == 0 ||
ext.CmpNoCase(
"jpeg") == 0 ||
631 ext.CmpNoCase(
"tif") == 0 ||
ext.CmpNoCase(
"tiff") == 0 ||
632 ext.CmpNoCase(
"png") == 0 ||
ext.CmpNoCase(
"exr") == 0 ||
633 ext.CmpNoCase(
"pnm") == 0 ||
ext.CmpNoCase(
"hdr") == 0)
648 stitchFrame->SetTitle(wxString::Format(
_(
"%s - Stitching"), basename.GetName().c_str()));
680 stitchFrame->SetTitle(wxString::Format(
_(
"%s - Assistant"), basename.GetName().c_str()));
749 if(file.FileExists())
809 if (!
m_projList.Item(
i).userDefindSequence.empty())
812 if (!wxFileName::FileExists(
m_projList.Item(
i).userDefindSequence))
824 e.SetString(wxString::Format(
_(
"Now stitching: %s"),
m_projList.Item(
i).path.c_str()));
825 GetParent()->GetEventHandler()->AddPendingEvent(e);
831 e.SetString(wxString::Format(
_(
"Now detecting: %s"),
m_projList.Item(
i).path.c_str()));
832 GetParent()->GetEventHandler()->AddPendingEvent(e);
860 batchFile.SetPath(wxString::Format(
"/Project_%u",
i + 1));
872 if (!
m_projList.Item(
i).userDefindSequence.IsEmpty())
895 userDataDir = wxStandardPaths::Get().GetUserConfigDir();
wxDEFINE_EVENT(EVT_BATCH_FAILED, wxCommandEvent)
Batch processor for Hugin.
void RemoveProject(int id)
Removes project with id from batch list.
int ClearBatch()
Clears batch list and returns 0 if succesful.
void RunBatch()
Starts batch execution.
void ChangeUserDefined(int index, wxString newUserDefined)
Changes user defined sequence for project at index.
int GetRunningCount()
Returns number of projects currently in progress.
void SaveBatchFile(wxString file)
Saves batch list to file.
std::vector< FailedProject > m_failedProjects
void RemoveProjectAtIndex(int selIndex)
Removes project at index from batch list.
bool CompareProjectsInLists(int stitchListIndex, int batchListIndex)
Compares two project at indexes in both lists and returns true if they have identical project ids.
wxString GetFailedProjectLog(unsigned int i)
returns log file name of failed project with index i
bool AllDone()
Returns true if there are no more projects pending execution.
void AddProjectToBatch(wxString projectFile, wxString outputFile=wxEmptyString, wxString userDefinedSequence=wxEmptyString, Project::Target target=Project::STITCHING)
Adds a project entry in the batch list.
bool IsPaused()
Returns true if batch execution is currently paused.
void OnProcessTerminate(wxProcessEvent &event)
Called internally when all running processes have completed and need to be removed from running list.
void PauseBatch()
Pauses and continues batch execution.
void AddAppToBatch(wxString app)
Adds an application entry in the batch list.
Project * GetProject(int index)
Returns project at index.
bool IsRunning()
return true, if batch is running
wxString GetBatchFilename()
returns the filename of the default queue file
Batch(wxFrame *parent)
Main constructor.
Project::Status GetStatus(int index)
Returns current status of project at index.
wxPowerResourceBlocker * m_resBlocker
bool OnDetect(wxString scriptFile, wxString userDefinedAssistant, int id)
called to start detecting
void ChangePrefix(int index, wxString newPrefix)
Changes output prefix for project at index.
int GetFirstAvailable()
Returns index of first waiting project in batch.
void RunNextInBatch()
Starts execution of next waiting project in batch.
void CancelProject(int index)
Cancels project at index in batch, failing it.
FrameArray m_stitchFrames
bool OnStitch(wxString scriptFile, wxString outname, wxString userDefinedOutput, int id)
Called to start stitch of project with input scriptFile.
void SwapProject(int index)
Swaps position in batch of project at index with project at index+1.
void SetStatus(int index, Project::Status status)
Used internally to set status of selected project.
bool NoErrors()
Returns true if there are no failed projects in batch.
int LoadBatchFile(wxString file)
Clears current batch list and loads projects from batch file.
void SaveTemp()
Saves batch list to temporary file.
void AppendBatchFile(wxString file)
Appends projects from file to batch list.
wxString GetFailedProjectName(unsigned int i)
returns project file name of failed project with index i
int GetProjectCountByPath(wxString path)
Returns number of projects in batch list with the input file path.
int GetIndex(int id)
Returns index of project with selected id.
int LoadTemp()
Loads temporary batch file.
int GetProjectCount()
Returns number of projects in batch list.
void ShowOutput(bool isVisible=true)
Set visibility of all running projects.
void CancelBatch()
Stops batch run, failing projects in progress.
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.