diff options
Diffstat (limited to 'rbutil/rbutilFrm.cpp')
-rw-r--r-- | rbutil/rbutilFrm.cpp | 1164 |
1 files changed, 0 insertions, 1164 deletions
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp deleted file mode 100644 index 306f955d46..0000000000 --- a/rbutil/rbutilFrm.cpp +++ /dev/null | |||
@@ -1,1164 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * Module: rbutil | ||
9 | * File: rbutilFrm.cpp | ||
10 | * | ||
11 | * Copyright (C) 2005 Christi Alice Scarborough | ||
12 | * | ||
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. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "rbutilFrm.h" | ||
22 | #include "credits.h" | ||
23 | |||
24 | #include "rbutilFrm_XPM.xpm" | ||
25 | #include "icons/rbinstall_btn.h" | ||
26 | #include "icons/remrb_btn.h" | ||
27 | #include "icons/font_btn.h" | ||
28 | #include "icons/bootloader_btn.h" | ||
29 | #include "icons/rembootloader_btn.h" | ||
30 | #include "icons/themes_btn.h" | ||
31 | #include "icons/doom_btn.h" | ||
32 | #include "icons/talkfile_btn.h" | ||
33 | |||
34 | #include "rblogo.xpm" | ||
35 | |||
36 | #include "bootloaders.h" | ||
37 | #include "install_dialogs.h" | ||
38 | |||
39 | |||
40 | |||
41 | //---------------------------------------------------------------------------- | ||
42 | // rbutilFrm | ||
43 | //---------------------------------------------------------------------------- | ||
44 | |||
45 | BEGIN_EVENT_TABLE(rbutilFrm,wxFrame) | ||
46 | EVT_BUTTON (ID_INSTALL_BTN, rbutilFrm::OnInstallBtn) | ||
47 | EVT_BUTTON (ID_REMOVE_BTN, rbutilFrm::OnRemoveBtn) | ||
48 | EVT_BUTTON (ID_FONT_BTN, rbutilFrm::OnFontBtn) | ||
49 | EVT_BUTTON (ID_THEMES_BTN, rbutilFrm::OnThemesBtn) | ||
50 | EVT_BUTTON (ID_BOOTLOADER_BTN, rbutilFrm::OnBootloaderBtn) | ||
51 | EVT_BUTTON (ID_BOOTLOADERREMOVE_BTN, rbutilFrm::OnBootloaderRemoveBtn) | ||
52 | EVT_BUTTON (ID_DOOM_BTN, rbutilFrm::OnDoomBtn) | ||
53 | EVT_BUTTON (ID_TALK_BTN, rbutilFrm::OnTalkBtn) | ||
54 | |||
55 | EVT_CLOSE(rbutilFrm::rbutilFrmClose) | ||
56 | EVT_MENU(ID_FILE_EXIT, rbutilFrm::OnFileExit) | ||
57 | EVT_MENU(ID_FILE_ABOUT, rbutilFrm::OnFileAbout) | ||
58 | EVT_MENU(ID_FILE_WIPECACHE, rbutilFrm::OnFileWipeCache) | ||
59 | EVT_MENU(ID_PORTABLE_INSTALL, rbutilFrm::OnPortableInstall) | ||
60 | |||
61 | EVT_MENU(ID_FILE_PROXY, rbutilFrm::OnFileProxy) | ||
62 | |||
63 | EVT_UPDATE_UI (ID_MANUAL, rbutilFrm::OnManualUpdate) | ||
64 | |||
65 | END_EVENT_TABLE() | ||
66 | |||
67 | rbutilFrm::rbutilFrm( wxWindow *parent, wxWindowID id, const wxString &title, | ||
68 | const wxPoint &position, const wxSize& size, long style ) | ||
69 | : wxFrame( parent, id, title, position, size, style) | ||
70 | { | ||
71 | wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrm(...)")); | ||
72 | CreateGUIControls(); | ||
73 | wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrm")); | ||
74 | } | ||
75 | |||
76 | rbutilFrm::~rbutilFrm() {} | ||
77 | |||
78 | void rbutilFrm::CreateGUIControls(void) | ||
79 | { | ||
80 | wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()")); | ||
81 | |||
82 | wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL); | ||
83 | this->SetSizer(WxBoxSizer1); | ||
84 | this->SetAutoLayout(TRUE); | ||
85 | |||
86 | wxPanel* mainPanel = new wxPanel(this,wxID_ANY); | ||
87 | WxBoxSizer1->Add(mainPanel,1,wxGROW|wxALL,0); | ||
88 | wxBoxSizer* WxBoxSizer0 = new wxBoxSizer(wxVERTICAL); | ||
89 | mainPanel->SetSizer(WxBoxSizer0); | ||
90 | mainPanel->SetAutoLayout(TRUE); | ||
91 | |||
92 | wxBitmap rockboxbmp(rblogo_xpm); | ||
93 | ImageCtrl* rockboxbmpCtrl = new ImageCtrl(mainPanel,wxID_ANY); | ||
94 | rockboxbmpCtrl->SetBitmap(rockboxbmp); | ||
95 | |||
96 | WxBoxSizer0->Add(rockboxbmpCtrl,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5); | ||
97 | |||
98 | myDeviceSelector = new DeviceSelectorCtrl(mainPanel,wxID_ANY); | ||
99 | myDeviceSelector->setDefault(); | ||
100 | myDeviceSelector->AutoDetect(); | ||
101 | WxBoxSizer0->Add(myDeviceSelector,0,wxGROW|wxALL,5); | ||
102 | |||
103 | |||
104 | wxNotebook* tabwindow = new wxNotebook(mainPanel,wxID_ANY); | ||
105 | WxBoxSizer0->Add(tabwindow,1,wxGROW|wxALL,5); | ||
106 | |||
107 | wxPanel* installpage = new wxPanel(tabwindow,wxID_ANY); | ||
108 | wxPanel* themepage = new wxPanel(tabwindow,wxID_ANY); | ||
109 | wxPanel* uninstallpage = new wxPanel(tabwindow,wxID_ANY); | ||
110 | wxPanel* manualpage = new wxPanel(tabwindow,wxID_ANY); | ||
111 | tabwindow->AddPage(installpage,wxT("Installation"),true); | ||
112 | tabwindow->AddPage(themepage,wxT("Extras")); | ||
113 | tabwindow->AddPage(uninstallpage,wxT("Uninstallation")); | ||
114 | tabwindow->AddPage(manualpage,wxT("Manual")); | ||
115 | |||
116 | /********************* | ||
117 | Install Page | ||
118 | ***********************/ | ||
119 | |||
120 | wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxVERTICAL); | ||
121 | installpage->SetSizer(WxBoxSizer2); | ||
122 | installpage->SetAutoLayout(TRUE); | ||
123 | |||
124 | wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(installpage, | ||
125 | wxID_ANY, wxT("Please choose an option")); | ||
126 | wxStaticBoxSizer* WxStaticBoxSizer3 = | ||
127 | new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxHORIZONTAL); | ||
128 | WxBoxSizer2->Add(WxStaticBoxSizer3,1,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5); | ||
129 | |||
130 | wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(2,2,0,0); | ||
131 | WxStaticBoxSizer3->Add(WxFlexGridSizer1,0,wxGROW | wxALL,0); | ||
132 | |||
133 | |||
134 | wxBitmap BootloaderInstallButton (wxGetBitmapFromMemory(bootloader_btn_png,bootloader_btn_png_length)); | ||
135 | WxBitmapButton4 = new wxBitmapButton(installpage, ID_BOOTLOADER_BTN, | ||
136 | BootloaderInstallButton, wxPoint(0,0), wxSize(64,54), | ||
137 | wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,wxT("Bootloader Installation")); | ||
138 | WxBitmapButton4->SetToolTip(wxT("Click here to install the Rockbox bootloader")); | ||
139 | WxFlexGridSizer1->Add(WxBitmapButton4, 0, | ||
140 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
141 | |||
142 | wxStaticText* WxStaticText5 = new wxStaticText(installpage, wxID_ANY, | ||
143 | wxT("Bootloader installation\n\n" | ||
144 | "Before Rockbox can be installed on your audio player, you " | ||
145 | "may have to\ninstall a bootloader.\nThis is only necessary the first time " | ||
146 | "Rockbox is installed.")); | ||
147 | WxFlexGridSizer1->Add(WxStaticText5, 0, | ||
148 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
149 | |||
150 | wxBitmap WxBitmapButton1_BITMAP (wxGetBitmapFromMemory(rbinstall_btn_png,rbinstall_btn_png_length)); | ||
151 | WxBitmapButton1 = new wxBitmapButton(installpage, ID_INSTALL_BTN, | ||
152 | WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54), | ||
153 | wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator, | ||
154 | wxT("Rockbox Installation")); | ||
155 | WxBitmapButton1->SetToolTip(wxT("Click here to install Rockbox")); | ||
156 | WxFlexGridSizer1->Add(WxBitmapButton1,0, | ||
157 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
158 | |||
159 | WxStaticText2 = new wxStaticText(installpage, ID_WXSTATICTEXT2, | ||
160 | wxT("Install Rockbox on your audio player")); | ||
161 | WxFlexGridSizer1->Add(WxStaticText2,0, | ||
162 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
163 | |||
164 | /*********************+ | ||
165 | Extras Page | ||
166 | ***********************/ | ||
167 | |||
168 | wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxVERTICAL); | ||
169 | themepage->SetSizer(WxBoxSizer3); | ||
170 | themepage->SetAutoLayout(TRUE); | ||
171 | |||
172 | wxStaticBox* WxStaticBoxSizer4_StaticBoxObj = new wxStaticBox(themepage, | ||
173 | wxID_ANY, wxT("Please choose an option")); | ||
174 | wxStaticBoxSizer* WxStaticBoxSizer4 = | ||
175 | new wxStaticBoxSizer(WxStaticBoxSizer4_StaticBoxObj,wxHORIZONTAL); | ||
176 | WxBoxSizer3->Add(WxStaticBoxSizer4,1,wxALIGN_CENTER_HORIZONTAL |wxGROW| wxALL, 5); | ||
177 | |||
178 | wxFlexGridSizer* WxFlexGridSizer2 = new wxFlexGridSizer(2,2,0,0); | ||
179 | WxStaticBoxSizer4->Add(WxFlexGridSizer2,0,wxGROW | wxALL,0); | ||
180 | |||
181 | wxBitmap FontInstallButton (wxGetBitmapFromMemory(font_btn_png,font_btn_png_length)); | ||
182 | WxBitmapButton3 = new wxBitmapButton(themepage, ID_FONT_BTN, | ||
183 | FontInstallButton, wxPoint(0,0), wxSize(64,54), | ||
184 | wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Font installation")); | ||
185 | WxBitmapButton3->SetToolTip(wxT("Click here to install the most up to date " | ||
186 | "Rockbox fonts.")); | ||
187 | WxFlexGridSizer2->Add(WxBitmapButton3, 0, | ||
188 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
189 | |||
190 | wxStaticText* WxStaticText4 = new wxStaticText(themepage, wxID_ANY, | ||
191 | wxT("Install the Rockbox fonts package\n\n" | ||
192 | "This step is needed for many Themes. You " | ||
193 | "will not need to download these\nagain unless you uninstall " | ||
194 | "Rockbox.")); | ||
195 | WxFlexGridSizer2->Add(WxStaticText4, 0, | ||
196 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
197 | |||
198 | wxBitmap ThemesInstallButton (wxGetBitmapFromMemory(themes_btn_png,themes_btn_png_length)); | ||
199 | WxBitmapButton5 = new wxBitmapButton(themepage, ID_THEMES_BTN, | ||
200 | ThemesInstallButton, wxPoint(0,0), wxSize(64,54), | ||
201 | wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Theme installation")); | ||
202 | WxBitmapButton5->SetToolTip(wxT("Click here to install themes for Rockbox.")); | ||
203 | WxFlexGridSizer2->Add(WxBitmapButton5, 0, | ||
204 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
205 | |||
206 | wxStaticText* WxStaticText6 = new wxStaticText(themepage, wxID_ANY, | ||
207 | wxT("Install more Themes for Rockbox.\n\n")); | ||
208 | WxFlexGridSizer2->Add(WxStaticText6, 0, | ||
209 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
210 | |||
211 | wxBitmap DoomInstallButton (wxGetBitmapFromMemory(doom_btn_png,doom_btn_png_length)); | ||
212 | WxBitmapButton6 = new wxBitmapButton(themepage, ID_DOOM_BTN, | ||
213 | DoomInstallButton, wxPoint(0,0), wxSize(64,54), | ||
214 | wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Freedoom installation")); | ||
215 | WxBitmapButton6->SetToolTip(wxT("Click here to install the freedoom wad files.")); | ||
216 | WxFlexGridSizer2->Add(WxBitmapButton6, 0, | ||
217 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
218 | |||
219 | wxStaticText* WxStaticText7 = new wxStaticText(themepage, wxID_ANY, | ||
220 | wxT("Install the freedoom wad files.\n\n")); | ||
221 | WxFlexGridSizer2->Add(WxStaticText7, 0, | ||
222 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
223 | |||
224 | wxBitmap TalkInstallButton (wxGetBitmapFromMemory(talkfile_btn_png,talkfile_btn_png_length)); | ||
225 | WxBitmapButton7 = new wxBitmapButton(themepage, ID_TALK_BTN, | ||
226 | TalkInstallButton, wxPoint(0,0), wxSize(64,54), | ||
227 | wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Create Talk Files")); | ||
228 | WxBitmapButton7->SetToolTip(wxT("Click here to create Talk files.")); | ||
229 | WxFlexGridSizer2->Add(WxBitmapButton7, 0, | ||
230 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
231 | |||
232 | wxStaticText* WxStaticText8 = new wxStaticText(themepage, wxID_ANY, | ||
233 | wxT("Create Talk Files.\n\n")); | ||
234 | WxFlexGridSizer2->Add(WxStaticText8, 0, | ||
235 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
236 | |||
237 | |||
238 | |||
239 | /*********************+ | ||
240 | Uninstall Page | ||
241 | ***********************/ | ||
242 | |||
243 | wxBoxSizer* WxBoxSizer4 = new wxBoxSizer(wxVERTICAL); | ||
244 | uninstallpage->SetSizer(WxBoxSizer4); | ||
245 | uninstallpage->SetAutoLayout(TRUE); | ||
246 | |||
247 | wxStaticBox* WxStaticBoxSizer5_StaticBoxObj = new wxStaticBox(uninstallpage, | ||
248 | wxID_ANY, wxT("Please choose an option")); | ||
249 | wxStaticBoxSizer* WxStaticBoxSizer5 = | ||
250 | new wxStaticBoxSizer(WxStaticBoxSizer5_StaticBoxObj,wxHORIZONTAL); | ||
251 | WxBoxSizer4->Add(WxStaticBoxSizer5,1,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5); | ||
252 | |||
253 | wxFlexGridSizer* WxFlexGridSizer3 = new wxFlexGridSizer(2,2,0,0); | ||
254 | WxStaticBoxSizer5->Add(WxFlexGridSizer3,0,wxGROW | wxALL,0); | ||
255 | |||
256 | wxBitmap WxBitmapButton2_BITMAP (wxGetBitmapFromMemory(remrb_btn_png,remrb_btn_png_length)); | ||
257 | WxBitmapButton2 = new wxBitmapButton(uninstallpage, ID_REMOVE_BTN, | ||
258 | WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54), | ||
259 | wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Rockbox uninstallation")); | ||
260 | WxBitmapButton2->SetToolTip(wxT("Click here to uninstall Rockbox")); | ||
261 | WxFlexGridSizer3->Add(WxBitmapButton2,0, | ||
262 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
263 | |||
264 | WxStaticText3 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT3, | ||
265 | wxT("Remove Rockbox from your audio player")); | ||
266 | WxFlexGridSizer3->Add(WxStaticText3,0, | ||
267 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
268 | |||
269 | wxBitmap WxBitmapButton4_BITMAP (wxGetBitmapFromMemory(rembootloader_btn_png,rembootloader_btn_png_length)); | ||
270 | WxBitmapButton4 = new wxBitmapButton(uninstallpage, ID_BOOTLOADERREMOVE_BTN, | ||
271 | WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54), | ||
272 | wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator, | ||
273 | wxT("Bootloader uninstallation")); | ||
274 | WxBitmapButton4->SetToolTip(wxT("Click here to uninstall the Bootloader")); | ||
275 | WxFlexGridSizer3->Add(WxBitmapButton4,0, | ||
276 | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
277 | |||
278 | WxStaticText4 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT4, | ||
279 | wxT("Remove Rockbox Bootloader from your audio player")); | ||
280 | WxFlexGridSizer3->Add(WxStaticText4,0, | ||
281 | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); | ||
282 | |||
283 | |||
284 | /***************** | ||
285 | * Manual Page | ||
286 | ******************/ | ||
287 | |||
288 | wxBoxSizer* WxBoxSizer5 = new wxBoxSizer(wxVERTICAL); | ||
289 | manualpage->SetSizer(WxBoxSizer5); | ||
290 | manualpage->SetAutoLayout(TRUE); | ||
291 | |||
292 | manuallink = new wxHyperlinkCtrl(manualpage,wxID_ANY,wxT("Rockbox PDF Manual"),wxT("http://www.rockbox.org")); | ||
293 | WxBoxSizer5->Add(manuallink,1,wxGROW | wxALL, 5); | ||
294 | |||
295 | manual =new wxHtmlWindow(manualpage,ID_MANUAL); | ||
296 | WxBoxSizer5->Add(manual,10,wxGROW | wxALL, 5); | ||
297 | |||
298 | |||
299 | /********** | ||
300 | ** rest of the controls | ||
301 | **********/ | ||
302 | |||
303 | WxMenuBar1 = new wxMenuBar(); | ||
304 | wxMenu *ID_FILE_MENU_Mnu_Obj = new wxMenu(0); | ||
305 | WxMenuBar1->Append(ID_FILE_MENU_Mnu_Obj, wxT("&File")); | ||
306 | |||
307 | ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_WIPECACHE, | ||
308 | wxT("&Empty local download cache"), wxT(""), wxITEM_NORMAL); | ||
309 | if (! gv->portable ) | ||
310 | { | ||
311 | ID_FILE_MENU_Mnu_Obj->Append(ID_PORTABLE_INSTALL, | ||
312 | wxT("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL); | ||
313 | } | ||
314 | ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_PROXY, wxT("Set &Proxy"), wxT(""), | ||
315 | wxITEM_NORMAL); | ||
316 | ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_ABOUT, wxT("&About"), wxT(""), | ||
317 | wxITEM_NORMAL); | ||
318 | ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_EXIT, wxT("E&xit\tCtrl+X"), wxT(""), | ||
319 | wxITEM_NORMAL); | ||
320 | |||
321 | this->SetMenuBar(WxMenuBar1); | ||
322 | Layout(); | ||
323 | GetSizer()->Fit(this); | ||
324 | GetSizer()->SetSizeHints(this); | ||
325 | if (gv->portable) | ||
326 | { | ||
327 | this->SetTitle(wxT("Rockbox Utility (portable)")); | ||
328 | } else | ||
329 | { | ||
330 | this->SetTitle(wxT("Rockbox Utility")); | ||
331 | } | ||
332 | this->Center(); | ||
333 | wxIcon rbutilFrm_ICON (rbutilFrm_XPM); | ||
334 | this->SetIcon(rbutilFrm_XPM); | ||
335 | this->SetToolTip(wxT("Install Rockbox")); | ||
336 | |||
337 | wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls")); | ||
338 | } | ||
339 | |||
340 | void rbutilFrm::OnManualUpdate(wxUpdateUIEvent& event) | ||
341 | { | ||
342 | wxString tmp = wxT("/rockbox-") + gv->curplat; | ||
343 | |||
344 | int index = GetDeviceId(false); | ||
345 | if(index < 0) { | ||
346 | curManualDevice = tmp; | ||
347 | wxString pdflink; | ||
348 | pdflink = gv->manual_url; | ||
349 | manuallink->SetURL(pdflink); | ||
350 | manual->SetPage(wxT("<p><b>no device selected</b> — " | ||
351 | "You can find an overview of available manuals at " | ||
352 | "<a href='http://www.rockbox.org/manual.shtml'>" | ||
353 | "http://www.rockbox.org/manual.shtml</a></p>")); | ||
354 | return; | ||
355 | } | ||
356 | |||
357 | if(gv->plat_manualname[index] != wxT("")) | ||
358 | tmp = wxT("/") + gv->plat_manualname[index]; | ||
359 | |||
360 | if( tmp == curManualDevice) | ||
361 | return; | ||
362 | |||
363 | curManualDevice = tmp; | ||
364 | |||
365 | // construct link to pdf | ||
366 | wxString pdflink; | ||
367 | pdflink = gv->manual_url + tmp + wxT(".pdf"); | ||
368 | manuallink->SetURL(pdflink); | ||
369 | |||
370 | // construct link to html | ||
371 | wxString htmllink; | ||
372 | htmllink = gv->manual_url + tmp + wxT("/rockbox-build.html"); | ||
373 | if(gv->proxy_url == wxT("")) | ||
374 | if(manual->LoadPage(htmllink)) return; | ||
375 | manual->SetPage(wxT("<p>unable to display manual —" | ||
376 | "please use the PDF link above</p>")); | ||
377 | |||
378 | |||
379 | } | ||
380 | |||
381 | |||
382 | void rbutilFrm::OnFileProxy(wxCommandEvent& event) | ||
383 | { | ||
384 | |||
385 | wxTextEntryDialog proxydlg(this,wxT("Please enter your Proxy in the Format: URL:PORT"),wxT("Proxy Configuration"), gv->proxy_url); | ||
386 | |||
387 | if(proxydlg.ShowModal() == wxID_OK) | ||
388 | { | ||
389 | gv->proxy_url = proxydlg.GetValue(); | ||
390 | } | ||
391 | |||
392 | } | ||
393 | |||
394 | |||
395 | void rbutilFrm::rbutilFrmClose(wxCloseEvent& event) | ||
396 | { | ||
397 | wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrmClose(event)")); | ||
398 | Destroy(); | ||
399 | wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrmClose")); | ||
400 | } | ||
401 | |||
402 | |||
403 | |||
404 | /* | ||
405 | * OnFileExit | ||
406 | */ | ||
407 | void rbutilFrm::OnFileExit(wxCommandEvent& event) | ||
408 | { | ||
409 | wxLogVerbose(wxT("=== begin rbutilFrm::OnFileExit(event)")); | ||
410 | Close(); | ||
411 | wxLogVerbose(wxT("=== end rbutilFrm::OnFileExit")); | ||
412 | } | ||
413 | |||
414 | // The routines this code uses are in the wxWidgets documentation, but | ||
415 | // not yet the library (2.7.0-1). This code can be re-enabled later. | ||
416 | |||
417 | void rbutilFrm::OnFileAbout(wxCommandEvent& event) | ||
418 | { | ||
419 | /* | ||
420 | wxAboutDialogInfo *info = new wxAboutDialogInfo(); | ||
421 | |||
422 | info->SetName(wxT(RBUTIL_FULLNAME)); | ||
423 | info->SetVersion(wxT(RBUTIL_VERSION)); | ||
424 | info->SetCopyright(wxT(RBUTIL_COPYRIGHT)); | ||
425 | info->SetDescription(wxT(RBUTIL_DESCRIPTION)); | ||
426 | info->SetWebSite(wxT(RBUTIL_WEBSITE)); | ||
427 | |||
428 | long i = 0; | ||
429 | while (rbutil_developers[i] != "") | ||
430 | { | ||
431 | info->AddDeveloper(wxT(rbutil_developers[i++])); | ||
432 | } | ||
433 | |||
434 | wxAboutBox(*info); | ||
435 | delete info; | ||
436 | */ | ||
437 | |||
438 | AboutDlg(this).ShowModal(); | ||
439 | } | ||
440 | |||
441 | void rbutilFrm::OnFileWipeCache(wxCommandEvent& event) | ||
442 | { | ||
443 | wxString cacheloc, datadir; | ||
444 | |||
445 | datadir = gv->stdpaths->GetUserDataDir(); | ||
446 | if (datadir == wxT("")) | ||
447 | { | ||
448 | ERR_DIALOG(wxT("Can't locate user data directory. Unable to delete " | ||
449 | "cache."), wxT("Delete download cache.") ); | ||
450 | return; | ||
451 | } | ||
452 | |||
453 | cacheloc = datadir + wxT("" PATH_SEP "download"); | ||
454 | |||
455 | if (! rm_rf(cacheloc) ) | ||
456 | { | ||
457 | wxMessageDialog* msg = new wxMessageDialog(this, wxT("Local download cache has been deleted.") | ||
458 | , wxT("Cache deletion"), wxOK |wxICON_INFORMATION); | ||
459 | msg->ShowModal(); | ||
460 | delete msg; | ||
461 | } | ||
462 | else { | ||
463 | MESG_DIALOG(wxT("Errors occured deleting the local download cache.")); | ||
464 | } | ||
465 | |||
466 | wxMkdir(cacheloc, 0777); | ||
467 | } | ||
468 | |||
469 | void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event) | ||
470 | { | ||
471 | wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)")); | ||
472 | |||
473 | int index = GetDeviceId(true); | ||
474 | if(index < 0) | ||
475 | return; | ||
476 | |||
477 | wxString bootloadermethod = gv->plat_bootloadermethod[index]; | ||
478 | |||
479 | if(!gv->plat_needsbootloader[index]) | ||
480 | { | ||
481 | WARN_DIALOG(wxT("This Device doesnt need a Bootloader"), | ||
482 | wxT("Bootloader")); | ||
483 | return; | ||
484 | } | ||
485 | |||
486 | // really deinstall ? | ||
487 | wxMessageDialog msg(this,wxT("Do you really want to deinstall the Bootloader ?"),wxT("Bootloader deinstallation"),wxOK|wxCANCEL); | ||
488 | if(msg.ShowModal() != wxID_OK ) | ||
489 | return; | ||
490 | |||
491 | |||
492 | if(bootloadermethod == wxT("ipodpatcher")) | ||
493 | { | ||
494 | wxString bootloadername = wxT("bootloader-"); | ||
495 | bootloadername.Append(gv->plat_bootloadername[index] ); | ||
496 | if(ipodpatcher(BOOTLOADER_REM,bootloadername)) | ||
497 | { | ||
498 | MESG_DIALOG(wxT("The Bootloader has been uninstalled.") ); | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | MESG_DIALOG(wxT("The Uninstallation failed.") ); | ||
503 | } | ||
504 | } | ||
505 | else if(bootloadermethod == wxT("sansapatcher")) | ||
506 | { | ||
507 | if(sansapatcher(BOOTLOADER_REM,gv->plat_bootloadername[index])) | ||
508 | { | ||
509 | MESG_DIALOG(wxT("The Bootloader has been uninstalled.") ); | ||
510 | } | ||
511 | else | ||
512 | { | ||
513 | MESG_DIALOG(wxT("The Uninstallation failed.") ); | ||
514 | } | ||
515 | } | ||
516 | else if(bootloadermethod== wxT("gigabeatf")) | ||
517 | { | ||
518 | |||
519 | if(gigabeatf(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir)) | ||
520 | { | ||
521 | MESG_DIALOG(wxT("The Bootloader has been uninstalled.")); | ||
522 | } | ||
523 | else | ||
524 | MESG_DIALOG(wxT("The Uninstallation failed.") ); | ||
525 | } | ||
526 | else if(bootloadermethod == wxT("iaudio") ) | ||
527 | { | ||
528 | MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n" | ||
529 | "you need to download and install an Original Firmware from the Manufacturer.")); | ||
530 | } | ||
531 | else if(bootloadermethod == wxT("fwpatcher")) | ||
532 | { | ||
533 | MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n" | ||
534 | "you need to download and install an original Firmware from the Manufacturer.\n" | ||
535 | "To do this, you need to boot into the original Firmware.")); | ||
536 | } | ||
537 | else if(bootloadermethod == wxT("h10")) | ||
538 | { | ||
539 | if(h10(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir)) | ||
540 | { | ||
541 | MESG_DIALOG(wxT("The Bootloader has been uninstalled.")); | ||
542 | } | ||
543 | else | ||
544 | MESG_DIALOG(wxT("The Uninstallation failed.") ); | ||
545 | } | ||
546 | else | ||
547 | { | ||
548 | MESG_DIALOG(wxT("Unsupported Bootloader Uninstall method.") ); | ||
549 | } | ||
550 | |||
551 | wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn")); | ||
552 | } | ||
553 | |||
554 | void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event) | ||
555 | { | ||
556 | wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)")); | ||
557 | |||
558 | int index = GetDeviceId(true); | ||
559 | if(index < 0) | ||
560 | return; | ||
561 | |||
562 | wxString bootloadermethod = gv->plat_bootloadermethod[index]; | ||
563 | |||
564 | if(!gv->plat_needsbootloader[index]) | ||
565 | { | ||
566 | WARN_DIALOG(wxT("This Device doesnt need a Bootloader"), | ||
567 | wxT("Bootloader")); | ||
568 | return; | ||
569 | } | ||
570 | |||
571 | // Bootloader dialog | ||
572 | if(bootloadermethod != wxT("ipodpatcher") && bootloadermethod != wxT("sansapatcher") ) | ||
573 | { | ||
574 | bootloaderInstallDlg dialog(NULL, wxID_ANY,wxT("Bootloader Installation")); | ||
575 | if (dialog.ShowModal() != wxID_OK) | ||
576 | return; | ||
577 | } | ||
578 | |||
579 | // really install ? | ||
580 | wxMessageDialog msg(this,wxT("Do you really want to install the Bootloader ?"),wxT("Bootloader installation"),wxOK|wxCANCEL); | ||
581 | if(msg.ShowModal() != wxID_OK ) | ||
582 | return; | ||
583 | |||
584 | |||
585 | if(bootloadermethod == wxT("ipodpatcher")) | ||
586 | { | ||
587 | wxString bootloadername = wxT("bootloader-"); | ||
588 | bootloadername.Append(gv->plat_bootloadername[index] ); | ||
589 | if(ipodpatcher(BOOTLOADER_ADD,bootloadername)) | ||
590 | { | ||
591 | MESG_DIALOG(wxT("The Bootloader has been installed on your device.") ); | ||
592 | } | ||
593 | else | ||
594 | { | ||
595 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
596 | } | ||
597 | } | ||
598 | else if(bootloadermethod == wxT("sansapatcher")) | ||
599 | { | ||
600 | if(sansapatcher(BOOTLOADER_ADD,gv->plat_bootloadername[index])) | ||
601 | { | ||
602 | MESG_DIALOG(wxT("The Bootloader has been installed on your device.") ); | ||
603 | } | ||
604 | else | ||
605 | { | ||
606 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
607 | } | ||
608 | |||
609 | } | ||
610 | else if(bootloadermethod== wxT("gigabeatf")) | ||
611 | { | ||
612 | |||
613 | if(gigabeatf(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir)) | ||
614 | { | ||
615 | MESG_DIALOG(wxT("The Bootloader has been installed on your device.")); | ||
616 | } | ||
617 | else | ||
618 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
619 | } | ||
620 | else if(bootloadermethod == wxT("iaudio") ) | ||
621 | { | ||
622 | if(iaudiox5(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir)) | ||
623 | { | ||
624 | MESG_DIALOG(wxT("The Bootloader has been installed on your device.\n" | ||
625 | "Now turn OFF your Device, unplug USB,and insert Charger\n" | ||
626 | "Your Device will automatically upgrade the flash with the Rockbox bootloader")); | ||
627 | } | ||
628 | else | ||
629 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
630 | } | ||
631 | else if(bootloadermethod == wxT("fwpatcher")) | ||
632 | { | ||
633 | if(fwpatcher(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir,gv->curfirmware)) | ||
634 | { | ||
635 | MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n" | ||
636 | "Now use the Firmware upgrade option of your Device\n")); | ||
637 | } | ||
638 | else | ||
639 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
640 | } | ||
641 | else if(bootloadermethod == wxT("h10")) | ||
642 | { | ||
643 | if(h10(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir)) | ||
644 | { | ||
645 | MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n")); | ||
646 | } | ||
647 | else | ||
648 | MESG_DIALOG(wxT("The installation has failed.") ); | ||
649 | } | ||
650 | else | ||
651 | { | ||
652 | MESG_DIALOG(wxT("Unsupported Bootloader Install method.") ); | ||
653 | } | ||
654 | |||
655 | |||
656 | |||
657 | wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn")); | ||
658 | |||
659 | } | ||
660 | |||
661 | void rbutilFrm::OnInstallBtn(wxCommandEvent& event) | ||
662 | { | ||
663 | wxString src, dest, buf; | ||
664 | wxDateTime date; | ||
665 | wxTimeSpan day(24); | ||
666 | wxLogVerbose(wxT("=== begin rbutilFrm::OnInstallBtn(event)")); | ||
667 | wxFileSystem fs; | ||
668 | wxFileConfig* buildinfo; | ||
669 | wxDateSpan oneday; | ||
670 | |||
671 | int index = GetDeviceId(true); | ||
672 | if(index < 0) | ||
673 | return; | ||
674 | |||
675 | // rockbox install dialog | ||
676 | rockboxInstallDlg dialog(NULL, wxID_ANY, | ||
677 | wxT("Rockbox Installation")); | ||
678 | if (dialog.ShowModal() != wxID_OK) | ||
679 | return; | ||
680 | |||
681 | // really install | ||
682 | wxMessageDialog msg(this,wxT("Do you really want to install Rockbox ?"),wxT("rockbox installation"),wxOK|wxCANCEL); | ||
683 | if(msg.ShowModal() != wxID_OK ) | ||
684 | return; | ||
685 | |||
686 | |||
687 | switch (gv->curbuild) | ||
688 | { | ||
689 | case BUILD_RELEASE: | ||
690 | // This is a URL - don't use PATH_SEP | ||
691 | src = gv->download_url + gv->prog_name + wxT("-") | ||
692 | + gv->last_release + wxT("-") + gv->curplat + wxT(".zip"); | ||
693 | dest = gv->stdpaths->GetUserDataDir() + wxT("download" PATH_SEP) | ||
694 | + gv->prog_name + wxT("-") + gv->last_release + wxT("-") | ||
695 | + gv->curplat + wxT(".zip"); | ||
696 | break; | ||
697 | case BUILD_DAILY: | ||
698 | dest = gv->stdpaths->GetUserDataDir() | ||
699 | + PATH_SEP + wxT("download") + PATH_SEP + wxT("build-info"); | ||
700 | if (DownloadURL(gv->server_conf_url, dest)) { | ||
701 | WARN_DIALOG(wxT("Unable to download build status."), | ||
702 | wxT("Install")); | ||
703 | buf = wxT(""); | ||
704 | } else | ||
705 | { | ||
706 | buildinfo = new wxFileConfig(wxEmptyString, | ||
707 | wxEmptyString, dest); | ||
708 | buf = buildinfo->Read(wxT("/dailies/date")); | ||
709 | buildinfo->DeleteAll(); | ||
710 | |||
711 | if (buf.Len() != 8) { | ||
712 | dest = wxT("Invalid build date: ") + buf; | ||
713 | WARN_DIALOG(dest, wxT("Install")); | ||
714 | buf = wxT(""); | ||
715 | } | ||
716 | } | ||
717 | |||
718 | if (buf == wxT("")) { | ||
719 | WARN_DIALOG(wxT("Can't get date of latest build from " | ||
720 | "server. Using yesterday's date."), wxT("Install") ); | ||
721 | date = wxDateTime::Now(); | ||
722 | date.Subtract(oneday.Day()); | ||
723 | buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC | ||
724 | } | ||
725 | |||
726 | src = gv->daily_url + gv->curplat + wxT("/") + gv->prog_name | ||
727 | + wxT("-") + gv->curplat + wxT("-") + buf + wxT(".zip"); | ||
728 | |||
729 | dest = gv->stdpaths->GetUserDataDir() + PATH_SEP wxT("download") | ||
730 | + gv->prog_name + wxT("-") + gv->curplat + wxT("-") | ||
731 | + buf + wxT(".zip"); | ||
732 | break; | ||
733 | case BUILD_BLEEDING: | ||
734 | src = gv->bleeding_url + gv->curplat + wxT("/") | ||
735 | + gv->prog_name + wxT(".zip"); | ||
736 | dest = gv->stdpaths->GetUserDataDir() | ||
737 | + PATH_SEP wxT("download") PATH_SEP | ||
738 | + gv->prog_name + wxT(".zip"); | ||
739 | break; | ||
740 | default: | ||
741 | ERR_DIALOG(wxT("Something seriously odd has happened."), | ||
742 | wxT("Install")); | ||
743 | return; | ||
744 | break; | ||
745 | } | ||
746 | |||
747 | if (gv->nocache || ( ! wxFileExists(dest) ) ) | ||
748 | { | ||
749 | if ( DownloadURL(src, dest) ) | ||
750 | { | ||
751 | wxRemoveFile(dest); | ||
752 | ERR_DIALOG(wxT("Unable to download ")+src, wxT("Install")); | ||
753 | return; | ||
754 | } | ||
755 | } | ||
756 | |||
757 | if ( !UnzipFile(dest, gv->curdestdir, true) ) | ||
758 | { | ||
759 | wxMessageDialog* msg = new wxMessageDialog(this, wxT("Rockbox has been installed on your device.") | ||
760 | ,wxT("Installation"), wxOK |wxICON_INFORMATION); | ||
761 | msg->ShowModal(); | ||
762 | delete msg; | ||
763 | } else | ||
764 | { | ||
765 | wxRemoveFile(dest); | ||
766 | ERR_DIALOG(wxT("Unable to unzip ")+dest, wxT("Install")); | ||
767 | } | ||
768 | |||
769 | |||
770 | wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn")); | ||
771 | } | ||
772 | |||
773 | void rbutilFrm::OnFontBtn(wxCommandEvent& event) | ||
774 | { | ||
775 | wxString src, dest, buf; | ||
776 | wxDateTime date; | ||
777 | wxTimeSpan day(24); | ||
778 | wxLogVerbose(wxT("=== begin rbutilFrm::OnFontBtn(event)")); | ||
779 | wxFileSystem fs; | ||
780 | wxFileConfig* buildinfo; | ||
781 | wxDateSpan oneday; | ||
782 | |||
783 | int index = GetDeviceId(true); | ||
784 | if(index < 0) | ||
785 | return; | ||
786 | |||
787 | // font install dialog | ||
788 | fontInstallDlg dialog(NULL, wxID_ANY, | ||
789 | wxT("Font Installation")); | ||
790 | if (dialog.ShowModal() != wxID_OK) | ||
791 | return; | ||
792 | |||
793 | // really install ? | ||
794 | wxMessageDialog msg(this,wxT("Do you really want to install the Fonts ?"),wxT("Font installation"),wxOK|wxCANCEL); | ||
795 | if(msg.ShowModal() != wxID_OK ) | ||
796 | return; | ||
797 | |||
798 | |||
799 | buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox"); | ||
800 | if (! wxDirExists(buf) ) | ||
801 | { | ||
802 | WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf | ||
803 | + wxT(" - install Rockbox first."), | ||
804 | wxT("Can't install fonts") ); | ||
805 | return; | ||
806 | } | ||
807 | |||
808 | dest = gv->stdpaths->GetUserDataDir() | ||
809 | + wxT( "" PATH_SEP "download" PATH_SEP "build-info"); | ||
810 | if (DownloadURL(gv->server_conf_url, dest)) | ||
811 | { | ||
812 | WARN_DIALOG(wxT("Unable to download build status."), | ||
813 | wxT("Font Install")); | ||
814 | buf = wxT(""); | ||
815 | } else | ||
816 | { | ||
817 | buildinfo = new wxFileConfig(wxEmptyString, | ||
818 | wxEmptyString, dest); | ||
819 | buf = buildinfo->Read(wxT("/dailies/date")); | ||
820 | buildinfo->DeleteAll(); | ||
821 | |||
822 | if (buf.Len() != 8) { | ||
823 | WARN_DIALOG(wxT("Invalid build date: ") + buf, wxT("Font Install")); | ||
824 | buf = wxT(""); | ||
825 | } | ||
826 | } | ||
827 | |||
828 | if (buf == wxT("")) { | ||
829 | WARN_DIALOG(wxT("Can't get date of latest build from " | ||
830 | "server. Using yesterday's date."), | ||
831 | wxT("Font Install") ); | ||
832 | date = wxDateTime::Now(); | ||
833 | date.Subtract(oneday.Day()); | ||
834 | buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC | ||
835 | } | ||
836 | |||
837 | src = gv->font_url + buf + wxT(".zip"); | ||
838 | |||
839 | dest = gv->stdpaths->GetUserDataDir() + wxT( "" PATH_SEP "download" | ||
840 | PATH_SEP "rockbox-fonts-") + buf + wxT(".zip"); | ||
841 | |||
842 | if ( ! wxFileExists(dest) ) | ||
843 | { | ||
844 | if ( DownloadURL(src, dest) ) | ||
845 | { | ||
846 | wxRemoveFile(dest); | ||
847 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Font Install")); | ||
848 | return; | ||
849 | } | ||
850 | } | ||
851 | |||
852 | if ( !UnzipFile(dest, gv->curdestdir, true) ) | ||
853 | { | ||
854 | wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Rockbox fonts have been installed on your device.") | ||
855 | ,wxT("Installation"), wxOK |wxICON_INFORMATION); | ||
856 | msg->ShowModal(); | ||
857 | delete msg; | ||
858 | } else | ||
859 | { | ||
860 | wxRemoveFile(dest); | ||
861 | ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Font Install")); | ||
862 | } | ||
863 | |||
864 | wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn")); | ||
865 | } | ||
866 | |||
867 | void rbutilFrm::OnDoomBtn(wxCommandEvent& event) | ||
868 | { | ||
869 | wxString src, dest, buf; | ||
870 | wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)")); | ||
871 | |||
872 | int index = GetDeviceId(true); | ||
873 | if(index < 0) | ||
874 | return; | ||
875 | |||
876 | // font install dialog, reused | ||
877 | fontInstallDlg dialog(NULL, wxID_ANY, | ||
878 | wxT("Freedoom wad file Installation")); | ||
879 | if (dialog.ShowModal() != wxID_OK) | ||
880 | return; | ||
881 | |||
882 | // really install ? | ||
883 | wxMessageDialog msg(this,wxT("Do you really want to install the Freedoom wads ?"),wxT("Freedoom installation"),wxOK|wxCANCEL); | ||
884 | if(msg.ShowModal() != wxID_OK ) | ||
885 | return; | ||
886 | |||
887 | buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox"); | ||
888 | if (! wxDirExists(buf) ) | ||
889 | { | ||
890 | WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf | ||
891 | + wxT(" - install Rockbox first."), | ||
892 | wxT("Can't install freedoom wads") ); | ||
893 | return; | ||
894 | } | ||
895 | |||
896 | src = gv->doom_url; | ||
897 | |||
898 | dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP | ||
899 | "rockdoom.zip"); | ||
900 | |||
901 | if ( ! wxFileExists(dest) ) | ||
902 | { | ||
903 | if ( DownloadURL(src, dest) ) | ||
904 | { | ||
905 | wxRemoveFile(dest); | ||
906 | ERR_DIALOG(wxT("Unable to download ") + src, | ||
907 | wxT("Freedoom Install")); | ||
908 | return; | ||
909 | } | ||
910 | } | ||
911 | |||
912 | if ( !UnzipFile(dest, gv->curdestdir, true) ) | ||
913 | { | ||
914 | wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Freedoom wads have been installed on your device.") | ||
915 | ,wxT("Installation"), wxOK |wxICON_INFORMATION); | ||
916 | msg->ShowModal(); | ||
917 | delete msg; | ||
918 | } else | ||
919 | { | ||
920 | wxRemoveFile(dest); | ||
921 | ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Freedoom Install")); | ||
922 | } | ||
923 | |||
924 | |||
925 | wxLogVerbose(wxT("=== end rbutilFrm::OnDoomBtn")); | ||
926 | } | ||
927 | |||
928 | |||
929 | void rbutilFrm::OnThemesBtn(wxCommandEvent& event) | ||
930 | { | ||
931 | wxString src, dest, buf; | ||
932 | wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)")); | ||
933 | |||
934 | int index = GetDeviceId(true); | ||
935 | if(index < 0) | ||
936 | return; | ||
937 | |||
938 | // Theme install dialog | ||
939 | themesInstallDlg dialog(NULL, wxID_ANY, | ||
940 | wxT("Theme Installation")); | ||
941 | if (dialog.ShowModal() != wxID_OK) | ||
942 | return; | ||
943 | |||
944 | // really install ? | ||
945 | wxMessageDialog msg(this,wxT("Do you really want to install the selected Themes ?"),wxT("Theme installation"),wxOK|wxCANCEL); | ||
946 | if(msg.ShowModal() != wxID_OK ) | ||
947 | return; | ||
948 | |||
949 | bool success=true; | ||
950 | for(unsigned int i=0 ;i < gv->themesToInstall.GetCount();i++) | ||
951 | { | ||
952 | if(!InstallTheme(gv->themesToInstall[i])) | ||
953 | { | ||
954 | MESG_DIALOG(wxT("The Themes installation has failed") ); | ||
955 | success=false; | ||
956 | break; | ||
957 | } | ||
958 | } | ||
959 | if(success) | ||
960 | { | ||
961 | MESG_DIALOG(wxT("The Theme installation completed successfully.") ); | ||
962 | } | ||
963 | |||
964 | |||
965 | wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)")); | ||
966 | } | ||
967 | |||
968 | |||
969 | void rbutilFrm::OnRemoveBtn(wxCommandEvent& event) | ||
970 | { | ||
971 | wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)")); | ||
972 | |||
973 | int index = GetDeviceId(true); | ||
974 | if(index < 0) | ||
975 | return; | ||
976 | |||
977 | // Rockbox deinstall dialog | ||
978 | rockboxDeInstallDlg dialog(NULL, wxID_ANY, | ||
979 | wxT("Rockbox Deinstallation")); | ||
980 | if (dialog.ShowModal() != wxID_OK) | ||
981 | return; | ||
982 | |||
983 | // really install ? | ||
984 | wxMessageDialog msg(this,wxT("Do you really want to deinstall Rockbox ?"),wxT("Rockbox deinstallation"),wxOK|wxCANCEL); | ||
985 | if(msg.ShowModal() != wxID_OK ) | ||
986 | return; | ||
987 | |||
988 | |||
989 | if (Uninstall(gv->curdestdir, gv->curisfull) ) | ||
990 | { | ||
991 | MESG_DIALOG( | ||
992 | wxT("The uninstallation wizard was cancelled or completed with " | ||
993 | "some errors.") ); | ||
994 | } else { | ||
995 | wxMessageDialog* msg = new wxMessageDialog(this, wxT("The uninstall wizard completed successfully\n" | ||
996 | "Depending on which Device you own, you also have to uninstall the Bootloader") | ||
997 | ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION); | ||
998 | msg->ShowModal(); | ||
999 | delete msg; | ||
1000 | } | ||
1001 | |||
1002 | wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn")); | ||
1003 | } | ||
1004 | |||
1005 | void rbutilFrm::OnPortableInstall(wxCommandEvent& event) | ||
1006 | { | ||
1007 | wxString src, dest, buf; | ||
1008 | wxLogVerbose(wxT("=== begin rbutilFrm::OnPortableInstall(event)")); | ||
1009 | wxFileSystem fs; | ||
1010 | wxDateSpan oneday; | ||
1011 | |||
1012 | int index = GetDeviceId(true); | ||
1013 | if(index < 0) | ||
1014 | return; | ||
1015 | |||
1016 | //portable install dialog ( reused font dialog) | ||
1017 | fontInstallDlg dialog(NULL, wxID_ANY, | ||
1018 | wxT("Rockbox Utility Portable Installation")); | ||
1019 | if (dialog.ShowModal() != wxID_OK) | ||
1020 | return; | ||
1021 | |||
1022 | // really install ? | ||
1023 | wxMessageDialog msg(this,wxT("Do you really want a portable install of rbutil ?"),wxT("rbutil installation"),wxOK|wxCANCEL); | ||
1024 | if(msg.ShowModal() != wxID_OK ) | ||
1025 | return; | ||
1026 | |||
1027 | if ( InstallRbutil(gv->curdestdir) ) | ||
1028 | { | ||
1029 | MESG_DIALOG(wxT("The Rockbox Utility has been installed on your device.")); | ||
1030 | |||
1031 | } else | ||
1032 | { | ||
1033 | ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install")); | ||
1034 | } | ||
1035 | |||
1036 | wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable")); | ||
1037 | } | ||
1038 | |||
1039 | void rbutilFrm::OnTalkBtn(wxCommandEvent& event) | ||
1040 | { | ||
1041 | wxLogVerbose(wxT("=== begin rbutilFrm::OnTalkBtn(event)")); | ||
1042 | |||
1043 | TalkFileCreator talk; | ||
1044 | |||
1045 | talkInstallDlg dialog(&talk,NULL,wxID_ANY); | ||
1046 | |||
1047 | if (dialog.ShowModal() != wxID_OK) | ||
1048 | return; | ||
1049 | |||
1050 | // really install ? | ||
1051 | wxMessageDialog msg(this,wxT("Do you really want to create Talkfiles ?"),wxT("Talk file creation"),wxOK|wxCANCEL); | ||
1052 | if(msg.ShowModal() != wxID_OK ) | ||
1053 | return; | ||
1054 | |||
1055 | if(talk.createTalkFiles()) | ||
1056 | { | ||
1057 | MESG_DIALOG(wxT("Talk files have been successfully created.")); | ||
1058 | } | ||
1059 | else | ||
1060 | { | ||
1061 | ERR_DIALOG(wxT("Talkfile creation failed"), wxT("Talk file creation")); | ||
1062 | } | ||
1063 | |||
1064 | wxLogVerbose(wxT("=== end rbutilFrm::OnTalkBtn")); | ||
1065 | } | ||
1066 | |||
1067 | int rbutilFrm::GetDeviceId(bool detect) | ||
1068 | { | ||
1069 | int index = gv->plat_id.Index(gv->curplat); | ||
1070 | if(index < 0 && detect) | ||
1071 | { | ||
1072 | if( wxMessageBox(wxT("No device selected. Do you want to autodetect " | ||
1073 | "the device?"), | ||
1074 | wxT("Warning"), wxYES_NO ) == wxYES ) | ||
1075 | { | ||
1076 | myDeviceSelector->AutoDetect(); | ||
1077 | index = gv->plat_id.Index(gv->curplat); | ||
1078 | if(index < 0) | ||
1079 | { | ||
1080 | WARN_DIALOG( wxT("Aborting"), wxT("Auto detection failed") ); | ||
1081 | return index; | ||
1082 | } | ||
1083 | else | ||
1084 | { | ||
1085 | if( wxMessageBox(wxT("Found ") + gv->plat_name[index] + | ||
1086 | wxT(". Do you want to continue?"), | ||
1087 | wxT("Device found"), wxYES_NO ) == wxYES ) | ||
1088 | return index; | ||
1089 | else | ||
1090 | return -1; | ||
1091 | } | ||
1092 | } | ||
1093 | else | ||
1094 | { | ||
1095 | return -1; | ||
1096 | } | ||
1097 | } | ||
1098 | return index; | ||
1099 | } | ||
1100 | |||
1101 | AboutDlg::AboutDlg(rbutilFrm* parent) | ||
1102 | : wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize, | ||
1103 | wxDEFAULT_DIALOG_STYLE) | ||
1104 | { | ||
1105 | wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL); | ||
1106 | this->SetSizer(WxBoxSizer1); | ||
1107 | this->SetAutoLayout(TRUE); | ||
1108 | |||
1109 | wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); | ||
1110 | |||
1111 | wxBitmap WxBitmap1 = wxBitmap(rbutilFrm_XPM); | ||
1112 | wxStaticBitmap* WxStaticBitmap1 = new wxStaticBitmap(this, wxID_ANY, | ||
1113 | WxBitmap1); | ||
1114 | WxBoxSizer2->Add(WxStaticBitmap1, 0, wxALL | wxCENTER, 5); | ||
1115 | |||
1116 | wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY, | ||
1117 | wxT(RBUTIL_FULLNAME), wxDefaultPosition, wxDefaultSize, | ||
1118 | wxALIGN_CENTER | wxST_NO_AUTORESIZE ); | ||
1119 | WxBoxSizer2->Add(WxStaticText1, 0, wxALL | wxCENTER, 5); | ||
1120 | WxBoxSizer1->Add(WxBoxSizer2, 0, wxALL, 5); | ||
1121 | |||
1122 | wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY, | ||
1123 | wxT(RBUTIL_VERSION "\n" RBUTIL_DESCRIPTION "\n\n" RBUTIL_COPYRIGHT)); | ||
1124 | WxStaticText2->Wrap(400); | ||
1125 | WxBoxSizer1->Add(WxStaticText2, 0, wxALL, 5); | ||
1126 | |||
1127 | wxHyperlinkCtrl* WxHyperlink1 = new wxHyperlinkCtrl(this, wxID_ANY, | ||
1128 | wxT(RBUTIL_WEBSITE), wxT(RBUTIL_WEBSITE) ); | ||
1129 | WxBoxSizer1->Add(WxHyperlink1, 0, wxALL, 5); | ||
1130 | |||
1131 | wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Contributors:")); | ||
1132 | wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1, | ||
1133 | wxVERTICAL); | ||
1134 | wxTextCtrl* WxTextCtrl1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, | ||
1135 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); | ||
1136 | |||
1137 | long i = 0; | ||
1138 | while ( rbutil_developers[i] != wxT("")) | ||
1139 | { | ||
1140 | WxTextCtrl1->AppendText(rbutil_developers[i++]); | ||
1141 | WxTextCtrl1->AppendText(wxT("\n")); | ||
1142 | } | ||
1143 | |||
1144 | WxBoxSizer1->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5); | ||
1145 | WxStaticBoxSizer2->Add(WxTextCtrl1, 1, wxGROW | wxALL, 0); | ||
1146 | |||
1147 | wxStdDialogButtonSizer* WxStdDialogButtonSizer1 = new wxStdDialogButtonSizer(); | ||
1148 | wxButton* WxOKButton = new wxButton(this, wxID_OK); | ||
1149 | WxStdDialogButtonSizer1->AddButton(WxOKButton); | ||
1150 | WxStdDialogButtonSizer1->Realize(); | ||
1151 | |||
1152 | WxBoxSizer1->Add(WxStdDialogButtonSizer1, 0, wxALL | wxCENTER, 5); | ||
1153 | |||
1154 | GetSizer()->Fit(this); | ||
1155 | GetSizer()->SetSizeHints(this); | ||
1156 | |||
1157 | //this->Center(); | ||
1158 | this->Show(); | ||
1159 | |||
1160 | } | ||
1161 | |||
1162 | AboutDlg::~AboutDlg() | ||
1163 | { | ||
1164 | } | ||