replace the old rbutil title icon with the logo-like icon (which is already used...
[Rockbox.git] / rbutil / rbutil.h
blobeb31986acec191d9eb06e538ab01ed1d8c230ffb
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;
127 wxString pathToTts;
128 wxString pathToEnc;
132 // Global system variables
133 wxFFile* logfile;
134 wxLogStderr* logstderr;
135 wxLogChain* logchain;
136 wxLogGui* loggui;
139 extern GlobalVars* gv;
142 wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
143 const wxString& appVariableName);
144 int DownloadURL(wxString src, wxString dest);
145 int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
146 int Uninstall(const wxString dir, bool isFullUninstall = false);
147 bool InstallRbutil(wxString dest);
148 bool InstallTheme(wxString src);
149 bool checkZip(wxString zipname);
150 wxString stream_err_str(int errnum);
151 bool rm_rf(wxString file);
153 wxBitmap wxGetBitmapFromMemory(const unsigned char *data,int length);
156 #define ERR_DIALOG(msg, title) \
157 wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
159 #define WARN_DIALOG(msg, title) \
160 wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
162 #define MESG_DIALOG(msg) \
163 wxLogMessage(msg)
165 #define INFO_DIALOG(msg) \
166 wxLogInfo(msg)
168 #define BUILD_RELEASE 0
169 #define BUILD_DAILY 1
170 #define BUILD_BLEEDING 2
172 #define BOOTLOADER_ADD 0
173 #define BOOTLOADER_REM 1
176 #endif