Update the Swedish translation.
[kugel-rb.git] / rbutil / rbutil.h
blobf8a88d4e8d3a56ed469092ed9030cc29c1eca882
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>
63 #ifdef __WXMSW__
64 #define PATH_SEP "\\"
65 #define PATH_SEP_CHR '\\'
66 #define EXE_NAME wxT("rbutil.exe")
67 #else
68 #define PATH_SEP wxT("/")
69 #define PATH_SEP_CHR '/'
70 #define EXE_NAME wxT("rbutil")
71 #endif
73 #define UNINSTALL_FILE wxT(".rockbox" PATH_SEP ".rbutil_install_data")
74 #define MAX_PLATFORMS 50
75 #define SYSTEM_CONFIG rbutil.ini
76 #define FILE_BUFFER_SIZE 1024
78 //WX_DEFINE_OBJARRAY(bool, wxArrayBool);
80 class GlobalVars
82 public:
83 // Program configuration data (rbutil.ini and environment)
84 wxFileConfig* GlobalConfig;
85 wxFileConfig* UserConfig;
86 wxString UserConfigFile;
87 wxString GlobalConfigFile;
88 wxString AppDir;
89 wxString ResourceDir;
91 wxString* ErrStr;
92 wxStandardPaths* stdpaths;
93 wxArrayString plat_id;
94 wxArrayString plat_name;
95 wxArrayInt plat_released;
96 wxArrayInt plat_needsbootloader;
97 wxArrayString plat_bootloadermethod;
98 wxArrayString plat_bootloadername;
99 wxArrayString plat_resolution;
100 wxString download_url;
101 wxString daily_url;
102 wxString bleeding_url;
103 wxString server_conf_url;
104 wxString font_url;
105 wxString last_release;
106 wxString prog_name;
107 wxString bootloader_url;
108 wxString themes_url;
109 wxString manual_url;
110 wxString doom_url;
111 wxString proxy_url;
114 // User configuration data.
115 wxString curplat;
116 // unsigned int curplatnum;
117 wxString curdestdir;
118 wxString curfirmware;
119 unsigned int curbuild;
120 bool curisfull;
121 bool nocache;
122 bool portable;
123 wxString curresolution;
124 wxArrayString themesToInstall;
126 // Global system variables
127 wxFFile* logfile;
128 wxLogStderr* logstderr;
129 wxLogChain* logchain;
130 wxLogGui* loggui;
133 extern GlobalVars* gv;
135 wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
136 const wxString& appVariableName);
137 int DownloadURL(wxString src, wxString dest);
138 int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
139 int Uninstall(const wxString dir, bool isFullUninstall = false);
140 bool InstallRbutil(wxString dest);
141 bool InstallTheme(wxString src);
142 bool checkZip(wxString zipname);
143 wxString stream_err_str(int errnum);
144 bool rm_rf(wxString file);
147 #define ERR_DIALOG(msg, title) \
148 wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
150 #define WARN_DIALOG(msg, title) \
151 wxLogWarning(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
153 #define MESG_DIALOG(msg) \
154 wxLogMessage(msg)
156 #define INFO_DIALOG(msg) \
157 wxLogInfo(msg)
159 #define BUILD_RELEASE 0
160 #define BUILD_DAILY 1
161 #define BUILD_BLEEDING 2
163 #define BOOTLOADER_ADD 0
164 #define BOOTLOADER_REM 1
167 #endif