Statistics
| Revision:

svn-gvsig-desktop / trunk / build / distribution / launcher / izpack-launcher-1.3 / src / launcher.h @ 21757

History | View | Annotate | Download (4.67 KB)

1
/* 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
#include "statusdialog.h"
43

    
44
class LauncherApp : public wxApp
45
{
46
private:
47

    
48
  wxString APPLICATION_NAME;
49
  wxString paramsApplicationName;
50

    
51
  wxFileName exeFileName; 
52
  wxFileName exePath;
53
  
54
  wxString javaHome;
55
  wxString javaExecPath;
56
// std::map<wxString, wxString> params;
57
  wxString paramsJar;
58
  wxString paramsCommand;  
59
  bool paramsLaunchJarAsync;
60
  bool paramsAskForCheckingProcess;
61
  wxString paramsJre;
62
  wxString paramsJreDownload;
63
  bool paramsCheckJai;
64
  wxString paramsJai;
65
  wxString paramsJaiDownload;
66
  bool paramsCheckJaiIo;
67
  wxString paramsJaiIo;
68
  wxString paramsJaiIoDownload;
69
  bool paramsEnabledDownload;
70
  bool paramsDoChecks;
71
  bool paramsChecksJREExecutionTerminationCode;
72
  wxString paramsJreHome;
73
  StatusDialog* statusDialog;
74
  bool isStatusDialogVisible;
75
  wxTimer* myTimer;
76

    
77
  wxArrayString variables;
78
  wxArrayString variablesValues;
79

    
80
  wxArrayString environVariables;
81
  wxArrayString environVariablesValues;
82

    
83
  wxArrayString classpathValues;
84
  wxArrayString classpathVariables;
85

    
86
  wxString paramsLaunchMode;
87
  
88
  wxString paramsJreVersion;
89
  wxString paramsJreVersionPrefered;
90

    
91
  wxString localVersionToUse;
92

    
93
  wxString classpath;
94

    
95
  wxLocale locale;
96

    
97
  bool completed;
98

    
99
  wxString cfgName;
100

    
101
  void loadParams();
102

    
103
  void error(const wxString &msg);
104

    
105
  bool searchJRE();
106

    
107
  void runJRE();
108

    
109
  void manualLaunch();
110

    
111
  void jreInstall();
112

    
113
  void netDownload();
114

    
115
  void echo(const wxString &msg);
116
  
117
  void confirm(const wxString &msg);
118

    
119
  bool confirmYesNoCancel(const wxString &msg,const int yesDefault);
120
  
121
  void notifyToUser(const wxString &msg);
122
  
123
  bool compareVersions(const wxString localVersion, const wxString requireVersion);
124

    
125
  void jaiInstall();
126

    
127
  bool checkVersion(const wxString msg);
128
  
129
  void jaiIoInstall();
130

    
131
  bool checksJaiIo();
132
  
133
  bool checksJai();
134
  
135
  void fixSystemJREConfig();
136
  
137
  bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
138

    
139
  bool copyFile(const wxString urlOfFile, const wxString filePath, const wxString msg);
140
  
141
  bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription);
142
  
143
  void showStatusMsg(const wxString msg);
144
  
145
  void run();
146
  
147
  void calculateJavaExePath(const wxString aJavaHome);
148

    
149
  wxString parseCommand();
150

    
151
  wxString parseString(const wxString theString);
152

    
153
  wxString parseEnviron(const wxString theString);
154

    
155
  bool copyRequiredFiles();
156

    
157

    
158
  wxString readPathFromINI(wxString section, wxString key, const wxString defaultValue);
159

    
160
  wxString readPathFromINI(wxString key, const wxString defaultValue);
161

    
162
  wxString readFromINI(wxString section, wxString key, const wxString defaultValue);
163

    
164
  wxString readFromINI(wxString key, const wxString defaultValue);
165

    
166
  wxArrayString sectionKeysFromINI(const wxString section);
167

    
168
  wxArrayString sectionKeysValuesFromINI(const wxString section,wxArrayString keys);
169

    
170
  void showStatusWindow();
171

    
172
  
173
  void calculateClasspath(wxArrayString ClassPathValues);
174

    
175
 
176
public:
177

    
178
  LauncherApp();
179

    
180
  virtual ~LauncherApp();
181

    
182
  virtual bool OnInit();
183
  
184
  virtual void OnTimer(wxTimerEvent& event);
185

    
186
protected:
187
   DECLARE_EVENT_TABLE()
188

    
189
};
190

    
191
#endif