1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 "rbutilFrm.h"
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"
36 #include "bootloaders.h"
37 #include "install_dialogs.h"
41 //----------------------------------------------------------------------------
43 //----------------------------------------------------------------------------
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
)
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
)
61 EVT_MENU(ID_FILE_PROXY
, rbutilFrm::OnFileProxy
)
63 EVT_UPDATE_UI (ID_MANUAL
, rbutilFrm::OnManualUpdate
)
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
)
71 wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrm(...)"));
73 wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrm"));
76 rbutilFrm::~rbutilFrm() {}
78 void rbutilFrm::CreateGUIControls(void)
80 wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
82 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxVERTICAL
);
83 this->SetSizer(WxBoxSizer1
);
84 this->SetAutoLayout(TRUE
);
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
);
92 wxBitmap
rockboxbmp(rblogo_xpm
);
93 ImageCtrl
* rockboxbmpCtrl
= new ImageCtrl(mainPanel
,wxID_ANY
);
94 rockboxbmpCtrl
->SetBitmap(rockboxbmp
);
96 WxBoxSizer0
->Add(rockboxbmpCtrl
,0,wxALIGN_CENTER_HORIZONTAL
| wxALL
,5);
98 myDeviceSelector
= new DeviceSelectorCtrl(mainPanel
,wxID_ANY
);
99 myDeviceSelector
->setDefault();
100 myDeviceSelector
->AutoDetect();
101 WxBoxSizer0
->Add(myDeviceSelector
,0,wxGROW
|wxALL
,5);
104 wxNotebook
* tabwindow
= new wxNotebook(mainPanel
,wxID_ANY
);
105 WxBoxSizer0
->Add(tabwindow
,1,wxGROW
|wxALL
,5);
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"));
116 /*********************
118 ***********************/
120 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
121 installpage
->SetSizer(WxBoxSizer2
);
122 installpage
->SetAutoLayout(TRUE
);
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);
130 wxFlexGridSizer
* WxFlexGridSizer1
= new wxFlexGridSizer(2,2,0,0);
131 WxStaticBoxSizer3
->Add(WxFlexGridSizer1
,0,wxGROW
| wxALL
,0);
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);
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);
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);
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);
164 /*********************+
166 ***********************/
168 wxBoxSizer
* WxBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
169 themepage
->SetSizer(WxBoxSizer3
);
170 themepage
->SetAutoLayout(TRUE
);
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);
178 wxFlexGridSizer
* WxFlexGridSizer2
= new wxFlexGridSizer(2,2,0,0);
179 WxStaticBoxSizer4
->Add(WxFlexGridSizer2
,0,wxGROW
| wxALL
,0);
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 "
187 WxFlexGridSizer2
->Add(WxBitmapButton3
, 0,
188 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
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 "
195 WxFlexGridSizer2
->Add(WxStaticText4
, 0,
196 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
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);
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);
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);
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);
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);
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);
239 /*********************+
241 ***********************/
243 wxBoxSizer
* WxBoxSizer4
= new wxBoxSizer(wxVERTICAL
);
244 uninstallpage
->SetSizer(WxBoxSizer4
);
245 uninstallpage
->SetAutoLayout(TRUE
);
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);
253 wxFlexGridSizer
* WxFlexGridSizer3
= new wxFlexGridSizer(2,2,0,0);
254 WxStaticBoxSizer5
->Add(WxFlexGridSizer3
,0,wxGROW
| wxALL
,0);
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);
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);
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);
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);
288 wxBoxSizer
* WxBoxSizer5
= new wxBoxSizer(wxVERTICAL
);
289 manualpage
->SetSizer(WxBoxSizer5
);
290 manualpage
->SetAutoLayout(TRUE
);
292 manuallink
= new wxHyperlinkCtrl(manualpage
,wxID_ANY
,wxT("Rockbox PDF Manual"),wxT("http://www.rockbox.org"));
293 WxBoxSizer5
->Add(manuallink
,1,wxGROW
| wxALL
, 5);
295 manual
=new wxHtmlWindow(manualpage
,ID_MANUAL
);
296 WxBoxSizer5
->Add(manual
,10,wxGROW
| wxALL
, 5);
300 ** rest of the controls
303 WxMenuBar1
= new wxMenuBar();
304 wxMenu
*ID_FILE_MENU_Mnu_Obj
= new wxMenu(0);
305 WxMenuBar1
->Append(ID_FILE_MENU_Mnu_Obj
, wxT("&File"));
307 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_WIPECACHE
,
308 wxT("&Empty local download cache"), wxT(""), wxITEM_NORMAL
);
311 ID_FILE_MENU_Mnu_Obj
->Append(ID_PORTABLE_INSTALL
,
312 wxT("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL
);
314 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_PROXY
, wxT("Set &Proxy"), wxT(""),
316 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_ABOUT
, wxT("&About"), wxT(""),
318 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_EXIT
, wxT("E&xit\tCtrl+X"), wxT(""),
321 this->SetMenuBar(WxMenuBar1
);
323 GetSizer()->Fit(this);
324 GetSizer()->SetSizeHints(this);
327 this->SetTitle(wxT("Rockbox Utility (portable)"));
330 this->SetTitle(wxT("Rockbox Utility"));
333 wxIcon
rbutilFrm_ICON (rbutilFrm_XPM
);
334 this->SetIcon(rbutilFrm_XPM
);
335 this->SetToolTip(wxT("Install Rockbox"));
337 wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls"));
340 void rbutilFrm::OnManualUpdate(wxUpdateUIEvent
& event
)
342 wxString tmp
= wxT("/rockbox-") + gv
->curplat
;
344 int index
= GetDeviceId(false);
346 curManualDevice
= tmp
;
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>"));
357 if(gv
->plat_manualname
[index
] != wxT(""))
358 tmp
= wxT("/") + gv
->plat_manualname
[index
];
360 if( tmp
== curManualDevice
)
363 curManualDevice
= tmp
;
365 // construct link to pdf
367 pdflink
= gv
->manual_url
+ tmp
+ wxT(".pdf");
368 manuallink
->SetURL(pdflink
);
370 // construct link to html
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>"));
382 void rbutilFrm::OnFileProxy(wxCommandEvent
& event
)
385 wxTextEntryDialog
proxydlg(this,wxT("Please enter your Proxy in the Format: URL:PORT"),wxT("Proxy Configuration"), gv
->proxy_url
);
387 if(proxydlg
.ShowModal() == wxID_OK
)
389 gv
->proxy_url
= proxydlg
.GetValue();
395 void rbutilFrm::rbutilFrmClose(wxCloseEvent
& event
)
397 wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrmClose(event)"));
399 wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrmClose"));
407 void rbutilFrm::OnFileExit(wxCommandEvent
& event
)
409 wxLogVerbose(wxT("=== begin rbutilFrm::OnFileExit(event)"));
411 wxLogVerbose(wxT("=== end rbutilFrm::OnFileExit"));
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.
417 void rbutilFrm::OnFileAbout(wxCommandEvent
& event
)
420 wxAboutDialogInfo *info = new wxAboutDialogInfo();
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));
429 while (rbutil_developers[i] != "")
431 info->AddDeveloper(wxT(rbutil_developers[i++]));
438 AboutDlg(this).ShowModal();
441 void rbutilFrm::OnFileWipeCache(wxCommandEvent
& event
)
443 wxString cacheloc
, datadir
;
445 datadir
= gv
->stdpaths
->GetUserDataDir();
446 if (datadir
== wxT(""))
448 ERR_DIALOG(wxT("Can't locate user data directory. Unable to delete "
449 "cache."), wxT("Delete download cache.") );
453 cacheloc
= datadir
+ wxT("" PATH_SEP
"download");
455 if (! rm_rf(cacheloc
) )
457 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("Local download cache has been deleted.")
458 , wxT("Cache deletion"), wxOK
|wxICON_INFORMATION
);
463 MESG_DIALOG(wxT("Errors occured deleting the local download cache."));
466 wxMkdir(cacheloc
, 0777);
469 void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent
& event
)
471 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
473 int index
= GetDeviceId(true);
477 wxString bootloadermethod
= gv
->plat_bootloadermethod
[index
];
479 if(!gv
->plat_needsbootloader
[index
])
481 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
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
)
492 if(bootloadermethod
== wxT("ipodpatcher"))
494 wxString bootloadername
= wxT("bootloader-");
495 bootloadername
.Append(gv
->plat_bootloadername
[index
] );
496 if(ipodpatcher(BOOTLOADER_REM
,bootloadername
))
498 MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
502 MESG_DIALOG(wxT("The Uninstallation failed.") );
505 else if(bootloadermethod
== wxT("sansapatcher"))
507 if(sansapatcher(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
]))
509 MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
513 MESG_DIALOG(wxT("The Uninstallation failed.") );
516 else if(bootloadermethod
== wxT("gigabeatf"))
519 if(gigabeatf(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
521 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
524 MESG_DIALOG(wxT("The Uninstallation failed.") );
526 else if(bootloadermethod
== wxT("iaudio") )
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."));
531 else if(bootloadermethod
== wxT("fwpatcher"))
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."));
537 else if(bootloadermethod
== wxT("h10"))
539 if(h10(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
541 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
544 MESG_DIALOG(wxT("The Uninstallation failed.") );
548 MESG_DIALOG(wxT("Unsupported Bootloader Uninstall method.") );
551 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn"));
554 void rbutilFrm::OnBootloaderBtn(wxCommandEvent
& event
)
556 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
558 int index
= GetDeviceId(true);
562 wxString bootloadermethod
= gv
->plat_bootloadermethod
[index
];
564 if(!gv
->plat_needsbootloader
[index
])
566 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
572 if(bootloadermethod
!= wxT("ipodpatcher") && bootloadermethod
!= wxT("sansapatcher") )
574 bootloaderInstallDlg
dialog(NULL
, wxID_ANY
,wxT("Bootloader Installation"));
575 if (dialog
.ShowModal() != wxID_OK
)
580 wxMessageDialog
msg(this,wxT("Do you really want to install the Bootloader ?"),wxT("Bootloader installation"),wxOK
|wxCANCEL
);
581 if(msg
.ShowModal() != wxID_OK
)
585 if(bootloadermethod
== wxT("ipodpatcher"))
587 wxString bootloadername
= wxT("bootloader-");
588 bootloadername
.Append(gv
->plat_bootloadername
[index
] );
589 if(ipodpatcher(BOOTLOADER_ADD
,bootloadername
))
591 MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
595 MESG_DIALOG(wxT("The installation has failed.") );
598 else if(bootloadermethod
== wxT("sansapatcher"))
600 if(sansapatcher(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
]))
602 MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
606 MESG_DIALOG(wxT("The installation has failed.") );
610 else if(bootloadermethod
== wxT("gigabeatf"))
613 if(gigabeatf(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
615 MESG_DIALOG(wxT("The Bootloader has been installed on your device."));
618 MESG_DIALOG(wxT("The installation has failed.") );
620 else if(bootloadermethod
== wxT("iaudio") )
622 if(iaudiox5(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
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"));
629 MESG_DIALOG(wxT("The installation has failed.") );
631 else if(bootloadermethod
== wxT("fwpatcher"))
633 if(fwpatcher(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
,gv
->curfirmware
))
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"));
639 MESG_DIALOG(wxT("The installation has failed.") );
641 else if(bootloadermethod
== wxT("h10"))
643 if(h10(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
645 MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"));
648 MESG_DIALOG(wxT("The installation has failed.") );
652 MESG_DIALOG(wxT("Unsupported Bootloader Install method.") );
657 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn"));
661 void rbutilFrm::OnInstallBtn(wxCommandEvent
& event
)
663 wxString src
, dest
, buf
;
666 wxLogVerbose(wxT("=== begin rbutilFrm::OnInstallBtn(event)"));
668 wxFileConfig
* buildinfo
;
671 int index
= GetDeviceId(true);
675 // rockbox install dialog
676 rockboxInstallDlg
dialog(NULL
, wxID_ANY
,
677 wxT("Rockbox Installation"));
678 if (dialog
.ShowModal() != wxID_OK
)
682 wxMessageDialog
msg(this,wxT("Do you really want to install Rockbox ?"),wxT("rockbox installation"),wxOK
|wxCANCEL
);
683 if(msg
.ShowModal() != wxID_OK
)
687 switch (gv
->curbuild
)
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");
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."),
706 buildinfo
= new wxFileConfig(wxEmptyString
,
707 wxEmptyString
, dest
);
708 buf
= buildinfo
->Read(wxT("/dailies/date"));
709 buildinfo
->DeleteAll();
711 if (buf
.Len() != 8) {
712 dest
= wxT("Invalid build date: ") + buf
;
713 WARN_DIALOG(dest
, wxT("Install"));
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
726 src
= gv
->daily_url
+ gv
->curplat
+ wxT("/") + gv
->prog_name
727 + wxT("-") + gv
->curplat
+ wxT("-") + buf
+ wxT(".zip");
729 dest
= gv
->stdpaths
->GetUserDataDir() + PATH_SEP
wxT("download")
730 + gv
->prog_name
+ wxT("-") + gv
->curplat
+ wxT("-")
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");
741 ERR_DIALOG(wxT("Something seriously odd has happened."),
747 if (gv
->nocache
|| ( ! wxFileExists(dest
) ) )
749 if ( DownloadURL(src
, dest
) )
752 ERR_DIALOG(wxT("Unable to download ")+src
, wxT("Install"));
757 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
759 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("Rockbox has been installed on your device.")
760 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
766 ERR_DIALOG(wxT("Unable to unzip ")+dest
, wxT("Install"));
770 wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn"));
773 void rbutilFrm::OnFontBtn(wxCommandEvent
& event
)
775 wxString src
, dest
, buf
;
778 wxLogVerbose(wxT("=== begin rbutilFrm::OnFontBtn(event)"));
780 wxFileConfig
* buildinfo
;
783 int index
= GetDeviceId(true);
787 // font install dialog
788 fontInstallDlg
dialog(NULL
, wxID_ANY
,
789 wxT("Font Installation"));
790 if (dialog
.ShowModal() != wxID_OK
)
794 wxMessageDialog
msg(this,wxT("Do you really want to install the Fonts ?"),wxT("Font installation"),wxOK
|wxCANCEL
);
795 if(msg
.ShowModal() != wxID_OK
)
799 buf
= gv
->curdestdir
+ wxT("" PATH_SEP
".rockbox");
800 if (! wxDirExists(buf
) )
802 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
803 + wxT(" - install Rockbox first."),
804 wxT("Can't install fonts") );
808 dest
= gv
->stdpaths
->GetUserDataDir()
809 + wxT( "" PATH_SEP
"download" PATH_SEP
"build-info");
810 if (DownloadURL(gv
->server_conf_url
, dest
))
812 WARN_DIALOG(wxT("Unable to download build status."),
813 wxT("Font Install"));
817 buildinfo
= new wxFileConfig(wxEmptyString
,
818 wxEmptyString
, dest
);
819 buf
= buildinfo
->Read(wxT("/dailies/date"));
820 buildinfo
->DeleteAll();
822 if (buf
.Len() != 8) {
823 WARN_DIALOG(wxT("Invalid build date: ") + buf
, wxT("Font Install"));
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
837 src
= gv
->font_url
+ buf
+ wxT(".zip");
839 dest
= gv
->stdpaths
->GetUserDataDir() + wxT( "" PATH_SEP
"download"
840 PATH_SEP
"rockbox-fonts-") + buf
+ wxT(".zip");
842 if ( ! wxFileExists(dest
) )
844 if ( DownloadURL(src
, dest
) )
847 ERR_DIALOG(wxT("Unable to download ") + src
, wxT("Font Install"));
852 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
854 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("The Rockbox fonts have been installed on your device.")
855 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
861 ERR_DIALOG(wxT("Unable to unzip ") + dest
, wxT("Font Install"));
864 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
867 void rbutilFrm::OnDoomBtn(wxCommandEvent
& event
)
869 wxString src
, dest
, buf
;
870 wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)"));
872 int index
= GetDeviceId(true);
876 // font install dialog, reused
877 fontInstallDlg
dialog(NULL
, wxID_ANY
,
878 wxT("Freedoom wad file Installation"));
879 if (dialog
.ShowModal() != wxID_OK
)
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
)
887 buf
= gv
->curdestdir
+ wxT("" PATH_SEP
".rockbox");
888 if (! wxDirExists(buf
) )
890 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
891 + wxT(" - install Rockbox first."),
892 wxT("Can't install freedoom wads") );
898 dest
= gv
->stdpaths
->GetUserDataDir() + wxT("" PATH_SEP
"download" PATH_SEP
901 if ( ! wxFileExists(dest
) )
903 if ( DownloadURL(src
, dest
) )
906 ERR_DIALOG(wxT("Unable to download ") + src
,
907 wxT("Freedoom Install"));
912 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
914 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("The Freedoom wads have been installed on your device.")
915 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
921 ERR_DIALOG(wxT("Unable to unzip ") + dest
, wxT("Freedoom Install"));
925 wxLogVerbose(wxT("=== end rbutilFrm::OnDoomBtn"));
929 void rbutilFrm::OnThemesBtn(wxCommandEvent
& event
)
931 wxString src
, dest
, buf
;
932 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
934 int index
= GetDeviceId(true);
938 // Theme install dialog
939 themesInstallDlg
dialog(NULL
, wxID_ANY
,
940 wxT("Theme Installation"));
941 if (dialog
.ShowModal() != wxID_OK
)
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
)
950 for(unsigned int i
=0 ;i
< gv
->themesToInstall
.GetCount();i
++)
952 if(!InstallTheme(gv
->themesToInstall
[i
]))
954 MESG_DIALOG(wxT("The Themes installation has failed") );
961 MESG_DIALOG(wxT("The Theme installation completed successfully.") );
965 wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)"));
969 void rbutilFrm::OnRemoveBtn(wxCommandEvent
& event
)
971 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
973 int index
= GetDeviceId(true);
977 // Rockbox deinstall dialog
978 rockboxDeInstallDlg
dialog(NULL
, wxID_ANY
,
979 wxT("Rockbox Deinstallation"));
980 if (dialog
.ShowModal() != wxID_OK
)
984 wxMessageDialog
msg(this,wxT("Do you really want to deinstall Rockbox ?"),wxT("Rockbox deinstallation"),wxOK
|wxCANCEL
);
985 if(msg
.ShowModal() != wxID_OK
)
989 if (Uninstall(gv
->curdestdir
, gv
->curisfull
) )
992 wxT("The uninstallation wizard was cancelled or completed with "
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
);
1002 wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn"));
1005 void rbutilFrm::OnPortableInstall(wxCommandEvent
& event
)
1007 wxString src
, dest
, buf
;
1008 wxLogVerbose(wxT("=== begin rbutilFrm::OnPortableInstall(event)"));
1012 int index
= GetDeviceId(true);
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
)
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
)
1027 if ( InstallRbutil(gv
->curdestdir
) )
1029 MESG_DIALOG(wxT("The Rockbox Utility has been installed on your device."));
1033 ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install"));
1036 wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
1039 void rbutilFrm::OnTalkBtn(wxCommandEvent
& event
)
1041 wxLogVerbose(wxT("=== begin rbutilFrm::OnTalkBtn(event)"));
1043 TalkFileCreator talk
;
1045 talkInstallDlg
dialog(&talk
,NULL
,wxID_ANY
);
1047 if (dialog
.ShowModal() != wxID_OK
)
1051 wxMessageDialog
msg(this,wxT("Do you really want to create Talkfiles ?"),wxT("Talk file creation"),wxOK
|wxCANCEL
);
1052 if(msg
.ShowModal() != wxID_OK
)
1055 if(talk
.createTalkFiles())
1057 MESG_DIALOG(wxT("Talk files have been successfully created."));
1061 ERR_DIALOG(wxT("Talkfile creation failed"), wxT("Talk file creation"));
1064 wxLogVerbose(wxT("=== end rbutilFrm::OnTalkBtn"));
1067 int rbutilFrm::GetDeviceId(bool detect
)
1069 int index
= gv
->plat_id
.Index(gv
->curplat
);
1070 if(index
< 0 && detect
)
1072 if( wxMessageBox(wxT("No device selected. Do you want to autodetect "
1074 wxT("Warning"), wxYES_NO
) == wxYES
)
1076 myDeviceSelector
->AutoDetect();
1077 index
= gv
->plat_id
.Index(gv
->curplat
);
1080 WARN_DIALOG( wxT("Aborting"), wxT("Auto detection failed") );
1085 if( wxMessageBox(wxT("Found ") + gv
->plat_name
[index
] +
1086 wxT(". Do you want to continue?"),
1087 wxT("Device found"), wxYES_NO
) == wxYES
)
1101 AboutDlg::AboutDlg(rbutilFrm
* parent
)
1102 : wxDialog(parent
, -1, wxT("About"), wxDefaultPosition
, wxDefaultSize
,
1103 wxDEFAULT_DIALOG_STYLE
)
1105 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxVERTICAL
);
1106 this->SetSizer(WxBoxSizer1
);
1107 this->SetAutoLayout(TRUE
);
1109 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxHORIZONTAL
);
1111 wxBitmap WxBitmap1
= wxBitmap(rbutilFrm_XPM
);
1112 wxStaticBitmap
* WxStaticBitmap1
= new wxStaticBitmap(this, wxID_ANY
,
1114 WxBoxSizer2
->Add(WxStaticBitmap1
, 0, wxALL
| wxCENTER
, 5);
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);
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);
1127 wxHyperlinkCtrl
* WxHyperlink1
= new wxHyperlinkCtrl(this, wxID_ANY
,
1128 wxT(RBUTIL_WEBSITE
), wxT(RBUTIL_WEBSITE
) );
1129 WxBoxSizer1
->Add(WxHyperlink1
, 0, wxALL
, 5);
1131 wxStaticBox
* WxStaticBox1
= new wxStaticBox(this, wxID_ANY
, wxT("Contributors:"));
1132 wxStaticBoxSizer
* WxStaticBoxSizer2
= new wxStaticBoxSizer(WxStaticBox1
,
1134 wxTextCtrl
* WxTextCtrl1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
1135 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
| wxTE_READONLY
);
1138 while ( rbutil_developers
[i
] != wxT(""))
1140 WxTextCtrl1
->AppendText(rbutil_developers
[i
++]);
1141 WxTextCtrl1
->AppendText(wxT("\n"));
1144 WxBoxSizer1
->Add(WxStaticBoxSizer2
, 1, wxGROW
| wxALL
, 5);
1145 WxStaticBoxSizer2
->Add(WxTextCtrl1
, 1, wxGROW
| wxALL
, 0);
1147 wxStdDialogButtonSizer
* WxStdDialogButtonSizer1
= new wxStdDialogButtonSizer();
1148 wxButton
* WxOKButton
= new wxButton(this, wxID_OK
);
1149 WxStdDialogButtonSizer1
->AddButton(WxOKButton
);
1150 WxStdDialogButtonSizer1
->Realize();
1152 WxBoxSizer1
->Add(WxStdDialogButtonSizer1
, 0, wxALL
| wxCENTER
, 5);
1154 GetSizer()->Fit(this);
1155 GetSizer()->SetSizeHints(this);
1162 AboutDlg::~AboutDlg()