Revision 6707
trunk/install/launcher/izpack-launcher-1.3/src/launcher.cpp | ||
---|---|---|
203 | 203 |
|
204 | 204 |
myTimer = new wxTimer(this,LAUNCHAPP_TIMER_ID); |
205 | 205 |
myTimer->Start(150,true); |
206 |
|
|
206 |
this->MainLoop(); |
|
207 | 207 |
return true; |
208 | 208 |
/* |
209 | 209 |
|
... | ... | |
561 | 561 |
return (wxFileExists(javaHome + "\\lib\\ext\\jai_imageio.jar")); |
562 | 562 |
} |
563 | 563 |
|
564 |
bool LauncherApp::downloadFileHttp(const wxString urlOfFile, const wxString filePath){ |
|
564 |
bool LauncherApp::downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg){
|
|
565 | 565 |
|
566 | 566 |
bool isOk; |
567 | 567 |
//echo(urlOfFile); |
... | ... | |
573 | 573 |
return false; |
574 | 574 |
} |
575 | 575 |
|
576 |
showStatusMsg(msg); |
|
576 | 577 |
wxURL url(urlOfFile); |
577 | 578 |
//echo("url open"); |
578 | 579 |
wxInputStream *in_stream; |
... | ... | |
587 | 588 |
//echo("filePath =" + filePath); |
588 | 589 |
wxFileName fileName(filePath); |
589 | 590 |
|
591 |
|
|
592 |
// Preparamos la ruta para el fichero destino |
|
590 | 593 |
wxArrayString dirs; |
591 | 594 |
|
592 | 595 |
dirs = fileName.GetDirs(); |
... | ... | |
608 | 611 |
} |
609 | 612 |
} |
610 | 613 |
|
614 |
|
|
611 | 615 |
wxFileOutputStream out_stream = wxFileOutputStream(filePath); |
612 | 616 |
//echo("out_stream open"); |
613 | 617 |
|
614 |
in_stream->Read(out_stream); |
|
618 |
//in_stream->Read(out_stream); |
|
619 |
size_t nbytes = 10240; |
|
620 |
char buffer[nbytes]; |
|
615 | 621 |
|
616 | 622 |
|
617 |
isOk = (out_stream.IsOk() && in_stream->Eof()); |
|
623 |
//while (!in_stream->Eof()) { |
|
624 |
while (!in_stream->Eof()) { |
|
625 |
in_stream->Read(&buffer,nbytes); |
|
626 |
if (in_stream->LastError() != wxSTREAM_NO_ERROR && in_stream->LastError() != wxSTREAM_EOF) { |
|
627 |
return false; |
|
628 |
} |
|
629 |
out_stream.Write(&buffer,in_stream->LastRead()); |
|
630 |
if (out_stream.LastError() != wxSTREAM_NO_ERROR) { |
|
631 |
return false; |
|
632 |
} |
|
633 |
int totalKb = out_stream.GetSize() / 1024; |
|
634 |
wxString totalMsg =msg.Format("%i",totalKb); |
|
635 |
showStatusMsg(msg+" "+ totalMsg + " Kb"); |
|
636 |
|
|
637 |
} |
|
638 |
|
|
639 |
|
|
640 |
isOk = true; |
|
618 | 641 |
/* |
619 | 642 |
if (isOk) { |
620 | 643 |
echo("isOk = true"); |
... | ... | |
623 | 646 |
} |
624 | 647 |
*/ |
625 | 648 |
delete in_stream; |
649 |
|
|
626 | 650 |
//echo("end"); |
627 | 651 |
return isOk; |
628 | 652 |
|
... | ... | |
633 | 657 |
{ |
634 | 658 |
if (paramsEnabledDownload) |
635 | 659 |
{ |
636 |
wxString msg = _("Intalation require download this file:\n") + |
|
660 |
wxString msg = _("Instalation require download this file:\n") +
|
|
637 | 661 |
fileDescription + "\n" + |
638 | 662 |
_("Do you want to continue?"); |
639 | 663 |
confirm(msg); |
640 |
showStatusMsg(_("Downloading ") + fileDescription + "...");
|
|
641 |
if (!downloadFileHttp(urlDownload,filePath)) |
|
664 |
//showStatusMsg(_("Downloading ") + fileDescription + "...");
|
|
665 |
if (!downloadFileHttp(urlDownload,filePath,_("Downloading ") + fileDescription + "..." ))
|
|
642 | 666 |
{ |
667 |
//FIXME: Falta msgError |
|
643 | 668 |
return false; |
644 | 669 |
} |
645 | 670 |
} |
... | ... | |
654 | 679 |
|
655 | 680 |
void LauncherApp::showStatusMsg(const wxString msg) { |
656 | 681 |
if (isStatusDialogVisible) { |
682 |
while (this->Pending()) { |
|
683 |
this->Dispatch(); |
|
684 |
} |
|
657 | 685 |
if (statusDialog->IsCanceled()) { |
658 |
notifyToUser(_("Canceled by user")); |
|
659 |
exit(1); |
|
686 |
int response; |
|
687 |
wxMessageDialog dlg(0, _("Are you sure to cancel instalation process?"), _(APPLICATION_NAME), wxYES_NO | wxICON_QUESTION ); |
|
688 |
response = dlg.ShowModal(); |
|
689 |
if (response == wxID_YES) { |
|
690 |
notifyToUser(_("Canceled by user")); |
|
691 |
exit(1); |
|
692 |
} |
|
693 |
statusDialog->DoNotCancel(); |
|
660 | 694 |
} |
661 | 695 |
statusDialog->showStatus(msg); |
662 | 696 |
} |
... | ... | |
685 | 719 |
jaiIoInstall(); |
686 | 720 |
} else { |
687 | 721 |
// No quiere comprobacion, por lo que solicitamos |
688 |
wxString msgDir = _("Find de Java Virtual Machine executable file to run"); |
|
689 |
/* |
|
690 |
wxFileDialog( |
|
691 |
wxWindow* parent, |
|
692 |
const wxString& message = "Choose a file", |
|
693 |
const wxString& defaultDir = "", |
|
694 |
const wxString& defaultFile = "", |
|
695 |
const wxString& wildcard = "*.*", |
|
696 |
long style = 0, |
|
697 |
const wxPoint& pos = wxDefaultPosition |
|
698 |
) |
|
699 |
*/ |
|
700 |
|
|
701 |
|
|
722 |
wxString msgDir = _("Find de Java Virtual Machine executable file to run"); |
|
702 | 723 |
wxFileDialog dlg( |
703 | 724 |
0, |
704 | 725 |
msgDir, |
trunk/install/launcher/izpack-launcher-1.3/src/statusdialog.cpp | ||
---|---|---|
11 | 11 |
} |
12 | 12 |
|
13 | 13 |
long STATUSDIALOG_TIMER_ID = wxNewId(); |
14 |
long STATUSDIALOG_CANCELBUTTON_ID = wxNewId(); |
|
14 | 15 |
|
15 | 16 |
BEGIN_EVENT_TABLE(StatusDialog, wxFrame) |
16 | 17 |
EVT_TIMER(STATUSDIALOG_TIMER_ID, StatusDialog::OnTimer) |
17 |
EVT_BUTTON(wxID_CANCEL, StatusDialog::OnCancel)
|
|
18 |
EVT_BUTTON(STATUSDIALOG_CANCELBUTTON_ID, StatusDialog::OnCancelButton)
|
|
18 | 19 |
EVT_CLOSE(StatusDialog::OnCancel) |
19 | 20 |
END_EVENT_TABLE() |
20 | 21 |
|
21 | 22 |
StatusDialog::StatusDialog(const wxString &wxStringHeadline ) |
22 | 23 |
: wxFrame(0, -1, _(wxStringHeadline), wxDefaultPosition, wxDefaultSize, |
23 |
wxDEFAULT_FRAME_STYLE)
|
|
24 |
wxSYSTEM_MENU | wxCAPTION )
|
|
24 | 25 |
{ |
25 | 26 |
|
26 | 27 |
buildUI(); |
... | ... | |
37 | 38 |
// Inits |
38 | 39 |
canceled = false; |
39 | 40 |
count = 0; |
40 |
wxString explanationMsg = _("gvSIG intalation program. Please wait..."); |
|
41 |
wxString explanationMsg = _("gvSIG instalation program. Please wait...");
|
|
41 | 42 |
statusMsg = _("Checking..."); |
42 | 43 |
sizerDesc= new wxBoxSizer(wxHORIZONTAL); |
43 | 44 |
sizer = new wxBoxSizer(wxVERTICAL); |
44 | 45 |
// Widgets |
45 | 46 |
|
46 |
cancelButton= new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition);
|
|
47 |
cancelButton= new wxButton(this, STATUSDIALOG_CANCELBUTTON_ID, _("Cancel"), wxDefaultPosition);
|
|
47 | 48 |
icon = new wxStaticBitmap(this, -1,wxICON(package),wxDefaultPosition,wxSize(32,32)); |
48 | 49 |
icon->SetBackgroundColour(cancelButton->GetBackgroundColour()); |
49 | 50 |
sizerDesc->Add(icon,0, wxALIGN_LEFT | wxALL ,5); |
... | ... | |
55 | 56 |
statusMsgText->SetBackgroundColour(cancelButton->GetBackgroundColour()); |
56 | 57 |
sizer->Add(statusMsgText, 0, wxALIGN_LEFT | wxALL, 5); |
57 | 58 |
|
58 |
cancelButton->Hide(); |
|
59 |
//sizer->Add(cancelButton, 0, wxALIGN_RIGHT | wxALL, 5); |
|
59 |
//cancelButton->Hide(); |
|
60 |
cancelButton->Enable(true); |
|
61 |
sizer->Add(cancelButton, 0, wxALIGN_RIGHT | wxALL, 5); |
|
60 | 62 |
|
61 | 63 |
this->SetBackgroundColour(cancelButton->GetBackgroundColour()); |
62 | 64 |
|
... | ... | |
102 | 104 |
} |
103 | 105 |
|
104 | 106 |
void StatusDialog::OnCancel(wxEvent& event) { |
105 |
//echo("StatusDialog::OnCancel"); |
|
106 | 107 |
this->canceled = true; |
107 | 108 |
} |
108 | 109 |
|
110 |
void StatusDialog::OnCancelButton(wxMouseEvent& event) { |
|
111 |
this->canceled = true; |
|
112 |
} |
|
113 |
|
|
114 |
|
|
109 | 115 |
bool StatusDialog::IsCanceled() { |
110 | 116 |
return this->canceled; |
111 | 117 |
} |
118 |
|
|
119 |
void StatusDialog::DoNotCancel() { |
|
120 |
this->canceled = false; |
|
121 |
} |
trunk/install/launcher/izpack-launcher-1.3/src/launcher.h | ||
---|---|---|
112 | 112 |
|
113 | 113 |
void fixSystemJREConfig(); |
114 | 114 |
|
115 |
bool downloadFileHttp(const wxString urlOfFile, const wxString filePath); |
|
115 |
bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
|
|
116 | 116 |
|
117 | 117 |
bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription); |
118 | 118 |
|
trunk/install/launcher/izpack-launcher-1.3/src/statusdialog.h | ||
---|---|---|
32 | 32 |
void OnTimer(wxTimerEvent& event); |
33 | 33 |
|
34 | 34 |
void OnCancel(wxEvent& event); |
35 |
|
|
36 |
void OnCancelButton(wxMouseEvent& event); |
|
35 | 37 |
|
36 | 38 |
bool IsCanceled(); |
39 |
|
|
40 |
void DoNotCancel(); |
|
37 | 41 |
protected: |
38 | 42 |
DECLARE_EVENT_TABLE() |
39 | 43 |
|
Also available in: Unified diff