29 #include <wx/stdpaths.h>
30 #include <wx/wfstream.h>
33 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
41 wxXmlResource::Get()->LoadDialog(
this, parent,
"change_user_defined_dialog");
43 m_radio_default = XRCCTRL(*
this,
"radio_default_sequence", wxRadioButton);
67 if (userDefinedSequence.IsEmpty())
74 if (index == wxNOT_FOUND)
113 const long id = e.GetSelection();
123 wxFileDialog userOutputDlg(
this, (
m_isAssistantUserDefined ? _(
"Select user defined assistant") : _(
"Select user defined output")),
125 wxFD_OPEN | wxFD_FILE_MUST_EXIST, wxDefaultPosition);
126 if (userOutputDlg.ShowModal() == wxID_OK)
138 if (filename.IsEmpty())
140 hugin_utils::HuginMessageBox(_(
"Please provide a filename to the user defined sequence."), _(
"PTBatcherGUI"), wxOK | wxOK_DEFAULT | wxICON_WARNING,
this);
145 hugin_utils::HuginMessageBox(wxString::Format(_(
"The file \"%s\" does not exists.\nPlease provide an existing file to the user defined sequence."), filename),
146 _(
"PTBatcherGUI"), wxOK | wxOK_DEFAULT | wxICON_WARNING,
this);
157 return wxEmptyString;
167 return wxEmptyString;
176 #if defined __WXMSW__
177 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
178 exePath.RemoveLastDir();
179 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
180 return huginRoot +
"share\\hugin\\data\\";
181 #elif defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
184 wxString thePath = MacGetPathToBundledResourceFile(CFSTR(
"xrc"));
185 if (thePath.IsEmpty())
188 return wxEmptyString;
190 return thePath +
"/";
192 #elif defined UNIX_SELF_CONTAINED_BUNDLE
195 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
196 exePath.RemoveLastDir();
197 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
198 return huginRoot +
"share/hugin/data/";
202 return INSTALL_DATA_DIR;
210 wxDir::GetAllFiles(
GetDataPath() +
"assistant", &files,
"*.assistant", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
219 wxDir::GetAllFiles(
GetDataPath() +
"output", &files,
"*.executor", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
226 if (!files.IsEmpty())
228 for (
auto file : files)
231 wxFileInputStream inputStream(file);
232 if (inputStream.IsOk())
235 wxFileConfig executorFile(inputStream);
244 help = wxString::Format(_(
"User defined sequence: %s"), file);
255 wxCommandEvent dummy;
bool FileExists(const std::string &filename)
checks if file exists
wxRadioButton * m_radio_user_sequence
wxString GetDataPath()
return path to data directory, it depends on operating system
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
wxArrayString m_userHelpTexts
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
wxTextCtrl * m_text_external_file
void OnChangeUserDefinedChoice(wxCommandEvent &e)
wxString GetNewSequence()
returns the newly selected sequence
bool m_isAssistantUserDefined
~ChangeUserDefinedSequenceDialog()
destructor, saves size and position
basic classes and function for queuing commands in wxWidgets
void FillUserDefinedChoice(const wxArrayString &files)
void UpdateStatus(wxCommandEvent &e)
void FillStitcherUserDefined()
wxRadioButton * m_radio_default
ChangeUserDefinedSequenceDialog(wxWindow *parent, wxString xrcPrefix, wxString userDefinedSequence, bool assistantUserDefined)
Constructor, read from xrc ressource; restore last uses size and position.
wxStaticText * m_label_user_define
wxArrayString m_userFileNames
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
wxButton * m_button_external_file
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
void OnChooseFilename(wxCommandEvent &e)
void FillAssistantUserDefined()
wxStaticText * m_label_user_define_filename
wxChoice * m_choice_user_define
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
wxRadioButton * m_radio_external
void OnOk(wxCommandEvent &e)