move handling of shared manuals (like h100 series) to a new setting in rbutil.ini...
[Rockbox.git] / rbutil / rbutil.h
blobcc53a80be75e601628d1e4bb8cd11f382e5bd437
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: rbutil.h
11 * Copyright (C) 2005 Christi Alice Scarborough
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
19 ****************************************************************************/
21 #include <wx/wxprec.h>
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25 #ifndef WX_PRECOMP
26 #include <wx/wx.h>
27 #endif
29 #ifndef __rbutil_HPP_
30 #define __rbutil_HPP_
32 #include <wx/config.h>
33 #include <wx/confbase.h>
34 #include <wx/fileconf.h>
35 #include <wx/stdpaths.h>
36 #include <wx/wfstream.h>
37 #include <wx/filesys.h>
38 #include <wx/fs_inet.h>
39 #include <wx/fs_zip.h>
40 #include <wx/progdlg.h>
41 #include <wx/protocol/http.h>
42 #include <wx/string.h>
43 #include <wx/url.h>
44 #include <wx/ptr_scpd.h>
45 #include <wx/zipstrm.h>
46 #include <wx/dir.h>
47 #include <wx/filefn.h>
48 #include <wx/sstream.h>
49 #include <wx/msgdlg.h>
50 #include <wx/log.h>
51 #include <wx/file.h>
52 #include <wx/wizard.h>
53 #include <wx/event.h>
54 #include <wx/statline.h>
55 #include <wx/valgen.h>
56 #include <wx/thread.h>
57 #include <wx/regex.h>
58 #include <wx/tokenzr.h>
59 #include <wx/notebook.h>
60 #include <wx/html/htmlwin.h>
61 #include <wx/hyperlink.h>
62 #include <wx/mstream.h>
64 #ifdef __WXMSW__
65 #define PATH_SEP "\\"
66 #define PATH_SEP_CHR '\\'
67 #define EXE_NAME wxT("rbutil.exe")
68 #else
69 #define PATH_SEP wxT("/")
70 #define PATH_SEP_CHR '/'
71 #define EXE_NAME wxT("rbutil")
72 #endif
74 #define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
75 #define MAX_PLATFORMS 50
76 #define SYSTEM_CONFIG rbutil.ini
77 #define FILE_BUFFER_SIZE 1024
79 //WX_DEFINE_OBJARRAY(bool, wxArrayBool);
81 class GlobalVars
83 public:
84 // Program configuration data (rbutil.ini and environment)
85 wxFileConfig* GlobalConfig;
86 wxFileConfig* UserConfig;
87 wxString UserConfigFile;
88 wxString GlobalConfigFile;
89 wxString AppDir;
90 wxString ResourceDir;
92 wxString* ErrStr;
93 wxStandardPaths* stdpaths;
94 wxArrayString plat_id;
95 wxArrayString plat_name;
96 wxArrayInt plat_released;
97 wxArrayInt plat_needsbootloader;
98 wxArrayString plat_bootloadermethod;
99 wxArrayString plat_bootloadername;
100 wxArrayString plat_resolution;
101 wxArrayString plat_manualname;
102 wxString download_url;
103 wxString daily_url;
104 wxString bleeding_url;
105 wxString server_conf_url;
106 wxString font_url;
107 wxString last_release;
108 wxString prog_name;
109 wxString bootloader_url;
110 wxString themes_url;
111 wxString manual_url;
112 wxString doom_url;
113 wxString proxy_url;
116 // User configuration data.
117 wxString curplat;
118 // unsigned int curplatnum;
119 wxString curdestdir;
120 wxString curfirmware;
121 unsigned int curbuild;
122 bool curisfull;
123 bool nocache;
124 bool portable;
125 wxString curresolution;
126 wxArrayString themesToInstall;
128 // Global system variables
129 wxFFile* logfile;
130 wxLogStderr* logstderr;
131 wxLogChain* logchain;
132 wxLogGui* loggui;
135 extern GlobalVars* gv;
138 wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
139 const wxString& appVariableName);
140 int DownloadURL(wxString src, wxString dest);
141 int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
142 int Uninstall(const wxString dir, bool isFullUninstall = false);
143 bool InstallRbutil(wxString dest);
144 bool InstallTheme(wxString src);
145 bool checkZip(wxString zipname);
146 wxString stream_err_str(int errnum);
147 bool rm_rf(wxString file);
149 wxBitmap wxGetBitmapFromMemory(const unsigned char *data,int length);
152 #define ERR_DIALOG(msg, title) \
153 wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
155 #define WARN_DIALOG(msg, title) \
156 wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
158 #define MESG_DIALOG(msg) \
159 wxLogMessage(msg)
161 #define INFO_DIALOG(msg) \
162 wxLogInfo(msg)
164 #define BUILD_RELEASE 0
165 #define BUILD_DAILY 1
166 #define BUILD_BLEEDING 2
168 #define BOOTLOADER_ADD 0
169 #define BOOTLOADER_REM 1
172 #endif