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"
35 #include "bootloaders.h"
36 #include "install_dialogs.h"
40 //----------------------------------------------------------------------------
42 //----------------------------------------------------------------------------
44 BEGIN_EVENT_TABLE(rbutilFrm
,wxFrame
)
45 EVT_BUTTON (ID_INSTALL_BTN
, rbutilFrm::OnInstallBtn
)
46 EVT_BUTTON (ID_REMOVE_BTN
, rbutilFrm::OnRemoveBtn
)
47 EVT_BUTTON (ID_FONT_BTN
, rbutilFrm::OnFontBtn
)
48 EVT_BUTTON (ID_THEMES_BTN
, rbutilFrm::OnThemesBtn
)
49 EVT_BUTTON (ID_BOOTLOADER_BTN
, rbutilFrm::OnBootloaderBtn
)
50 EVT_BUTTON (ID_BOOTLOADERREMOVE_BTN
, rbutilFrm::OnBootloaderRemoveBtn
)
51 EVT_BUTTON (ID_DOOM_BTN
, rbutilFrm::OnDoomBtn
)
54 EVT_CLOSE(rbutilFrm::rbutilFrmClose
)
55 EVT_MENU(ID_FILE_EXIT
, rbutilFrm::OnFileExit
)
56 EVT_MENU(ID_FILE_ABOUT
, rbutilFrm::OnFileAbout
)
57 EVT_MENU(ID_FILE_WIPECACHE
, rbutilFrm::OnFileWipeCache
)
58 EVT_MENU(ID_PORTABLE_INSTALL
, rbutilFrm::OnPortableInstall
)
60 EVT_MENU(ID_FILE_PROXY
, rbutilFrm::OnFileProxy
)
62 EVT_UPDATE_UI (ID_MANUAL
, rbutilFrm::OnManualUpdate
)
66 rbutilFrm::rbutilFrm( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
67 const wxPoint
&position
, const wxSize
& size
, long style
)
68 : wxFrame( parent
, id
, title
, position
, size
, style
)
70 wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrm(...)"));
72 wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrm"));
75 rbutilFrm::~rbutilFrm() {}
77 void rbutilFrm::CreateGUIControls(void)
79 wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
81 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxVERTICAL
);
82 this->SetSizer(WxBoxSizer1
);
83 this->SetAutoLayout(TRUE
);
85 wxPanel
* mainPanel
= new wxPanel(this,wxID_ANY
);
86 WxBoxSizer1
->Add(mainPanel
,1,wxGROW
|wxALL
,0);
87 wxBoxSizer
* WxBoxSizer0
= new wxBoxSizer(wxVERTICAL
);
88 mainPanel
->SetSizer(WxBoxSizer0
);
89 mainPanel
->SetAutoLayout(TRUE
);
91 wxBitmap
rockboxbmp(rblogo_xpm
);
92 ImageCtrl
* rockboxbmpCtrl
= new ImageCtrl(mainPanel
,wxID_ANY
);
93 rockboxbmpCtrl
->SetBitmap(rockboxbmp
);
95 WxBoxSizer0
->Add(rockboxbmpCtrl
,0,wxALIGN_CENTER_HORIZONTAL
| wxALL
,5);
97 myDeviceSelector
= new DeviceSelectorCtrl(mainPanel
,wxID_ANY
);
98 myDeviceSelector
->setDefault();
99 myDeviceSelector
->AutoDetect();
100 WxBoxSizer0
->Add(myDeviceSelector
,0,wxGROW
|wxALL
,5);
103 wxNotebook
* tabwindow
= new wxNotebook(mainPanel
,wxID_ANY
);
104 WxBoxSizer0
->Add(tabwindow
,1,wxGROW
|wxALL
,5);
106 wxPanel
* installpage
= new wxPanel(tabwindow
,wxID_ANY
);
107 wxPanel
* themepage
= new wxPanel(tabwindow
,wxID_ANY
);
108 wxPanel
* uninstallpage
= new wxPanel(tabwindow
,wxID_ANY
);
109 wxPanel
* manualpage
= new wxPanel(tabwindow
,wxID_ANY
);
110 tabwindow
->AddPage(installpage
,wxT("Installation"),true);
111 tabwindow
->AddPage(themepage
,wxT("Extras"));
112 tabwindow
->AddPage(uninstallpage
,wxT("Uninstallation"));
113 tabwindow
->AddPage(manualpage
,wxT("Manual"));
115 /*********************
117 ***********************/
119 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
120 installpage
->SetSizer(WxBoxSizer2
);
121 installpage
->SetAutoLayout(TRUE
);
123 wxStaticBox
* WxStaticBoxSizer3_StaticBoxObj
= new wxStaticBox(installpage
,
124 wxID_ANY
, wxT("Please choose an option"));
125 wxStaticBoxSizer
* WxStaticBoxSizer3
=
126 new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj
,wxHORIZONTAL
);
127 WxBoxSizer2
->Add(WxStaticBoxSizer3
,1,wxALIGN_CENTER_HORIZONTAL
|wxGROW
| wxALL
, 5);
129 wxFlexGridSizer
* WxFlexGridSizer1
= new wxFlexGridSizer(2,2,0,0);
130 WxStaticBoxSizer3
->Add(WxFlexGridSizer1
,0,wxGROW
| wxALL
,0);
133 wxBitmap
BootloaderInstallButton (wxGetBitmapFromMemory(bootloader_btn_png
,bootloader_btn_png_length
));
134 WxBitmapButton4
= new wxBitmapButton(installpage
, ID_BOOTLOADER_BTN
,
135 BootloaderInstallButton
, wxPoint(0,0), wxSize(64,54),
136 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,wxT("Bootloader Installation"));
137 WxBitmapButton4
->SetToolTip(wxT("Click here to install the Rockbox bootloader"));
138 WxFlexGridSizer1
->Add(WxBitmapButton4
, 0,
139 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
141 wxStaticText
* WxStaticText5
= new wxStaticText(installpage
, wxID_ANY
,
142 wxT("Bootloader installation instructions\n\n"
143 "Before Rockbox can be installed on your audio player, you "
144 "may have to\ninstall a bootloader.\nThis is only necessary the first time "
145 "Rockbox is installed."));
146 WxFlexGridSizer1
->Add(WxStaticText5
, 0,
147 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
149 wxBitmap
WxBitmapButton1_BITMAP (wxGetBitmapFromMemory(rbinstall_btn_png
,rbinstall_btn_png_length
));
150 WxBitmapButton1
= new wxBitmapButton(installpage
, ID_INSTALL_BTN
,
151 WxBitmapButton1_BITMAP
, wxPoint(0,0), wxSize(64,54),
152 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,
153 wxT("Rockbox Installation"));
154 WxBitmapButton1
->SetToolTip(wxT("Click here to install Rockbox"));
155 WxFlexGridSizer1
->Add(WxBitmapButton1
,0,
156 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
158 WxStaticText2
= new wxStaticText(installpage
, ID_WXSTATICTEXT2
,
159 wxT("Install Rockbox on your audio player"));
160 WxFlexGridSizer1
->Add(WxStaticText2
,0,
161 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
163 /*********************+
165 ***********************/
167 wxBoxSizer
* WxBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
168 themepage
->SetSizer(WxBoxSizer3
);
169 themepage
->SetAutoLayout(TRUE
);
171 wxStaticBox
* WxStaticBoxSizer4_StaticBoxObj
= new wxStaticBox(themepage
,
172 wxID_ANY
, wxT("Please choose an option"));
173 wxStaticBoxSizer
* WxStaticBoxSizer4
=
174 new wxStaticBoxSizer(WxStaticBoxSizer4_StaticBoxObj
,wxHORIZONTAL
);
175 WxBoxSizer3
->Add(WxStaticBoxSizer4
,1,wxALIGN_CENTER_HORIZONTAL
|wxGROW
| wxALL
, 5);
177 wxFlexGridSizer
* WxFlexGridSizer2
= new wxFlexGridSizer(2,2,0,0);
178 WxStaticBoxSizer4
->Add(WxFlexGridSizer2
,0,wxGROW
| wxALL
,0);
180 wxBitmap
FontInstallButton (wxGetBitmapFromMemory(font_btn_png
,font_btn_png_length
));
181 WxBitmapButton3
= new wxBitmapButton(themepage
, ID_FONT_BTN
,
182 FontInstallButton
, wxPoint(0,0), wxSize(64,54),
183 wxRAISED_BORDER
| wxBU_AUTODRAW
,wxDefaultValidator
, wxT("Font installation"));
184 WxBitmapButton3
->SetToolTip(wxT("Click here to install the most up to date "
186 WxFlexGridSizer2
->Add(WxBitmapButton3
, 0,
187 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
189 wxStaticText
* WxStaticText4
= new wxStaticText(themepage
, wxID_ANY
,
190 wxT("Install the Rockbox fonts package\n\n"
191 "This step is needed for many Themes. You "
192 "will not need to download these\nagain unless you uninstall "
194 WxFlexGridSizer2
->Add(WxStaticText4
, 0,
195 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
197 wxBitmap
ThemesInstallButton (wxGetBitmapFromMemory(themes_btn_png
,themes_btn_png_length
));
198 WxBitmapButton5
= new wxBitmapButton(themepage
, ID_THEMES_BTN
,
199 ThemesInstallButton
, wxPoint(0,0), wxSize(64,54),
200 wxRAISED_BORDER
| wxBU_AUTODRAW
,wxDefaultValidator
, wxT("Theme installation"));
201 WxBitmapButton5
->SetToolTip(wxT("Click here to install themes for Rockbox."));
202 WxFlexGridSizer2
->Add(WxBitmapButton5
, 0,
203 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
205 wxStaticText
* WxStaticText6
= new wxStaticText(themepage
, wxID_ANY
,
206 wxT("Install more Themes for Rockbox.\n\n"));
207 WxFlexGridSizer2
->Add(WxStaticText6
, 0,
208 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 /*********************+
226 ***********************/
228 wxBoxSizer
* WxBoxSizer4
= new wxBoxSizer(wxVERTICAL
);
229 uninstallpage
->SetSizer(WxBoxSizer4
);
230 uninstallpage
->SetAutoLayout(TRUE
);
232 wxStaticBox
* WxStaticBoxSizer5_StaticBoxObj
= new wxStaticBox(uninstallpage
,
233 wxID_ANY
, wxT("Please choose an option"));
234 wxStaticBoxSizer
* WxStaticBoxSizer5
=
235 new wxStaticBoxSizer(WxStaticBoxSizer5_StaticBoxObj
,wxHORIZONTAL
);
236 WxBoxSizer4
->Add(WxStaticBoxSizer5
,1,wxALIGN_CENTER_HORIZONTAL
|wxGROW
| wxALL
, 5);
238 wxFlexGridSizer
* WxFlexGridSizer3
= new wxFlexGridSizer(2,2,0,0);
239 WxStaticBoxSizer5
->Add(WxFlexGridSizer3
,0,wxGROW
| wxALL
,0);
241 wxBitmap
WxBitmapButton2_BITMAP (wxGetBitmapFromMemory(remrb_btn_png
,remrb_btn_png_length
));
242 WxBitmapButton2
= new wxBitmapButton(uninstallpage
, ID_REMOVE_BTN
,
243 WxBitmapButton2_BITMAP
, wxPoint(0,0), wxSize(64,54),
244 wxRAISED_BORDER
| wxBU_AUTODRAW
,wxDefaultValidator
, wxT("Rockbox uninstallation"));
245 WxBitmapButton2
->SetToolTip(wxT("Click here to uninstall Rockbox"));
246 WxFlexGridSizer3
->Add(WxBitmapButton2
,0,
247 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
249 WxStaticText3
= new wxStaticText(uninstallpage
, ID_WXSTATICTEXT3
,
250 wxT("Remove Rockbox from your audio player"));
251 WxFlexGridSizer3
->Add(WxStaticText3
,0,
252 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
254 wxBitmap
WxBitmapButton4_BITMAP (wxGetBitmapFromMemory(rembootloader_btn_png
,rembootloader_btn_png_length
));
255 WxBitmapButton4
= new wxBitmapButton(uninstallpage
, ID_BOOTLOADERREMOVE_BTN
,
256 WxBitmapButton4_BITMAP
, wxPoint(0,0), wxSize(64,54),
257 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,
258 wxT("Bootloader uninstallation"));
259 WxBitmapButton4
->SetToolTip(wxT("Click here to uninstall the Bootloader"));
260 WxFlexGridSizer3
->Add(WxBitmapButton4
,0,
261 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
263 WxStaticText4
= new wxStaticText(uninstallpage
, ID_WXSTATICTEXT4
,
264 wxT("Remove Rockbox Bootloader from your audio player"));
265 WxFlexGridSizer3
->Add(WxStaticText4
,0,
266 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
273 wxBoxSizer
* WxBoxSizer5
= new wxBoxSizer(wxVERTICAL
);
274 manualpage
->SetSizer(WxBoxSizer5
);
275 manualpage
->SetAutoLayout(TRUE
);
277 manuallink
= new wxHyperlinkCtrl(manualpage
,wxID_ANY
,wxT("Rockbox PDF Manual"),wxT("http://www.rockbox.org"));
278 WxBoxSizer5
->Add(manuallink
,1,wxGROW
| wxALL
, 5);
280 manual
=new wxHtmlWindow(manualpage
,ID_MANUAL
);
281 WxBoxSizer5
->Add(manual
,10,wxGROW
| wxALL
, 5);
285 ** rest of the controls
288 WxMenuBar1
= new wxMenuBar();
289 wxMenu
*ID_FILE_MENU_Mnu_Obj
= new wxMenu(0);
290 WxMenuBar1
->Append(ID_FILE_MENU_Mnu_Obj
, wxT("&File"));
292 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_WIPECACHE
,
293 wxT("&Empty local download cache"), wxT(""), wxITEM_NORMAL
);
296 ID_FILE_MENU_Mnu_Obj
->Append(ID_PORTABLE_INSTALL
,
297 wxT("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL
);
299 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_PROXY
, wxT("Set &Proxy"), wxT(""),
301 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_ABOUT
, wxT("&About"), wxT(""),
303 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_EXIT
, wxT("E&xit\tCtrl+X"), wxT(""),
306 this->SetMenuBar(WxMenuBar1
);
308 GetSizer()->Fit(this);
309 GetSizer()->SetSizeHints(this);
312 this->SetTitle(wxT("Rockbox Utility (portable)"));
315 this->SetTitle(wxT("Rockbox Utility"));
318 wxIcon
rbutilFrm_ICON (rbutilFrm_XPM
);
319 this->SetIcon(rbutilFrm_XPM
);
320 this->SetToolTip(wxT("Install Rockbox"));
322 wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls"));
325 void rbutilFrm::OnManualUpdate(wxUpdateUIEvent
& event
)
327 wxString tmp
= wxT("/rockbox-") + gv
->curplat
;
329 int index
= GetDeviceId();
330 if(gv
->plat_manualname
[index
] != wxT(""))
331 tmp
= wxT("/") + gv
->plat_manualname
[index
];
333 if( tmp
== curManualDevice
)
336 curManualDevice
= tmp
;
338 // construct link to pdf
340 pdflink
= gv
->manual_url
+ tmp
+ wxT(".pdf");
341 manuallink
->SetURL(pdflink
);
343 // construct link to html
345 htmllink
= gv
->manual_url
+ tmp
+ wxT("/rockbox-build.html");
346 if(!manual
->LoadPage(htmllink
))
347 manual
->SetPage(wxT("<p>unable to display manual -- please use the PDF link above</p>"));
353 void rbutilFrm::OnFileProxy(wxCommandEvent
& event
)
356 wxTextEntryDialog
proxydlg(this,wxT("Please enter your Proxy in the Format: URL:PORT"),wxT("Proxy Configuration"), gv
->proxy_url
);
358 if(proxydlg
.ShowModal() == wxID_OK
)
360 gv
->proxy_url
= proxydlg
.GetValue();
366 void rbutilFrm::rbutilFrmClose(wxCloseEvent
& event
)
368 wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrmClose(event)"));
370 wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrmClose"));
378 void rbutilFrm::OnFileExit(wxCommandEvent
& event
)
380 wxLogVerbose(wxT("=== begin rbutilFrm::OnFileExit(event)"));
382 wxLogVerbose(wxT("=== end rbutilFrm::OnFileExit"));
385 // The routines this code uses are in the wxWidgets documentation, but
386 // not yet the library (2.7.0-1). This code can be re-enabled later.
388 void rbutilFrm::OnFileAbout(wxCommandEvent
& event
)
391 wxAboutDialogInfo *info = new wxAboutDialogInfo();
393 info->SetName(wxT(RBUTIL_FULLNAME));
394 info->SetVersion(wxT(RBUTIL_VERSION));
395 info->SetCopyright(wxT(RBUTIL_COPYRIGHT));
396 info->SetDescription(wxT(RBUTIL_DESCRIPTION));
397 info->SetWebSite(wxT(RBUTIL_WEBSITE));
400 while (rbutil_developers[i] != "")
402 info->AddDeveloper(wxT(rbutil_developers[i++]));
409 AboutDlg(this).ShowModal();
412 void rbutilFrm::OnFileWipeCache(wxCommandEvent
& event
)
414 wxString cacheloc
, datadir
;
416 datadir
= gv
->stdpaths
->GetUserDataDir();
417 if (datadir
== wxT(""))
419 ERR_DIALOG(wxT("Can't locate user data directory. Unable to delete "
420 "cache."), wxT("Delete download cache.") );
424 cacheloc
= datadir
+ wxT("" PATH_SEP
"download");
426 if (! rm_rf(cacheloc
) )
428 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("Local download cache has been deleted.")
429 , wxT("Cache deletion"), wxOK
|wxICON_INFORMATION
);
434 MESG_DIALOG(wxT("Errors occured deleting the local download cache."));
437 wxMkdir(cacheloc
, 0777);
440 void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent
& event
)
442 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
444 int index
= GetDeviceId();
448 wxString bootloadermethod
= gv
->plat_bootloadermethod
[index
];
450 if(!gv
->plat_needsbootloader
[index
])
452 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
457 // really deinstall ?
458 wxMessageDialog
msg(this,wxT("Do you really want to deinstall the Bootloader ?"),wxT("Bootloader deinstallation"),wxOK
|wxCANCEL
);
459 if(msg
.ShowModal() != wxID_OK
)
463 if(bootloadermethod
== wxT("ipodpatcher"))
465 wxString bootloadername
= wxT("bootloader-");
466 bootloadername
.Append(gv
->plat_bootloadername
[index
] );
467 if(ipodpatcher(BOOTLOADER_REM
,bootloadername
))
469 MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
473 MESG_DIALOG(wxT("The Uninstallation failed.") );
476 else if(bootloadermethod
== wxT("sansapatcher"))
478 if(sansapatcher(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
]))
480 MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
484 MESG_DIALOG(wxT("The Uninstallation failed.") );
487 else if(bootloadermethod
== wxT("gigabeatf"))
490 if(gigabeatf(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
492 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
495 MESG_DIALOG(wxT("The Uninstallation failed.") );
497 else if(bootloadermethod
== wxT("iaudio") )
499 MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
500 "you need to download and install an Original Firmware from the Manufacturer."));
502 else if(bootloadermethod
== wxT("fwpatcher"))
504 MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
505 "you need to download and install an original Firmware from the Manufacturer.\n"
506 "To do this, you need to boot into the original Firmware."));
508 else if(bootloadermethod
== wxT("h10"))
510 if(h10(BOOTLOADER_REM
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
512 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
515 MESG_DIALOG(wxT("The Uninstallation failed.") );
519 MESG_DIALOG(wxT("Unsupported Bootloader Uninstall method.") );
522 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn"));
525 void rbutilFrm::OnBootloaderBtn(wxCommandEvent
& event
)
527 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
529 int index
= GetDeviceId();
533 wxString bootloadermethod
= gv
->plat_bootloadermethod
[index
];
535 if(!gv
->plat_needsbootloader
[index
])
537 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
543 if(bootloadermethod
!= wxT("ipodpatcher") && bootloadermethod
!= wxT("sansapatcher") )
545 bootloaderInstallDlg
dialog(NULL
, wxID_ANY
,wxT("Bootloader Installation"));
546 if (dialog
.ShowModal() != wxID_OK
)
551 wxMessageDialog
msg(this,wxT("Do you really want to install the Bootloader ?"),wxT("Bootloader installation"),wxOK
|wxCANCEL
);
552 if(msg
.ShowModal() != wxID_OK
)
556 if(bootloadermethod
== wxT("ipodpatcher"))
558 wxString bootloadername
= wxT("bootloader-");
559 bootloadername
.Append(gv
->plat_bootloadername
[index
] );
560 if(ipodpatcher(BOOTLOADER_ADD
,bootloadername
))
562 MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
566 MESG_DIALOG(wxT("The installation has failed.") );
569 else if(bootloadermethod
== wxT("sansapatcher"))
571 if(sansapatcher(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
]))
573 MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
577 MESG_DIALOG(wxT("The installation has failed.") );
581 else if(bootloadermethod
== wxT("gigabeatf"))
584 if(gigabeatf(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
586 MESG_DIALOG(wxT("The Bootloader has been installed on your device."));
589 MESG_DIALOG(wxT("The installation has failed.") );
591 else if(bootloadermethod
== wxT("iaudio") )
593 if(iaudiox5(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
595 MESG_DIALOG(wxT("The Bootloader has been installed on your device.\n"
596 "Now turn OFF your Device, unplug USB,and insert Charger\n"
597 "Your Device will automatically upgrade the flash with the Rockbox bootloader"));
600 MESG_DIALOG(wxT("The installation has failed.") );
602 else if(bootloadermethod
== wxT("fwpatcher"))
604 if(fwpatcher(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
,gv
->curfirmware
))
606 MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"
607 "Now use the Firmware upgrade option of your Device\n"));
610 MESG_DIALOG(wxT("The installation has failed.") );
612 else if(bootloadermethod
== wxT("h10"))
614 if(h10(BOOTLOADER_ADD
,gv
->plat_bootloadername
[index
],gv
->curdestdir
))
616 MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"));
619 MESG_DIALOG(wxT("The installation has failed.") );
623 MESG_DIALOG(wxT("Unsupported Bootloader Install method.") );
628 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn"));
632 void rbutilFrm::OnInstallBtn(wxCommandEvent
& event
)
634 wxString src
, dest
, buf
;
637 wxLogVerbose(wxT("=== begin rbutilFrm::OnInstallBtn(event)"));
639 wxFileConfig
* buildinfo
;
642 int index
= GetDeviceId();
646 // rockbox install dialog
647 rockboxInstallDlg
dialog(NULL
, wxID_ANY
,
648 wxT("Rockbox Installation"));
649 if (dialog
.ShowModal() != wxID_OK
)
653 wxMessageDialog
msg(this,wxT("Do you really want to install Rockbox ?"),wxT("rockbox installation"),wxOK
|wxCANCEL
);
654 if(msg
.ShowModal() != wxID_OK
)
658 switch (gv
->curbuild
)
661 // This is a URL - don't use PATH_SEP
662 src
= gv
->download_url
+ gv
->prog_name
+ wxT("-")
663 + gv
->last_release
+ wxT("-") + gv
->curplat
+ wxT(".zip");
664 dest
= gv
->stdpaths
->GetUserDataDir() + wxT("download" PATH_SEP
)
665 + gv
->prog_name
+ wxT("-") + gv
->last_release
+ wxT("-")
666 + gv
->curplat
+ wxT(".zip");
669 dest
= gv
->stdpaths
->GetUserDataDir()
670 + PATH_SEP
+ wxT("download") + PATH_SEP
+ wxT("build-info");
671 if (DownloadURL(gv
->server_conf_url
, dest
)) {
672 WARN_DIALOG(wxT("Unable to download build status."),
677 buildinfo
= new wxFileConfig(wxEmptyString
,
678 wxEmptyString
, dest
);
679 buf
= buildinfo
->Read(wxT("/dailies/date"));
680 buildinfo
->DeleteAll();
682 if (buf
.Len() != 8) {
683 dest
= wxT("Invalid build date: ") + buf
;
684 WARN_DIALOG(dest
, wxT("Install"));
689 if (buf
== wxT("")) {
690 WARN_DIALOG(wxT("Can't get date of latest build from "
691 "server. Using yesterday's date."), wxT("Install") );
692 date
= wxDateTime::Now();
693 date
.Subtract(oneday
.Day());
694 buf
= date
.Format(wxT("%Y%m%d")); // yes, we want UTC
697 src
= gv
->daily_url
+ gv
->curplat
+ wxT("/") + gv
->prog_name
698 + wxT("-") + gv
->curplat
+ wxT("-") + buf
+ wxT(".zip");
700 dest
= gv
->stdpaths
->GetUserDataDir() + PATH_SEP
wxT("download")
701 + gv
->prog_name
+ wxT("-") + gv
->curplat
+ wxT("-")
705 src
= gv
->bleeding_url
+ gv
->curplat
+ wxT("/")
706 + gv
->prog_name
+ wxT(".zip");
707 dest
= gv
->stdpaths
->GetUserDataDir()
708 + PATH_SEP
wxT("download") PATH_SEP
709 + gv
->prog_name
+ wxT(".zip");
712 ERR_DIALOG(wxT("Something seriously odd has happened."),
718 if (gv
->nocache
|| ( ! wxFileExists(dest
) ) )
720 if ( DownloadURL(src
, dest
) )
723 ERR_DIALOG(wxT("Unable to download ")+src
, wxT("Install"));
728 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
730 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("Rockbox has been installed on your device.")
731 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
737 ERR_DIALOG(wxT("Unable to unzip ")+dest
, wxT("Install"));
741 wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn"));
744 void rbutilFrm::OnFontBtn(wxCommandEvent
& event
)
746 wxString src
, dest
, buf
;
749 wxLogVerbose(wxT("=== begin rbutilFrm::OnFontBtn(event)"));
751 wxFileConfig
* buildinfo
;
754 int index
= GetDeviceId();
758 // font install dialog
759 fontInstallDlg
dialog(NULL
, wxID_ANY
,
760 wxT("Font Installation"));
761 if (dialog
.ShowModal() != wxID_OK
)
765 wxMessageDialog
msg(this,wxT("Do you really want to install the Fonts ?"),wxT("Font installation"),wxOK
|wxCANCEL
);
766 if(msg
.ShowModal() != wxID_OK
)
770 buf
= gv
->curdestdir
+ wxT("" PATH_SEP
".rockbox");
771 if (! wxDirExists(buf
) )
773 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
774 + wxT(" - install Rockbox first."),
775 wxT("Can't install fonts") );
779 dest
= gv
->stdpaths
->GetUserDataDir()
780 + wxT( "" PATH_SEP
"download" PATH_SEP
"build-info");
781 if (DownloadURL(gv
->server_conf_url
, dest
))
783 WARN_DIALOG(wxT("Unable to download build status."),
784 wxT("Font Install"));
788 buildinfo
= new wxFileConfig(wxEmptyString
,
789 wxEmptyString
, dest
);
790 buf
= buildinfo
->Read(wxT("/dailies/date"));
791 buildinfo
->DeleteAll();
793 if (buf
.Len() != 8) {
794 WARN_DIALOG(wxT("Invalid build date: ") + buf
, wxT("Font Install"));
799 if (buf
== wxT("")) {
800 WARN_DIALOG(wxT("Can't get date of latest build from "
801 "server. Using yesterday's date."),
802 wxT("Font Install") );
803 date
= wxDateTime::Now();
804 date
.Subtract(oneday
.Day());
805 buf
= date
.Format(wxT("%Y%m%d")); // yes, we want UTC
808 src
= gv
->font_url
+ buf
+ wxT(".zip");
810 dest
= gv
->stdpaths
->GetUserDataDir() + wxT( "" PATH_SEP
"download"
811 PATH_SEP
"rockbox-fonts-") + buf
+ wxT(".zip");
813 if ( ! wxFileExists(dest
) )
815 if ( DownloadURL(src
, dest
) )
818 ERR_DIALOG(wxT("Unable to download ") + src
, wxT("Font Install"));
823 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
825 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("The Rockbox fonts have been installed on your device.")
826 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
832 ERR_DIALOG(wxT("Unable to unzip ") + dest
, wxT("Font Install"));
835 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
838 void rbutilFrm::OnDoomBtn(wxCommandEvent
& event
)
840 wxString src
, dest
, buf
;
841 wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)"));
843 int index
= GetDeviceId();
847 // font install dialog, reused
848 fontInstallDlg
dialog(NULL
, wxID_ANY
,
849 wxT("Freedoom wad file Installation"));
850 if (dialog
.ShowModal() != wxID_OK
)
854 wxMessageDialog
msg(this,wxT("Do you really want to install the Freedoom wads ?"),wxT("Freedoom installation"),wxOK
|wxCANCEL
);
855 if(msg
.ShowModal() != wxID_OK
)
858 buf
= gv
->curdestdir
+ wxT("" PATH_SEP
".rockbox");
859 if (! wxDirExists(buf
) )
861 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
862 + wxT(" - install Rockbox first."),
863 wxT("Can't install freedoom wads") );
869 dest
= gv
->stdpaths
->GetUserDataDir() + wxT("" PATH_SEP
"download" PATH_SEP
872 if ( ! wxFileExists(dest
) )
874 if ( DownloadURL(src
, dest
) )
877 ERR_DIALOG(wxT("Unable to download ") + src
,
878 wxT("Freedoom Install"));
883 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
885 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("The Freedoom wads have been installed on your device.")
886 ,wxT("Installation"), wxOK
|wxICON_INFORMATION
);
892 ERR_DIALOG(wxT("Unable to unzip ") + dest
, wxT("Freedoom Install"));
896 wxLogVerbose(wxT("=== end rbutilFrm::OnDoomBtn"));
900 void rbutilFrm::OnThemesBtn(wxCommandEvent
& event
)
902 wxString src
, dest
, buf
;
903 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
905 int index
= GetDeviceId();
909 // Theme install dialog
910 themesInstallDlg
dialog(NULL
, wxID_ANY
,
911 wxT("Theme Installation"));
912 if (dialog
.ShowModal() != wxID_OK
)
916 wxMessageDialog
msg(this,wxT("Do you really want to install the selected Themes ?"),wxT("Theme installation"),wxOK
|wxCANCEL
);
917 if(msg
.ShowModal() != wxID_OK
)
921 for(unsigned int i
=0 ;i
< gv
->themesToInstall
.GetCount();i
++)
923 if(!InstallTheme(gv
->themesToInstall
[i
]))
925 MESG_DIALOG(wxT("The Themes installation has failed") );
932 MESG_DIALOG(wxT("The Theme installation completed successfully.") );
936 wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)"));
940 void rbutilFrm::OnRemoveBtn(wxCommandEvent
& event
)
942 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
944 int index
= GetDeviceId();
948 // Rockbox deinstall dialog
949 rockboxDeInstallDlg
dialog(NULL
, wxID_ANY
,
950 wxT("Rockbox Deinstallation"));
951 if (dialog
.ShowModal() != wxID_OK
)
955 wxMessageDialog
msg(this,wxT("Do you really want to deinstall Rockbox ?"),wxT("Rockbox deinstallation"),wxOK
|wxCANCEL
);
956 if(msg
.ShowModal() != wxID_OK
)
960 if (Uninstall(gv
->curdestdir
, gv
->curisfull
) )
963 wxT("The uninstallation wizard was cancelled or completed with "
966 wxMessageDialog
* msg
= new wxMessageDialog(this, wxT("The uninstall wizard completed successfully\n"
967 "Depending on which Device you own, you also have to uninstall the Bootloader")
968 ,wxT("Uninstallation"), wxOK
|wxICON_INFORMATION
);
973 wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn"));
976 void rbutilFrm::OnPortableInstall(wxCommandEvent
& event
)
978 wxString src
, dest
, buf
;
979 wxLogVerbose(wxT("=== begin rbutilFrm::OnPortableInstall(event)"));
983 int index
= GetDeviceId();
987 //portable install dialog ( reused font dialog)
988 fontInstallDlg
dialog(NULL
, wxID_ANY
,
989 wxT("Rockbox Utility Portable Installation"));
990 if (dialog
.ShowModal() != wxID_OK
)
994 wxMessageDialog
msg(this,wxT("Do you really want a portable install of rbutil ?"),wxT("rbutil installation"),wxOK
|wxCANCEL
);
995 if(msg
.ShowModal() != wxID_OK
)
998 if ( InstallRbutil(gv
->curdestdir
) )
1000 MESG_DIALOG(wxT("The Rockbox Utility has been installed on your device."));
1004 ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install"));
1007 wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
1010 int rbutilFrm::GetDeviceId()
1012 int index
= gv
->plat_id
.Index(gv
->curplat
);
1015 if( wxMessageBox(wxT("No device selected. Do you want to autodetect "
1017 wxT("Warning"), wxYES_NO
) == wxYES
)
1019 myDeviceSelector
->AutoDetect();
1020 index
= gv
->plat_id
.Index(gv
->curplat
);
1023 WARN_DIALOG( wxT("Aborting"), wxT("Auto detection failed") );
1028 if( wxMessageBox(wxT("Found ") + gv
->plat_name
[index
] +
1029 wxT(". Do you want to continue?"),
1030 wxT("Device found"), wxYES_NO
) == wxYES
)
1044 AboutDlg::AboutDlg(rbutilFrm
* parent
)
1045 : wxDialog(parent
, -1, wxT("About"), wxDefaultPosition
, wxDefaultSize
,
1046 wxDEFAULT_DIALOG_STYLE
)
1048 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxVERTICAL
);
1049 this->SetSizer(WxBoxSizer1
);
1050 this->SetAutoLayout(TRUE
);
1052 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxHORIZONTAL
);
1054 wxBitmap WxBitmap1
= wxBitmap(rbutilFrm_XPM
);
1055 wxStaticBitmap
* WxStaticBitmap1
= new wxStaticBitmap(this, wxID_ANY
,
1057 WxBoxSizer2
->Add(WxStaticBitmap1
, 0, wxALL
| wxCENTER
, 5);
1059 wxStaticText
* WxStaticText1
= new wxStaticText(this, wxID_ANY
,
1060 wxT(RBUTIL_FULLNAME
), wxDefaultPosition
, wxDefaultSize
,
1061 wxALIGN_CENTER
| wxST_NO_AUTORESIZE
);
1062 WxBoxSizer2
->Add(WxStaticText1
, 0, wxALL
| wxCENTER
, 5);
1063 WxBoxSizer1
->Add(WxBoxSizer2
, 0, wxALL
, 5);
1065 wxStaticText
* WxStaticText2
= new wxStaticText(this, wxID_ANY
,
1066 wxT(RBUTIL_VERSION
"\n" RBUTIL_DESCRIPTION
"\n\n" RBUTIL_COPYRIGHT
));
1067 WxStaticText2
->Wrap(400);
1068 WxBoxSizer1
->Add(WxStaticText2
, 0, wxALL
, 5);
1070 wxHyperlinkCtrl
* WxHyperlink1
= new wxHyperlinkCtrl(this, wxID_ANY
,
1071 wxT(RBUTIL_WEBSITE
), wxT(RBUTIL_WEBSITE
) );
1072 WxBoxSizer1
->Add(WxHyperlink1
, 0, wxALL
, 5);
1074 wxStaticBox
* WxStaticBox1
= new wxStaticBox(this, wxID_ANY
, wxT("Contributors:"));
1075 wxStaticBoxSizer
* WxStaticBoxSizer2
= new wxStaticBoxSizer(WxStaticBox1
,
1077 wxTextCtrl
* WxTextCtrl1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
1078 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
| wxTE_READONLY
);
1081 while ( rbutil_developers
[i
] != wxT(""))
1083 WxTextCtrl1
->AppendText(rbutil_developers
[i
++]);
1084 WxTextCtrl1
->AppendText(wxT("\n"));
1087 WxBoxSizer1
->Add(WxStaticBoxSizer2
, 1, wxGROW
| wxALL
, 5);
1088 WxStaticBoxSizer2
->Add(WxTextCtrl1
, 1, wxGROW
| wxALL
, 0);
1090 wxStdDialogButtonSizer
* WxStdDialogButtonSizer1
= new wxStdDialogButtonSizer();
1091 wxButton
* WxOKButton
= new wxButton(this, wxID_OK
);
1092 WxStdDialogButtonSizer1
->AddButton(WxOKButton
);
1093 WxStdDialogButtonSizer1
->Realize();
1095 WxBoxSizer1
->Add(WxStdDialogButtonSizer1
, 0, wxALL
| wxCENTER
, 5);
1097 GetSizer()->Fit(this);
1098 GetSizer()->SetSizeHints(this);
1105 AboutDlg::~AboutDlg()