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 "install_3d.xpm"
26 #include "uninstall_3d.xpm"
27 #include "fonts_3d.xpm"
28 #include "tools2_3d.xpm"
31 #include "bootloaders.h"
35 //----------------------------------------------------------------------------
37 //----------------------------------------------------------------------------
39 BEGIN_EVENT_TABLE(rbutilFrm
,wxFrame
)
40 EVT_BUTTON (ID_INSTALL_BTN
, rbutilFrm::OnInstallBtn
)
41 EVT_BUTTON (ID_REMOVE_BTN
, rbutilFrm::OnRemoveBtn
)
42 EVT_BUTTON (ID_FONT_BTN
, rbutilFrm::OnFontBtn
)
43 EVT_BUTTON (ID_BOOTLOADER_BTN
, rbutilFrm::OnBootloaderBtn
)
44 EVT_BUTTON (ID_BOOTLOADERREMOVE_BTN
, rbutilFrm::OnBootloaderRemoveBtn
)
46 EVT_CLOSE(rbutilFrm::rbutilFrmClose
)
47 EVT_MENU(ID_FILE_EXIT
, rbutilFrm::OnFileExit
)
48 EVT_MENU(ID_FILE_ABOUT
, rbutilFrm::OnFileAbout
)
49 EVT_MENU(ID_FILE_WIPECACHE
, rbutilFrm::OnFileWipeCache
)
50 EVT_MENU(ID_PORTABLE_INSTALL
, rbutilFrm::OnPortableInstall
)
53 rbutilFrm::rbutilFrm( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
54 const wxPoint
&position
, const wxSize
& size
, long style
)
55 : wxFrame( parent
, id
, title
, position
, size
, style
)
57 wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrm(...)"));
59 wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrm"));
62 rbutilFrm::~rbutilFrm() {}
64 void rbutilFrm::CreateGUIControls(void)
66 wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
68 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxHORIZONTAL
);
69 this->SetSizer(WxBoxSizer1
);
70 this->SetAutoLayout(TRUE
);
72 WxPanel1
= new wxPanel(this, ID_WXPANEL1
, wxPoint(0,0), wxSize(400,600));
73 WxBoxSizer1
->Add(WxPanel1
,1,wxGROW
| wxALL
,0);
75 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
76 WxPanel1
->SetSizer(WxBoxSizer2
);
77 WxPanel1
->SetAutoLayout(TRUE
);
79 wxBitmap
WxStaticBitmap1_BITMAP(rblogo_xpm
);
80 WxStaticBitmap1
= new wxStaticBitmap(WxPanel1
, ID_WXSTATICBITMAP1
,
81 WxStaticBitmap1_BITMAP
, wxPoint(0,0), wxSize(400,123));
82 WxStaticBitmap1
->Enable(false);
83 WxBoxSizer2
->Add(WxStaticBitmap1
,0,wxALIGN_CENTER_HORIZONTAL
| wxALL
,5);
85 wxStaticBox
* WxStaticBoxSizer3_StaticBoxObj
= new wxStaticBox(WxPanel1
,
86 wxID_ANY
, _("Please choose an option"));
87 wxStaticBoxSizer
* WxStaticBoxSizer3
=
88 new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj
,wxHORIZONTAL
);
89 WxBoxSizer2
->Add(WxStaticBoxSizer3
,1,wxALIGN_CENTER_HORIZONTAL
| wxALL
, 5);
91 wxFlexGridSizer
* WxFlexGridSizer1
= new wxFlexGridSizer(2,2,0,0);
92 WxStaticBoxSizer3
->Add(WxFlexGridSizer1
,0,wxGROW
| wxALL
,0);
94 wxBitmap
BootloaderInstallButton (tools2_3d_xpm
);
95 WxBitmapButton4
= new wxBitmapButton(WxPanel1
, ID_BOOTLOADER_BTN
,
96 BootloaderInstallButton
, wxPoint(0,0), wxSize(64,54),
97 wxRAISED_BORDER
| wxBU_AUTODRAW
);
98 WxBitmapButton4
->SetToolTip(_("Instructions for installing the "
99 "Rockbox bootloader on your audio device"));
100 WxFlexGridSizer1
->Add(WxBitmapButton4
, 0,
101 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
103 wxStaticText
* WxStaticText5
= new wxStaticText(WxPanel1
, wxID_ANY
,
104 _("Bootloader installation instructions\n\n"
105 "Before Rockbox can be installed on your audio player, you "
106 "may have to\ninstall a bootloader. This can not currently "
107 "be done automatically, but is\nonly necessary the first time "
108 "Rockbox is installed."));
109 WxFlexGridSizer1
->Add(WxStaticText5
, 0,
110 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
112 wxBitmap
WxBitmapButton1_BITMAP (install_3d_xpm
);
113 WxBitmapButton1
= new wxBitmapButton(WxPanel1
, ID_INSTALL_BTN
,
114 WxBitmapButton1_BITMAP
, wxPoint(0,0), wxSize(64,54),
115 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,
116 wxT("WxBitmapButton1"));
117 WxBitmapButton1
->SetToolTip(_("Install Rockbox"));
118 WxFlexGridSizer1
->Add(WxBitmapButton1
,0,
119 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
121 WxStaticText2
= new wxStaticText(WxPanel1
, ID_WXSTATICTEXT2
,
122 _("Install Rockbox on your audio player"));
123 WxFlexGridSizer1
->Add(WxStaticText2
,0,
124 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
126 wxBitmap
FontInstallButton (fonts_3d_xpm
);
127 WxBitmapButton3
= new wxBitmapButton(WxPanel1
, ID_FONT_BTN
,
128 FontInstallButton
, wxPoint(0,0), wxSize(64,54),
129 wxRAISED_BORDER
| wxBU_AUTODRAW
);
130 WxBitmapButton3
->SetToolTip(_("Download the most up to date "
132 WxFlexGridSizer1
->Add(WxBitmapButton3
, 0,
133 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
135 wxStaticText
* WxStaticText4
= new wxStaticText(WxPanel1
, wxID_ANY
,
136 _("Install the Rockbox fonts package\n\n"
137 "This step is only needed if you have installed "
138 "a daily build and want\nthe full set of Rockbox fonts. You "
139 "will not need to download these\nagain unless you uninstall "
141 WxFlexGridSizer1
->Add(WxStaticText4
, 0,
142 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
144 wxBitmap
WxBitmapButton2_BITMAP (uninstall_3d_xpm
);
145 WxBitmapButton2
= new wxBitmapButton(WxPanel1
, ID_REMOVE_BTN
,
146 WxBitmapButton2_BITMAP
, wxPoint(0,0), wxSize(64,54),
147 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,
148 wxT("WxBitmapButton2"));
149 WxBitmapButton2
->SetToolTip(_("Uninstall Rockbox"));
150 WxFlexGridSizer1
->Add(WxBitmapButton2
,0,
151 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
153 WxStaticText3
= new wxStaticText(WxPanel1
, ID_WXSTATICTEXT3
,
154 _("Remove Rockbox from your audio player"));
155 WxFlexGridSizer1
->Add(WxStaticText3
,0,
156 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
158 wxBitmap
WxBitmapButton4_BITMAP (uninstall_3d_xpm
);
159 WxBitmapButton4
= new wxBitmapButton(WxPanel1
, ID_BOOTLOADERREMOVE_BTN
,
160 WxBitmapButton4_BITMAP
, wxPoint(0,0), wxSize(64,54),
161 wxRAISED_BORDER
| wxBU_AUTODRAW
, wxDefaultValidator
,
162 wxT("WxBitmapButton4"));
163 WxBitmapButton4
->SetToolTip(_("Uninstall Bootloader"));
164 WxFlexGridSizer1
->Add(WxBitmapButton4
,0,
165 wxALIGN_CENTER_HORIZONTAL
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
167 WxStaticText4
= new wxStaticText(WxPanel1
, ID_WXSTATICTEXT4
,
168 _("Remove Rockbox Bootloader from your audio player"));
169 WxFlexGridSizer1
->Add(WxStaticText4
,0,
170 wxALIGN_LEFT
| wxALIGN_CENTER_VERTICAL
| wxALL
,5);
172 WxMenuBar1
= new wxMenuBar();
173 wxMenu
*ID_FILE_MENU_Mnu_Obj
= new wxMenu(0);
174 WxMenuBar1
->Append(ID_FILE_MENU_Mnu_Obj
, _("&File"));
176 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_WIPECACHE
,
177 _("&Empty local download cache"), wxT(""), wxITEM_NORMAL
);
180 ID_FILE_MENU_Mnu_Obj
->Append(ID_PORTABLE_INSTALL
,
181 _("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL
);
183 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_ABOUT
, _("&About"), wxT(""),
185 ID_FILE_MENU_Mnu_Obj
->Append(ID_FILE_EXIT
, _("E&xit\tCtrl+X"), wxT(""),
188 this->SetMenuBar(WxMenuBar1
);
190 GetSizer()->Fit(this);
191 GetSizer()->SetSizeHints(this);
194 this->SetTitle(_("Rockbox Utility (portable)"));
197 this->SetTitle(_("Rockbox Utility"));
200 wxIcon
rbutilFrm_ICON (rbutilFrm_XPM
);
201 this->SetIcon(rbutilFrm_XPM
);
202 this->SetToolTip(wxT("Install Rockbox"));
204 wxLogVerbose("=== end rbutilFrm::CreateGUIControls");
207 void rbutilFrm::rbutilFrmClose(wxCloseEvent
& event
)
209 wxLogVerbose("=== begin rbutilFrm::rbutilFrmClose(event)");
211 wxLogVerbose("=== end rbutilFrm::rbutilFrmClose");
218 void rbutilFrm::OnFileExit(wxCommandEvent
& event
)
220 wxLogVerbose("=== begin rbutilFrm::OnFileExit(event)");
222 wxLogVerbose("=== end rbutilFrm::OnFileExit");
225 // The routines this code uses are in the wxWidgets documentation, but
226 // not yet the library (2.7.0-1). This code can be re-enabled later.
228 void rbutilFrm::OnFileAbout(wxCommandEvent
& event
)
231 wxAboutDialogInfo *info = new wxAboutDialogInfo();
233 info->SetName(_(RBUTIL_FULLNAME));
234 info->SetVersion(_(RBUTIL_VERSION));
235 info->SetCopyright(_(RBUTIL_COPYRIGHT));
236 info->SetDescription(_(RBUTIL_DESCRIPTION));
237 info->SetWebSite(_(RBUTIL_WEBSITE));
240 while (rbutil_developers[i] != "")
242 info->AddDeveloper(wxT(rbutil_developers[i++]));
249 AboutDlg(this).ShowModal();
252 void rbutilFrm::OnFileWipeCache(wxCommandEvent
& event
)
254 wxString cacheloc
, datadir
;
256 datadir
= gv
->stdpaths
->GetUserDataDir();
259 ERR_DIALOG(_("Can't locate user data directory. Unable to delete "
260 "cache."), _("Delete download cache.") );
264 cacheloc
.Printf(wxT("%s" PATH_SEP
"download"),
267 if (! rm_rf(cacheloc
) )
269 wxMessageDialog
* msg
= new wxMessageDialog(this, _("Local download cache has been deleted.")
270 ,"Cache deletion", wxOK
|wxICON_INFORMATION
);
275 MESG_DIALOG(_("Errors occured deleting the local download cache."));
278 wxMkdir(cacheloc
, 0777);
281 void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent
& event
)
283 wxLogVerbose("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)");
285 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
286 _("Rockbox Bootloader Uninstallation Wizard"),
287 wxBitmap(wizard_xpm
),
289 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
290 wxBootPlatformPage
* page1
= new wxBootPlatformPage(wizard
);
291 wxBootLocationPage
* page2
= new wxBootLocationPage(wizard
); // Only one of these pages are shown
292 wxIpodLocationPage
* page3
= new wxIpodLocationPage(wizard
); // depending on Device selected
294 page1
->SetNext(page2
);
295 page2
->SetPrev(page1
);
296 page2
->SetNext(page3
);
297 page3
->SetPrev(page2
);
299 wizard
->GetPageAreaSizer()->Add(page1
);
302 if (wizard
->RunWizard(page1
) )
304 // uninstall the bootloader
305 if(gv
->curbootloadermethod
== "ipodpatcher")
308 if(ipodpatcher(BOOTLOADER_REM
))
310 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been uninstalled.")
311 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
317 MESG_DIALOG(_("The Uninstallation has failed.") );
320 else if(gv
->curbootloadermethod
== "gigabeatf")
323 if(gigabeatf(BOOTLOADER_REM
))
325 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been uninstalled.")
326 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
331 MESG_DIALOG(_("The Uninstallation has failed.") );
333 else if(gv
->curbootloadermethod
== "h10")
335 if(h10(BOOTLOADER_REM
))
337 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been uninstalled.")
338 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
343 MESG_DIALOG(_("The Uninstallation has failed.") );
346 else if(gv
->curbootloadermethod
== "iaudio" )
348 wxMessageDialog
* msg
= new wxMessageDialog(this, _("To uninstall the Bootloader on this Device,\n"
349 "you need to download and install an Original Firmware from the Manufacturer.")
350 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
354 else if(gv
->curbootloadermethod
== "fwpatcher" )
356 wxMessageDialog
* msg
= new wxMessageDialog(this, _("To uninstall the Bootloader on this Device,\n"
357 "you need to download and install an original Firmware from the Manufacturer.\n"
358 "To do this, you need to boot into the original Firmware.")
359 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
365 MESG_DIALOG(_("Unsupported Bootloader Method") );
370 MESG_DIALOG(_("The bootloader Uninstallation wizard was cancelled") );
373 wxLogVerbose("=== end rbutilFrm::OnBootloaderRemoveBtn");
376 void rbutilFrm::OnBootloaderBtn(wxCommandEvent
& event
)
378 wxLogVerbose("=== begin rbutilFrm::OnBootloaderBtn(event)");
380 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
381 _("Rockbox Installation Wizard"),
382 wxBitmap(wizard_xpm
),
384 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
385 wxBootPlatformPage
* page1
= new wxBootPlatformPage(wizard
);
386 wxFirmwareLocationPage
* page2
= new wxFirmwareLocationPage(wizard
); //this page is optional
387 wxBootLocationPage
* page3
= new wxBootLocationPage(wizard
); // Only one of these pages are shown
388 wxIpodLocationPage
* page4
= new wxIpodLocationPage(wizard
); // depending on Device selected
390 page1
->SetNext(page2
);
391 page2
->SetPrev(page1
);
392 page2
->SetNext(page3
);
393 page3
->SetPrev(page2
);
394 page3
->SetNext(page4
);
395 page4
->SetPrev(page3
);
397 wizard
->GetPageAreaSizer()->Add(page1
);
399 if (wizard
->RunWizard(page1
) )
401 // start installation depending on player
402 if(gv
->curbootloadermethod
== "ipodpatcher")
405 if(ipodpatcher(BOOTLOADER_ADD
))
407 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been installed on your device.")
408 ,"Installation", wxOK
|wxICON_INFORMATION
);
414 MESG_DIALOG(_("The installation has failed.") );
417 else if(gv
->curbootloadermethod
== "gigabeatf")
420 if(gigabeatf(BOOTLOADER_ADD
))
422 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been installed on your device.")
423 ,"Installation", wxOK
|wxICON_INFORMATION
);
428 MESG_DIALOG(_("The installation has failed.") );
430 else if(gv
->curbootloadermethod
== "iaudio" )
432 if(iaudiox5(BOOTLOADER_ADD
))
434 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been installed on your device.\n"
435 "Now turn OFF your Device, unplug USB,and insert Charger\n"
436 "Your Device will automatically upgrade the flash with the Rockbox bootloader")
437 ,"Installation", wxOK
|wxICON_INFORMATION
);
442 MESG_DIALOG(_("The installation has failed.") );
444 else if(gv
->curbootloadermethod
== "fwpatcher")
446 if(fwpatcher(BOOTLOADER_ADD
))
448 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been patched and copied on your device.\n"
449 "Now use the Firmware upgrade option of your Device\n")
450 ,"Installation", wxOK
|wxICON_INFORMATION
);
455 MESG_DIALOG(_("The installation has failed.") );
457 else if(gv
->curbootloadermethod
== "h10")
459 if(h10(BOOTLOADER_ADD
))
461 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Bootloader has been patched and copied on your device.\n")
462 ,"Installation", wxOK
|wxICON_INFORMATION
);
467 MESG_DIALOG(_("The installation has failed.") );
471 MESG_DIALOG(_("Unsupported Bootloader Method") );
476 MESG_DIALOG(_("The bootloader installation wizard was cancelled") );
479 wxLogVerbose("=== end rbutilFrm::OnBootloaderBtn");
483 void rbutilFrm::OnInstallBtn(wxCommandEvent
& event
)
485 wxString src
, dest
, buf
;
488 wxLogVerbose("=== begin rbutilFrm::OnInstallBtn(event)");
490 wxFileConfig
* buildinfo
;
493 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
494 _("Rockbox Installation Wizard"),
495 wxBitmap(wizard_xpm
),
497 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
498 wxPlatformPage
* page1
= new wxPlatformPage(wizard
);
499 wxLocationPage
* page2
= new wxLocationPage(wizard
);
500 wxBuildPage
* page3
= new wxBuildPage(wizard
);
501 page1
->SetNext(page2
);
502 page2
->SetPrev(page1
);
503 page2
->SetNext(page3
);
504 page3
->SetPrev(page2
);
506 wizard
->GetPageAreaSizer()->Add(page1
);
508 if (wizard
->RunWizard(page1
) )
510 switch (gv
->curbuild
)
513 // This is a URL - don't use PATH_SEP
514 src
.Printf("%s%s-%s-%s.zip",
515 gv
->download_url
.c_str(), gv
->prog_name
.c_str(),
516 gv
->last_release
.c_str(), gv
->curplat
.c_str());
517 dest
.Printf("%s" PATH_SEP
"download" PATH_SEP
"%s-%s-%s.zip",
518 gv
->stdpaths
->GetUserDataDir().c_str(),
519 gv
->prog_name
.c_str(), gv
->last_release
.c_str(),
520 gv
->curplat
.c_str());
523 dest
.Printf("%s" PATH_SEP
"download" PATH_SEP
"build-info",
524 gv
->stdpaths
->GetUserDataDir().c_str());
525 if (DownloadURL(gv
->server_conf_url
, dest
)) {
526 WARN_DIALOG(_("Unable to download build status."),
531 buildinfo
= new wxFileConfig(wxEmptyString
,
532 wxEmptyString
, dest
);
533 buf
= buildinfo
->Read(wxT("/dailies/date"));
534 buildinfo
->DeleteAll();
536 if (buf
.Len() != 8) {
537 dest
.Printf(_("Invalid build date: %s"), buf
.c_str());
538 WARN_DIALOG(dest
, _("Install"));
544 WARN_DIALOG(_("Can't get date of latest build from "
545 "server. Using yesterday's date."), _("Install") );
546 date
= wxDateTime::Now();
547 date
.Subtract(oneday
.Day());
548 buf
= date
.Format(wxT("%Y%m%d")); // yes, we want UTC
551 src
.Printf("%s%s/%s-%s-%s.zip",
552 gv
->daily_url
.c_str(), gv
->curplat
.c_str(),
553 gv
->prog_name
.c_str(), gv
->curplat
.c_str(),
556 dest
.Printf("%s" PATH_SEP
"download" PATH_SEP
"%s-%s-%s.zip",
557 gv
->stdpaths
->GetUserDataDir().c_str(),
558 gv
->prog_name
.c_str(),
559 gv
->curplat
.c_str(), buf
.c_str() );
562 src
.Printf("%s%s/%s.zip",
563 gv
->bleeding_url
.c_str(), gv
->curplat
.c_str(),
564 gv
->prog_name
.c_str() );
565 dest
.Printf("%s" PATH_SEP
"download" PATH_SEP
"%s.zip",
566 gv
->stdpaths
->GetUserDataDir().c_str(),
567 gv
->prog_name
.c_str() );
570 ERR_DIALOG(_("Something seriously odd has happened."),
576 if (gv
->nocache
|| ( ! wxFileExists(dest
) ) )
578 if ( DownloadURL(src
, dest
) )
581 buf
.Printf(_("Unable to download %s"), src
.c_str() );
582 ERR_DIALOG(buf
, _("Install"));
587 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
589 wxMessageDialog
* msg
= new wxMessageDialog(this, _("Rockbox has been installed on your device.")
590 ,"Installation", wxOK
|wxICON_INFORMATION
);
596 buf
.Printf(_("Unable to unzip %s"), dest
.c_str() );
597 ERR_DIALOG(buf
, _("Install"));
601 MESG_DIALOG(_("The installation wizard was cancelled") );
604 wxLogVerbose("=== end rbutilFrm::OnInstallBtn");
607 void rbutilFrm::OnFontBtn(wxCommandEvent
& event
)
609 wxString src
, dest
, buf
;
612 wxLogVerbose("=== begin rbutilFrm::OnFontBtn(event)");
614 wxFileConfig
* buildinfo
;
617 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
618 _("Rockbox Font Installation Wizard"),
619 wxBitmap(wizard_xpm
),
621 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
622 wxLocationPage
* page1
= new wxLocationPage(wizard
);
624 wizard
->GetPageAreaSizer()->Add(page1
);
626 if (wizard
->RunWizard(page1
) )
628 buf
.Printf(wxT("%s" PATH_SEP
".rockbox"), gv
->curdestdir
.c_str()) ;
629 if (! wxDirExists(buf
) )
631 buf
.Printf(_("Rockbox is not yet installed on %s - install "
632 "Rockbox first."), buf
.c_str() );
633 WARN_DIALOG(buf
, _("Can't install fonts") );
637 dest
.Printf(wxT("%s" PATH_SEP
"download" PATH_SEP
"build-info"),
638 gv
->stdpaths
->GetUserDataDir().c_str());
639 if (DownloadURL(gv
->server_conf_url
, dest
))
641 WARN_DIALOG(_("Unable to download build status."),
646 buildinfo
= new wxFileConfig(wxEmptyString
,
647 wxEmptyString
, dest
);
648 buf
= buildinfo
->Read(wxT("/dailies/date"));
649 buildinfo
->DeleteAll();
651 if (buf
.Len() != 8) {
652 dest
.Printf(_("Invalid build date: %s"), buf
.c_str());
653 WARN_DIALOG(dest
, _("Font Install"));
659 WARN_DIALOG(_("Can't get date of latest build from "
660 "server. Using yesterday's date."),
662 date
= wxDateTime::Now();
663 date
.Subtract(oneday
.Day());
664 buf
= date
.Format(wxT("%Y%m%d")); // yes, we want UTC
667 src
.Printf("%s%s.zip", gv
->font_url
.c_str(), buf
.c_str() );
669 dest
.Printf("%s" PATH_SEP
"download" PATH_SEP
670 "rockbox-fonts-%s.zip", gv
->stdpaths
->GetUserDataDir().c_str(),
673 if ( ! wxFileExists(dest
) )
675 if ( DownloadURL(src
, dest
) )
678 buf
.Printf(_("Unable to download %s"), src
.c_str() );
679 ERR_DIALOG(buf
, _("Font Install"));
684 if ( !UnzipFile(dest
, gv
->curdestdir
, true) )
686 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Rockbox fonts have been installed on your device.")
687 ,"Installation", wxOK
|wxICON_INFORMATION
);
693 buf
.Printf(_("Unable to unzip %s"), dest
.c_str() );
694 ERR_DIALOG(buf
, _("Font Install"));
698 MESG_DIALOG(_("The font installation wizard was cancelled") );
701 wxLogVerbose("=== end rbutilFrm::OnFontBtn");
704 void rbutilFrm::OnRemoveBtn(wxCommandEvent
& event
)
706 wxLogVerbose("=== begin rbutilFrm::OnRemoveBtn(event)");
708 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
709 _("Rockbox Uninstallation Wizard"),
710 wxBitmap(wizard_xpm
),
712 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
713 wxLocationPage
* page1
= new wxLocationPage(wizard
);
714 wxFullUninstallPage
*page2
= new wxFullUninstallPage(wizard
);
715 page1
->SetNext(page2
);
716 page2
->SetPrev(page1
);
718 wizard
->GetPageAreaSizer()->Add(page1
);
720 if (wizard
->RunWizard(page1
) )
722 if (Uninstall(gv
->curdestdir
, gv
->curisfull
) )
725 _("The uninstallation wizard was cancelled or completed with "
728 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The uninstall wizard completed successfully\n"
729 "Depending on which Device you own, you also have to uninstall the Bootloader")
730 ,"Uninstallation", wxOK
|wxICON_INFORMATION
);
736 MESG_DIALOG(_("The uninstallation wizard was cancelled.") );
739 wxLogVerbose("=== end rbutilFrm::OnRemoveBtn");
742 void rbutilFrm::OnPortableInstall(wxCommandEvent
& event
)
744 wxString src
, dest
, buf
;
745 wxLogVerbose("=== begin rbutilFrm::OnPortableInstall(event)");
747 wxFileConfig
* buildinfo
;
750 wxWizard
*wizard
= new wxWizard(this, wxID_ANY
,
751 _("Rockbox Utility Portable Installation Wizard"),
752 wxBitmap(wizard_xpm
),
754 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
);
755 wxLocationPage
* page1
= new wxLocationPage(wizard
);
757 wizard
->GetPageAreaSizer()->Add(page1
);
759 if (wizard
->RunWizard(page1
) )
761 if ( InstallRbutil(gv
->curdestdir
) )
763 wxMessageDialog
* msg
= new wxMessageDialog(this, _("The Rockbox Utility has been installed on your device.")
764 ,"Installation", wxOK
|wxICON_INFORMATION
);
769 ERR_DIALOG(_("Installation failed"), _("Portable Install"));
773 MESG_DIALOG(_("The portable installation wizard was cancelled") );
776 wxLogVerbose("=== end rbutilFrm::OnUnstallPortable");
779 AboutDlg::AboutDlg(rbutilFrm
* parent
)
780 : wxDialog(parent
, -1, _("About"), wxDefaultPosition
, wxDefaultSize
,
781 wxDEFAULT_DIALOG_STYLE
)
783 wxBoxSizer
* WxBoxSizer1
= new wxBoxSizer(wxVERTICAL
);
784 this->SetSizer(WxBoxSizer1
);
785 this->SetAutoLayout(TRUE
);
787 wxBoxSizer
* WxBoxSizer2
= new wxBoxSizer(wxHORIZONTAL
);
789 wxBitmap WxBitmap1
= wxBitmap(rbutilFrm_XPM
);
790 wxStaticBitmap
* WxStaticBitmap1
= new wxStaticBitmap(this, wxID_ANY
,
792 WxBoxSizer2
->Add(WxStaticBitmap1
, 0, wxALL
| wxCENTER
, 5);
794 wxStaticText
* WxStaticText1
= new wxStaticText(this, wxID_ANY
,
795 _(RBUTIL_FULLNAME
), wxDefaultPosition
, wxDefaultSize
,
796 wxALIGN_CENTER
| wxST_NO_AUTORESIZE
);
797 WxBoxSizer2
->Add(WxStaticText1
, 0, wxALL
| wxCENTER
, 5);
798 WxBoxSizer1
->Add(WxBoxSizer2
, 0, wxALL
, 5);
800 wxStaticText
* WxStaticText2
= new wxStaticText(this, wxID_ANY
,
801 _(RBUTIL_VERSION
"\n" RBUTIL_DESCRIPTION
"\n\n" RBUTIL_COPYRIGHT
));
802 WxStaticText2
->Wrap(400);
803 WxBoxSizer1
->Add(WxStaticText2
, 0, wxALL
, 5);
805 wxHyperlinkCtrl
* WxHyperlink1
= new wxHyperlinkCtrl(this, wxID_ANY
,
806 wxT(RBUTIL_WEBSITE
), wxT(RBUTIL_WEBSITE
) );
807 WxBoxSizer1
->Add(WxHyperlink1
, 0, wxALL
, 5);
809 wxStaticBox
* WxStaticBox1
= new wxStaticBox(this, wxID_ANY
, _("Contributors:"));
810 wxStaticBoxSizer
* WxStaticBoxSizer2
= new wxStaticBoxSizer(WxStaticBox1
,
812 wxTextCtrl
* WxTextCtrl1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
813 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
| wxTE_READONLY
);
816 while ( rbutil_developers
[i
] != "")
818 WxTextCtrl1
->AppendText(rbutil_developers
[i
++]);
819 WxTextCtrl1
->AppendText("\n");
822 WxBoxSizer1
->Add(WxStaticBoxSizer2
, 1, wxGROW
| wxALL
, 5);
823 WxStaticBoxSizer2
->Add(WxTextCtrl1
, 1, wxGROW
| wxALL
, 0);
825 wxStdDialogButtonSizer
* WxStdDialogButtonSizer1
= new wxStdDialogButtonSizer();
826 wxButton
* WxOKButton
= new wxButton(this, wxID_OK
);
827 WxStdDialogButtonSizer1
->AddButton(WxOKButton
);
828 WxStdDialogButtonSizer1
->Realize();
830 WxBoxSizer1
->Add(WxStdDialogButtonSizer1
, 0, wxALL
| wxCENTER
, 5);
832 GetSizer()->Fit(this);
833 GetSizer()->SetSizeHints(this);
840 AboutDlg::~AboutDlg()