~ubuntu-branches/ubuntu/trusty/hugin/trusty-proposed

« back to all changes in this revision

Viewing changes to src/hugin1/stitch_project/hugin_stitch_project.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2011-01-06 14:28:24 UTC
  • mfrom: (1.1.9 upstream) (0.1.21 experimental)
  • Revision ID: james.westby@ubuntu.com-20110106142824-zn9lxylg5z44dynn
* Drop Cyril Brulebois from Uploaders. Thank you very much for your work.
* Bump package version. (rc3 was re-released as 2010.4.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
#include <fstream>
36
36
#include <sstream>
37
 
#include <vigra/error.hxx>
38
 
#include <vigra_ext/MultiThreadOperations.h>
39
37
#include "PT/Panorama.h"
40
38
#include "PT/utils.h"
41
39
#include "base_wx/RunStitchPanel.h"
66
64
    RunStitchFrame(wxWindow * parent, const wxString& title, const wxPoint& pos, const wxSize& size);
67
65
 
68
66
    bool StitchProject(wxString scriptFile, wxString outname,
69
 
                       HuginBase::PanoramaMakefileExport::PTPrograms progs);
 
67
                       HuginBase::PanoramaMakefilelibExport::PTPrograms progs);
70
68
 
71
69
    void OnQuit(wxCommandEvent& event);
72
70
    void OnAbout(wxCommandEvent& event);
167
165
        Close();
168
166
    } else {
169
167
        m_isStitching = false;
170
 
        if (event.GetExitCode() != 0) {
171
 
            wxMessageBox(_("Error during stitching\nPlease report the complete text to the bug tracker on http://sf.net/projects/hugin."),
172
 
                     _("Error during stitching"), wxICON_ERROR | wxOK );
 
168
        if (event.GetExitCode() != 0)
 
169
        {
 
170
            if(wxMessageBox(_("Error during stitching\nPlease report the complete text to the bug tracker on https://bugs.launchpad.net/hugin.\n\nDo you want to save the log file?"),
 
171
                _("Error during stitching"), wxICON_ERROR | wxYES_NO )==wxYES)
 
172
            {
 
173
                wxString defaultdir = wxConfigBase::Get()->Read(wxT("/actualPath"),wxT(""));
 
174
                wxFileDialog dlg(this,
 
175
                         _("Specify log file"),
 
176
                         defaultdir, wxT(""),
 
177
                         _("Log files (*.log)|*.log|All files (*)|*"),
 
178
                         wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
 
179
                dlg.SetDirectory(wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")));
 
180
                if (dlg.ShowModal() == wxID_OK)
 
181
                {
 
182
                    wxConfig::Get()->Write(wxT("/actualPath"), dlg.GetDirectory());  // remember for later
 
183
                    m_stitchPanel->SaveLog(dlg.GetPath());
 
184
                };
 
185
            }
173
186
        } else {
174
187
            Close();
175
188
        }
177
190
}
178
191
 
179
192
bool RunStitchFrame::StitchProject(wxString scriptFile, wxString outname,
180
 
                                   HuginBase::PanoramaMakefileExport::PTPrograms progs)
 
193
                                   HuginBase::PanoramaMakefilelibExport::PTPrograms progs)
181
194
{
182
195
    if (! m_stitchPanel->StitchProject(scriptFile, outname, progs)) {
183
196
        return false;
286
299
    // parse arguments
287
300
    static const wxCmdLineEntryDesc cmdLineDesc[] =
288
301
    {
 
302
        //On wxWidgets 2.9, wide characters don't work here.
 
303
        //On previous versions, the wxT macro is required for unicode builds.
 
304
#if wxCHECK_VERSION(2,9,0)
 
305
      { wxCMD_LINE_SWITCH, "h", "help", "show this help message",
 
306
        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
 
307
      { wxCMD_LINE_OPTION, "o", "output",  "output prefix" },
 
308
      { wxCMD_LINE_SWITCH, "d", "delete",  "delete pto file after stitching" },
 
309
      { wxCMD_LINE_PARAM,  NULL, NULL, "<project>",
 
310
        wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
 
311
      { wxCMD_LINE_NONE }
 
312
#else 
289
313
      { wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), wxT("show this help message"),
290
314
        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
291
315
      { wxCMD_LINE_OPTION, wxT("o"), wxT("output"),  wxT("output prefix") },
292
 
      { wxCMD_LINE_OPTION, wxT("t"), wxT("threads"),  wxT("number of threads"),
293
 
             wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL },
294
316
      { wxCMD_LINE_SWITCH, wxT("d"), wxT("delete"),  wxT("delete pto file after stitching") },
295
 
      { wxCMD_LINE_PARAM,  NULL, NULL, _T("<project> <images>"),
296
 
        wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL + wxCMD_LINE_PARAM_MULTIPLE },
 
317
      { wxCMD_LINE_PARAM,  NULL, NULL, wxT("<project>"),
 
318
        wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
297
319
      { wxCMD_LINE_NONE }
 
320
#endif 
298
321
    };
299
322
 
300
323
    wxCmdLineParser parser(cmdLineDesc, argc, argv);
311
334
        break;
312
335
    }
313
336
 
314
 
    bool imgsFromCmdline = false;
315
 
 
316
 
 
317
337
    wxString scriptFile;
318
338
#ifdef __WXMAC__
319
339
    m_macFileNameToOpenOnStart = wxT("");
338
358
                         _("Specify project source project file"),
339
359
                         defaultdir, wxT(""),
340
360
                         _("Project files (*.pto,*.ptp,*.pts,*.oto)|*.pto;*.ptp;*.pts;*.oto;|All files (*)|*"),
341
 
                         wxOPEN, wxDefaultPosition);
 
361
                         wxFD_OPEN, wxDefaultPosition);
342
362
 
343
363
        dlg.SetDirectory(wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")));
344
364
        if (dlg.ShowModal() == wxID_OK) {
353
373
        if (! wxIsAbsolutePath(scriptFile)) {
354
374
            scriptFile = wxGetCwd() + wxT("/") + scriptFile;
355
375
        }
356
 
        if ( parser.GetParamCount() > 1) {
357
 
          // load images.
358
 
          imgsFromCmdline = true;
359
 
        }
360
376
    }
361
377
 
362
378
    cout << "input file is " << (const char *)scriptFile.mb_str(wxConvLocal) << endl;
368
384
        wxFileDialog dlg(0,_("Specify output prefix"),
369
385
                         wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")),
370
386
                         wxT(""), wxT(""),
371
 
                         wxSAVE, wxDefaultPosition);
 
387
                         wxFD_SAVE, wxDefaultPosition);
372
388
        dlg.SetDirectory(wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")));
373
389
        if (dlg.ShowModal() == wxID_OK) {
374
390
            while(containsInvalidCharacters(dlg.GetPath()))