Statistics
| Revision:

root / trunk / install / launcher / izpack-launcher-1.3 / src / launcher.h @ 11445

History | View | Annotate | Download (4.34 KB)

1 6028 jmvivo
/* Copyright (c) 2004 Julien Ponge - All rights reserved.
2
 *
3
 * Permission is hereby granted, free of charge, to any person obtaining a copy
4
 * of this software and associated documentation files (the "Software"), to
5
 * deal in the Software without restriction, including without limitation the
6
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
 * sell copies of the Software, and to permit persons to whom the Software is
8
 * furnished to do so, subject to the following conditions:
9
 *
10
 * The above copyright notice and this permission notice shall be included in
11
 * all copies or substantial portions of the Software.
12
 *
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
 * IN THE SOFTWARE.
20
 */
21
22
#ifndef LAUNCHER_H
23
#define LAUNCHER_H
24
25
#include <wx/wx.h>
26
#include <wx/config.h>
27
#include <wx/confbase.h>
28
#include <wx/fileconf.h>
29
#include <wx/wfstream.h>
30
31
#ifdef __WINDOWS__
32
  #include <wx/msw/registry.h>
33
#else
34
  #include <stdlib.h>
35
  #include <map>
36
  #include <list>
37
#endif
38
39
40
41
#include "failuredialog.h"
42 6051 jmvivo
#include "statusdialog.h"
43 6028 jmvivo
44
class LauncherApp : public wxApp
45
{
46
private:
47
48
  wxString APPLICATION_NAME;
49 8429 jmvivo
  wxString paramsApplicationName;
50 11419 jmvivo
51
  wxFileName exeFileName;
52
  wxFileName exePath;
53 6028 jmvivo
54
  wxString javaHome;
55
  wxString javaExecPath;
56
// std::map<wxString, wxString> params;
57
  wxString paramsJar;
58 7285 jmvivo
  wxString paramsCommand;
59 6096 jmvivo
  bool paramsLaunchJarAsync;
60 6705 jmvivo
  bool paramsAskForCheckingProcess;
61 6028 jmvivo
  wxString paramsJre;
62 6051 jmvivo
  wxString paramsJreDownload;
63 9962 jmvivo
  bool paramsCheckJai;
64 6028 jmvivo
  wxString paramsJai;
65 6051 jmvivo
  wxString paramsJaiDownload;
66 9962 jmvivo
  bool paramsCheckJaiIo;
67 6028 jmvivo
  wxString paramsJaiIo;
68 6051 jmvivo
  wxString paramsJaiIoDownload;
69
  bool paramsEnabledDownload;
70 7269 jmvivo
  bool paramsDoChecks;
71 9311 jmvivo
  bool paramsChecksJREExecutionTerminationCode;
72 7269 jmvivo
  wxString paramsJreHome;
73 6051 jmvivo
  StatusDialog* statusDialog;
74
  bool isStatusDialogVisible;
75 6066 jmvivo
  wxTimer* myTimer;
76 7889 jmvivo
77
  wxArrayString variables;
78
  wxArrayString variablesValues;
79
80 9979 jmvivo
  wxArrayString environVariables;
81
  wxArrayString environVariablesValues;
82
83 8429 jmvivo
  wxString paramsLaunchMode;
84 6028 jmvivo
85
  wxString paramsJreVersion;
86 6125 jmvivo
  wxString paramsJreVersionPrefered;
87 6121 jmvivo
88 6028 jmvivo
  wxString localVersionToUse;
89
90 6121 jmvivo
91 6028 jmvivo
  wxLocale locale;
92
93
  bool completed;
94
95
  wxString cfgName;
96
97
  void loadParams();
98
99
  void error(const wxString &msg);
100
101
  bool searchJRE();
102
103
  void runJRE();
104
105
  void manualLaunch();
106
107
  void jreInstall();
108
109
  void netDownload();
110
111
  void echo(const wxString &msg);
112
113
  void confirm(const wxString &msg);
114
115 6705 jmvivo
  bool confirmYesNoCancel(const wxString &msg,const int yesDefault);
116
117 6028 jmvivo
  void notifyToUser(const wxString &msg);
118
119
  bool compareVersions(const wxString localVersion, const wxString requireVersion);
120
121
  void jaiInstall();
122 7006 jmvivo
123
  bool checkVersion(const wxString msg);
124 6028 jmvivo
125
  void jaiIoInstall();
126
127
  bool checksJaiIo();
128
129
  bool checksJai();
130
131
  void fixSystemJREConfig();
132 6051 jmvivo
133 6707 jmvivo
  bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
134 7293 jmvivo
135
  bool copyFile(const wxString urlOfFile, const wxString filePath, const wxString msg);
136 6051 jmvivo
137
  bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription);
138
139
  void showStatusMsg(const wxString msg);
140
141
  void run();
142
143 7269 jmvivo
  void calculateJavaExePath(const wxString aJavaHome);
144 7285 jmvivo
145
  wxString parseCommand();
146 7293 jmvivo
147 7889 jmvivo
  wxString parseString(const wxString theString);
148
149 9979 jmvivo
  wxString parseEnviron(const wxString theString);
150
151 7293 jmvivo
  bool copyRequiredFiles();
152 7329 jmvivo
153
154 8429 jmvivo
  wxString readPathFromINI(wxString section, wxString key, const wxString defaultValue);
155 7329 jmvivo
156 8429 jmvivo
  wxString readPathFromINI(wxString key, const wxString defaultValue);
157 7329 jmvivo
158 8429 jmvivo
  wxString readFromINI(wxString section, wxString key, const wxString defaultValue);
159 7329 jmvivo
160 8429 jmvivo
  wxString readFromINI(wxString key, const wxString defaultValue);
161 7329 jmvivo
162 8429 jmvivo
  wxArrayString sectionKeysFromINI(const wxString section);
163 7329 jmvivo
164 8429 jmvivo
  wxArrayString sectionKeysValuesFromINI(const wxString section,wxArrayString keys);
165 7329 jmvivo
166 8429 jmvivo
  void showStatusWindow();
167 7879 jmvivo
168
169 7329 jmvivo
170 6028 jmvivo
public:
171
172
  LauncherApp();
173
174
  virtual ~LauncherApp();
175
176
  virtual bool OnInit();
177 6066 jmvivo
178
  virtual void OnTimer(wxTimerEvent& event);
179
180
protected:
181
   DECLARE_EVENT_TABLE()
182
183 6028 jmvivo
};
184
185
#endif