Revision 6705 trunk/install/launcher/izpack-launcher-1.3/src/launcher.cpp
launcher.cpp | ||
---|---|---|
117 | 117 |
wxFileConfig cfg( in ); |
118 | 118 |
wxString downloadEnabled; |
119 | 119 |
wxString launchJarAsync; |
120 |
wxString askForCheckingProcess; |
|
120 | 121 |
|
121 |
cfg.Read( "jar", ¶msJar, wxEmptyString); |
|
122 |
cfg.Read( "jre", ¶msJre, wxEmptyString); |
|
123 |
cfg.Read( "downloadJre", ¶msJreDownload, wxEmptyString); |
|
124 |
cfg.Read( "jai", ¶msJai, wxEmptyString); |
|
125 |
cfg.Read( "downloadJai", ¶msJaiDownload, wxEmptyString); |
|
126 |
cfg.Read( "jai_io", ¶msJaiIo, wxEmptyString); |
|
127 |
cfg.Read( "downloadJai_io", ¶msJaiIoDownload, wxEmptyString); |
|
128 |
cfg.Read( "jre_version", ¶msJreVersion, wxEmptyString); |
|
129 |
cfg.Read( "jre_version_prefered", ¶msJreVersionPrefered, wxEmptyString); |
|
130 |
cfg.Read( "jarParams", ¶msJarParams, wxEmptyString); |
|
131 |
cfg.Read( "downloadEnabled", &downloadEnabled, wxEmptyString); |
|
132 |
cfg.Read( "launchJarAsync", &launchJarAsync, wxEmptyString); |
|
122 |
cfg.Read( "jar", ¶msJar, wxEmptyString); |
|
123 |
cfg.Read( "jre", ¶msJre, wxEmptyString); |
|
124 |
cfg.Read( "downloadJre", ¶msJreDownload, wxEmptyString); |
|
125 |
cfg.Read( "jai", ¶msJai, wxEmptyString); |
|
126 |
cfg.Read( "downloadJai", ¶msJaiDownload, wxEmptyString); |
|
127 |
cfg.Read( "jai_io", ¶msJaiIo, wxEmptyString); |
|
128 |
cfg.Read( "downloadJai_io", ¶msJaiIoDownload, wxEmptyString); |
|
129 |
cfg.Read( "jre_version", ¶msJreVersion, wxEmptyString); |
|
130 |
cfg.Read( "jre_version_prefered", ¶msJreVersionPrefered, wxEmptyString); |
|
131 |
cfg.Read( "jarParams", ¶msJarParams, wxEmptyString); |
|
132 |
cfg.Read( "downloadEnabled", &downloadEnabled, wxEmptyString); |
|
133 |
cfg.Read( "launchJarAsync", &launchJarAsync, wxEmptyString); |
|
134 |
cfg.Read( "askForCheckingProcess", &askForCheckingProcess, wxEmptyString); |
|
133 | 135 |
|
134 | 136 |
//procesamos el parametro booleano 'downloadEnabled' |
135 | 137 |
paramsEnabledDownload =string_to_bool(downloadEnabled,false); |
138 |
//procesamos el parametro booleano 'launchJarAsync' |
|
136 | 139 |
paramsLaunchJarAsync =string_to_bool(launchJarAsync,false); |
140 |
//procesamos el parametro booleano 'askForCheckingProcess' |
|
141 |
paramsAskForCheckingProcess=string_to_bool(askForCheckingProcess,true); |
|
137 | 142 |
|
138 | 143 |
if (paramsJar == wxEmptyString ) |
139 | 144 |
{ |
... | ... | |
161 | 166 |
exit(1); |
162 | 167 |
} |
163 | 168 |
} |
169 |
bool LauncherApp::confirmYesNoCancel(const wxString &msg,const int yesDefault = true) |
|
170 |
{ |
|
171 |
int response; |
|
172 |
long maskDefault; |
|
173 |
if (yesDefault) { |
|
174 |
maskDefault = wxYES_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION; |
|
175 |
} else { |
|
176 |
maskDefault = wxNO_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION; |
|
177 |
} |
|
178 |
wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), maskDefault); |
|
179 |
response = dlg.ShowModal(); |
|
180 |
if (response != wxID_YES && response != wxID_NO) { |
|
181 |
notifyToUser(_("Canceled by user")); |
|
182 |
exit(1); |
|
183 |
} |
|
184 |
return (response == wxID_YES); |
|
185 |
|
|
186 |
} |
|
164 | 187 |
|
188 |
|
|
189 |
|
|
165 | 190 |
bool LauncherApp::OnInit() |
166 | 191 |
{ |
167 | 192 |
isStatusDialogVisible = false; |
... | ... | |
638 | 663 |
} |
639 | 664 |
|
640 | 665 |
void LauncherApp::run(){ |
641 |
|
|
642 |
if (!searchJRE()) |
|
643 |
{ |
|
644 |
jreInstall(); |
|
666 |
bool doChecks = true; |
|
667 |
|
|
668 |
if (paramsAskForCheckingProcess) { |
|
669 |
wxString msg = _("Do you want to make checks of the application requisites?"); |
|
670 |
doChecks = confirmYesNoCancel(msg,true); |
|
645 | 671 |
} |
672 |
|
|
646 | 673 |
|
647 |
fixSystemJREConfig();
|
|
674 |
if (doChecks) {
|
|
648 | 675 |
|
649 |
jaiInstall(); |
|
676 |
if (!searchJRE()) |
|
677 |
{ |
|
678 |
jreInstall(); |
|
679 |
} |
|
680 |
|
|
681 |
fixSystemJREConfig(); |
|
682 |
|
|
683 |
jaiInstall(); |
|
684 |
|
|
685 |
jaiIoInstall(); |
|
686 |
} else { |
|
687 |
// 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 |
|
|
702 |
wxFileDialog dlg( |
|
703 |
0, |
|
704 |
msgDir, |
|
705 |
wxEmptyString, |
|
706 |
wxString("java.exe"), |
|
707 |
wxString("Java VM executable file (java.exe)|java.exe"), |
|
708 |
wxOPEN | wxFILE_MUST_EXIST, |
|
709 |
wxDefaultPosition |
|
710 |
); |
|
711 |
int response = dlg.ShowModal(); |
|
712 |
if (response != wxID_OK) { |
|
713 |
notifyToUser(_("Canceled by user")); |
|
714 |
exit(1); |
|
715 |
} |
|
716 |
//caragamos la variable con el eljecutable |
|
717 |
javaExecPath = dlg.GetPath(); |
|
718 |
|
|
719 |
//generamos el path para el JavaHome (por si acaso) |
|
720 |
wxFileName fileName(javaExecPath); |
|
721 |
fileName.SetFullName(""); |
|
722 |
fileName.AppendDir(".."); |
|
723 |
fileName.Normalize(); |
|
724 |
javaHome = fileName.GetPath(); |
|
725 |
|
|
726 |
} |
|
650 | 727 |
|
651 |
jaiIoInstall(); |
|
652 |
|
|
653 | 728 |
runJRE(); |
654 | 729 |
|
655 | 730 |
exit(0); |
Also available in: Unified diff