Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / install / launcher / izpack-launcher-1.3 / src / launcher.h @ 7890

History | View | Annotate | Download (4.05 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
  
50
  wxString javaHome;
51
  wxString javaExecPath;
52
// std::map<wxString, wxString> params;
53
  wxString paramsJar;
54
  wxString paramsCommand;  
55
  bool paramsLaunchJarAsync;
56
  bool paramsAskForCheckingProcess;
57
  wxString paramsJre;
58
  wxString paramsJreDownload;
59
  wxString paramsJai;
60
  wxString paramsJaiDownload;
61
  wxString paramsJaiIo;
62
  wxString paramsJaiIoDownload;
63
  bool paramsEnabledDownload;
64
  bool paramsDoChecks;
65
  wxString paramsJreHome;
66
  StatusDialog* statusDialog;
67
  bool isStatusDialogVisible;
68
  wxTimer* myTimer;
69

    
70
  wxArrayString variables;
71
  wxArrayString variablesValues;
72

    
73
 
74
  
75
  wxString paramsJreVersion;
76
  wxString paramsJreVersionPrefered;
77

    
78
  wxString localVersionToUse;
79

    
80

    
81
  wxLocale locale;
82

    
83
  bool completed;
84

    
85
  wxString cfgName;
86

    
87
  void loadParams();
88

    
89
  void error(const wxString &msg);
90

    
91
  bool searchJRE();
92

    
93
  void runJRE();
94

    
95
  void manualLaunch();
96

    
97
  void jreInstall();
98

    
99
  void netDownload();
100

    
101
  void echo(const wxString &msg);
102
  
103
  void confirm(const wxString &msg);
104

    
105
  bool confirmYesNoCancel(const wxString &msg,const int yesDefault);
106
  
107
  void notifyToUser(const wxString &msg);
108
  
109
  bool compareVersions(const wxString localVersion, const wxString requireVersion);
110

    
111
  void jaiInstall();
112

    
113
  bool checkVersion(const wxString msg);
114
  
115
  void jaiIoInstall();
116

    
117
  bool checksJaiIo();
118
  
119
  bool checksJai();
120
  
121
  void fixSystemJREConfig();
122
  
123
  bool downloadFileHttp(const wxString urlOfFile, const wxString filePath, const wxString msg);
124

    
125
  bool copyFile(const wxString urlOfFile, const wxString filePath, const wxString msg);
126
  
127
  bool checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription);
128
  
129
  void showStatusMsg(const wxString msg);
130
  
131
  void run();
132
  
133
  void calculateJavaExePath(const wxString aJavaHome);
134

    
135
  wxString parseCommand();
136

    
137
  wxString parseString(const wxString theString);
138

    
139
  bool copyRequiredFiles();
140

    
141

    
142
wxString LauncherApp::readPathFromINI(wxString section, wxString key, const wxString defaultValue);
143

    
144
wxString LauncherApp::readPathFromINI(wxString key, const wxString defaultValue);
145

    
146
wxString LauncherApp::readFromINI(wxString section, wxString key, const wxString defaultValue);
147

    
148
wxString LauncherApp::readFromINI(wxString key, const wxString defaultValue);
149

    
150
wxArrayString LauncherApp::sectionKeysFromINI(const wxString section);
151

    
152
wxArrayString LauncherApp::sectionKeysValuesFromINI(const wxString section,wxArrayString keys);
153

    
154

    
155

    
156
 
157
public:
158

    
159
  LauncherApp();
160

    
161
  virtual ~LauncherApp();
162

    
163
  virtual bool OnInit();
164
  
165
  virtual void OnTimer(wxTimerEvent& event);
166

    
167
protected:
168
   DECLARE_EVENT_TABLE()
169

    
170
};
171

    
172
#endif