2006-12-13 21:11:24 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* Module: rbutil
|
|
|
|
* File: rbutilFrm.cpp
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Christi Alice Scarborough
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
#include "rbutilFrm.h"
|
|
|
|
#include "credits.h"
|
|
|
|
|
|
|
|
#include "rbutilFrm_XPM.xpm"
|
|
|
|
#include "install_3d.xpm"
|
|
|
|
#include "uninstall_3d.xpm"
|
|
|
|
#include "fonts_3d.xpm"
|
|
|
|
#include "tools2_3d.xpm"
|
|
|
|
#include "rblogo.xpm"
|
2007-03-15 14:02:37 +00:00
|
|
|
#include "untools2_3d.xpm"
|
|
|
|
#include "themes_3d.xpm"
|
2006-12-11 21:25:37 +00:00
|
|
|
|
2007-02-21 20:27:14 +00:00
|
|
|
#include "bootloaders.h"
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
#include "wizard.xpm"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// rbutilFrm
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(rbutilFrm,wxFrame)
|
|
|
|
EVT_BUTTON (ID_INSTALL_BTN, rbutilFrm::OnInstallBtn)
|
|
|
|
EVT_BUTTON (ID_REMOVE_BTN, rbutilFrm::OnRemoveBtn)
|
|
|
|
EVT_BUTTON (ID_FONT_BTN, rbutilFrm::OnFontBtn)
|
2007-03-15 14:02:37 +00:00
|
|
|
EVT_BUTTON (ID_THEMES_BTN, rbutilFrm::OnThemesBtn)
|
2006-12-11 21:25:37 +00:00
|
|
|
EVT_BUTTON (ID_BOOTLOADER_BTN, rbutilFrm::OnBootloaderBtn)
|
2007-02-21 20:27:14 +00:00
|
|
|
EVT_BUTTON (ID_BOOTLOADERREMOVE_BTN, rbutilFrm::OnBootloaderRemoveBtn)
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
EVT_CLOSE(rbutilFrm::rbutilFrmClose)
|
|
|
|
EVT_MENU(ID_FILE_EXIT, rbutilFrm::OnFileExit)
|
|
|
|
EVT_MENU(ID_FILE_ABOUT, rbutilFrm::OnFileAbout)
|
|
|
|
EVT_MENU(ID_FILE_WIPECACHE, rbutilFrm::OnFileWipeCache)
|
2006-12-13 21:11:24 +00:00
|
|
|
EVT_MENU(ID_PORTABLE_INSTALL, rbutilFrm::OnPortableInstall)
|
2006-12-11 21:25:37 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
rbutilFrm::rbutilFrm( wxWindow *parent, wxWindowID id, const wxString &title,
|
|
|
|
const wxPoint &position, const wxSize& size, long style )
|
|
|
|
: wxFrame( parent, id, title, position, size, style)
|
|
|
|
{
|
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrm(...)"));
|
|
|
|
CreateGUIControls();
|
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrm"));
|
|
|
|
}
|
|
|
|
|
|
|
|
rbutilFrm::~rbutilFrm() {}
|
|
|
|
|
|
|
|
void rbutilFrm::CreateGUIControls(void)
|
|
|
|
{
|
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
|
|
|
|
|
|
|
|
wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
this->SetSizer(WxBoxSizer1);
|
|
|
|
this->SetAutoLayout(TRUE);
|
|
|
|
|
|
|
|
WxPanel1 = new wxPanel(this, ID_WXPANEL1, wxPoint(0,0), wxSize(400,600));
|
|
|
|
WxBoxSizer1->Add(WxPanel1,1,wxGROW | wxALL,0);
|
|
|
|
|
|
|
|
wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
WxPanel1->SetSizer(WxBoxSizer2);
|
|
|
|
WxPanel1->SetAutoLayout(TRUE);
|
|
|
|
|
|
|
|
wxBitmap WxStaticBitmap1_BITMAP(rblogo_xpm);
|
|
|
|
WxStaticBitmap1 = new wxStaticBitmap(WxPanel1, ID_WXSTATICBITMAP1,
|
|
|
|
WxStaticBitmap1_BITMAP, wxPoint(0,0), wxSize(400,123));
|
|
|
|
WxStaticBitmap1->Enable(false);
|
|
|
|
WxBoxSizer2->Add(WxStaticBitmap1,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5);
|
|
|
|
|
|
|
|
wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(WxPanel1,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxID_ANY, wxT("Please choose an option"));
|
2006-12-11 21:25:37 +00:00
|
|
|
wxStaticBoxSizer* WxStaticBoxSizer3 =
|
|
|
|
new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxHORIZONTAL);
|
|
|
|
WxBoxSizer2->Add(WxStaticBoxSizer3,1,wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
|
|
|
|
|
|
|
|
wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(2,2,0,0);
|
|
|
|
WxStaticBoxSizer3->Add(WxFlexGridSizer1,0,wxGROW | wxALL,0);
|
|
|
|
|
|
|
|
wxBitmap BootloaderInstallButton (tools2_3d_xpm);
|
|
|
|
WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADER_BTN,
|
2006-12-13 21:11:24 +00:00
|
|
|
BootloaderInstallButton, wxPoint(0,0), wxSize(64,54),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW);
|
2007-03-15 14:02:37 +00:00
|
|
|
WxBitmapButton4->SetToolTip(wxT("Instructions for installing the "
|
2006-12-11 21:25:37 +00:00
|
|
|
"Rockbox bootloader on your audio device"));
|
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton4, 0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
wxStaticText* WxStaticText5 = new wxStaticText(WxPanel1, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Bootloader installation instructions\n\n"
|
2006-12-11 21:25:37 +00:00
|
|
|
"Before Rockbox can be installed on your audio player, you "
|
|
|
|
"may have to\ninstall a bootloader. This can not currently "
|
|
|
|
"be done automatically, but is\nonly necessary the first time "
|
|
|
|
"Rockbox is installed."));
|
|
|
|
WxFlexGridSizer1->Add(WxStaticText5, 0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
|
|
|
|
WxBitmapButton1 = new wxBitmapButton(WxPanel1, ID_INSTALL_BTN,
|
2006-12-13 21:11:24 +00:00
|
|
|
WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
|
|
|
wxT("WxBitmapButton1"));
|
2007-03-15 14:02:37 +00:00
|
|
|
WxBitmapButton1->SetToolTip(wxT("Install Rockbox"));
|
2006-12-11 21:25:37 +00:00
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton1,0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
WxStaticText2 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT2,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Install Rockbox on your audio player"));
|
2006-12-11 21:25:37 +00:00
|
|
|
WxFlexGridSizer1->Add(WxStaticText2,0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
wxBitmap FontInstallButton (fonts_3d_xpm);
|
|
|
|
WxBitmapButton3 = new wxBitmapButton(WxPanel1, ID_FONT_BTN,
|
2006-12-13 21:11:24 +00:00
|
|
|
FontInstallButton, wxPoint(0,0), wxSize(64,54),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW);
|
2007-03-15 14:02:37 +00:00
|
|
|
WxBitmapButton3->SetToolTip(wxT("Download the most up to date "
|
2006-12-11 21:25:37 +00:00
|
|
|
"Rockbox fonts."));
|
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton3, 0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
wxStaticText* WxStaticText4 = new wxStaticText(WxPanel1, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Install the Rockbox fonts package\n\n"
|
2006-12-11 21:25:37 +00:00
|
|
|
"This step is only needed if you have installed "
|
|
|
|
"a daily build and want\nthe full set of Rockbox fonts. You "
|
|
|
|
"will not need to download these\nagain unless you uninstall "
|
|
|
|
"Rockbox."));
|
|
|
|
WxFlexGridSizer1->Add(WxStaticText4, 0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
|
|
|
|
wxBitmap ThemesInstallButton (themes_3d_xpm);
|
|
|
|
WxBitmapButton5 = new wxBitmapButton(WxPanel1, ID_THEMES_BTN,
|
|
|
|
ThemesInstallButton, wxPoint(0,0), wxSize(64,54),
|
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW);
|
|
|
|
WxBitmapButton5->SetToolTip(wxT("Download other Themes for Rockbox."));
|
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton5, 0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
wxStaticText* WxStaticText6 = new wxStaticText(WxPanel1, wxID_ANY,
|
|
|
|
wxT("Install more Themes for Rockbox.\n\n"));
|
|
|
|
WxFlexGridSizer1->Add(WxStaticText6, 0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
|
|
|
|
WxBitmapButton2 = new wxBitmapButton(WxPanel1, ID_REMOVE_BTN,
|
2006-12-13 21:11:24 +00:00
|
|
|
WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
|
|
|
wxT("WxBitmapButton2"));
|
2007-03-15 14:02:37 +00:00
|
|
|
WxBitmapButton2->SetToolTip(wxT("Uninstall Rockbox"));
|
2006-12-11 21:25:37 +00:00
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton2,0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
WxStaticText3 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT3,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Remove Rockbox from your audio player"));
|
2006-12-11 21:25:37 +00:00
|
|
|
WxFlexGridSizer1->Add(WxStaticText3,0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxBitmap WxBitmapButton4_BITMAP (untools2_3d_xpm);
|
2007-02-21 20:27:14 +00:00
|
|
|
WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADERREMOVE_BTN,
|
|
|
|
WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54),
|
|
|
|
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
|
|
|
wxT("WxBitmapButton4"));
|
2007-03-15 14:02:37 +00:00
|
|
|
WxBitmapButton4->SetToolTip(wxT("Uninstall Bootloader"));
|
2007-02-21 20:27:14 +00:00
|
|
|
WxFlexGridSizer1->Add(WxBitmapButton4,0,
|
|
|
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
|
|
|
WxStaticText4 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT4,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Remove Rockbox Bootloader from your audio player"));
|
2007-02-21 20:27:14 +00:00
|
|
|
WxFlexGridSizer1->Add(WxStaticText4,0,
|
|
|
|
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
WxMenuBar1 = new wxMenuBar();
|
|
|
|
wxMenu *ID_FILE_MENU_Mnu_Obj = new wxMenu(0);
|
2007-03-15 14:02:37 +00:00
|
|
|
WxMenuBar1->Append(ID_FILE_MENU_Mnu_Obj, wxT("&File"));
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_WIPECACHE,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("&Empty local download cache"), wxT(""), wxITEM_NORMAL);
|
2006-12-13 21:11:24 +00:00
|
|
|
if (! gv->portable )
|
|
|
|
{
|
|
|
|
ID_FILE_MENU_Mnu_Obj->Append(ID_PORTABLE_INSTALL,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL);
|
2006-12-13 21:11:24 +00:00
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_ABOUT, wxT("&About"), wxT(""),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxITEM_NORMAL);
|
2007-03-15 14:02:37 +00:00
|
|
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_EXIT, wxT("E&xit\tCtrl+X"), wxT(""),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxITEM_NORMAL);
|
|
|
|
|
|
|
|
this->SetMenuBar(WxMenuBar1);
|
|
|
|
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
GetSizer()->SetSizeHints(this);
|
2006-12-13 21:11:24 +00:00
|
|
|
if (gv->portable)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
this->SetTitle(wxT("Rockbox Utility (portable)"));
|
2006-12-13 21:11:24 +00:00
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
this->SetTitle(wxT("Rockbox Utility"));
|
2006-12-13 21:11:24 +00:00
|
|
|
}
|
2006-12-11 21:25:37 +00:00
|
|
|
this->Center();
|
|
|
|
wxIcon rbutilFrm_ICON (rbutilFrm_XPM);
|
|
|
|
this->SetIcon(rbutilFrm_XPM);
|
|
|
|
this->SetToolTip(wxT("Install Rockbox"));
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rbutilFrm::rbutilFrmClose(wxCloseEvent& event)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::rbutilFrmClose(event)"));
|
2006-12-11 21:25:37 +00:00
|
|
|
Destroy();
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::rbutilFrmClose"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OnFileExit
|
|
|
|
*/
|
|
|
|
void rbutilFrm::OnFileExit(wxCommandEvent& event)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnFileExit(event)"));
|
2006-12-11 21:25:37 +00:00
|
|
|
Close();
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnFileExit"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The routines this code uses are in the wxWidgets documentation, but
|
|
|
|
// not yet the library (2.7.0-1). This code can be re-enabled later.
|
|
|
|
|
|
|
|
void rbutilFrm::OnFileAbout(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
wxAboutDialogInfo *info = new wxAboutDialogInfo();
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
info->SetName(wxT(RBUTIL_FULLNAME));
|
|
|
|
info->SetVersion(wxT(RBUTIL_VERSION));
|
|
|
|
info->SetCopyright(wxT(RBUTIL_COPYRIGHT));
|
|
|
|
info->SetDescription(wxT(RBUTIL_DESCRIPTION));
|
|
|
|
info->SetWebSite(wxT(RBUTIL_WEBSITE));
|
2006-12-14 06:11:29 +00:00
|
|
|
|
|
|
|
long i = 0;
|
|
|
|
while (rbutil_developers[i] != "")
|
|
|
|
{
|
|
|
|
info->AddDeveloper(wxT(rbutil_developers[i++]));
|
|
|
|
}
|
|
|
|
|
|
|
|
wxAboutBox(*info);
|
|
|
|
delete info;
|
2006-12-11 21:25:37 +00:00
|
|
|
*/
|
2006-12-14 06:11:29 +00:00
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
AboutDlg(this).ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void rbutilFrm::OnFileWipeCache(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxString cacheloc, datadir;
|
|
|
|
|
|
|
|
datadir = gv->stdpaths->GetUserDataDir();
|
2007-03-15 18:02:15 +00:00
|
|
|
if (datadir == wxT(""))
|
2006-12-11 21:25:37 +00:00
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
ERR_DIALOG(wxT("Can't locate user data directory. Unable to delete "
|
|
|
|
"cache."), wxT("Delete download cache.") );
|
2006-12-11 21:25:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cacheloc.Printf(wxT("%s" PATH_SEP "download"),
|
|
|
|
datadir.c_str());
|
|
|
|
|
|
|
|
if (! rm_rf(cacheloc) )
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("Local download cache has been deleted.")
|
2007-03-15 18:02:15 +00:00
|
|
|
, wxT("Cache deletion"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
else {
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("Errors occured deleting the local download cache."));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2006-12-14 03:55:15 +00:00
|
|
|
wxMkdir(cacheloc, 0777);
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2007-02-21 20:27:14 +00:00
|
|
|
void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
|
2007-02-21 20:27:14 +00:00
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Bootloader Uninstallation Wizard"),
|
2007-02-21 20:27:14 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxBootPlatformPage* page1 = new wxBootPlatformPage(wizard);
|
|
|
|
wxBootLocationPage* page2 = new wxBootLocationPage(wizard); // Only one of these pages are shown
|
|
|
|
wxIpodLocationPage* page3 = new wxIpodLocationPage(wizard); // depending on Device selected
|
|
|
|
|
|
|
|
page1->SetNext(page2);
|
|
|
|
page2->SetPrev(page1);
|
|
|
|
page2->SetNext(page3);
|
|
|
|
page3->SetPrev(page2);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
// uninstall the bootloader
|
2007-03-15 14:02:37 +00:00
|
|
|
if(gv->curbootloadermethod == wxT("ipodpatcher"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(ipodpatcher(BOOTLOADER_REM))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
|
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The Uninstallation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("gigabeatf"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(gigabeatf(BOOTLOADER_REM))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
|
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The Uninstallation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("h10"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
if(h10(BOOTLOADER_REM))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
|
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The Uninstallation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
|
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("iaudio") )
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n"
|
2007-02-21 20:27:14 +00:00
|
|
|
"you need to download and install an Original Firmware from the Manufacturer.")
|
2007-03-15 14:02:37 +00:00
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("fwpatcher") )
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n"
|
2007-02-21 20:27:14 +00:00
|
|
|
"you need to download and install an original Firmware from the Manufacturer.\n"
|
|
|
|
"To do this, you need to boot into the original Firmware.")
|
2007-03-15 14:02:37 +00:00
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("Unsupported Bootloader Method") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The bootloader Uninstallation wizard was cancelled") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn"));
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
|
2007-02-21 20:27:14 +00:00
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Installation Wizard"),
|
2007-02-21 20:27:14 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxBootPlatformPage* page1 = new wxBootPlatformPage(wizard);
|
|
|
|
wxFirmwareLocationPage* page2 = new wxFirmwareLocationPage(wizard); //this page is optional
|
|
|
|
wxBootLocationPage* page3 = new wxBootLocationPage(wizard); // Only one of these pages are shown
|
|
|
|
wxIpodLocationPage* page4 = new wxIpodLocationPage(wizard); // depending on Device selected
|
|
|
|
|
|
|
|
page1->SetNext(page2);
|
|
|
|
page2->SetPrev(page1);
|
|
|
|
page2->SetNext(page3);
|
|
|
|
page3->SetPrev(page2);
|
|
|
|
page3->SetNext(page4);
|
|
|
|
page4->SetPrev(page3);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
// start installation depending on player
|
2007-03-15 14:02:37 +00:00
|
|
|
if(gv->curbootloadermethod == wxT("ipodpatcher"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(ipodpatcher(BOOTLOADER_ADD))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("gigabeatf"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(gigabeatf(BOOTLOADER_ADD))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("iaudio") )
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
if(iaudiox5(BOOTLOADER_ADD))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.\n"
|
2007-02-21 20:27:14 +00:00
|
|
|
"Now turn OFF your Device, unplug USB,and insert Charger\n"
|
|
|
|
"Your Device will automatically upgrade the flash with the Rockbox bootloader")
|
2007-03-15 14:02:37 +00:00
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("fwpatcher"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
if(fwpatcher(BOOTLOADER_ADD))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n"
|
2007-02-21 20:27:14 +00:00
|
|
|
"Now use the Firmware upgrade option of your Device\n")
|
2007-03-15 14:02:37 +00:00
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
2007-03-15 14:02:37 +00:00
|
|
|
else if(gv->curbootloadermethod == wxT("h10"))
|
2007-02-21 20:27:14 +00:00
|
|
|
{
|
|
|
|
if(h10(BOOTLOADER_ADD))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
|
|
|
}
|
|
|
|
else
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation has failed.") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("Unsupported Bootloader Method") );
|
2007-02-21 20:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-12-11 21:25:37 +00:00
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The bootloader installation wizard was cancelled") );
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
2007-02-21 20:27:14 +00:00
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn"));
|
2007-02-21 20:27:14 +00:00
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxString src, dest, buf;
|
|
|
|
wxDateTime date;
|
|
|
|
wxTimeSpan day(24);
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnInstallBtn(event)"));
|
2006-12-11 21:25:37 +00:00
|
|
|
wxFileSystem fs;
|
|
|
|
wxFileConfig* buildinfo;
|
|
|
|
wxDateSpan oneday;
|
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Installation Wizard"),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxPlatformPage* page1 = new wxPlatformPage(wizard);
|
|
|
|
wxLocationPage* page2 = new wxLocationPage(wizard);
|
|
|
|
wxBuildPage* page3 = new wxBuildPage(wizard);
|
|
|
|
page1->SetNext(page2);
|
|
|
|
page2->SetPrev(page1);
|
|
|
|
page2->SetNext(page3);
|
|
|
|
page3->SetPrev(page2);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
switch (gv->curbuild)
|
|
|
|
{
|
|
|
|
case BUILD_RELEASE:
|
|
|
|
// This is a URL - don't use PATH_SEP
|
2007-03-15 14:02:37 +00:00
|
|
|
src.Printf(wxT("%s%s-%s-%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->download_url.c_str(), gv->prog_name.c_str(),
|
|
|
|
gv->last_release.c_str(), gv->curplat.c_str());
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->stdpaths->GetUserDataDir().c_str(),
|
|
|
|
gv->prog_name.c_str(), gv->last_release.c_str(),
|
|
|
|
gv->curplat.c_str());
|
|
|
|
break;
|
|
|
|
case BUILD_DAILY:
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->stdpaths->GetUserDataDir().c_str());
|
|
|
|
if (DownloadURL(gv->server_conf_url, dest)) {
|
2007-03-15 14:02:37 +00:00
|
|
|
WARN_DIALOG(wxT("Unable to download build status."),
|
|
|
|
wxT("Install"));
|
2007-03-15 18:02:15 +00:00
|
|
|
buf = wxT("");
|
2006-12-11 21:25:37 +00:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
buildinfo = new wxFileConfig(wxEmptyString,
|
|
|
|
wxEmptyString, dest);
|
|
|
|
buf = buildinfo->Read(wxT("/dailies/date"));
|
|
|
|
buildinfo->DeleteAll();
|
|
|
|
|
|
|
|
if (buf.Len() != 8) {
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("Invalid build date: %s"), buf.c_str());
|
|
|
|
WARN_DIALOG(dest, wxT("Install"));
|
|
|
|
buf = wxT("");
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-15 18:02:15 +00:00
|
|
|
if (buf == wxT("")) {
|
2007-03-15 14:02:37 +00:00
|
|
|
WARN_DIALOG(wxT("Can't get date of latest build from "
|
|
|
|
"server. Using yesterday's date."), wxT("Install") );
|
2006-12-11 21:25:37 +00:00
|
|
|
date = wxDateTime::Now();
|
|
|
|
date.Subtract(oneday.Day());
|
|
|
|
buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
|
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
src.Printf(wxT("%s%s/%s-%s-%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->daily_url.c_str(), gv->curplat.c_str(),
|
|
|
|
gv->prog_name.c_str(), gv->curplat.c_str(),
|
|
|
|
buf.c_str() );
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->stdpaths->GetUserDataDir().c_str(),
|
|
|
|
gv->prog_name.c_str(),
|
|
|
|
gv->curplat.c_str(), buf.c_str() );
|
|
|
|
break;
|
|
|
|
case BUILD_BLEEDING:
|
2007-03-15 14:02:37 +00:00
|
|
|
src.Printf(wxT("%s%s/%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->bleeding_url.c_str(), gv->curplat.c_str(),
|
|
|
|
gv->prog_name.c_str() );
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.zip"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->stdpaths->GetUserDataDir().c_str(),
|
|
|
|
gv->prog_name.c_str() );
|
|
|
|
break;
|
|
|
|
default:
|
2007-03-15 14:02:37 +00:00
|
|
|
ERR_DIALOG(wxT("Something seriously odd has happened."),
|
|
|
|
wxT("Install"));
|
2006-12-11 21:25:37 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gv->nocache || ( ! wxFileExists(dest) ) )
|
|
|
|
{
|
|
|
|
if ( DownloadURL(src, dest) )
|
|
|
|
{
|
|
|
|
wxRemoveFile(dest);
|
2007-03-15 14:02:37 +00:00
|
|
|
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
|
|
|
ERR_DIALOG(buf, wxT("Install"));
|
2006-12-11 21:25:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !UnzipFile(dest, gv->curdestdir, true) )
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("Rockbox has been installed on your device.")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
2006-12-11 21:25:37 +00:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
wxRemoveFile(dest);
|
2007-03-15 14:02:37 +00:00
|
|
|
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
|
|
|
|
ERR_DIALOG(buf, wxT("Install"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The installation wizard was cancelled") );
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxString src, dest, buf;
|
|
|
|
wxDateTime date;
|
|
|
|
wxTimeSpan day(24);
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnFontBtn(event)"));
|
2006-12-11 21:25:37 +00:00
|
|
|
wxFileSystem fs;
|
|
|
|
wxFileConfig* buildinfo;
|
|
|
|
wxDateSpan oneday;
|
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Font Installation Wizard"),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxLocationPage* page1 = new wxLocationPage(wizard);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
2006-12-14 03:55:15 +00:00
|
|
|
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
|
|
|
|
if (! wxDirExists(buf) )
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
buf.Printf(wxT("Rockbox is not yet installed on %s - install "
|
2006-12-14 03:55:15 +00:00
|
|
|
"Rockbox first."), buf.c_str() );
|
2007-03-15 14:02:37 +00:00
|
|
|
WARN_DIALOG(buf, wxT("Can't install fonts") );
|
2006-12-14 03:55:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"),
|
2006-12-11 21:25:37 +00:00
|
|
|
gv->stdpaths->GetUserDataDir().c_str());
|
|
|
|
if (DownloadURL(gv->server_conf_url, dest))
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
WARN_DIALOG(wxT("Unable to download build status."),
|
|
|
|
wxT("Font Install"));
|
2007-03-15 18:02:15 +00:00
|
|
|
buf = wxT("");
|
2006-12-11 21:25:37 +00:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
buildinfo = new wxFileConfig(wxEmptyString,
|
|
|
|
wxEmptyString, dest);
|
|
|
|
buf = buildinfo->Read(wxT("/dailies/date"));
|
|
|
|
buildinfo->DeleteAll();
|
|
|
|
|
|
|
|
if (buf.Len() != 8) {
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("Invalid build date: %s"), buf.c_str());
|
|
|
|
WARN_DIALOG(dest, wxT("Font Install"));
|
2007-03-15 18:02:15 +00:00
|
|
|
buf = wxT("");
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-15 18:02:15 +00:00
|
|
|
if (buf == wxT("")) {
|
2007-03-15 14:02:37 +00:00
|
|
|
WARN_DIALOG(wxT("Can't get date of latest build from "
|
2006-12-11 21:25:37 +00:00
|
|
|
"server. Using yesterday's date."),
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Font Install") );
|
2006-12-11 21:25:37 +00:00
|
|
|
date = wxDateTime::Now();
|
|
|
|
date.Subtract(oneday.Day());
|
|
|
|
buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
|
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
src.Printf(wxT("%s%s.zip"), gv->font_url.c_str(), buf.c_str() );
|
2006-12-11 21:25:37 +00:00
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP
|
|
|
|
"rockbox-fonts-%s.zip"), gv->stdpaths->GetUserDataDir().c_str(),
|
2006-12-11 21:25:37 +00:00
|
|
|
buf.c_str() );
|
|
|
|
|
|
|
|
if ( ! wxFileExists(dest) )
|
|
|
|
{
|
|
|
|
if ( DownloadURL(src, dest) )
|
|
|
|
{
|
|
|
|
wxRemoveFile(dest);
|
2007-03-15 14:02:37 +00:00
|
|
|
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
|
|
|
ERR_DIALOG(buf, wxT("Font Install"));
|
2006-12-11 21:25:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-14 03:55:15 +00:00
|
|
|
if ( !UnzipFile(dest, gv->curdestdir, true) )
|
2006-12-11 21:25:37 +00:00
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Rockbox fonts have been installed on your device.")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
2006-12-11 21:25:37 +00:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
wxRemoveFile(dest);
|
2007-03-15 14:02:37 +00:00
|
|
|
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
|
|
|
|
ERR_DIALOG(buf, wxT("Font Install"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The font installation wizard was cancelled") );
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
|
|
|
|
void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxString src, dest, buf;
|
|
|
|
wxTimeSpan day(24);
|
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
|
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
|
|
|
wxT("Rockbox Themes Installation Wizard"),
|
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxPlatformPage* page1 = new wxPlatformPage(wizard);
|
|
|
|
wxLocationPage* page2 = new wxLocationPage(wizard);
|
|
|
|
wxThemesPage* page3 = new wxThemesPage(wizard);
|
|
|
|
page1->SetNext(page2);
|
|
|
|
page2->SetPrev(page1);
|
|
|
|
page2->SetNext(page3);
|
|
|
|
page3->SetPrev(page2);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
bool success=true;
|
|
|
|
for(int i=0 ;i < gv->themesToInstall.GetCount();i++)
|
|
|
|
{
|
|
|
|
if(!InstallTheme(gv->themesToInstall[i]))
|
|
|
|
{
|
|
|
|
MESG_DIALOG(wxT("The Themes installation has failed") );
|
|
|
|
success=false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(success)
|
|
|
|
{
|
|
|
|
MESG_DIALOG(wxT("The Theme installation completed successfully.") );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MESG_DIALOG(wxT("The Themes installation wizard was cancelled") );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Uninstallation Wizard"),
|
2006-12-11 21:25:37 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxLocationPage* page1 = new wxLocationPage(wizard);
|
|
|
|
wxFullUninstallPage *page2 = new wxFullUninstallPage(wizard);
|
|
|
|
page1->SetNext(page2);
|
|
|
|
page2->SetPrev(page1);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
if (Uninstall(gv->curdestdir, gv->curisfull) )
|
|
|
|
{
|
|
|
|
MESG_DIALOG(
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("The uninstallation wizard was cancelled or completed with "
|
2006-12-11 21:25:37 +00:00
|
|
|
"some errors.") );
|
|
|
|
} else {
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The uninstall wizard completed successfully\n"
|
2007-02-21 20:27:14 +00:00
|
|
|
"Depending on which Device you own, you also have to uninstall the Bootloader")
|
2007-03-15 14:02:37 +00:00
|
|
|
,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The uninstallation wizard was cancelled.") );
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn"));
|
2006-12-11 21:25:37 +00:00
|
|
|
}
|
|
|
|
|
2006-12-13 21:11:24 +00:00
|
|
|
void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxString src, dest, buf;
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnPortableInstall(event)"));
|
2006-12-13 21:11:24 +00:00
|
|
|
wxFileSystem fs;
|
|
|
|
wxFileConfig* buildinfo;
|
|
|
|
wxDateSpan oneday;
|
|
|
|
|
|
|
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT("Rockbox Utility Portable Installation Wizard"),
|
2006-12-13 21:11:24 +00:00
|
|
|
wxBitmap(wizard_xpm),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
|
|
|
wxLocationPage* page1 = new wxLocationPage(wizard);
|
|
|
|
|
|
|
|
wizard->GetPageAreaSizer()->Add(page1);
|
|
|
|
|
|
|
|
if (wizard->RunWizard(page1) )
|
|
|
|
{
|
|
|
|
if ( InstallRbutil(gv->curdestdir) )
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Rockbox Utility has been installed on your device.")
|
|
|
|
,wxT("Installation"), wxOK |wxICON_INFORMATION);
|
2007-02-21 20:27:14 +00:00
|
|
|
msg->ShowModal();
|
|
|
|
delete msg;
|
2006-12-13 21:11:24 +00:00
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install"));
|
2006-12-13 21:11:24 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
{
|
2007-03-15 14:02:37 +00:00
|
|
|
MESG_DIALOG(wxT("The portable installation wizard was cancelled") );
|
2006-12-13 21:11:24 +00:00
|
|
|
}
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
|
2006-12-13 21:11:24 +00:00
|
|
|
}
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
AboutDlg::AboutDlg(rbutilFrm* parent)
|
2007-03-15 14:02:37 +00:00
|
|
|
: wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize,
|
2006-12-11 21:25:37 +00:00
|
|
|
wxDEFAULT_DIALOG_STYLE)
|
|
|
|
{
|
|
|
|
wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
this->SetSizer(WxBoxSizer1);
|
|
|
|
this->SetAutoLayout(TRUE);
|
|
|
|
|
2006-12-14 06:11:29 +00:00
|
|
|
wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
|
|
|
|
wxBitmap WxBitmap1 = wxBitmap(rbutilFrm_XPM);
|
2006-12-11 21:25:37 +00:00
|
|
|
wxStaticBitmap* WxStaticBitmap1 = new wxStaticBitmap(this, wxID_ANY,
|
|
|
|
WxBitmap1);
|
2006-12-14 06:11:29 +00:00
|
|
|
WxBoxSizer2->Add(WxStaticBitmap1, 0, wxALL | wxCENTER, 5);
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT(RBUTIL_FULLNAME), wxDefaultPosition, wxDefaultSize,
|
2006-12-14 06:11:29 +00:00
|
|
|
wxALIGN_CENTER | wxST_NO_AUTORESIZE );
|
|
|
|
WxBoxSizer2->Add(WxStaticText1, 0, wxALL | wxCENTER, 5);
|
|
|
|
WxBoxSizer1->Add(WxBoxSizer2, 0, wxALL, 5);
|
|
|
|
|
|
|
|
wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
|
2007-03-15 14:02:37 +00:00
|
|
|
wxT(RBUTIL_VERSION "\n" RBUTIL_DESCRIPTION "\n\n" RBUTIL_COPYRIGHT));
|
2006-12-14 06:11:29 +00:00
|
|
|
WxStaticText2->Wrap(400);
|
|
|
|
WxBoxSizer1->Add(WxStaticText2, 0, wxALL, 5);
|
2006-12-11 21:25:37 +00:00
|
|
|
|
|
|
|
wxHyperlinkCtrl* WxHyperlink1 = new wxHyperlinkCtrl(this, wxID_ANY,
|
|
|
|
wxT(RBUTIL_WEBSITE), wxT(RBUTIL_WEBSITE) );
|
|
|
|
WxBoxSizer1->Add(WxHyperlink1, 0, wxALL, 5);
|
|
|
|
|
2007-03-15 14:02:37 +00:00
|
|
|
wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Contributors:"));
|
2006-12-14 06:11:29 +00:00
|
|
|
wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
|
|
|
|
wxVERTICAL);
|
|
|
|
wxTextCtrl* WxTextCtrl1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
|
|
|
|
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
|
|
|
|
|
|
|
|
long i = 0;
|
2007-03-15 18:02:15 +00:00
|
|
|
while ( rbutil_developers[i] != wxT(""))
|
2006-12-14 06:11:29 +00:00
|
|
|
{
|
|
|
|
WxTextCtrl1->AppendText(rbutil_developers[i++]);
|
2007-03-15 14:02:37 +00:00
|
|
|
WxTextCtrl1->AppendText(wxT("\n"));
|
2006-12-14 06:11:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WxBoxSizer1->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
|
|
|
|
WxStaticBoxSizer2->Add(WxTextCtrl1, 1, wxGROW | wxALL, 0);
|
|
|
|
|
2006-12-11 21:25:37 +00:00
|
|
|
wxStdDialogButtonSizer* WxStdDialogButtonSizer1 = new wxStdDialogButtonSizer();
|
|
|
|
wxButton* WxOKButton = new wxButton(this, wxID_OK);
|
|
|
|
WxStdDialogButtonSizer1->AddButton(WxOKButton);
|
|
|
|
WxStdDialogButtonSizer1->Realize();
|
|
|
|
|
|
|
|
WxBoxSizer1->Add(WxStdDialogButtonSizer1, 0, wxALL | wxCENTER, 5);
|
|
|
|
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
|
|
|
|
//this->Center();
|
|
|
|
this->Show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
AboutDlg::~AboutDlg()
|
|
|
|
{
|
|
|
|
}
|