summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2007-05-03 17:10:28 +0000
committerDominik Wenger <domonoky@googlemail.com>2007-05-03 17:10:28 +0000
commit60f864181118212507ae4873c8ba2667f333f23e (patch)
tree95099393d2c386d9130bc35e91f7821e4975e3eb /rbutil
parentf48e0b514c6672b38d80a14a5779922253f1bbdc (diff)
downloadrockbox-60f864181118212507ae4873c8ba2667f333f23e.tar.gz
rockbox-60f864181118212507ae4873c8ba2667f333f23e.tar.bz2
rockbox-60f864181118212507ae4873c8ba2667f333f23e.zip
New, better GUI for rbutil. (FS#6893)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13310 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/Makefile2
-rwxr-xr-xrbutil/bootloaders.cpp83
-rwxr-xr-xrbutil/bootloaders.h11
-rw-r--r--rbutil/credits.h2
-rw-r--r--rbutil/install_dialogs.cpp753
-rw-r--r--rbutil/install_dialogs.h234
-rw-r--r--rbutil/rbutil-rc.rc8
-rw-r--r--rbutil/rbutil.cbp4
-rw-r--r--rbutil/rbutil.cpp4
-rw-r--r--rbutil/rbutil.h15
-rw-r--r--rbutil/rbutil.ini64
-rw-r--r--rbutil/rbutilApp.cpp12
-rw-r--r--rbutil/rbutilCtrls.cpp588
-rw-r--r--rbutil/rbutilCtrls.h561
-rw-r--r--rbutil/rbutilFrm.cpp433
-rw-r--r--rbutil/rbutilFrm.h5
-rw-r--r--rbutil/wizard_pages.cpp967
-rw-r--r--rbutil/wizard_pages.h241
18 files changed, 2397 insertions, 1590 deletions
diff --git a/rbutil/Makefile b/rbutil/Makefile
index a33960a923..fdb29f30a3 100644
--- a/rbutil/Makefile
+++ b/rbutil/Makefile
@@ -12,7 +12,7 @@
CXX=$(shell $(PREFIX)wx-config --cxx)
INC =
CFLAGS = -Wall -Wundef
-OBJS=rbutil.o rbutilApp.o rbutilFrm.o wizard_pages.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o irivertools.o md5sum.o
+OBJS=rbutil.o rbutilApp.o rbutilFrm.o rbutilCtrls.o install_dialogs.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o irivertools.o md5sum.o
# Install into /usr/local by default
ifndef DESTDIR
diff --git a/rbutil/bootloaders.cpp b/rbutil/bootloaders.cpp
index d424a4f35e..274264cadf 100755
--- a/rbutil/bootloaders.cpp
+++ b/rbutil/bootloaders.cpp
@@ -35,25 +35,10 @@ bool initIpodpatcher()
else return false;
}
// uses ipodpatcher for add and rem of bootloader
-bool ipodpatcher(int mode)
+bool ipodpatcher(int mode,wxString bootloadername)
{
wxString src,dest,buf;
- // downloading files
- if(mode == BOOTLOADER_ADD)
- {
- src.Printf(wxT("%s/ipod/%s.ipod"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str());
- if ( DownloadURL(src, dest) )
- {
- wxRemoveFile(dest);
- buf.Printf(wxT("Unable to download %s"), src.c_str() );
- ERR_DIALOG(buf, wxT("Install"));
- return false;
- }
- }
-
struct ipod_t ipod;
int n = ipod_scan(&ipod);
@@ -68,6 +53,21 @@ bool ipodpatcher(int mode)
return false;
}
+ // downloading files
+ if(mode == BOOTLOADER_ADD)
+ {
+ src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
+ gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
+ if ( DownloadURL(src, dest) )
+ {
+ wxRemoveFile(dest);
+ buf.Printf(wxT("Unable to download %s"), src.c_str() );
+ ERR_DIALOG(buf, wxT("Install"));
+ return false;
+ }
+ }
+
if (ipod_open(&ipod, 0) < 0)
{
ERR_DIALOG(wxT("[ERR] could not open ipod"), wxT("open Ipod"));
@@ -163,20 +163,20 @@ bool ipodpatcher(int mode)
}
// gigabeatinstallation
-bool gigabeatf(int mode)
+bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
{
wxString path1,path2;
wxString err;
wxString src,dest;
- path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),gv->curdestdir.c_str());
+ path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),deviceDir.c_str());
if(mode == BOOTLOADER_ADD)
{
//Files downloaden
- src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
+ src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str());
+ gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
if( DownloadURL(src, dest) )
{
wxRemoveFile(dest);
@@ -233,20 +233,20 @@ bool gigabeatf(int mode)
}
// iaudio bootloader install
-bool iaudiox5(int mode)
+bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir)
{
wxString path1,path2;
wxString err;
wxString src,dest;
- path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),gv->curdestdir.c_str(),gv->curbootloader.c_str());
+ path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),deviceDir.c_str(),bootloadername.c_str());
if(mode == BOOTLOADER_ADD)
{
//Files downloaden
- src.Printf(wxT("%s/iaudio/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
+ src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str());
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str());
+ gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
if( DownloadURL(src, dest) )
{
wxRemoveFile(dest);
@@ -270,19 +270,19 @@ bool iaudiox5(int mode)
}
// H10 install
-bool h10(int mode)
+bool h10(int mode,wxString bootloadername,wxString deviceDir)
{
wxString err,src,dest,path1,path2;
- int pos = gv->curbootloader.Find('/');
+ int pos = bootloadername.Find('/');
if(pos == wxNOT_FOUND) pos = 0;
- wxString firmwarename = gv->curbootloader.SubString(pos,gv->curbootloader.Length());
+ wxString firmwarename = bootloadername.SubString(pos,bootloadername.Length());
//wxString firmDir = gv->curbootloader.SubString(0,pos);
if(mode == BOOTLOADER_ADD)
{
//Files downloaden
- src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
+ src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str());
if( DownloadURL(src, dest) )
@@ -293,12 +293,12 @@ bool h10(int mode)
return false;
}
- path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),gv->curdestdir.c_str(),firmwarename.c_str());
- path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str());
+ path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
+ path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str());
if(!wxFileExists(path1)) //Firmware dosent exists on player
{
- path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),gv->curdestdir.c_str()); //attempt other firmwarename
+ path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename
if(!wxFileExists(path1)) //Firmware dosent exists on player
{
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
@@ -328,11 +328,11 @@ bool h10(int mode)
}
else if(mode == BOOTLOADER_REM)
{
- path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),gv->curdestdir.c_str(),firmwarename.c_str());
+ path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str());
if(!wxFileExists(path1)) //Firmware dosent exists on player
{
- path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),gv->curdestdir.c_str()); //attempt other firmwarename
+ path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename
if(!wxFileExists(path1)) //Firmware dosent exists on player
{
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
@@ -361,7 +361,7 @@ bool h10(int mode)
}
// FWPatcher
-bool fwpatcher(int mode)
+bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firmware)
{
if(mode == BOOTLOADER_ADD)
{
@@ -369,7 +369,7 @@ bool fwpatcher(int mode)
wxString src,dest,err;
int series,table_entry;
- if (!FileMD5(gv->curfirmware, md5sum_str)) {
+ if (!FileMD5(firmware, md5sum_str)) {
ERR_DIALOG(wxT("Could not open firmware"), wxT("Open Firmware"));
return false;
}
@@ -402,9 +402,9 @@ bool fwpatcher(int mode)
else
{
//Download bootloader
- src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
+ src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str());
+ gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
if( DownloadURL(src, dest) )
{
wxRemoveFile(dest);
@@ -413,7 +413,7 @@ bool fwpatcher(int mode)
return false;
}
- if(!PatchFirmware(gv->curfirmware,dest,series, table_entry)) // Patch firmware
+ if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware
{
ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware"));
return false;
@@ -425,11 +425,11 @@ bool fwpatcher(int mode)
gv->stdpaths->GetUserDataDir().c_str());
if(gv->curplat == wxT("h100"))
- dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),gv->curdestdir.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),deviceDir.c_str());
else if(gv->curplat == wxT("h120"))
- dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),gv->curdestdir.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),deviceDir.c_str());
else if(gv->curplat == wxT("h300"))
- dest.Printf(wxT("%s" PATH_SEP "H300.hex"),gv->curdestdir.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str());
if(!wxRenameFile(src,dest))
{
@@ -440,7 +440,6 @@ bool fwpatcher(int mode)
{
return true;
}
-
}
}
diff --git a/rbutil/bootloaders.h b/rbutil/bootloaders.h
index 53569e34da..015f095b76 100755
--- a/rbutil/bootloaders.h
+++ b/rbutil/bootloaders.h
@@ -23,6 +23,7 @@
#ifndef BOOTLOADERS_H_INCLUDED
#define BOOTLOADERS_H_INCLUDED
+#include <wx/string.h>
extern "C" {
// Ipodpatcher
@@ -31,11 +32,11 @@ extern "C" {
bool initIpodpatcher();
-bool ipodpatcher(int mode);
-bool gigabeatf(int mode);
-bool iaudiox5(int mode);
-bool fwpatcher(int mode);
-bool h10(int mode);
+bool ipodpatcher(int mode,wxString bootloadername);
+bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir);
+bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir);
+bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firmware);
+bool h10(int mode,wxString bootloadername,wxString deviceDir);
#endif // BOOTLOADERS_H_INCLUDED
diff --git a/rbutil/credits.h b/rbutil/credits.h
index 75ba0f547b..2fc14c6efd 100644
--- a/rbutil/credits.h
+++ b/rbutil/credits.h
@@ -22,7 +22,7 @@
#define CREDITS_H_INCLUDED
#define RBUTIL_FULLNAME "The Rockbox Utility"
-#define RBUTIL_VERSION "Version 0.3.0.2"
+#define RBUTIL_VERSION "Version 0.3.1.0"
static const wxString rbutil_developers[] = {
wxT("Christi Alice Scarborough"),
diff --git a/rbutil/install_dialogs.cpp b/rbutil/install_dialogs.cpp
new file mode 100644
index 0000000000..2cb754a482
--- /dev/null
+++ b/rbutil/install_dialogs.cpp
@@ -0,0 +1,753 @@
+
+#include "install_dialogs.h"
+#include "wizard.xpm"
+
+
+
+////////////////////////////////////////////////
+//// Bootloader Installation
+/////////////////////////////////////////////////
+
+IMPLEMENT_CLASS( bootloaderInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( bootloaderInstallDlg, wxDialog )
+
+END_EVENT_TABLE()
+
+bootloaderInstallDlg::bootloaderInstallDlg( )
+{
+ Init();
+}
+
+bootloaderInstallDlg::bootloaderInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Init();
+ Create(parent, id, caption, pos, size, style);
+}
+
+void bootloaderInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
+ wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_firmwarepos = new FirmwarePositionCtrl(this,ID_FIRMWARE);
+ wxBoxSizer3->Add(m_firmwarepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+}
+
+//init the local variables
+void bootloaderInstallDlg::Init()
+{
+
+}
+
+// create the window
+bool bootloaderInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+
+
+// tranver data from the controls
+bool bootloaderInstallDlg::TransferDataFromWindow()
+{
+
+ if( m_devicepos->IsShown())
+ {
+ gv->curdestdir = m_devicepos->getDevicePos();
+ if(!wxDirExists(gv->curdestdir))
+ {
+ WARN_DIALOG(wxT("The Devicepostion is not valid"),
+ wxT("Select a Deviceposition"));
+ gv->curdestdir = wxT("");
+ return false;
+ }
+ }
+
+ if(m_firmwarepos->IsShown())
+ {
+ gv->curfirmware = m_firmwarepos->getFirmwarePos();
+ if(!wxFileExists(gv->curfirmware))
+ {
+ WARN_DIALOG(wxT("The Firmware position is not valid"),
+ wxT("Select a original Firmware"));
+ gv->curfirmware = wxT("");
+ return false;
+ }
+ }
+ return true;
+}
+
+// tranver data to the controls
+bool bootloaderInstallDlg::TransferDataToWindow()
+{
+ if(gv->curplat == wxT(""))
+ {
+ WARN_DIALOG(wxT("You have not selected a audio device"),
+ wxT("Select a Device"));
+ return false;
+ }
+ int index = gv->plat_id.Index(gv->curplat);
+
+ if(!gv->plat_needsbootloader[index])
+ {
+ WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
+ wxT("Bootloader"));
+ return false;
+ }
+
+ if(gv->plat_bootloadermethod[index] != wxT("ipodpatcher") && gv->plat_bootloadermethod[index] != wxT("sansapatcher"))
+ {
+ m_devicepos->Show(true);
+ }else
+ {
+ m_devicepos->Show(false);
+ }
+ if(gv->plat_bootloadermethod[index] == wxT("fwpatcher"))
+ {
+ m_firmwarepos->Show(true);
+ }else
+ {
+ m_firmwarepos->Show(false);
+ }
+
+ m_devicepos->setDefault();
+ m_firmwarepos->setDefault();
+ return true;
+}
+
+////////////////////////////////////////////////
+//// Bootloader Deinstallation
+/////////////////////////////////////////////////
+
+IMPLEMENT_CLASS( bootloaderDeInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( bootloaderDeInstallDlg, wxDialog )
+
+END_EVENT_TABLE()
+
+bootloaderDeInstallDlg::bootloaderDeInstallDlg( )
+{
+ Init();
+}
+
+bootloaderDeInstallDlg::bootloaderDeInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Init();
+ Create(parent, id, caption, pos, size, style);
+}
+
+void bootloaderDeInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // controls at the bottom
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+}
+
+//init the local variables
+void bootloaderDeInstallDlg::Init()
+{
+
+}
+
+// create the window
+bool bootloaderDeInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+// tranver data from the controls
+bool bootloaderDeInstallDlg::TransferDataFromWindow()
+{
+ return true;
+}
+
+// tranver data to the controls
+bool bootloaderDeInstallDlg::TransferDataToWindow()
+{
+ if(gv->curplat == wxT(""))
+ {
+ WARN_DIALOG(wxT("You have not selected a audio device"),
+ wxT("Select a Device"));
+ return false;
+ }
+ return true;
+}
+
+////////////////////////////////////////////////
+//// Font Installation
+/////////////////////////////////////////////////
+
+
+IMPLEMENT_CLASS( fontInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( fontInstallDlg, wxDialog )
+
+END_EVENT_TABLE()
+
+fontInstallDlg::fontInstallDlg( )
+{
+ Init();
+}
+
+fontInstallDlg::fontInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Init();
+ Create(parent, id, caption, pos, size, style);
+}
+
+void fontInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
+ wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+ // controls at the bottom
+ wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
+ topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
+
+}
+
+//init the local variables
+void fontInstallDlg::Init()
+{
+
+}
+
+// create the window
+bool fontInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+
+// tranver data from the controls
+bool fontInstallDlg::TransferDataFromWindow()
+{
+ gv->curdestdir = m_devicepos->getDevicePos();
+ if(!wxDirExists(gv->curdestdir))
+ {
+ WARN_DIALOG(wxT("The Devicepostion is not valid"),
+ wxT("Select a Deviceposition"));
+ gv->curdestdir = wxT("");
+ return false;
+ }
+
+ return true;
+}
+
+// tranver data to the controls
+bool fontInstallDlg::TransferDataToWindow()
+{
+ m_devicepos->setDefault();
+ return true;
+}
+
+////////////////////////////////////////////////
+//// Rockbox DeInstallation
+/////////////////////////////////////////////////
+
+IMPLEMENT_CLASS( rockboxDeInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( rockboxDeInstallDlg, wxDialog )
+
+END_EVENT_TABLE()
+
+rockboxDeInstallDlg::rockboxDeInstallDlg( )
+{
+ Init();
+}
+
+rockboxDeInstallDlg::rockboxDeInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Init();
+ Create(parent, id, caption, pos, size, style);
+}
+
+void rockboxDeInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
+ wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // Full deinstallation ?
+ wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
+ wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
+ "file created during installation. This means that when Rockbox is\n"
+ "uninstalled all your configuration files are preserved. However,\n"
+ "you can also perform a full uninstall, which will completely\n"
+ "remove all traces of Rockbox from your system, and can be used\n"
+ "even if Rockbox was previously installed manually."));
+ wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
+
+ wxCheckBox* FullCheckBox = new wxCheckBox(this, ID_FULL_CHCKBX,
+ wxT("Perform a full uninstall"));
+ wxBoxSizer3->Add(FullCheckBox, 0, wxALL, 5);
+
+ // controls at the bottom
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+}
+
+//init the local variables
+void rockboxDeInstallDlg::Init()
+{
+
+}
+
+// create the window
+bool rockboxDeInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+
+// tranver data from the controls
+bool rockboxDeInstallDlg::TransferDataFromWindow()
+{
+
+ gv->curdestdir = m_devicepos->getDevicePos();
+ if(!wxDirExists(gv->curdestdir))
+ {
+ WARN_DIALOG(wxT("The Devicepostion is not valid"),
+ wxT("Select a Deviceposition"));
+ gv->curdestdir = wxT("");
+ return false;
+ }
+
+ wxCheckBox* fullchkbx = (wxCheckBox*) FindWindow(ID_FULL_CHCKBX);
+ gv->curisfull = fullchkbx->IsChecked();
+
+ return true;
+}
+
+// tranver data to the controls
+bool rockboxDeInstallDlg::TransferDataToWindow()
+{
+ m_devicepos->setDefault();
+ return true;
+}
+
+////////////////////////////////////////////////
+//// Themes Installation
+/////////////////////////////////////////////////
+
+IMPLEMENT_CLASS( themesInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( themesInstallDlg, wxDialog )
+
+END_EVENT_TABLE()
+
+themesInstallDlg::themesInstallDlg( )
+{
+
+}
+
+themesInstallDlg::themesInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Create(parent, id, caption, pos, size, style);
+}
+
+void themesInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* topHoriSizer = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(topHoriSizer, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ topHoriSizer->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* mainVertiSizer = new wxBoxSizer(wxVERTICAL);
+ topHoriSizer->Add(mainVertiSizer, 0, wxGROW|wxALL, 5);
+
+ wxBoxSizer* wxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
+ mainVertiSizer->Add(wxBoxSizer4, 0, wxGROW|wxALL, 0);
+
+ wxBoxSizer* wxBoxSizer5 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer4->Add(wxBoxSizer5, 0, wxGROW|wxALL, 0);
+
+ m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
+ wxBoxSizer5->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_theme = new ThemeCtrl(this,ID_THEME);
+ wxBoxSizer5->Add(m_theme, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // controls at the bottom
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+
+}
+
+
+// create the window
+bool themesInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+
+// tranver data from the controls
+bool themesInstallDlg::TransferDataFromWindow()
+{
+
+ gv->curdestdir = m_devicepos->getDevicePos();
+ if(!wxDirExists(gv->curdestdir))
+ {
+ WARN_DIALOG(wxT("The Devicepostion is not valid"),
+ wxT("Select a Deviceposition"));
+ gv->curdestdir = wxT("");
+ return false;
+ }
+
+ gv->themesToInstall.Clear();
+ gv->themesToInstall = m_theme->getThemesToInstall();
+
+ if(gv->themesToInstall.GetCount() == 0)
+ {
+ WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
+ return false;
+ }
+
+ return true;
+}
+
+// tranver data to the controls
+bool themesInstallDlg::TransferDataToWindow()
+{
+ if(gv->curplat == wxT(""))
+ {
+ WARN_DIALOG(wxT("You have not selected a audio device"),
+ wxT("Select a Device"));
+ return false;
+ }
+
+ m_devicepos->setDefault();
+ m_theme->setDevice(gv->curplat);
+ return true;
+}
+////////////////////////////////////////////////
+//// Rockbox Installation
+/////////////////////////////////////////////////
+
+IMPLEMENT_CLASS( rockboxInstallDlg, wxDialog )
+
+BEGIN_EVENT_TABLE( rockboxInstallDlg, wxDialog )
+ EVT_RADIOBOX(ID_BUILD_BOX, rockboxInstallDlg::OnBuildBox)
+END_EVENT_TABLE()
+
+rockboxInstallDlg::rockboxInstallDlg( )
+{
+}
+
+rockboxInstallDlg::rockboxInstallDlg( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+ Create(parent, id, caption, pos, size, style);
+}
+
+void rockboxInstallDlg::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // bitmap
+ wxBitmap sidebmp(wizard_xpm);
+
+ ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
+ sideimage->SetBitmap(sidebmp);
+ wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
+
+ wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
+ wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // Build information
+ wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
+ wxT("Please select the Rockbox version you would like "
+ "to install on your audio\ndevice:"));
+ wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
+
+ wxArrayString array;
+ wxString buf;
+ buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
+ array.Add(buf);
+ array.Add(wxT("Archived Build"));
+ array.Add(wxT("Current Build "));
+
+ wxRadioBox* BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
+ wxDefaultPosition, wxDefaultSize, array, 0, wxRA_SPECIFY_ROWS);
+ wxBoxSizer3->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
+
+ wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
+ wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
+ wxVERTICAL);
+ wxStaticText* DetailText = new wxStaticText(this, ID_DETAIL_TXT, wxT(""));
+ wxBoxSizer3->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
+ WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
+
+ wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
+ wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
+ "local hard disk to save network traffic. If your local copy is\n"
+ "no longer working, tick this box to download a fresh copy.") );
+ wxBoxSizer3->Add(WxStaticText2, 0 , wxALL, 5);
+
+ wxCheckBox* NoCacheCheckBox = new wxCheckBox(this, ID_NOCACHE_CHCKBX,
+ wxT("Don't use locally cached copies of Rockbox") );
+ wxBoxSizer3->Add(NoCacheCheckBox, 0, wxALL, 5);
+ // controls at the bottom
+ OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
+ topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+
+}
+
+// create the window
+bool rockboxInstallDlg::Create( wxWindow* parent,
+ wxWindowID id, const wxString& caption,
+ const wxPoint& pos, const wxSize& size, long style )
+{
+
+ if (!wxDialog::Create( parent, id, caption, pos, size, style ))
+ return false;
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+ return true;
+}
+
+void rockboxInstallDlg::OnBuildBox(wxCommandEvent& event)
+{
+ wxString str;
+ wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
+ wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
+ wxStaticText* DetailText = (wxStaticText*)FindWindow(ID_DETAIL_TXT);
+
+ switch(BuildRadioBox->GetSelection() )
+ {
+ case BUILD_RELEASE:
+ str = _("This is the last released version of Rockbox, and is the\n"
+ "recommended version to install.");
+ NoCacheCheckBox->Enable();
+ break;
+ case BUILD_DAILY:
+ str = _("These are automatically built each day from the current\n"
+ "development source code. This generally has more features\n"
+ "than the last release but may be much less stable. Features\n"
+ "may change regularly.");
+ NoCacheCheckBox->Enable();
+ break;
+ case BUILD_BLEEDING:
+ str = _("This is the absolute up to the minute Rockbox built after\n"
+ "the last change was made.\n\n"
+ "Note: This option will always download a fresh copy from the\n"
+ "web server.\n");
+ NoCacheCheckBox->Enable(false);
+ break;
+ default:
+ break;
+ }
+
+ DetailText->SetLabel(str);
+
+ this->GetSizer()->Layout();
+ this->GetSizer()->Fit(this);
+ this->GetSizer()->SetSizeHints(this);
+ Refresh();
+}
+
+
+// tranver data from the controls
+bool rockboxInstallDlg::TransferDataFromWindow()
+{
+ wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
+ wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
+
+ gv->curdestdir = m_devicepos->getDevicePos();
+ if(!wxDirExists(gv->curdestdir))
+ {
+ WARN_DIALOG(wxT("The Devicepostion is not valid"),
+ wxT("Select a Deviceposition"));
+ gv->curdestdir = wxT("");
+ return false;
+ }
+
+ gv->curbuild = BuildRadioBox->GetSelection();
+ gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
+ NoCacheCheckBox->IsChecked();
+
+ return true;
+}
+
+// tranver data to the controls
+bool rockboxInstallDlg::TransferDataToWindow()
+{
+ m_devicepos->setDefault();
+
+ if(gv->curplat == wxT(""))
+ {
+ WARN_DIALOG(wxT("You have not selected a audio device"),
+ wxT("Select a Device"));
+ return false;
+ }
+
+ wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
+
+ int index =gv->plat_id.Index(gv->curplat);
+
+ wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
+ ID_BUILD_BOX);
+
+ if (gv->plat_released[index] )
+ {
+ BuildRadioBox->Enable(BUILD_RELEASE, true);
+ BuildRadioBox->SetSelection(BUILD_RELEASE);
+ } else {
+ BuildRadioBox->Enable(BUILD_RELEASE, false);
+ BuildRadioBox->SetSelection(BUILD_DAILY);
+
+ }
+ wxPostEvent(this, updateradiobox);
+ return true;
+}
diff --git a/rbutil/install_dialogs.h b/rbutil/install_dialogs.h
new file mode 100644
index 0000000000..4ed1f5eeee
--- /dev/null
+++ b/rbutil/install_dialogs.h
@@ -0,0 +1,234 @@
+#ifndef INSTALL_DIALOGS_H_INCLUDED
+#define INSTALL_DIALOGS_H_INCLUDED
+
+#include "rbutil.h"
+
+#include "rbutilCtrls.h"
+class bootloaderInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( bootloaderInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICEPOS = 1002,
+ ID_FIRMWARE = 1003,
+ }; //End of Enum
+public:
+ bootloaderInstallDlg( );
+ bootloaderInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Bootloader Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ // Member initialization
+ void Init();
+ //Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Bootloader Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ // Creates the controls and sizers
+ void CreateControls();
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+
+ DevicePositionCtrl* m_devicepos;
+ FirmwarePositionCtrl* m_firmwarepos;
+
+
+};
+
+class bootloaderDeInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( bootloaderDeInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICE = 1001,
+
+ }; //End of Enum
+public:
+ bootloaderDeInstallDlg( );
+ bootloaderDeInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Bootloader Deinstallation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ /// Member initialization
+ void Init();
+ /// Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Bootloader Deinstallation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style =wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+ DeviceSelectorCtrl* m_deviceselector;
+};
+
+
+class fontInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( fontInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICEPOS = 1002,
+ }; //End of Enum
+public:
+ fontInstallDlg( );
+ fontInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Font Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ /// Member initialization
+ void Init();
+ /// Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Font Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+ DevicePositionCtrl* m_devicepos;
+};
+
+
+class rockboxDeInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( rockboxDeInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICEPOS = 1002,
+ ID_FULL_CHCKBX = 1003,
+ }; //End of Enum
+public:
+ rockboxDeInstallDlg( );
+ rockboxDeInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Rockbox Deinstallation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style =wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ /// Member initialization
+ void Init();
+ /// Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Rockbox Deinstallation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style =wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+ DevicePositionCtrl* m_devicepos;
+};
+
+class themesInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( themesInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICE = 1001,
+ ID_DEVICEPOS = 1002,
+ ID_THEME = 1006,
+ }; //End of Enum
+public:
+ themesInstallDlg( );
+ themesInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Themes Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ // Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Themes Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ // Creates the controls and sizers
+ void CreateControls();
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+ wxString currentPreview;
+ DevicePositionCtrl* m_devicepos;
+ ThemeCtrl* m_theme;
+
+};
+
+class rockboxInstallDlg : public wxDialog
+{
+ DECLARE_CLASS( rockboxInstallDlg )
+ DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICEPOS = 1002,
+ ID_BUILD_BOX = 1006,
+ ID_DEVICE_POS_CTRL = 1007,
+ ID_DETAIL_TXT = 1008,
+ ID_NOCACHE_CHCKBX =1009,
+
+ }; //End of Enum
+public:
+ rockboxInstallDlg( );
+ rockboxInstallDlg( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Rockbox Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ // Creation
+ bool Create( wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxString& caption = wxT("Rockbox Installation"),
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
+ // Creates the controls and sizers
+ void CreateControls();
+
+ void OnBuildBox(wxCommandEvent& event);
+
+ bool TransferDataFromWindow();
+ bool TransferDataToWindow();
+
+private:
+ DevicePositionCtrl* m_devicepos;
+};
+
+#endif // INSTALL_DIALOGS_H_INCLUDED
diff --git a/rbutil/rbutil-rc.rc b/rbutil/rbutil-rc.rc
index 7ca5040256..abede2a54f 100644
--- a/rbutil/rbutil-rc.rc
+++ b/rbutil/rbutil-rc.rc
@@ -1,8 +1,8 @@
#define RBUTIL 1
#include <wx/msw/wx.rc>
RBUTIL VERSIONINFO
-FILEVERSION 0,3,0,0
-PRODUCTVERSION 0,3,0,0
+FILEVERSION 0,3,1,0
+PRODUCTVERSION 0,3,1,0
FILEOS 0x00000004
FILETYPE 0x00000001
BEGIN
@@ -10,8 +10,8 @@ BEGIN
BEGIN
BLOCK "FFFF0000"
BEGIN
- VALUE "FileVersion", "0.3.0.2\0"
- VALUE "ProductVersion", "0.3.0.2\0"
+ VALUE "FileVersion", "0.3.1.0\0"
+ VALUE "ProductVersion", "0.3.1.0\0"
VALUE "CompanyName", "Rockbox Team\0"
VALUE "FileDescription", "Rockbox Utility\0"
VALUE "InternalName", "rbutil\0"
diff --git a/rbutil/rbutil.cbp b/rbutil/rbutil.cbp
index e577abc3b1..9b31e924a5 100644
--- a/rbutil/rbutil.cbp
+++ b/rbutil/rbutil.cbp
@@ -101,6 +101,8 @@
<Unit filename="h120sums.h" />
<Unit filename="h300sums.h" />
<Unit filename="install_3d.xpm" />
+ <Unit filename="install_dialogs.cpp" />
+ <Unit filename="install_dialogs.h" />
<Unit filename="installlog.cpp" />
<Unit filename="installlog.h" />
<Unit filename="ipodpatcher\ipodio-win32.c">
@@ -136,8 +138,6 @@
<Unit filename="uninstall_3d.xpm" />
<Unit filename="untools2_3d.xpm" />
<Unit filename="wizard.xpm" />
- <Unit filename="wizard_pages.cpp" />
- <Unit filename="wizard_pages.h" />
<Unit filename="wx_pch.h" />
<Extensions>
<code_completion />
diff --git a/rbutil/rbutil.cpp b/rbutil/rbutil.cpp
index ff01a65923..df496a1c42 100644
--- a/rbutil/rbutil.cpp
+++ b/rbutil/rbutil.cpp
@@ -125,8 +125,9 @@ int DownloadURL(wxString src, wxString dest)
buf, 100, NULL, wxPD_APP_MODAL |
wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME |
wxPD_REMAINING_TIME | wxPD_CAN_ABORT);
- progress->Update(0);
progress->SetSize(500,200);
+ progress->Update(0);
+
input = true;
wxURL* in_http = new wxURL(src);
@@ -750,3 +751,4 @@ bool rm_rf(wxString file)
return rc ? true : false;
}
+
diff --git a/rbutil/rbutil.h b/rbutil/rbutil.h
index ae00bd21fb..74e626407a 100644
--- a/rbutil/rbutil.h
+++ b/rbutil/rbutil.h
@@ -51,6 +51,12 @@
#include <wx/file.h>
#include <wx/wizard.h>
#include <wx/event.h>
+#include <wx/statline.h>
+#include <wx/valgen.h>
+#include <wx/thread.h>
+#include <wx/regex.h>
+#include <wx/tokenzr.h>
+#include <wx/notebook.h>
#ifdef __WXMSW__
#define PATH_SEP "\\"
@@ -88,8 +94,6 @@ public:
wxArrayInt plat_needsbootloader;
wxArrayString plat_bootloadermethod;
wxArrayString plat_bootloadername;
- wxArrayInt plat_autodetect;
- wxArrayString plat_combinedname;
wxArrayString plat_resolution;
wxString download_url;
wxString daily_url;
@@ -103,15 +107,13 @@ public:
// User configuration data.
wxString curplat;
- unsigned int curplatnum;
+ // unsigned int curplatnum;
wxString curdestdir;
+ wxString curfirmware;
unsigned int curbuild;
bool curisfull;
bool nocache;
bool portable;
- wxString curbootloadermethod;
- wxString curbootloader;
- wxString curfirmware;
wxString curresolution;
wxArrayString themesToInstall;
@@ -155,4 +157,5 @@ bool rm_rf(wxString file);
#define BOOTLOADER_ADD 0
#define BOOTLOADER_REM 1
+
#endif
diff --git a/rbutil/rbutil.ini b/rbutil/rbutil.ini
index 838edfb6d3..01e86c1506 100644
--- a/rbutil/rbutil.ini
+++ b/rbutil/rbutil.ini
@@ -43,8 +43,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=11x2x1
[recorder]
@@ -54,8 +52,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[recorder8mb]
@@ -65,8 +61,6 @@ released=no
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[recorderv2]
@@ -76,8 +70,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[fmrecorder]
@@ -87,8 +79,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[fmrecorder8mb]
@@ -98,8 +88,6 @@ released=no
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[ondiosp]
@@ -109,8 +97,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[ondiofm]
@@ -120,8 +106,6 @@ released=yes
needsbootloader=no
bootloadermethod=
bootloadername=
-autodetect=no
-combinedname=
resolution=112x64x1
[h100]
@@ -131,8 +115,6 @@ released=no
needsbootloader=yes
bootloadermethod=fwpatcher
bootloadername=bootloader-h100.bin
-autodetect=no
-combinedname=
resolution=160x128x2
[h120]
@@ -142,8 +124,6 @@ released=no
needsbootloader=yes
bootloadermethod=fwpatcher
bootloadername=bootloader-h120.bin
-autodetect=no
-combinedname=
resolution=160x128x2
[h300]
@@ -153,8 +133,6 @@ released=no
needsbootloader=yes
bootloadermethod=fwpatcher
bootloadername=bootloader-h300.bin
-autodetect=no
-combinedname=
resolution=220x176x16
[h10_5gbums]
@@ -164,8 +142,6 @@ released=no
needsbootloader=yes
bootloadermethod=h10
bootloadername=H10.mi4
-autodetect=no
-combinedname=
resolution=128x128x16
[h10_5gbmtp]
@@ -175,8 +151,6 @@ released=no
needsbootloader=yes
bootloadermethod=h10
bootloadername=H10_5GB-MTP/H10.mi4
-autodetect=no
-combinedname=
resolution=128x128x16
[h10]
@@ -186,8 +160,6 @@ released=no
needsbootloader=yes
bootloadermethod=h10
bootloadername=H10_20GC.mi4
-autodetect=no
-combinedname=
resolution=160x128x16
[ipodcolor]
@@ -196,9 +168,7 @@ platform=ipodcolor
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipodcolor
resolution=220x176x16
[ipodnano]
@@ -207,9 +177,7 @@ platform=ipodnano
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipodnano
resolution=176x132x16
[ipod4gray]
@@ -218,9 +186,7 @@ platform=ipod4gray
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipod4g
resolution=160x128x2
[ipodvideo]
@@ -229,9 +195,7 @@ platform=ipodvideo
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipodvideo
resolution=320x240x16
[ipod3g]
@@ -240,9 +204,7 @@ platform=ipod3g
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipod3g
resolution=160x128x2
[ipodmini1g]
@@ -251,9 +213,7 @@ platform=ipodmini1g
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipodmini
resolution=138x110x2
[ipodmini2g]
@@ -262,9 +222,7 @@ platform=ipodmini2g
released=no
needsbootloader=yes
bootloadermethod=ipodpatcher
-bootloadername=none
-autodetect=yes
-combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
+bootloadername=ipodmini2g
resolution=138x110x2
[iaudiox5]
@@ -274,8 +232,6 @@ released=no
needsbootloader=yes
bootloadermethod=iaudio
bootloadername=x5_fw.bin
-autodetect=no
-combinedname=
resolution=160x128x16
[iaudiox5v]
@@ -285,8 +241,6 @@ released=no
needsbootloader=yes
bootloadermethod=iaudio
bootloadername=x5v_fw.bin
-autodetect=no
-combinedname=
resolution=160x128x2
[iaudiom5]
@@ -296,8 +250,6 @@ released=no
needsbootloader=yes
bootloadermethod=iaudio
bootloadername=m5_fw.bin
-autodetect=no
-combinedname=
resolution=160x128x16
[gigabeatf]
@@ -306,6 +258,4 @@ platform=gigabeatf
needsbootloader=yes
bootloadermethod=gigabeatf
bootloadername=FWIMG01.DAT
-autodetect=no
-combinedname=
resolution=240x320x16
diff --git a/rbutil/rbutilApp.cpp b/rbutil/rbutilApp.cpp
index 812142185f..1b183a1e49 100644
--- a/rbutil/rbutilApp.cpp
+++ b/rbutil/rbutilApp.cpp
@@ -80,6 +80,7 @@ bool rbutilFrmApp::OnInit()
rbutilFrm *myFrame = new rbutilFrm(NULL);
SetTopWindow(myFrame);
+
myFrame->Show(TRUE);
initIpodpatcher(); // reserve mem for ipodpatcher
@@ -171,12 +172,6 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
gv->GlobalConfig->Read(buf.Format(wxT("/%s/bootloadername"),
cur.c_str()), &tmpstr);
gv->plat_bootloadername.Add(tmpstr);
- gv->GlobalConfig->Read(buf.Format(wxT("/%s/autodetect"),
- cur.c_str()), &tmpstr);
- gv->plat_autodetect.Add( (tmpstr == wxT("yes")) ? true : false ) ;
- gv->GlobalConfig->Read(buf.Format(wxT("/%s/combinedname"),
- cur.c_str()), &tmpstr);
- gv->plat_combinedname.Add(tmpstr);
gv->GlobalConfig->Read(buf.Format(wxT("/%s/resolution"),
cur.c_str()), &tmpstr);
gv->plat_resolution.Add(tmpstr);
@@ -187,9 +182,6 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
gv->GlobalConfig->SetPath(wxT("/general"));
gv->GlobalConfig->Read(wxT("default_platform"), &tmpstr, wxT("cthulhu"));
- for (i=0; i< gv->plat_id.GetCount(); i++) {
- if (gv->plat_id[i] == tmpstr) gv->curplatnum = i;
- }
gv->GlobalConfig->Read(wxT("last_release"), &tmpstr);
gv->last_release = tmpstr;
@@ -255,6 +247,7 @@ void rbutilFrmApp::ReadUserConfig()
gv->UserConfig->SetPath(wxT("/defaults"));
if (gv->UserConfig->Read(wxT("curdestdir"), &str) ) gv->curdestdir = str;
if (gv->UserConfig->Read(wxT("curplatform"), &str) ) gv->curplat = str;
+ if (gv->UserConfig->Read(wxT("curfirmware"), &str) ) gv->curfirmware = str;
gv->UserConfig->SetPath(stack);
}
@@ -263,6 +256,7 @@ void rbutilFrmApp::WriteUserConfig()
gv->UserConfig->SetPath(wxT("/defaults"));
gv->UserConfig->Write(wxT("curdestdir"), gv->curdestdir);
gv->UserConfig->Write(wxT("curplatform"), gv->curplat);
+ gv->UserConfig->Write(wxT("curfirmware"), gv->curfirmware);
delete gv->UserConfig;
diff --git a/rbutil/rbutilCtrls.cpp b/rbutil/rbutilCtrls.cpp
new file mode 100644
index 0000000000..36caeeaac0
--- /dev/null
+++ b/rbutil/rbutilCtrls.cpp
@@ -0,0 +1,588 @@
+
+#include "rbutilCtrls.h"
+#include "bootloaders.h"
+
+/////////////////////////////////////////////////////////////
+//// Controls
+////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////
+//// Image Ctrl
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(ImageCtrl, wxControl)
+ EVT_PAINT(ImageCtrl::OnPaint)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(ImageCtrl, wxControl)
+
+bool ImageCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+return true;
+}
+
+void ImageCtrl::OnPaint(wxPaintEvent& event)
+{
+ wxPaintDC dc(this);
+ dc.DrawBitmap(m_bitmap,0,0,false);
+}
+
+void ImageCtrl::SetBitmap(wxBitmap bmp)
+{
+ m_bitmap = bmp;
+ Refresh();
+
+}
+
+wxSize ImageCtrl::DoGetBestSize() const
+{
+ wxSize bestsize;
+ bestsize.x = m_bitmap.GetWidth();
+ bestsize.y = m_bitmap.GetHeight();
+ return bestsize;
+}
+
+
+
+/////////////////////////////////////////////
+//// Theme Control
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(ThemeCtrl, wxControl)
+ EVT_LISTBOX(ID_THEME_LST, ThemeCtrl::OnThemesLst)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(ThemeCtrl, wxControl)
+
+bool ThemeCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+ CreateControls();
+
+ GetSizer()->Fit(this);
+
+ GetSizer()->SetSizeHints(this);
+return true;
+}
+
+void ThemeCtrl::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
+
+ //Device Selection
+ wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
+ horizontalSizer->Add(wxBoxSizer7,0,wxGROW | wxALL,0);
+
+ wxStaticText* m_desc = new wxStaticText( this, wxID_STATIC,
+ wxT("Select one or more Themes to install"), wxDefaultPosition,
+ wxDefaultSize, 0 );
+ wxBoxSizer7->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_themeList = new wxListBox(this,ID_THEME_LST,wxDefaultPosition,
+ wxDefaultSize,0,NULL,wxLB_EXTENDED);
+ wxBoxSizer7->Add(m_themeList, 0, wxALIGN_LEFT|wxALL, 5);
+
+ // Preview Picture
+ wxBoxSizer* wxBoxSizer9 = new wxBoxSizer(wxVERTICAL);
+ horizontalSizer->Add(wxBoxSizer9,0,wxGROW | wxALL,0);
+
+ wxStaticText* preview_desc= new wxStaticText(this,wxID_ANY,wxT("Preview:"));
+ wxBoxSizer9->Add(preview_desc,0,wxGROW | wxALL,5);
+
+ m_PreviewBitmap = new ImageCtrl(this,ID_PREVIEW_BITMAP );
+ wxBoxSizer9->Add(m_PreviewBitmap,0,wxALIGN_LEFT | wxALL,5);
+
+ wxStaticBox* groupbox= new wxStaticBox(this,wxID_ANY,wxT("Selected Theme:"));
+ wxStaticBoxSizer* styleSizer = new wxStaticBoxSizer( groupbox, wxVERTICAL );
+ topSizer->Add(styleSizer,0,wxGROW|wxALL,0);
+
+ // horizontal sizer
+ wxBoxSizer* wxBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
+ styleSizer->Add(wxBoxSizer8,0,wxGROW | wxALL,0);
+
+ // File size
+ wxStaticText* size_desc= new wxStaticText(this,wxID_ANY,wxT("Filesize:"));
+ wxBoxSizer8->Add(size_desc,0,wxGROW | wxALL,5);
+
+ m_size= new wxStaticText(this,ID_FILESIZE,wxT(""));
+ wxBoxSizer8->Add(m_size,0,wxGROW | wxALL,5);
+
+ // Description
+ wxStaticText* desc_desc= new wxStaticText(this,wxID_ANY,wxT("Description:"));
+ styleSizer->Add(desc_desc,0,wxGROW | wxALL,5);
+
+ m_themedesc= new wxStaticText(this,ID_DESC,wxT(""));
+ styleSizer->Add(m_themedesc,0,wxGROW | wxALL,5);
+
+ topSizer->Fit(this);
+ topSizer->SetSizeHints(this);
+ Layout();
+
+}
+
+void ThemeCtrl::Init()
+{
+ m_Themes.Clear();
+ m_Themes_path.Clear();
+ m_Themes_size.Clear();
+ m_Themes_image.Clear();
+ m_Themes_desc.Clear();
+
+}
+
+void ThemeCtrl::setDevice(wxString device)
+{
+
+ int index = gv->plat_id.Index(device);
+ if(index == -1) return;
+
+ if(gv->plat_resolution[index] == m_currentResolution)
+ return;
+ else
+ m_currentResolution = gv->plat_resolution[index];
+
+ // load the themelist
+ Init();
+ m_size->SetLabel(wxT(""));
+ m_themedesc->SetLabel(wxT(""));
+ m_themeList->Clear();
+
+ //get correct Themes list
+ wxString src,dest,err;
+
+ src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),m_currentResolution.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"),
+ gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
+
+ if(DownloadURL(src, dest))
+ {
+ MESG_DIALOG(wxT("Unable to download themes list."));
+ return;
+ }
+
+ //read and parse Themes list
+ wxString themelistraw;
+ wxFFile themefile;
+ if(!themefile.Open(dest)) //open file
+ {
+ MESG_DIALOG(wxT("Unable to open themes list."));
+ return;
+ }
+ if(!themefile.ReadAll(&themelistraw)) //read complete file
+ {
+ MESG_DIALOG(wxT("Unable to read themes list."));
+ return;
+ }
+ wxRegEx reAll(wxT("<body >(.+)</body>")); //extract body part
+ if(! reAll.Matches(themelistraw))
+ {
+ MESG_DIALOG(wxT("Themes list is in wrong Format."));
+ return;
+ }
+ wxString lines = reAll.GetMatch(themelistraw,1);
+
+ // prepare text
+ lines.Replace(wxT("<br />"),wxT(""),true); //replace <br /> with nothing
+ lines.Replace(wxT("\n"),wxT(""),true); //replace \n with nothing
+ lines.Trim(true); //strip WS at end
+ lines.Trim(false); //strip WS at beginning
+ wxStringTokenizer tkz(lines,wxT("|")); //tokenize it
+
+ while ( tkz.HasMoreTokens() ) // read all entrys
+ {
+ m_Themes.Add(tkz.GetNextToken()); //Theme name
+ m_Themes_path.Add(tkz.GetNextToken()); //Theme path
+ m_Themes_size.Add(tkz.GetNextToken()); //File size
+ m_Themes_image.Add(tkz.GetNextToken()); //Screenshot
+ m_Themes_desc.Add(tkz.GetNextToken()); //Description
+
+ m_themeList->Append(m_Themes.Last());
+ }
+
+ this->GetSizer()->Layout();
+ this->GetSizer()->Fit(this);
+ this->GetSizer()->SetSizeHints(this);
+ m_parent->GetSizer()->Layout();
+ m_parent->GetSizer()->Fit(m_parent);
+ m_parent->GetSizer()->SetSizeHints(m_parent);
+}
+
+
+void ThemeCtrl::OnThemesLst(wxCommandEvent& event)
+{
+ // wxCriticalSectionLocker locker(m_ThemeSelectSection);
+
+ wxArrayInt selected;
+ int numSelected = m_themeList->GetSelections(selected);
+ if(numSelected == 0) return;
+
+ int index = selected[0];
+
+ m_size->SetLabel(m_Themes_size[index]);
+ m_themedesc->SetLabel(m_Themes_desc[index]);
+ m_themedesc->Wrap(200); // wrap desc
+
+ wxString src,dest;
+
+ int pos = m_Themes_image[index].Find('/',true);
+ wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
+
+ dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
+ gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
+
+ if(!wxDirExists(dest))
+ wxMkdir(dest);
+
+ //this is a URL no PATH_SEP
+ src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),m_currentResolution.c_str(),filename.c_str());
+ dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
+ gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str(),filename.c_str());
+
+ if(DownloadURL(src, dest))
+ {
+ MESG_DIALOG(wxT("Unable to download image."));
+ return;
+ }
+
+ m_currentimage = dest;
+ wxBitmap bmp;
+ bmp.LoadFile(m_currentimage,wxBITMAP_TYPE_PNG);
+ m_PreviewBitmap->SetBitmap(bmp);
+
+ Refresh();
+ this->GetSizer()->Layout();
+ this->GetSizer()->Fit(this);
+ this->GetSizer()->SetSizeHints(this);
+
+ m_parent->GetSizer()->Layout();
+ m_parent->GetSizer()->Fit(m_parent);
+ m_parent->GetSizer()->SetSizeHints(m_parent);
+
+}
+
+
+ wxArrayString ThemeCtrl::getThemesToInstall()
+ {
+ wxArrayString themes;
+ wxArrayInt selected;
+ int numSelected = m_themeList->GetSelections(selected);
+
+ for(int i=0; i < numSelected; i++)
+ {
+ themes.Add(m_Themes_path[selected[i]]);
+ }
+ return themes;
+
+ }
+
+/////////////////////////////////////////////
+//// Ok Cancel Control
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(OkCancelCtrl, wxControl)
+
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(OkCancelCtrl, wxControl)
+
+bool OkCancelCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+return true;
+}
+
+void OkCancelCtrl::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL);
+ this->SetSizer(topSizer);
+
+ // The OK button
+ m_OkBtn = new wxButton ( this, wxID_OK, wxT("&OK"),
+ wxDefaultPosition, wxDefaultSize, 0 );
+ topSizer->Add(m_OkBtn, 0, wxALL, 5);
+ // The Cancel button
+ m_CancelBtn = new wxButton ( this, wxID_CANCEL,
+ wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
+ topSizer->Add(m_CancelBtn, 0, wxALL, 5);
+
+ Layout();
+
+}
+
+
+/////////////////////////////////////////////
+//// Device Selector
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(DeviceSelectorCtrl, wxControl)
+ EVT_BUTTON(ID_AUTODETECT_BTN, DeviceSelectorCtrl::OnAutoDetect)
+ EVT_COMBOBOX(ID_DEVICE_CBX,DeviceSelectorCtrl::OnComboBox)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(DeviceSelectorCtrl, wxControl)
+
+bool DeviceSelectorCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+return true;
+}
+
+void DeviceSelectorCtrl::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ //Device Selection
+
+ wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
+ m_desc = new wxStaticText( this, wxID_STATIC,
+ wxT("Device:"), wxDefaultPosition,
+ wxDefaultSize, 0 );
+ horizontalSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_deviceCbx = new wxComboBox(this, ID_DEVICE_CBX,wxT(""),
+ wxDefaultPosition,wxDefaultSize,gv->plat_name,wxCB_READONLY);
+
+ m_deviceCbx->SetToolTip(wxT("Select your Device."));
+ m_deviceCbx->SetHelpText(wxT("Select your Device."));
+
+ horizontalSizer->Add(m_deviceCbx, 0, wxALIGN_LEFT|wxALL, 5);
+
+ wxButton* m_autodetectBtn = new wxButton(this, ID_AUTODETECT_BTN, wxT("Autodetect"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
+ wxT("AutodetectBtn"));
+
+ m_autodetectBtn->SetToolTip(wxT("Autodetection of the Device."));
+ m_autodetectBtn->SetHelpText(wxT("Autodetection of the Device."));
+
+ horizontalSizer->Add(m_autodetectBtn,0,wxGROW | wxALL,5);
+ Layout();
+
+}
+
+wxString DeviceSelectorCtrl::getDevice()
+{
+ return m_currentDevice;
+}
+
+void DeviceSelectorCtrl::setDefault()
+{
+ int index = gv->plat_id.Index(gv->curplat);
+ if(index == -1) return;
+ m_deviceCbx->SetValue(gv->plat_name[index]);
+}
+
+void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event)
+{
+ int index = gv->plat_name.Index(m_deviceCbx->GetValue());
+ if(index == -1) m_currentDevice = wxT("");
+
+ gv->curplat = gv->plat_id[index];
+}
+
+void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
+{
+ struct ipod_t ipod;
+ int n = ipod_scan(&ipod);
+ if(n == 1)
+ {
+ wxString temp(ipod.targetname,wxConvUTF8);
+ int index = gv->plat_bootloadername.Index(temp);
+ m_deviceCbx->SetValue(gv->plat_name[index]);
+ gv->curplat=gv->plat_id[index];
+ }
+ else if (n > 1)
+ {
+ WARN_DIALOG(wxT("More then one device Ipod detected, please connect only One"),
+ wxT("Detecting a Device"));
+ return;
+ }
+ else
+ {
+ WARN_DIALOG(wxT("No Device detected. (This function currently only works for Ipods)."),
+ wxT("Detecting a Device"));
+ return;
+ }
+
+}
+
+/////////////////////////////////////////////
+//// DevicePosition Selector
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(DevicePositionCtrl, wxControl)
+ EVT_BUTTON(ID_BROWSE_BTN, DevicePositionCtrl::OnBrowseBtn)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(DevicePositionCtrl, wxControl)
+
+bool DevicePositionCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+return true;
+}
+
+void DevicePositionCtrl::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ //Device Selection
+ m_desc = new wxStaticText( this, wxID_STATIC,
+ wxT("Select your Device in the Filesystem"), wxDefaultPosition,
+ wxDefaultSize, 0 );
+ topSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
+
+ wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(horizontalSizer, 0, wxGROW|wxALL, 5);
+
+ m_devicePos = new wxTextCtrl(this,wxID_ANY,gv->curdestdir);
+ m_devicePos->SetToolTip(wxT("Select your Devicefolder"));
+ m_devicePos->SetHelpText(wxT("Select your Devicefolder"));
+ horizontalSizer->Add(m_devicePos,0,wxGROW | wxALL,5);
+
+ m_browseBtn = new wxButton(this, ID_BROWSE_BTN, wxT("Browse"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
+ wxT("BrowseBtn"));
+ m_browseBtn->SetToolTip(wxT("Browse for your Device"));
+ m_browseBtn->SetHelpText(wxT("Browse for your Device"));
+ horizontalSizer->Add(m_browseBtn,0,wxGROW | wxALL,5);
+
+ topSizer->Fit(this);
+ Layout();
+
+}
+
+wxString DevicePositionCtrl::getDevicePos()
+{
+ return m_devicePos->GetValue();
+
+}
+
+void DevicePositionCtrl::setDefault()
+{
+ m_devicePos->SetValue(gv->curdestdir);
+}
+
+void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
+{
+ const wxString& temp = wxDirSelector(
+ wxT("Please select the location of your audio device"), gv->curdestdir);
+
+ if (!temp.empty())
+ {
+ m_devicePos->SetValue(temp);
+ }
+
+}
+
+/////////////////////////////////////////////
+//// FirmwarePosition Selector
+//////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE(FirmwarePositionCtrl, wxControl)
+ EVT_BUTTON(ID_BROWSE_BTN, FirmwarePositionCtrl::OnBrowseBtn)
+END_EVENT_TABLE()
+
+IMPLEMENT_DYNAMIC_CLASS(FirmwarePositionCtrl, wxControl)
+
+bool FirmwarePositionCtrl::Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos, const wxSize& size, long style,
+ const wxValidator& validator)
+{
+ if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
+
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+return true;
+}
+
+void FirmwarePositionCtrl::CreateControls()
+{
+ // A top-level sizer
+ wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
+ this->SetSizer(topSizer);
+
+ //Device Selection
+ m_desc = new wxStaticText( this, wxID_STATIC,
+ wxT("Select original Firmware form the Manufacturer"), wxDefaultPosition,
+ wxDefaultSize, 0 );
+ topSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
+
+ wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
+ topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_firmwarePos = new wxTextCtrl(this,wxID_ANY,gv->curdestdir);
+ m_firmwarePos->SetToolTip(wxT("Select the original Firmware"));
+ m_firmwarePos->SetHelpText(wxT("Select the original Firmware"));
+ horizontalSizer->Add(m_firmwarePos,0,wxGROW | wxALL,5);
+
+ m_browseBtn = new wxButton(this, ID_BROWSE_BTN, wxT("Browse"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
+ wxT("BrowseBtn"));
+ m_browseBtn->SetToolTip(wxT("Browse for the original Firmware"));
+ m_browseBtn->SetHelpText(wxT("Browse for the original Firmware"));
+ horizontalSizer->Add(m_browseBtn,0,wxGROW | wxALL,5);
+
+ Layout();
+
+}
+
+wxString FirmwarePositionCtrl::getFirmwarePos()
+{
+ return m_firmwarePos->GetValue();
+
+}
+
+void FirmwarePositionCtrl::setDefault()
+{
+ m_firmwarePos->SetValue(gv->curfirmware);
+}
+
+void FirmwarePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
+{
+ wxString temp = wxFileSelector(
+ wxT("Please select the location of the original Firmware"), gv->curdestdir,wxT(""),wxT(""),wxT("*.hex"));
+
+ if (!temp.empty())
+ {
+ m_firmwarePos->SetValue(temp);
+ }
+
+}
+
diff --git a/rbutil/rbutilCtrls.h b/rbutil/rbutilCtrls.h
new file mode 100644
index 0000000000..fcad8dea52
--- /dev/null
+++ b/rbutil/rbutilCtrls.h
@@ -0,0 +1,561 @@
+#ifndef RBUTILCTRLS_H_INCLUDED
+#define RBUTILCTRLS_H_INCLUDED
+
+#include "rbutil.h"
+
+
+class ImageCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(ImageCtrl)
+DECLARE_EVENT_TABLE()
+
+public:
+ // Constructors
+ ImageCtrl() { }
+ ImageCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Event handlers
+ void OnPaint(wxPaintEvent& event);
+
+ wxSize DoGetBestSize() const ;
+
+ void SetBitmap(wxBitmap bmp);
+
+protected:
+ wxBitmap m_bitmap;
+
+};
+
+class ThemeCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(ThemeCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DESC = 10001,
+ ID_FILESIZE= 10002,
+ ID_INSTALLCHECKBOX= 10003,
+ ID_PREVIEW_BITMAP = 10004,
+ ID_THEME_LST = 10005,
+ }; //End of Enum
+
+public:
+ // Constructors
+ ThemeCtrl() { Init(); }
+ ThemeCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init();
+ // Event handlers
+ void OnThemesLst(wxCommandEvent& event);
+ void OnCheckBox(wxCommandEvent& event);
+
+ void setDevice(wxString device);
+ wxArrayString getThemesToInstall();
+
+protected:
+ wxString m_currentimage;
+ wxString m_currentResolution;
+
+ wxStaticText* m_desc;
+ wxListBox* m_themeList;
+ wxStaticText* m_size;
+ wxStaticText* m_themedesc;
+ ImageCtrl* m_PreviewBitmap;
+
+ wxArrayString m_Themes;
+ wxArrayString m_Themes_path;
+ wxArrayString m_Themes_size;
+ wxArrayString m_Themes_image;
+ wxArrayString m_Themes_desc;
+
+};
+
+class OkCancelCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(OkCancelCtrl)
+DECLARE_EVENT_TABLE()
+
+public:
+ // Constructors
+ OkCancelCtrl() { Init(); }
+ OkCancelCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+
+protected:
+ wxButton* m_OkBtn;
+ wxButton* m_CancelBtn;
+
+};
+
+class DeviceSelectorCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICE_CBX = 10001,
+ ID_AUTODETECT_BTN= 10002,
+ }; //End of Enum
+
+public:
+ // Constructors
+ DeviceSelectorCtrl() { }
+ DeviceSelectorCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Event handlers
+ void OnAutoDetect(wxCommandEvent& event);
+ void OnComboBox(wxCommandEvent& event);
+ // Accessors
+ wxString getDevice();
+ void setDefault();
+
+protected:
+ wxString m_currentDevice;
+ wxComboBox* m_deviceCbx;
+ wxStaticText* m_desc;
+ wxButton* m_autodetectBtn;
+
+};
+
+
+class DevicePositionCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(DevicePositionCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_BROWSE_BTN = 10003,
+ }; //End of Enum
+
+public:
+ // Constructors
+ DevicePositionCtrl() { Init(); }
+ DevicePositionCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+ // Event handlers
+ void OnBrowseBtn(wxCommandEvent& event);
+ // Accessors
+ wxString getDevicePos();
+
+ void setDefault();
+
+protected:
+ wxTextCtrl* m_devicePos;
+ wxStaticText* m_desc;
+ wxButton* m_browseBtn;
+
+};
+
+
+class FirmwarePositionCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_BROWSE_BTN = 10004,
+ }; //End of Enum
+
+public:
+ // Constructors
+ FirmwarePositionCtrl() { Init(); }
+ FirmwarePositionCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+ // Event handlers
+ void OnBrowseBtn(wxCommandEvent& event);
+ // Accessors
+ wxString getFirmwarePos();
+ void setDefault();
+
+protected:
+ wxTextCtrl* m_firmwarePos;
+ wxStaticText* m_desc;
+ wxButton* m_browseBtn;
+
+};
+
+
+
+#endif
+
+#ifndef RBUTILCTRLS_H_INCLUDED
+#define RBUTILCTRLS_H_INCLUDED
+
+#include "rbutil.h"
+
+
+class ImageCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(ImageCtrl)
+DECLARE_EVENT_TABLE()
+
+public:
+ // Constructors
+ ImageCtrl() { }
+ ImageCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Event handlers
+ void OnPaint(wxPaintEvent& event);
+
+ wxSize DoGetBestSize() const ;
+
+ void SetBitmap(wxBitmap bmp);
+
+protected:
+ wxBitmap m_bitmap;
+
+};
+
+class ThemeCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(ThemeCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DESC = 10001,
+ ID_FILESIZE= 10002,
+ ID_INSTALLCHECKBOX= 10003,
+ ID_PREVIEW_BITMAP = 10004,
+ ID_THEME_LST = 10005,
+ }; //End of Enum
+
+public:
+ // Constructors
+ ThemeCtrl() { Init(); }
+ ThemeCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init();
+ // Event handlers
+ void OnThemesLst(wxCommandEvent& event);
+ void OnCheckBox(wxCommandEvent& event);
+
+ void setDevice(wxString device);
+ wxArrayString getThemesToInstall();
+
+protected:
+ wxString m_currentimage;
+ wxString m_currentResolution;
+
+ wxStaticText* m_desc;
+ wxListBox* m_themeList;
+ wxStaticText* m_size;
+ wxStaticText* m_themedesc;
+ ImageCtrl* m_PreviewBitmap;
+
+ wxArrayString m_Themes;
+ wxArrayString m_Themes_path;
+ wxArrayString m_Themes_size;
+ wxArrayString m_Themes_image;
+ wxArrayString m_Themes_desc;
+
+ wxCriticalSection m_setDeviceSection;
+ wxCriticalSection m_ThemeSelectSection;
+
+};
+
+class OkCancelCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(OkCancelCtrl)
+DECLARE_EVENT_TABLE()
+
+public:
+ // Constructors
+ OkCancelCtrl() { Init(); }
+ OkCancelCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+
+protected:
+ wxButton* m_OkBtn;
+ wxButton* m_CancelBtn;
+
+};
+
+class DeviceSelectorCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_DEVICE_CBX = 10001,
+ ID_AUTODETECT_BTN= 10002,
+ }; //End of Enum
+
+public:
+ // Constructors
+ DeviceSelectorCtrl() { }
+ DeviceSelectorCtrl(wxWindow* parent, wxWindowID id,bool bootmode,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Create(parent, id,bootmode, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,bool bootmode,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls(bool bootmode);
+ // Event handlers
+ void OnAutoDetect(wxCommandEvent& event);
+ void OnComboBox(wxCommandEvent& event);
+ // Accessors
+ wxString getDevice();
+ void setDefault();
+
+protected:
+ wxString m_currentDevice;
+ wxComboBox* m_deviceCbx;
+ wxStaticText* m_desc;
+ wxButton* m_autodetectBtn;
+
+};
+
+
+class DevicePositionCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(DevicePositionCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_BROWSE_BTN = 10003,
+ }; //End of Enum
+
+public:
+ // Constructors
+ DevicePositionCtrl() { Init(); }
+ DevicePositionCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+ // Event handlers
+ void OnBrowseBtn(wxCommandEvent& event);
+ // Accessors
+ wxString getDevicePos();
+
+ void setDefault();
+
+protected:
+ wxTextCtrl* m_devicePos;
+ wxStaticText* m_desc;
+ wxButton* m_browseBtn;
+
+};
+
+
+class FirmwarePositionCtrl: public wxControl
+{
+DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl)
+DECLARE_EVENT_TABLE()
+public:
+enum {
+ ID_BROWSE_BTN = 10004,
+ }; //End of Enum
+
+public:
+ // Constructors
+ FirmwarePositionCtrl() { Init(); }
+ FirmwarePositionCtrl(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator)
+ {
+ Init();
+ Create(parent, id, pos, size, style, validator);
+ }
+ // Creation
+ bool Create(wxWindow* parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER,
+ const wxValidator& validator = wxDefaultValidator);
+
+ // Creates the controls and sizers
+ void CreateControls();
+ // Common initialization
+ void Init() { }
+ // Event handlers
+ void OnBrowseBtn(wxCommandEvent& event);
+ // Accessors
+ wxString getFirmwarePos();
+ void setDefault();
+
+protected:
+ wxTextCtrl* m_firmwarePos;
+ wxStaticText* m_desc;
+ wxButton* m_browseBtn;
+
+};
+
+
+
+#endif
+
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp
index f41d290633..4c57e08353 100644
--- a/rbutil/rbutilFrm.cpp
+++ b/rbutil/rbutilFrm.cpp
@@ -31,8 +31,8 @@
#include "themes_3d.xpm"
#include "bootloaders.h"
+#include "install_dialogs.h"
-#include "wizard.xpm"
//----------------------------------------------------------------------------
// rbutilFrm
@@ -66,26 +66,46 @@ rbutilFrm::~rbutilFrm() {}
void rbutilFrm::CreateGUIControls(void)
{
- wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
+ wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
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);
-
+
+ wxPanel* mainPanel = new wxPanel(this,wxID_ANY);
+ WxBoxSizer1->Add(mainPanel,0,wxALL,0);
+ wxBoxSizer* WxBoxSizer0 = new wxBoxSizer(wxVERTICAL);
+ mainPanel->SetSizer(WxBoxSizer0);
+ mainPanel->SetAutoLayout(TRUE);
+
+ wxBitmap rockboxbmp(rblogo_xpm);
+ ImageCtrl* rockboxbmpCtrl = new ImageCtrl(mainPanel,wxID_ANY);
+ rockboxbmpCtrl->SetBitmap(rockboxbmp);
+ WxBoxSizer0->Add(rockboxbmpCtrl,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5);
+
+ myDeviceSelector = new DeviceSelectorCtrl(mainPanel,wxID_ANY);
+ myDeviceSelector->setDefault();
+ WxBoxSizer0->Add(myDeviceSelector,0,wxALL,5);
+
+ wxNotebook* tabwindow = new wxNotebook(mainPanel,wxID_ANY);
+ WxBoxSizer0->Add(tabwindow,0,wxALL,5);
+
+ wxPanel* installpage = new wxPanel(tabwindow,wxID_ANY);
+ wxPanel* themepage = new wxPanel(tabwindow,wxID_ANY);
+ wxPanel* uninstallpage = new wxPanel(tabwindow,wxID_ANY);
+ tabwindow->AddPage(installpage,wxT("Installation"),true);
+ tabwindow->AddPage(themepage,wxT("Themes"));
+ tabwindow->AddPage(uninstallpage,wxT("Uninstallation"));
+
+ /*********************
+ Install Page
+ ***********************/
+
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,
+ installpage->SetSizer(WxBoxSizer2);
+ installpage->SetAutoLayout(TRUE);
+
+ wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(installpage,
wxID_ANY, wxT("Please choose an option"));
wxStaticBoxSizer* WxStaticBoxSizer3 =
new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxHORIZONTAL);
@@ -94,16 +114,16 @@ void rbutilFrm::CreateGUIControls(void)
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,
+ wxBitmap BootloaderInstallButton (tools2_3d_xpm);
+ WxBitmapButton4 = new wxBitmapButton(installpage, ID_BOOTLOADER_BTN,
BootloaderInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW);
- WxBitmapButton4->SetToolTip(wxT("Instructions for installing the "
+ WxBitmapButton4->SetToolTip(wxT("Instructions for installing the "
"Rockbox bootloader on your audio device"));
- WxFlexGridSizer1->Add(WxBitmapButton4, 0,
+ WxFlexGridSizer1->Add(WxBitmapButton4, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxStaticText* WxStaticText5 = new wxStaticText(WxPanel1, wxID_ANY,
+ wxStaticText* WxStaticText5 = new wxStaticText(installpage, wxID_ANY,
wxT("Bootloader installation instructions\n\n"
"Before Rockbox can be installed on your audio player, you "
"may have to\ninstall a bootloader. This can not currently "
@@ -113,7 +133,7 @@ void rbutilFrm::CreateGUIControls(void)
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
- WxBitmapButton1 = new wxBitmapButton(WxPanel1, ID_INSTALL_BTN,
+ WxBitmapButton1 = new wxBitmapButton(installpage, ID_INSTALL_BTN,
WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
wxT("WxBitmapButton1"));
@@ -121,69 +141,102 @@ void rbutilFrm::CreateGUIControls(void)
WxFlexGridSizer1->Add(WxBitmapButton1,0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- WxStaticText2 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT2,
+ WxStaticText2 = new wxStaticText(installpage, ID_WXSTATICTEXT2,
wxT("Install Rockbox on your audio player"));
WxFlexGridSizer1->Add(WxStaticText2,0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
+/* ********************+
+ Theme Page
+ ***********************/
+
+ wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ themepage->SetSizer(WxBoxSizer3);
+ themepage->SetAutoLayout(TRUE);
+
+ wxStaticBox* WxStaticBoxSizer4_StaticBoxObj = new wxStaticBox(themepage,
+ wxID_ANY, wxT("Please choose an option"));
+ wxStaticBoxSizer* WxStaticBoxSizer4 =
+ new wxStaticBoxSizer(WxStaticBoxSizer4_StaticBoxObj,wxHORIZONTAL);
+ WxBoxSizer3->Add(WxStaticBoxSizer4,1,wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
+
+ wxFlexGridSizer* WxFlexGridSizer2 = new wxFlexGridSizer(2,2,0,0);
+ WxStaticBoxSizer4->Add(WxFlexGridSizer2,0,wxGROW | wxALL,0);
+
wxBitmap FontInstallButton (fonts_3d_xpm);
- WxBitmapButton3 = new wxBitmapButton(WxPanel1, ID_FONT_BTN,
+ WxBitmapButton3 = new wxBitmapButton(themepage, ID_FONT_BTN,
FontInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW);
WxBitmapButton3->SetToolTip(wxT("Download the most up to date "
"Rockbox fonts."));
- WxFlexGridSizer1->Add(WxBitmapButton3, 0,
+ WxFlexGridSizer2->Add(WxBitmapButton3, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxStaticText* WxStaticText4 = new wxStaticText(WxPanel1, wxID_ANY,
+ wxStaticText* WxStaticText4 = new wxStaticText(themepage, wxID_ANY,
wxT("Install the Rockbox fonts package\n\n"
"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,
+ WxFlexGridSizer2->Add(WxStaticText4, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
-
wxBitmap ThemesInstallButton (themes_3d_xpm);
- WxBitmapButton5 = new wxBitmapButton(WxPanel1, ID_THEMES_BTN,
+ WxBitmapButton5 = new wxBitmapButton(themepage, 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,
+ WxFlexGridSizer2->Add(WxBitmapButton5, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxStaticText* WxStaticText6 = new wxStaticText(WxPanel1, wxID_ANY,
+ wxStaticText* WxStaticText6 = new wxStaticText(themepage, wxID_ANY,
wxT("Install more Themes for Rockbox.\n\n"));
- WxFlexGridSizer1->Add(WxStaticText6, 0,
+ WxFlexGridSizer2->Add(WxStaticText6, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
-
+
+ /* ********************+
+ Uninstall Page
+ ***********************/
+
+ wxBoxSizer* WxBoxSizer4 = new wxBoxSizer(wxVERTICAL);
+ uninstallpage->SetSizer(WxBoxSizer4);
+ uninstallpage->SetAutoLayout(TRUE);
+
+ wxStaticBox* WxStaticBoxSizer5_StaticBoxObj = new wxStaticBox(uninstallpage,
+ wxID_ANY, wxT("Please choose an option"));
+ wxStaticBoxSizer* WxStaticBoxSizer5 =
+ new wxStaticBoxSizer(WxStaticBoxSizer5_StaticBoxObj,wxHORIZONTAL);
+ WxBoxSizer4->Add(WxStaticBoxSizer5,1,wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
+
+ wxFlexGridSizer* WxFlexGridSizer3 = new wxFlexGridSizer(2,2,0,0);
+ WxStaticBoxSizer5->Add(WxFlexGridSizer3,0,wxGROW | wxALL,0);
+
wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
- WxBitmapButton2 = new wxBitmapButton(WxPanel1, ID_REMOVE_BTN,
+ WxBitmapButton2 = new wxBitmapButton(uninstallpage, ID_REMOVE_BTN,
WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
wxT("WxBitmapButton2"));
WxBitmapButton2->SetToolTip(wxT("Uninstall Rockbox"));
- WxFlexGridSizer1->Add(WxBitmapButton2,0,
+ WxFlexGridSizer3->Add(WxBitmapButton2,0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- WxStaticText3 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT3,
+ WxStaticText3 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT3,
wxT("Remove Rockbox from your audio player"));
- WxFlexGridSizer1->Add(WxStaticText3,0,
+ WxFlexGridSizer3->Add(WxStaticText3,0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
wxBitmap WxBitmapButton4_BITMAP (untools2_3d_xpm);
- WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADERREMOVE_BTN,
+ WxBitmapButton4 = new wxBitmapButton(uninstallpage, ID_BOOTLOADERREMOVE_BTN,
WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
wxT("WxBitmapButton4"));
WxBitmapButton4->SetToolTip(wxT("Uninstall Bootloader"));
- WxFlexGridSizer1->Add(WxBitmapButton4,0,
+ WxFlexGridSizer3->Add(WxBitmapButton4,0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
- WxStaticText4 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT4,
+ WxStaticText4 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT4,
wxT("Remove Rockbox Bootloader from your audio player"));
- WxFlexGridSizer1->Add(WxStaticText4,0,
+ WxFlexGridSizer3->Add(WxStaticText4,0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
WxMenuBar1 = new wxMenuBar();
@@ -203,7 +256,7 @@ void rbutilFrm::CreateGUIControls(void)
wxITEM_NORMAL);
this->SetMenuBar(WxMenuBar1);
-
+ Layout();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
if (gv->portable)
@@ -217,7 +270,7 @@ void rbutilFrm::CreateGUIControls(void)
wxIcon rbutilFrm_ICON (rbutilFrm_XPM);
this->SetIcon(rbutilFrm_XPM);
this->SetToolTip(wxT("Install Rockbox"));
-
+
wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls"));
}
@@ -229,6 +282,7 @@ void rbutilFrm::rbutilFrmClose(wxCloseEvent& event)
}
+
/*
* OnFileExit
*/
@@ -299,93 +353,63 @@ void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
{
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Bootloader Uninstallation Wizard"),
- 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
+ bootloaderDeInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Bootloader Deinstallation"));
- page1->SetNext(page2);
- page2->SetPrev(page1);
- page2->SetNext(page3);
- page3->SetPrev(page2);
-
- wizard->GetPageAreaSizer()->Add(page1);
-
-
- if (wizard->RunWizard(page1) )
+ if (dialog.ShowModal() == wxID_OK)
{
- // uninstall the bootloader
- if(gv->curbootloadermethod == wxT("ipodpatcher"))
- {
+ int index = gv->plat_id.Index(gv->curplat);
+ wxString bootloadermethod = gv->plat_bootloadermethod[index];
- if(ipodpatcher(BOOTLOADER_REM))
+ if(bootloadermethod == wxT("ipodpatcher"))
+ {
+ wxString bootloadername = wxT("bootloader-");
+ bootloadername.Append(gv->plat_bootloadername[index] );
+ if(ipodpatcher(BOOTLOADER_REM,bootloadername))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
- ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
}
else
{
- MESG_DIALOG(wxT("The Uninstallation has failed.") );
+ MESG_DIALOG(wxT("The Uninstallation failed.") );
}
}
- else if(gv->curbootloadermethod == wxT("gigabeatf"))
+ else if(bootloadermethod== wxT("gigabeatf"))
{
- if(gigabeatf(BOOTLOADER_REM))
+ if(gigabeatf(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
- ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
}
else
- MESG_DIALOG(wxT("The Uninstallation has failed.") );
+ MESG_DIALOG(wxT("The Uninstallation failed.") );
}
- else if(gv->curbootloadermethod == wxT("h10"))
+ else if(bootloadermethod == wxT("iaudio") )
{
- if(h10(BOOTLOADER_REM))
- {
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
- ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
- }
- else
- MESG_DIALOG(wxT("The Uninstallation has failed.") );
-
+ MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
+ "you need to download and install an Original Firmware from the Manufacturer."));
}
- else if(gv->curbootloadermethod == wxT("iaudio") )
+ else if(bootloadermethod == wxT("fwpatcher"))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n"
- "you need to download and install an Original Firmware from the Manufacturer.")
- ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
+ "you need to download and install an original Firmware from the Manufacturer.\n"
+ "To do this, you need to boot into the original Firmware."));
}
- else if(gv->curbootloadermethod == wxT("fwpatcher") )
+ else if(bootloadermethod == wxT("h10"))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n"
- "you need to download and install an original Firmware from the Manufacturer.\n"
- "To do this, you need to boot into the original Firmware.")
- ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ if(h10(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir))
+ {
+ MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
+ }
+ else
+ MESG_DIALOG(wxT("The Uninstallation failed.") );
}
else
{
- MESG_DIALOG(wxT("Unsupported Bootloader Method") );
+ MESG_DIALOG(wxT("Unsupported Bootloader Uninstall method.") );
}
}
- else
- {
- MESG_DIALOG(wxT("The bootloader Uninstallation wizard was cancelled") );
- }
+
wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn"));
}
@@ -394,104 +418,73 @@ void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
{
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Installation Wizard"),
- 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) )
+ bootloaderInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Bootloader Installation"));
+
+ if (dialog.ShowModal() == wxID_OK)
{
- // start installation depending on player
- if(gv->curbootloadermethod == wxT("ipodpatcher"))
- {
+ int index = gv->plat_id.Index(gv->curplat);
+ wxString bootloadermethod = gv->plat_bootloadermethod[index];
- if(ipodpatcher(BOOTLOADER_ADD))
+ if(bootloadermethod == wxT("ipodpatcher"))
+ {
+ wxString bootloadername = wxT("bootloader-");
+ bootloadername.Append(gv->plat_bootloadername[index] );
+ if(ipodpatcher(BOOTLOADER_ADD,bootloadername))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
}
else
{
MESG_DIALOG(wxT("The installation has failed.") );
}
}
- else if(gv->curbootloadermethod == wxT("gigabeatf"))
+ else if(bootloadermethod== wxT("gigabeatf"))
{
- if(gigabeatf(BOOTLOADER_ADD))
+ if(gigabeatf(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been installed on your device."));
}
else
MESG_DIALOG(wxT("The installation has failed.") );
}
- else if(gv->curbootloadermethod == wxT("iaudio") )
+ else if(bootloadermethod == wxT("iaudio") )
{
- if(iaudiox5(BOOTLOADER_ADD))
+ if(iaudiox5(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.\n"
+ MESG_DIALOG(wxT("The Bootloader has been installed on your device.\n"
"Now turn OFF your Device, unplug USB,and insert Charger\n"
- "Your Device will automatically upgrade the flash with the Rockbox bootloader")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ "Your Device will automatically upgrade the flash with the Rockbox bootloader"));
}
else
MESG_DIALOG(wxT("The installation has failed.") );
}
- else if(gv->curbootloadermethod == wxT("fwpatcher"))
+ else if(bootloadermethod == wxT("fwpatcher"))
{
- if(fwpatcher(BOOTLOADER_ADD))
+ if(fwpatcher(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir,gv->curfirmware))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n"
- "Now use the Firmware upgrade option of your Device\n")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"
+ "Now use the Firmware upgrade option of your Device\n"));
}
else
MESG_DIALOG(wxT("The installation has failed.") );
}
- else if(gv->curbootloadermethod == wxT("h10"))
+ else if(bootloadermethod == wxT("h10"))
{
- if(h10(BOOTLOADER_ADD))
+ if(h10(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"));
}
else
MESG_DIALOG(wxT("The installation has failed.") );
}
else
{
- MESG_DIALOG(wxT("Unsupported Bootloader Method") );
+ MESG_DIALOG(wxT("Unsupported Bootloader Install method.") );
}
}
- else
- {
- MESG_DIALOG(wxT("The bootloader installation wizard was cancelled") );
- }
+
wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn"));
@@ -507,22 +500,10 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
wxFileConfig* buildinfo;
wxDateSpan oneday;
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Installation Wizard"),
- 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) )
+ rockboxInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Rockbox Installation"));
+
+ if (dialog.ShowModal() == wxID_OK)
{
switch (gv->curbuild)
{
@@ -613,9 +594,6 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
ERR_DIALOG(buf, wxT("Install"));
}
- } else
- {
- MESG_DIALOG(wxT("The installation wizard was cancelled") );
}
wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn"));
@@ -631,17 +609,12 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
wxFileConfig* buildinfo;
wxDateSpan oneday;
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Font Installation Wizard"),
- wxBitmap(wizard_xpm),
- wxDefaultPosition,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
- wxLocationPage* page1 = new wxLocationPage(wizard);
-
- wizard->GetPageAreaSizer()->Add(page1);
+ fontInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Font Installation"));
- if (wizard->RunWizard(page1) )
+ if (dialog.ShowModal() == wxID_OK)
{
+
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
if (! wxDirExists(buf) )
{
@@ -710,11 +683,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
ERR_DIALOG(buf, wxT("Font Install"));
}
- } else
- {
- MESG_DIALOG(wxT("The font installation wizard was cancelled") );
}
-
wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
}
@@ -722,25 +691,13 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
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) )
+
+ themesInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Theme Installation"));
+
+ if (dialog.ShowModal() == wxID_OK)
{
bool success=true;
for(unsigned int i=0 ;i < gv->themesToInstall.GetCount();i++)
@@ -756,35 +713,21 @@ void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
{
MESG_DIALOG(wxT("The Theme installation completed successfully.") );
}
-
-
- }
- else
- {
- MESG_DIALOG(wxT("The Themes installation wizard was cancelled") );
}
+
wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)"));
}
void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
{
- wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
+ wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Uninstallation Wizard"),
- 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);
+ rockboxDeInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Rockbox Deinstallation"));
- wizard->GetPageAreaSizer()->Add(page1);
-
- if (wizard->RunWizard(page1) )
+ if (dialog.ShowModal() == wxID_OK)
{
if (Uninstall(gv->curdestdir, gv->curisfull) )
{
@@ -798,9 +741,6 @@ void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
msg->ShowModal();
delete msg;
}
- } else
- {
- MESG_DIALOG(wxT("The uninstallation wizard was cancelled.") );
}
wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn"));
@@ -813,30 +753,19 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
wxFileSystem fs;
wxDateSpan oneday;
- wxWizard *wizard = new wxWizard(this, wxID_ANY,
- wxT("Rockbox Utility Portable Installation Wizard"),
- wxBitmap(wizard_xpm),
- wxDefaultPosition,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
- wxLocationPage* page1 = new wxLocationPage(wizard);
+ fontInstallDlg dialog(NULL, wxID_ANY,
+ wxT("Rockbox Utility Portable Installation"));
- wizard->GetPageAreaSizer()->Add(page1);
-
- if (wizard->RunWizard(page1) )
+ if (dialog.ShowModal() == wxID_OK)
{
if ( InstallRbutil(gv->curdestdir) )
{
- wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Rockbox Utility has been installed on your device.")
- ,wxT("Installation"), wxOK |wxICON_INFORMATION);
- msg->ShowModal();
- delete msg;
+ MESG_DIALOG(wxT("The Rockbox Utility has been installed on your device."));
+
} else
{
ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install"));
}
- } else
- {
- MESG_DIALOG(wxT("The portable installation wizard was cancelled") );
}
wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
diff --git a/rbutil/rbutilFrm.h b/rbutil/rbutilFrm.h
index 9f922cbbad..bf4205be10 100644
--- a/rbutil/rbutilFrm.h
+++ b/rbutil/rbutilFrm.h
@@ -41,7 +41,7 @@
#include <wx/richtext/richtextctrl.h>
#include "rbutil.h"
-#include "wizard_pages.h"
+#include "rbutilCtrls.h"
class rbutilFrm : public wxFrame
{
@@ -56,6 +56,7 @@ public:
wxMINIMIZE_BOX | wxCLOSE_BOX);
virtual ~rbutilFrm();
public:
+ DeviceSelectorCtrl* myDeviceSelector;
wxMenuBar *WxMenuBar1;
wxStaticText *WxStaticText3;
wxBitmapButton *WxBitmapButton2;
@@ -107,7 +108,7 @@ public:
void OnBootloaderBtn(wxCommandEvent& event);
void OnPortableInstall(wxCommandEvent& event);
void OnBootloaderRemoveBtn(wxCommandEvent& event);
-
+
};
#endif
diff --git a/rbutil/wizard_pages.cpp b/rbutil/wizard_pages.cpp
deleted file mode 100644
index 5649238ac8..0000000000
--- a/rbutil/wizard_pages.cpp
+++ /dev/null
@@ -1,967 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * Module: rbutil
- * File: wizardpages.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.
- *
- ****************************************************************************/
-
-#include "wizard_pages.h"
-#include "bootloaders.h"
-
-
-#include <wx/regex.h>
-#include <wx/tokenzr.h>
-
-/////// Bootplatform page ///////////////////////////////////77
-wxBootPlatformPage::wxBootPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent)
-{
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Please select the model of audio device that you would like to"
- "\ninstall the Rockbox Bootloader on from the list below:"));
- WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
-
- wxArrayString arrayStringFor_WxListBox1;
- for (unsigned int i=0; i< gv->plat_name.GetCount(); i++) {
- if (gv->plat_needsbootloader[i])
- {
- if(gv->plat_autodetect[i])
- {
- if(arrayStringFor_WxListBox1.Index(gv->plat_combinedname[i]) == wxNOT_FOUND)
- arrayStringFor_WxListBox1.Add(gv->plat_combinedname[i]);
- }
- else
- {
- arrayStringFor_WxListBox1.Add(gv->plat_name[i]);
- }
- }
- }
-
- BootPlatformListBox = new wxListBox(this, wxID_ANY, wxDefaultPosition,
- wxDefaultSize, arrayStringFor_WxListBox1, wxLB_SINGLE);
- WxBoxSizer1->Add(BootPlatformListBox,0,wxGROW | wxALL,5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
-
- for (unsigned int i=0; i< gv->plat_id.GetCount(); i++) {
- if (gv->plat_id[i] == gv->curplat) BootPlatformListBox->SetSelection(i);
- }
-
-}
-
-wxWizardPage * wxBootPlatformPage::GetNext() const
-{
- if(gv->curbootloadermethod != wxT("fwpatcher")&& gv->curbootloadermethod != wxT("ipodpatcher"))
- {
- if(wxWizardPageSimple::GetNext()->GetNext() != NULL) // not iriver hx0 and ipod, skip one page
- return wxWizardPageSimple::GetNext()->GetNext();
- }
- else if(gv->curbootloadermethod == wxT("ipodpatcher"))
- {
- if(wxWizardPageSimple::GetNext()->GetNext() != NULL)
- if(wxWizardPageSimple::GetNext()->GetNext()->GetNext() != NULL)
- return wxWizardPageSimple::GetNext()->GetNext()->GetNext(); //ipod, skip 2 pages
- else
- return wxWizardPageSimple::GetNext()->GetNext(); //ipod, skip 1 page (for uninstallation)
- }
-
- // all others , no skip
- return wxWizardPageSimple::GetNext();
-}
-
-bool wxBootPlatformPage::TransferDataFromWindow()
-{
- if (BootPlatformListBox->GetSelection() == wxNOT_FOUND )
- {
- WARN_DIALOG(wxT("You must select an audio device type before proceeding"),
- wxT("Select Platform"));
- return false;
- } else
- {
- int idx = gv->plat_name.Index(BootPlatformListBox->GetStringSelection());
- if(idx == wxNOT_FOUND) idx =gv->plat_combinedname.Index(BootPlatformListBox->GetStringSelection());
- gv->curplatnum = idx;
- gv->curplat = gv->plat_id[gv->curplatnum];
- gv->curbootloadermethod = gv->plat_bootloadermethod[gv->curplatnum];
- gv->curbootloader = gv->plat_bootloadername[gv->curplatnum];
-
- return true;
- }
-}
-//// Plattfor Page //////////////////////////
-wxPlatformPage::wxPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent)
-{
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Please select the model of audio device that you would like to"
- "\ninstall Rockbox on from the list below:"));
- WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
-
- wxArrayString arrayStringFor_WxListBox1;
- PlatformListBox = new wxListBox(this, wxID_ANY, wxDefaultPosition,
- wxDefaultSize, gv->plat_name, wxLB_SINGLE);
- WxBoxSizer1->Add(PlatformListBox,0,wxGROW | wxALL,5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
- for (unsigned int i=0; i< gv->plat_id.GetCount(); i++) {
- if (gv->plat_id[i] == gv->curplat) PlatformListBox->SetSelection(i);
- }
-}
-
-bool wxPlatformPage::TransferDataFromWindow()
-{
- if (PlatformListBox->GetSelection() == wxNOT_FOUND )
- {
- WARN_DIALOG(wxT("You must select an audio device type before proceeding"),
- wxT("Select Platform"));
- return false;
- } else
- {
- gv->curplatnum = PlatformListBox->GetSelection();
- gv->curplat = gv->plat_id[gv->curplatnum];
- gv->curresolution = gv->plat_resolution[gv->curplatnum];
- return true;
- }
-}
-
-
-//////////////// ThemeImage Dialog /////////////////
-BEGIN_EVENT_TABLE(wxThemeImageDialog,wxDialog)
- EVT_PAINT(wxThemeImageDialog::OnPaint)
- EVT_CLOSE(wxThemeImageDialog::OnClose)
-END_EVENT_TABLE();
-wxThemeImageDialog::wxThemeImageDialog(wxWindow* parent,wxWindowID id,wxString title,wxBitmap bmp) :
- wxDialog(parent, id, title)
-{
- wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
- m_bitmap = bmp;
-
- sizerTop->SetMinSize(64,64);
-
- SetSizer(sizerTop);
-
- sizerTop->SetSizeHints(this);
- sizerTop->Fit(this);
-
-}
-
-void wxThemeImageDialog::OnClose(wxCloseEvent& event)
-{
- event.Veto();
- this->Show(false);
-}
-
-void wxThemeImageDialog::SetImage(wxBitmap bmp)
-{
- m_bitmap = bmp;
- this->GetSizer()->SetMinSize(m_bitmap.GetWidth(),m_bitmap.GetHeight());
- this->GetSizer()->Fit(this);
- Layout();
- Refresh();
-}
-
-void wxThemeImageDialog::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
- wxPaintDC dc( this );
- dc.DrawBitmap( m_bitmap, 0, 0, true /* use mask */ );
-}
-
-////////////////// Themes page ////////////////////////
-BEGIN_EVENT_TABLE(wxThemesPage,wxWizardPageSimple)
- EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxThemesPage::OnPageShown)
- EVT_WIZARD_PAGE_CHANGING (wxID_ANY, wxThemesPage::OnWizardPageChanging)
- EVT_LISTBOX (ID_LISTBOX,wxThemesPage::OnListBox)
- EVT_BUTTON (ID_PREVIEW_BTN, wxThemesPage::OnPreviewBtn)
- EVT_CHECKBOX (ID_INSTALLCHECKBOX, wxThemesPage::OnCheckBox)
-END_EVENT_TABLE();
-
-wxThemesPage::wxThemesPage(wxWizard *parent) : wxWizardPageSimple(parent)
-{
- m_parent = parent;
-
- myImageDialog = new wxThemeImageDialog(this,wxID_ANY,wxT("Preview"),NULL);
- myImageDialog->Show(false);
-
- wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Please select the Theme you would like to"
- "\ninstall on your Device from the list below:"));
- mainSizer->Add(WxStaticText1,0,wxGROW | wxALL,5);
-
- // create theme listbox
- wxArrayString list;
- for(int i = 0; i< 35;i++)
- list.Add(wxT(""));
- ThemesListBox= new wxListBox(this, ID_LISTBOX, wxDefaultPosition,
- wxDefaultSize,list, wxLB_SINGLE);
- mainSizer->Add(ThemesListBox,10,wxGROW | wxALL,5);
-
- // create groupbox
- wxStaticBox* groupbox= new wxStaticBox(this,wxID_ANY,wxT("Selected Theme:"));
- wxBoxSizer* styleSizer = new wxStaticBoxSizer( groupbox, wxVERTICAL );
- mainSizer->Add(styleSizer,11,wxGROW | wxALL,5);
-
- // horizontal sizer
- wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
- styleSizer->Add(wxBoxSizer2,0,wxGROW | wxALL,0);
-
- // preview button
- m_previewBtn = new wxButton(this, ID_PREVIEW_BTN, wxT("Preview"),
- wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("PreviewBtn"));
- wxBoxSizer2->Add(m_previewBtn,0,wxGROW | wxALL,5);
-
- // checkbox for Install
- m_InstallCheckBox= new wxCheckBox(this,ID_INSTALLCHECKBOX,wxT("Install")
- ,wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("InstallCheckbox"));
- wxBoxSizer2->Add(m_InstallCheckBox,0,wxGROW | wxALL,5);
-
- // horizontal sizer
- wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
- styleSizer->Add(wxBoxSizer3,0,wxGROW | wxALL,0);
-
- // File size
- wxStaticText* size= new wxStaticText(this,wxID_ANY,wxT("Filesize:"));
- wxBoxSizer3->Add(size,0,wxGROW | wxALL,5);
-
- m_size= new wxStaticText(this,wxID_ANY,wxT(""));
- wxBoxSizer3->Add(m_size,0,wxGROW | wxALL,5);
-
- // Description
- wxStaticText* desc= new wxStaticText(this,wxID_ANY,wxT("Description:"));
- styleSizer->Add(desc,0,wxGROW | wxALL,5);
-
- m_desc= new wxStaticText(this,wxID_ANY,wxT(""));
- styleSizer->Add(m_desc,0,wxGROW | wxALL,5);
-
- SetSizer(mainSizer);
- mainSizer->Fit(this);
-
-}
-
-bool wxThemesPage::TransferDataFromWindow()
-{
- gv->themesToInstall.Clear();
-
- for(unsigned int i=0; i < m_installTheme.GetCount(); i++)
- {
- if(m_installTheme[i])
- {
- gv->themesToInstall.Add(m_Themes_path[i]);
- }
- }
-
- return true;
-
-}
-
-void wxThemesPage::OnWizardPageChanging(wxWizardEvent& event)
-{
- if(event.GetDirection()) // going forwards in the Wizard
- {
- if(gv->themesToInstall.GetCount() == 0)
- {
- WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
- event.Veto();
- }
- }
-}
-
-void wxThemesPage::OnCheckBox(wxCommandEvent& event)
-{
- int index = ThemesListBox->GetSelection(); //get Index
- if(index == wxNOT_FOUND)
- return;
-
- m_installTheme[index]= ! m_installTheme[index]; // Toggle install
-
-}
-
-void wxThemesPage::OnListBox(wxCommandEvent& event)
-{
- int index = ThemesListBox->GetSelection(); //get Index
- if(index == wxNOT_FOUND)
- return;
-
- m_desc->SetLabel(m_Themes_desc[index]); //set Desc
- m_desc->Wrap(270); // wrap desc
- m_size->SetLabel(m_Themes_size[index]+wxT(" kb")); //set file size
- m_InstallCheckBox->SetValue(m_installTheme[index]); // set the install checkbox
-
- this->GetSizer()->Layout();
-
- if(myImageDialog->IsShown())
- {
- wxString src,dest;
-
- int pos = m_Themes_image[index].Find('/',true);
- wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
-
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
-
- if(!wxDirExists(dest))
- wxMkdir(dest);
-
- //this is a URL no PATH_SEP
- src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),gv->curresolution.c_str(),filename.c_str());
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str(),filename.c_str());
-
- if(DownloadURL(src, dest))
- {
- MESG_DIALOG(wxT("Unable to download image."));
- return;
- }
-
- wxBitmap bmp;
- bmp.LoadFile(dest,wxBITMAP_TYPE_PNG);
- myImageDialog->SetImage(bmp);
- }
-
-}
-
-void wxThemesPage::OnPreviewBtn(wxCommandEvent& event)
-{
-
- int index = ThemesListBox->GetSelection();
- if(index == wxNOT_FOUND)
- return;
-
- wxString src,dest;
-
- int pos = m_Themes_image[index].Find('/',true);
- wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
-
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
-
- if(!wxDirExists(dest))
- wxMkdir(dest);
-
- //this is a URL no PATH_SEP
- src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),gv->curresolution.c_str(),filename.c_str());
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str(),filename.c_str());
-
- if(DownloadURL(src, dest))
- {
- MESG_DIALOG(wxT("Unable to download image."));
- return;
- }
-
- wxBitmap bmp;
- bmp.LoadFile(dest,wxBITMAP_TYPE_PNG);
-
- myImageDialog->SetImage(bmp);
-
- myImageDialog->Show(true);
-
-}
-
-void wxThemesPage::OnPageShown(wxWizardEvent& event)
-{
- // clear Theme info
- m_Themes.Clear();
- m_Themes_image.Clear();
- m_Themes_path.Clear();
- m_Themes_desc.Clear();
- m_Themes_size.Clear();
- m_installTheme.Clear();
- m_desc->SetLabel(wxT(""));
- m_size->SetLabel(wxT(""));
- m_InstallCheckBox->SetValue(false);
-
- //get correct Themes list
- wxString src,dest,err;
-
- src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),gv->curresolution.c_str());
- dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"),
- gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
-
- if(DownloadURL(src, dest))
- {
- MESG_DIALOG(wxT("Unable to download themes list."));
- return;
- }
-
- //read and parse Themes list
- wxString themelistraw;
- wxFFile themefile;
- if(!themefile.Open(dest)) //open file
- {
- MESG_DIALOG(wxT("Unable to open themes list."));
- return;
- }
- if(!themefile.ReadAll(&themelistraw)) //read complete file
- {
- MESG_DIALOG(wxT("Unable to read themes list."));
- return;
- }
- wxRegEx reAll(wxT("<body >(.+)</body>")); //extract body part
- if(! reAll.Matches(themelistraw))
- {
- MESG_DIALOG(wxT("Themes list is in wrong Format."));
- return;
- }
- wxString lines = reAll.GetMatch(themelistraw,1);
-
- // prepare text
- lines.Replace(wxT("<br />"),wxT(""),true); //replace <br /> with nothing
- lines.Replace(wxT("\n"),wxT(""),true); //replace \n with nothing
- lines.Trim(true); //strip WS at end
- lines.Trim(false); //strip WS at beginning
- wxStringTokenizer tkz(lines,wxT("|")); //tokenize it
-
- while ( tkz.HasMoreTokens() ) // read all entrys
- {
- m_Themes.Add(tkz.GetNextToken()); //Theme name
- m_Themes_path.Add(tkz.GetNextToken()); //Theme path
- m_Themes_size.Add(tkz.GetNextToken()); //File size
- m_Themes_image.Add(tkz.GetNextToken()); //Screenshot
- m_Themes_desc.Add(tkz.GetNextToken()); //Description
- m_installTheme.Add(false); //Theme should be installed ?
- }
-
- // set ThemeList
- ThemesListBox->Set(m_Themes);
-}
-
- //////////////////// Ipod Locaction Page /////////////////////////////
-BEGIN_EVENT_TABLE(wxIpodLocationPage,wxWizardPageSimple)
- EVT_BUTTON (ID_IPODLOCATION_BTN, wxIpodLocationPage::OnIpodLocationBtn)
- EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxIpodLocationPage::OnWizardPageChanging)
-END_EVENT_TABLE();
-
-wxIpodLocationPage::wxIpodLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
-{
-
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- // Header text
- IpodLocationLabel = new wxStaticText(this, wxID_ANY,
- wxT("Rockbox utility needs to know the device where your ipod\n"
- "device is located on your computer. Use the\n"
- "Scan Button:"));
- WxBoxSizer1->Add(IpodLocationLabel,0,wxGROW | wxALL, 5);
-
- // device location
- wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
- WxBoxSizer1->Add(WxBoxSizer3,0,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- IpodLocationText = new wxStaticText(this, wxID_ANY, wxT(""),
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer3->Add(IpodLocationText,1,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- IpodLocationBtn = new wxButton(this, ID_IPODLOCATION_BTN, wxT("Scan"),
- wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("IpodLocationBtn"));
- IpodLocationBtn->SetToolTip(wxT("Scan for your Ipod"));
- WxBoxSizer3->Add(IpodLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- // Extra text
- IpodLocationExtraText = new wxStaticText(this,wxID_ANY, wxT(""));
- WxBoxSizer1->Add(IpodLocationExtraText,0,wxGROW | wxALL, 5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
-}
-
-wxWizardPage* wxIpodLocationPage::GetPrev() const
-{
- if(gv->curbootloadermethod == wxT("ipodpatcher")) //if ipod, skip previous
- {
- if(wxWizardPageSimple::GetPrev()->GetPrev() != NULL)
- return wxWizardPageSimple::GetPrev()->GetPrev();
-
- }
- return wxWizardPageSimple::GetPrev();
-}
-
-void wxIpodLocationPage::OnWizardPageChanging(wxWizardEvent& event)
-{
- if(event.GetDirection()) // going forwards in the Wizard
- {
- if(gv->curbootloadermethod==wxT("ipodpatcher"))
- {
- if(IpodLocationText->GetLabel() == wxT("no Ipod found") ||
- IpodLocationText->GetLabel() ==wxT("More than 1 Ipod found") ||
- IpodLocationText->GetLabel() ==wxT(""))
- {
- WARN_DIALOG(wxT("No valid ipod found!"), wxT("Select Location"));
- event.Veto(); //stop pagechanging
- }
- }
- }
-}
-
-void wxIpodLocationPage::OnIpodLocationBtn(wxCommandEvent& event)
-{
- wxLogVerbose(wxT("=== begin wxIpodLocationPage::OnIpodLocationBtn"));
- struct ipod_t ipod;
- int n = ipod_scan(&ipod);
- gv->curbootloader=wxT("");
-
- if(n == 0)
- IpodLocationText->SetLabel(wxT("no Ipod found"));
- else if( n==1)
- {
- gv->curbootloader=wxT("bootloader-");
- gv->curbootloader.Append(wxString(ipod.targetname, wxConvUTF8));
- IpodLocationText->SetLabel(wxString(ipod.modelstr, wxConvUTF8));
- }
- else
- IpodLocationText->SetLabel(wxT("More than 1 Ipod found"));
-
- if(ipod.macpod)
- IpodLocationExtraText->SetLabel(wxT("This Ipod is a Mac formated Ipod\n"
- "Rockbox will not work on this.\n"
- "You have to convert it first to Fat32"));
- wxLogVerbose(wxT("=== end wxIpodLocationPage::OnIpodLocationBtn"));
-
-}
-
-BEGIN_EVENT_TABLE(wxBootLocationPage,wxWizardPageSimple)
- EVT_BUTTON (ID_BOOTLOCATION_BTN, wxBootLocationPage::OnBootLocationBtn)
- EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxBootLocationPage::OnWizardPageChanging)
- EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxBootLocationPage::OnPageShown)
-END_EVENT_TABLE();
-
-wxBootLocationPage::wxBootLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
- {
-
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- // Header text
- BootLocationLabel = new wxStaticText(this, wxID_ANY,
- wxT("Rockbox utility needs to know the folder where your audio\n"
- "device is located on your computer. Currently Rockbox utility\n"
- "is configured to use the following location:"));
- WxBoxSizer1->Add(BootLocationLabel,0,wxGROW | wxALL, 5);
-
- // device location
- wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
- WxBoxSizer1->Add(WxBoxSizer3,0,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- if (gv->curdestdir == wxT("")) gv->curdestdir = wxT("<none>");
- BootLocationText = new wxStaticText(this, wxID_ANY, gv->curdestdir,
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer3->Add(BootLocationText,1,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- BootLocationBtn = new wxButton(this, ID_BOOTLOCATION_BTN, wxT("Change"),
- wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("BootLocationBtn"));
- BootLocationBtn->SetToolTip(wxT("Select the location of your audio device"));
- WxBoxSizer3->Add(BootLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
-
- BootLocationInfo = new wxStaticText(this, wxID_ANY, wxT(""),
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer1->Add(BootLocationInfo,0,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
-}
-
-wxWizardPage* wxBootLocationPage::GetPrev() const
-{
- if(gv->curbootloadermethod != wxT("fwpatcher"))
- {
- if(wxWizardPageSimple::GetPrev()->GetPrev() != NULL)
- return wxWizardPageSimple::GetPrev()->GetPrev();
-
- }
-
- return wxWizardPageSimple::GetPrev();
-}
-
-wxWizardPage* wxBootLocationPage::GetNext() const
-{
- if(gv->curbootloadermethod == wxT("ipodpatcher"))
- {
- return wxWizardPageSimple::GetNext(); // if ipod then this is not the last page
- }
- else return NULL; // else this is the last page
-}
-
-void wxBootLocationPage::OnPageShown(wxWizardEvent& event)
-{
- if(gv->curplat == wxT("h10") || gv->curplat == wxT("h10_5gb"))
- {
- BootLocationInfo->SetLabel(wxT("Your Device needs to be in UMS Mode. \n\n"
- "If it is an MTP device, you can do this by \n"
- "reseting you Device via the Pinhole,or disconnecting the Battery \n"
- "then connecting it via the Data cable with the PC. \n"
- "Then press and hold Next,push the Power button, and \n"
- "continue to hold the Next button until the \n"
- "USB-Connected Screen appears." ));
- }
- else
- {
- BootLocationInfo->SetLabel(wxT(""));
- }
-
-}
-
-void wxBootLocationPage::OnWizardPageChanging(wxWizardEvent& event)
-{
- if(event.GetDirection()) // going forwards in the Wizard
- {
- if(!wxDirExists(BootLocationText->GetLabel()))
- {
- WARN_DIALOG(wxT("You have not selected a valid location for your audio "
- "device"), wxT("Select Location"));
- event.Veto();
- }
-
- }
-}
-
-bool wxBootLocationPage::TransferDataFromWindow()
-{
- gv->curdestdir = BootLocationText->GetLabel();
- return true;
-
-}
-
-
-void wxBootLocationPage::OnBootLocationBtn(wxCommandEvent& event)
-{
- const wxString& temp = wxDirSelector(
- wxT("Please select the location of your audio device"), gv->curdestdir);
- wxLogVerbose(wxT("=== begin wxBootLocationPage::OnBootLocationBtn(event)"));
- if (!temp.empty())
- {
- BootLocationText->SetLabel(temp);
- }
- wxLogVerbose(wxT("=== end wxBootLocationPage::OnBootLocationBtn"));
-
-}
-
-
-BEGIN_EVENT_TABLE(wxFirmwareLocationPage,wxWizardPageSimple)
- EVT_BUTTON (ID_FIRMWARELOCATION_BTN, wxFirmwareLocationPage::OnFirmwareFilenameBtn)
- EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxFirmwareLocationPage::OnWizardPageChanging)
-END_EVENT_TABLE();
-
-wxFirmwareLocationPage::wxFirmwareLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
-{
-
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- // Header text
- FirmwareLocationText = new wxStaticText(this, wxID_ANY,
- wxT("For this step Rockbox Utility needs an original Firmware.\n"
- "You can download this from the Manufacturers Website."));
- WxBoxSizer1->Add(FirmwareLocationText,0,wxGROW | wxALL, 5);
-
- // Filename text
- wxBoxSizer* WxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
- WxBoxSizer1->Add(WxBoxSizer4,0,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- FirmwareLocationFilename = new wxStaticText(this, wxID_ANY, gv->curfirmware,
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer4->Add(FirmwareLocationFilename,1,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- // Button
- FirmwareLocationBtn = new wxButton(this, ID_FIRMWARELOCATION_BTN, wxT("Explore"),
- wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("FirmwareLocationBtn"));
- FirmwareLocationBtn->SetToolTip(wxT("Select the location of the downloaded Firmware"));
- WxBoxSizer4->Add(FirmwareLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
-}
-
-void wxFirmwareLocationPage::OnWizardPageChanging(wxWizardEvent& event)
-{
- if(event.GetDirection()) // going forwards in the Wizard
- {
- if( !wxFileExists(gv->curfirmware))
- {
- WARN_DIALOG(wxT("You have not selected a valid location for the firmware "
- "file"), wxT("Select File"));
- event.Veto();
- }
- }
-
-}
-
-void wxFirmwareLocationPage::OnFirmwareFilenameBtn(wxCommandEvent& event)
-{
- wxString temp = wxFileSelector(
- wxT("Please select the location of the original Firmware"), gv->curdestdir,wxT(""),wxT(""),wxT("*.hex"));
- wxLogVerbose(wxT("=== begin wxFirmwareLocationPage::OnFirmwareFilenameBtn(event)"));
- if (!temp.empty())
- {
- gv->curfirmware=temp;
- if(temp.Length() > 30)
- {
- temp.Remove(0, temp.Length()-30);
- temp.Prepend(wxT("..."));
- }
- FirmwareLocationFilename->SetLabel(temp);
- }
- wxLogVerbose(wxT("=== end wxFirmwareLocationPage::OnFirmwareFilenameBtn"));
-}
-
-BEGIN_EVENT_TABLE(wxLocationPage,wxWizardPageSimple)
- EVT_BUTTON (ID_LOCATION_BTN, wxLocationPage::OnLocationBtn)
- EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxLocationPage::OnWizardPageChanging)
- EVT_WIZARD_PAGE_CHANGED(wxID_ANY, wxLocationPage::OnPageShown)
-END_EVENT_TABLE();
-
-wxLocationPage::wxLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
- {
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Rockbox utility needs to know the folder where your audio\n"
- "device is located on your computer. Currently Rockbox utility\n"
- "is configured to use the following location:"));
- WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL, 5);
-
- wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
- WxBoxSizer1->Add(WxBoxSizer3,0,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- if (gv->curdestdir == wxT("")) gv->curdestdir = wxT("<none>");
- LocationText = new wxStaticText(this, wxID_ANY, gv->curdestdir,
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer3->Add(LocationText,1,
- wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- wxButton* LocationBtn = new wxButton(this, ID_LOCATION_BTN, wxT("Change"),
- wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
- wxT("LocationBtn"));
- LocationBtn->SetToolTip(wxT("Select the location of your audio device"));
- WxBoxSizer3->Add(LocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
-
- LocationInfo = new wxStaticText(this, wxID_ANY, wxT(""),
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
- WxBoxSizer1->Add(LocationInfo,0,wxGROW | wxALL, 5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
-}
-
-
-void wxLocationPage::OnPageShown(wxWizardEvent& event)
-{
- if(gv->curplat == wxT("h10") || gv->curplat == wxT("h10_5gb"))
- {
- LocationInfo->SetLabel(wxT("Your Device needs to be in UMS Mode. \n\n"
- "If it is an MTP device, you can do this by \n"
- "reseting you Device via the Pinhole,or disconnecting the Battery \n"
- "then connecting it via the Data cable with the PC. \n"
- "Then press and hold Next,push the Power button, and \n"
- "continue to hold the Next button until the \n"
- "USB-Connected Screen appears." ));
- }
- else
- {
- LocationInfo->SetLabel(wxT(""));
- }
-
-
-}
-
-void wxLocationPage::OnWizardPageChanging(wxWizardEvent& event)
-{
- if(event.GetDirection()) // going forwards in the Wizard
- {
- if(!wxDirExists(LocationText->GetLabel()))
- {
- WARN_DIALOG(wxT("You have not selected a valid location for your audio "
- "device"), wxT("Select Location"));
- event.Veto();
- }
- }
-}
-
-bool wxLocationPage::TransferDataFromWindow()
-{
- gv->curdestdir = LocationText->GetLabel();
- return true;
-}
-
-void wxLocationPage::OnLocationBtn(wxCommandEvent& event)
-{
- const wxString& temp = wxDirSelector(
- wxT("Please select the location of your audio device"), gv->curdestdir);
- wxLogVerbose(wxT("=== begin wxLocationPage::OnLocationBtn(event)"));
- if (!temp.empty())
- {
- LocationText->SetLabel(temp);
- }
- wxLogVerbose(wxT("=== end wxLocationPage::OnLocationBtn"));
-}
-
-BEGIN_EVENT_TABLE(wxBuildPage,wxWizardPageSimple)
- EVT_RADIOBOX (ID_BUILD_BOX, wxBuildPage::OnBuildBox)
- EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxBuildPage::OnPageShown)
-END_EVENT_TABLE();
-
-
-wxBuildPage::wxBuildPage(wxWizard *parent) : wxWizardPageSimple(parent)
-{
- wxString buf;
-
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Please select the Rockbox version you would like "
- "to install on your audio\ndevice:"));
- WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
-
- wxArrayString* array = new wxArrayString();
- buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
- array->Add(buf);
- array->Add(wxT("Archived Build"));
- array->Add(wxT("Current Build "));
-
- BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
- wxDefaultPosition, wxDefaultSize, *array, 0, wxRA_SPECIFY_ROWS);
- WxBoxSizer1->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
- delete array;
-
- wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
- wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
- wxVERTICAL);
- DetailText = new wxStaticText(this, wxID_ANY, wxT(""));
- WxBoxSizer1->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
- WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
-
- wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
- wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
- "local hard disk to save network traffic. If your local copy is\n"
- "no longer working, tick this box to download a fresh copy.") );
- WxBoxSizer1->Add(WxStaticText2, 0 , wxALL, 5);
-
- NoCacheCheckBox = new wxCheckBox(this, wxID_ANY,
- wxT("Don't use locally cached copies of Rockbox") );
- WxBoxSizer1->Add(NoCacheCheckBox, 0, wxALL, 5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
- WxBoxSizer1->SetSizeHints(this);
-}
-
-bool wxBuildPage::TransferDataFromWindow()
-{
- gv->curbuild = BuildRadioBox->GetSelection();
- gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
- NoCacheCheckBox->IsChecked();
- return true;
-}
-
-void wxBuildPage::OnBuildBox(wxCommandEvent& event)
-{
- wxString str;
-
- switch(BuildRadioBox->GetSelection() )
- {
- case BUILD_RELEASE:
- str = _("This is the last released version of Rockbox, and is the\n"
- "recommended version to install.");
- NoCacheCheckBox->Enable();
- break;
- case BUILD_DAILY:
- str = _("These are automatically built each day from the current\n"
- "development source code. This generally has more features\n"
- "than the last release but may be much less stable. Features\n"
- "may change regularly.");
- NoCacheCheckBox->Enable();
- break;
- case BUILD_BLEEDING:
- str = _("This is the absolute up to the minute Rockbox built after\n"
- "the last change was made.\n\n"
- "Note: This option will always download a fresh copy from the\n"
- "web server.\n");
- NoCacheCheckBox->Enable(false);
- break;
- default:
- break;
- }
-
- DetailText->SetLabel(str);
-}
-
-void wxBuildPage::OnPageShown(wxWizardEvent& event)
-{
- wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
- ID_BUILD_BOX);
-
- if (gv->plat_released[gv->curplatnum] )
- {
- BuildRadioBox->Enable(BUILD_RELEASE, true);
- BuildRadioBox->SetSelection(BUILD_RELEASE);
- } else {
- BuildRadioBox->Enable(BUILD_RELEASE, false);
- BuildRadioBox->SetSelection(BUILD_DAILY);
-
- }
-
- wxPostEvent(this, updateradiobox);
-}
-
-wxFullUninstallPage::wxFullUninstallPage(wxWizard* parent) :
- wxWizardPageSimple(parent)
-{
- wxString buf;
-
- wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
- wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
- "file created during installation. This means that when Rockbox is\n"
- "uninstalled all your configuration files are preserved. However,\n"
- "you can also perform a full uninstall, which will completely\n"
- "remove all traces of Rockbox from your system, and can be used\n"
- "even if Rockbox was previously installed manually.\n\n"
- "Archos users will need to reinstall any firmware upgrades obtained\n"
- "from Archos after a full uninstall."));
- WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
-
- FullCheckBox = new wxCheckBox(this, wxID_ANY,
- wxT("Perform a full uninstall"));
- WxBoxSizer1->Add(FullCheckBox, 0, wxALL, 5);
-
- SetSizer(WxBoxSizer1);
- WxBoxSizer1->Fit(this);
- WxBoxSizer1->SetSizeHints(this);
-}
-
-bool wxFullUninstallPage::TransferDataFromWindow()
-{
- gv->curisfull = FullCheckBox->IsChecked();
- return true;
-}
diff --git a/rbutil/wizard_pages.h b/rbutil/wizard_pages.h
deleted file mode 100644
index f08d29d315..0000000000
--- a/rbutil/wizard_pages.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * Module: rbutil
- * File: wizard_pages.h
- *
- * 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.
- *
- ****************************************************************************/
-
-
-#ifndef __wizard_pages_HPP_
-#define __wizard_pages_HPP_
-
-#include "rbutil.h"
-
-
-////// Dialog for Preview of Theme //////////////
-class wxThemeImageDialog : public wxDialog
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- wxThemeImageDialog(wxWindow* parent,wxWindowID id,wxString title,wxBitmap bmp);
- void OnPaint(wxPaintEvent& WXUNUSED(event));
- void SetImage(wxBitmap bmp);
- void OnClose(wxCloseEvent& event);
-
-private:
- wxBitmap m_bitmap;
-};
-
-
-
-class wxThemesPage : public wxWizardPageSimple
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_PREVIEW_BTN = 1000,
- ID_LISTBOX = 1001,
- ID_INSTALLCHECKBOX = 1002,
- };
-
-public:
- wxThemesPage(wxWizard *parent);
- virtual bool TransferDataFromWindow(void);
- void OnPageShown(wxWizardEvent& event);
- void OnPreviewBtn(wxCommandEvent& event);
- void OnListBox(wxCommandEvent& event);
- void OnCheckBox(wxCommandEvent& event);
- void OnWizardPageChanging(wxWizardEvent& event);
-
-public:
- wxListBox* ThemesListBox;
- wxButton* m_previewBtn;
- wxStaticText* m_desc;
- wxStaticText* m_size;
- wxCheckBox* m_InstallCheckBox;
- wxThemeImageDialog* myImageDialog;
-
- wxArrayString m_Themes;
- wxArrayString m_Themes_path;
- wxArrayString m_Themes_image;
- wxArrayString m_Themes_desc;
- wxArrayString m_Themes_size;
- wxArrayInt m_installTheme;
-
-};
-
-class wxBootPlatformPage : public wxWizardPageSimple
-{
-public:
- wxBootPlatformPage(wxWizard *parent);
- virtual bool TransferDataFromWindow(void);
- virtual wxWizardPage *GetNext() const;
- void SetNext(wxWizardPage * next) {wxWizardPageSimple::SetNext(next); my_next = next;}
-
-public:
- wxListBox* BootPlatformListBox;
- wxWizardPage *my_next;
-};
-
-class wxIpodLocationPage : public wxWizardPageSimple
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_IPODLOCATION_BTN = 1000,
- };
-public:
- wxIpodLocationPage(wxWizard* parent);
- void OnIpodLocationBtn(wxCommandEvent& event);
- void OnWizardPageChanging(wxWizardEvent& event);
- virtual wxWizardPage *GetPrev() const;
- void SetPrev(wxWizardPage * prev) {wxWizardPageSimple::SetPrev(prev); my_prev = prev;}
-
-private:
- wxStaticText* IpodLocationText;
- wxStaticText* IpodLocationLabel;
- wxStaticText* IpodLocationExtraText;
- wxButton* IpodLocationBtn;
- wxWizardPage *my_prev;
-};
-
-
-
-class wxBootLocationPage : public wxWizardPageSimple
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_BOOTLOCATION_BTN = 1000,
- };
-
-public:
- wxBootLocationPage(wxWizard* parent);
- virtual bool TransferDataFromWindow(void);
- void OnBootLocationBtn(wxCommandEvent& event);
- void OnPageShown(wxWizardEvent& event);
- void OnWizardPageChanging(wxWizardEvent& event);
- virtual wxWizardPage *GetPrev() const;
- virtual wxWizardPage *GetNext() const;
- void SetPrev(wxWizardPage * prev) {wxWizardPageSimple::SetPrev(prev); my_prev = prev;}
-
-private:
- wxStaticText* BootLocationText;
- wxStaticText* BootLocationLabel;
- wxStaticText* BootLocationInfo;
- wxButton* BootLocationBtn;
- wxWizardPage *my_prev;
-
-};
-
-class wxFirmwareLocationPage : public wxWizardPageSimple
-{
- private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_FIRMWARELOCATION_BTN = 1000,
- };
-
-public:
- wxFirmwareLocationPage(wxWizard* parent);
- void OnFirmwareFilenameBtn(wxCommandEvent& event);
- void OnWizardPageChanging(wxWizardEvent& event);
-
-private:
- wxStaticText* FirmwareLocationText;
- wxStaticText* FirmwareLocationFilename;
- wxButton* FirmwareLocationBtn;
-
-};
-
-
-class wxPlatformPage : public wxWizardPageSimple
-{
-public:
- wxPlatformPage(wxWizard *parent);
- virtual bool TransferDataFromWindow(void);
-
-public:
- wxListBox* PlatformListBox;
-};
-
-class wxLocationPage : public wxWizardPageSimple
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_LOCATION_BTN = 1000,
- };
-
-public:
- wxLocationPage(wxWizard* parent);
- virtual bool TransferDataFromWindow(void);
- void OnWizardPageChanging(wxWizardEvent& event);
- void OnLocationBtn(wxCommandEvent& event);
- void OnPageShown(wxWizardEvent& event);
-
-private:
- wxStaticText* LocationText;
- wxStaticText* BootLocationInfo;
- wxStaticText* LocationInfo;
-};
-
-class wxBuildPage : public wxWizardPageSimple
-{
-private:
- DECLARE_EVENT_TABLE()
-
-public:
- enum {
- ID_BUILD_BOX = 1000,
- };
-
-public:
- wxBuildPage(wxWizard *parent);
- virtual bool TransferDataFromWindow(void);
- void OnBuildBox(wxCommandEvent& event);
- void OnPageShown(wxWizardEvent& event);
-
-private:
- wxRadioBox* BuildRadioBox;
- wxStaticText* DetailText;
- wxCheckBox* NoCacheCheckBox;
-};
-
-class wxFullUninstallPage : public wxWizardPageSimple
-{
-public:
- wxFullUninstallPage(wxWizard *parent);
- virtual bool TransferDataFromWindow(void);
-
-private:
- wxCheckBox* FullCheckBox;
-};
-
-
-#endif