summaryrefslogtreecommitdiff
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
parentf48e0b514c6672b38d80a14a5779922253f1bbdc (diff)
downloadrockbox-60f864181118212507ae4873c8ba2667f333f23e.tar.gz
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
-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 @@
12CXX=$(shell $(PREFIX)wx-config --cxx) 12CXX=$(shell $(PREFIX)wx-config --cxx)
13INC = 13INC =
14CFLAGS = -Wall -Wundef 14CFLAGS = -Wall -Wundef
15OBJS=rbutil.o rbutilApp.o rbutilFrm.o wizard_pages.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o irivertools.o md5sum.o 15OBJS=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
16 16
17# Install into /usr/local by default 17# Install into /usr/local by default
18ifndef DESTDIR 18ifndef 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()
35 else return false; 35 else return false;
36} 36}
37// uses ipodpatcher for add and rem of bootloader 37// uses ipodpatcher for add and rem of bootloader
38bool ipodpatcher(int mode) 38bool ipodpatcher(int mode,wxString bootloadername)
39{ 39{
40 wxString src,dest,buf; 40 wxString src,dest,buf;
41 41
42 // downloading files
43 if(mode == BOOTLOADER_ADD)
44 {
45 src.Printf(wxT("%s/ipod/%s.ipod"), gv->bootloader_url.c_str(),gv->curbootloader.c_str());
46 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
47 gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str());
48 if ( DownloadURL(src, dest) )
49 {
50 wxRemoveFile(dest);
51 buf.Printf(wxT("Unable to download %s"), src.c_str() );
52 ERR_DIALOG(buf, wxT("Install"));
53 return false;
54 }
55 }
56
57 struct ipod_t ipod; 42 struct ipod_t ipod;
58 43
59 int n = ipod_scan(&ipod); 44 int n = ipod_scan(&ipod);
@@ -68,6 +53,21 @@ bool ipodpatcher(int mode)
68 return false; 53 return false;
69 } 54 }
70 55
56 // downloading files
57 if(mode == BOOTLOADER_ADD)
58 {
59 src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str());
60 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
61 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
62 if ( DownloadURL(src, dest) )
63 {
64 wxRemoveFile(dest);
65 buf.Printf(wxT("Unable to download %s"), src.c_str() );
66 ERR_DIALOG(buf, wxT("Install"));
67 return false;
68 }
69 }
70
71 if (ipod_open(&ipod, 0) < 0) 71 if (ipod_open(&ipod, 0) < 0)
72 { 72 {
73 ERR_DIALOG(wxT("[ERR] could not open ipod"), wxT("open Ipod")); 73 ERR_DIALOG(wxT("[ERR] could not open ipod"), wxT("open Ipod"));
@@ -163,20 +163,20 @@ bool ipodpatcher(int mode)
163} 163}
164 164
165// gigabeatinstallation 165// gigabeatinstallation
166bool gigabeatf(int mode) 166bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
167{ 167{
168 wxString path1,path2; 168 wxString path1,path2;
169 wxString err; 169 wxString err;
170 wxString src,dest; 170 wxString src,dest;
171 171
172 path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),gv->curdestdir.c_str()); 172 path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),deviceDir.c_str());
173 173
174 if(mode == BOOTLOADER_ADD) 174 if(mode == BOOTLOADER_ADD)
175 { 175 {
176 //Files downloaden 176 //Files downloaden
177 src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str()); 177 src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
178 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 178 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
179 gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str()); 179 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
180 if( DownloadURL(src, dest) ) 180 if( DownloadURL(src, dest) )
181 { 181 {
182 wxRemoveFile(dest); 182 wxRemoveFile(dest);
@@ -233,20 +233,20 @@ bool gigabeatf(int mode)
233} 233}
234 234
235// iaudio bootloader install 235// iaudio bootloader install
236bool iaudiox5(int mode) 236bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir)
237{ 237{
238 wxString path1,path2; 238 wxString path1,path2;
239 wxString err; 239 wxString err;
240 wxString src,dest; 240 wxString src,dest;
241 241
242 path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),gv->curdestdir.c_str(),gv->curbootloader.c_str()); 242 path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),deviceDir.c_str(),bootloadername.c_str());
243 243
244 if(mode == BOOTLOADER_ADD) 244 if(mode == BOOTLOADER_ADD)
245 { 245 {
246 //Files downloaden 246 //Files downloaden
247 src.Printf(wxT("%s/iaudio/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str()); 247 src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str());
248 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 248 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
249 gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str()); 249 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
250 if( DownloadURL(src, dest) ) 250 if( DownloadURL(src, dest) )
251 { 251 {
252 wxRemoveFile(dest); 252 wxRemoveFile(dest);
@@ -270,19 +270,19 @@ bool iaudiox5(int mode)
270} 270}
271 271
272// H10 install 272// H10 install
273bool h10(int mode) 273bool h10(int mode,wxString bootloadername,wxString deviceDir)
274{ 274{
275 wxString err,src,dest,path1,path2; 275 wxString err,src,dest,path1,path2;
276 276
277 int pos = gv->curbootloader.Find('/'); 277 int pos = bootloadername.Find('/');
278 if(pos == wxNOT_FOUND) pos = 0; 278 if(pos == wxNOT_FOUND) pos = 0;
279 wxString firmwarename = gv->curbootloader.SubString(pos,gv->curbootloader.Length()); 279 wxString firmwarename = bootloadername.SubString(pos,bootloadername.Length());
280 //wxString firmDir = gv->curbootloader.SubString(0,pos); 280 //wxString firmDir = gv->curbootloader.SubString(0,pos);
281 281
282 if(mode == BOOTLOADER_ADD) 282 if(mode == BOOTLOADER_ADD)
283 { 283 {
284 //Files downloaden 284 //Files downloaden
285 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str()); 285 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
286 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 286 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
287 gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str()); 287 gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str());
288 if( DownloadURL(src, dest) ) 288 if( DownloadURL(src, dest) )
@@ -293,12 +293,12 @@ bool h10(int mode)
293 return false; 293 return false;
294 } 294 }
295 295
296 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),gv->curdestdir.c_str(),firmwarename.c_str()); 296 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
297 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str()); 297 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str());
298 298
299 if(!wxFileExists(path1)) //Firmware dosent exists on player 299 if(!wxFileExists(path1)) //Firmware dosent exists on player
300 { 300 {
301 path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),gv->curdestdir.c_str()); //attempt other firmwarename 301 path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename
302 if(!wxFileExists(path1)) //Firmware dosent exists on player 302 if(!wxFileExists(path1)) //Firmware dosent exists on player
303 { 303 {
304 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); 304 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
@@ -328,11 +328,11 @@ bool h10(int mode)
328 } 328 }
329 else if(mode == BOOTLOADER_REM) 329 else if(mode == BOOTLOADER_REM)
330 { 330 {
331 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),gv->curdestdir.c_str(),firmwarename.c_str()); 331 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
332 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str()); 332 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str());
333 if(!wxFileExists(path1)) //Firmware dosent exists on player 333 if(!wxFileExists(path1)) //Firmware dosent exists on player
334 { 334 {
335 path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),gv->curdestdir.c_str()); //attempt other firmwarename 335 path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename
336 if(!wxFileExists(path1)) //Firmware dosent exists on player 336 if(!wxFileExists(path1)) //Firmware dosent exists on player
337 { 337 {
338 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); 338 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
@@ -361,7 +361,7 @@ bool h10(int mode)
361} 361}
362 362
363// FWPatcher 363// FWPatcher
364bool fwpatcher(int mode) 364bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firmware)
365{ 365{
366 if(mode == BOOTLOADER_ADD) 366 if(mode == BOOTLOADER_ADD)
367 { 367 {
@@ -369,7 +369,7 @@ bool fwpatcher(int mode)
369 wxString src,dest,err; 369 wxString src,dest,err;
370 int series,table_entry; 370 int series,table_entry;
371 371
372 if (!FileMD5(gv->curfirmware, md5sum_str)) { 372 if (!FileMD5(firmware, md5sum_str)) {
373 ERR_DIALOG(wxT("Could not open firmware"), wxT("Open Firmware")); 373 ERR_DIALOG(wxT("Could not open firmware"), wxT("Open Firmware"));
374 return false; 374 return false;
375 } 375 }
@@ -402,9 +402,9 @@ bool fwpatcher(int mode)
402 else 402 else
403 { 403 {
404 //Download bootloader 404 //Download bootloader
405 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),gv->curbootloader.c_str()); 405 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
406 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 406 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
407 gv->stdpaths->GetUserDataDir().c_str(),gv->curbootloader.c_str()); 407 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
408 if( DownloadURL(src, dest) ) 408 if( DownloadURL(src, dest) )
409 { 409 {
410 wxRemoveFile(dest); 410 wxRemoveFile(dest);
@@ -413,7 +413,7 @@ bool fwpatcher(int mode)
413 return false; 413 return false;
414 } 414 }
415 415
416 if(!PatchFirmware(gv->curfirmware,dest,series, table_entry)) // Patch firmware 416 if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware
417 { 417 {
418 ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware")); 418 ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware"));
419 return false; 419 return false;
@@ -425,11 +425,11 @@ bool fwpatcher(int mode)
425 gv->stdpaths->GetUserDataDir().c_str()); 425 gv->stdpaths->GetUserDataDir().c_str());
426 426
427 if(gv->curplat == wxT("h100")) 427 if(gv->curplat == wxT("h100"))
428 dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),gv->curdestdir.c_str()); 428 dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),deviceDir.c_str());
429 else if(gv->curplat == wxT("h120")) 429 else if(gv->curplat == wxT("h120"))
430 dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),gv->curdestdir.c_str()); 430 dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),deviceDir.c_str());
431 else if(gv->curplat == wxT("h300")) 431 else if(gv->curplat == wxT("h300"))
432 dest.Printf(wxT("%s" PATH_SEP "H300.hex"),gv->curdestdir.c_str()); 432 dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str());
433 433
434 if(!wxRenameFile(src,dest)) 434 if(!wxRenameFile(src,dest))
435 { 435 {
@@ -440,7 +440,6 @@ bool fwpatcher(int mode)
440 { 440 {
441 return true; 441 return true;
442 } 442 }
443
444 } 443 }
445 444
446 } 445 }
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 @@
23#ifndef BOOTLOADERS_H_INCLUDED 23#ifndef BOOTLOADERS_H_INCLUDED
24#define BOOTLOADERS_H_INCLUDED 24#define BOOTLOADERS_H_INCLUDED
25 25
26#include <wx/string.h>
26 27
27extern "C" { 28extern "C" {
28 // Ipodpatcher 29 // Ipodpatcher
@@ -31,11 +32,11 @@ extern "C" {
31 32
32 33
33bool initIpodpatcher(); 34bool initIpodpatcher();
34bool ipodpatcher(int mode); 35bool ipodpatcher(int mode,wxString bootloadername);
35bool gigabeatf(int mode); 36bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir);
36bool iaudiox5(int mode); 37bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir);
37bool fwpatcher(int mode); 38bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firmware);
38bool h10(int mode); 39bool h10(int mode,wxString bootloadername,wxString deviceDir);
39 40
40 41
41#endif // BOOTLOADERS_H_INCLUDED 42#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 @@
22#define CREDITS_H_INCLUDED 22#define CREDITS_H_INCLUDED
23 23
24#define RBUTIL_FULLNAME "The Rockbox Utility" 24#define RBUTIL_FULLNAME "The Rockbox Utility"
25#define RBUTIL_VERSION "Version 0.3.0.2" 25#define RBUTIL_VERSION "Version 0.3.1.0"
26 26
27static const wxString rbutil_developers[] = { 27static const wxString rbutil_developers[] = {
28 wxT("Christi Alice Scarborough"), 28 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 @@
1
2#include "install_dialogs.h"
3#include "wizard.xpm"
4
5
6
7////////////////////////////////////////////////
8//// Bootloader Installation
9/////////////////////////////////////////////////
10
11IMPLEMENT_CLASS( bootloaderInstallDlg, wxDialog )
12
13BEGIN_EVENT_TABLE( bootloaderInstallDlg, wxDialog )
14
15END_EVENT_TABLE()
16
17bootloaderInstallDlg::bootloaderInstallDlg( )
18{
19 Init();
20}
21
22bootloaderInstallDlg::bootloaderInstallDlg( wxWindow* parent,
23 wxWindowID id, const wxString& caption,
24 const wxPoint& pos, const wxSize& size, long style )
25{
26 Init();
27 Create(parent, id, caption, pos, size, style);
28}
29
30void bootloaderInstallDlg::CreateControls()
31{
32 // A top-level sizer
33 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
34 this->SetSizer(topSizer);
35
36 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
37 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
38
39 // bitmap
40 wxBitmap sidebmp(wizard_xpm);
41 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
42 sideimage->SetBitmap(sidebmp);
43 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
44
45 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
46 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
47
48 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
49 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
50
51 m_firmwarepos = new FirmwarePositionCtrl(this,ID_FIRMWARE);
52 wxBoxSizer3->Add(m_firmwarepos, 0, wxALIGN_LEFT|wxALL, 5);
53
54 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
55 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
56
57}
58
59//init the local variables
60void bootloaderInstallDlg::Init()
61{
62
63}
64
65// create the window
66bool bootloaderInstallDlg::Create( wxWindow* parent,
67 wxWindowID id, const wxString& caption,
68 const wxPoint& pos, const wxSize& size, long style )
69{
70
71 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
72 return false;
73 CreateControls();
74 GetSizer()->Fit(this);
75 GetSizer()->SetSizeHints(this);
76 Centre();
77 return true;
78}
79
80
81
82// tranver data from the controls
83bool bootloaderInstallDlg::TransferDataFromWindow()
84{
85
86 if( m_devicepos->IsShown())
87 {
88 gv->curdestdir = m_devicepos->getDevicePos();
89 if(!wxDirExists(gv->curdestdir))
90 {
91 WARN_DIALOG(wxT("The Devicepostion is not valid"),
92 wxT("Select a Deviceposition"));
93 gv->curdestdir = wxT("");
94 return false;
95 }
96 }
97
98 if(m_firmwarepos->IsShown())
99 {
100 gv->curfirmware = m_firmwarepos->getFirmwarePos();
101 if(!wxFileExists(gv->curfirmware))
102 {
103 WARN_DIALOG(wxT("The Firmware position is not valid"),
104 wxT("Select a original Firmware"));
105 gv->curfirmware = wxT("");
106 return false;
107 }
108 }
109 return true;
110}
111
112// tranver data to the controls
113bool bootloaderInstallDlg::TransferDataToWindow()
114{
115 if(gv->curplat == wxT(""))
116 {
117 WARN_DIALOG(wxT("You have not selected a audio device"),
118 wxT("Select a Device"));
119 return false;
120 }
121 int index = gv->plat_id.Index(gv->curplat);
122
123 if(!gv->plat_needsbootloader[index])
124 {
125 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
126 wxT("Bootloader"));
127 return false;
128 }
129
130 if(gv->plat_bootloadermethod[index] != wxT("ipodpatcher") && gv->plat_bootloadermethod[index] != wxT("sansapatcher"))
131 {
132 m_devicepos->Show(true);
133 }else
134 {
135 m_devicepos->Show(false);
136 }
137 if(gv->plat_bootloadermethod[index] == wxT("fwpatcher"))
138 {
139 m_firmwarepos->Show(true);
140 }else
141 {
142 m_firmwarepos->Show(false);
143 }
144
145 m_devicepos->setDefault();
146 m_firmwarepos->setDefault();
147 return true;
148}
149
150////////////////////////////////////////////////
151//// Bootloader Deinstallation
152/////////////////////////////////////////////////
153
154IMPLEMENT_CLASS( bootloaderDeInstallDlg, wxDialog )
155
156BEGIN_EVENT_TABLE( bootloaderDeInstallDlg, wxDialog )
157
158END_EVENT_TABLE()
159
160bootloaderDeInstallDlg::bootloaderDeInstallDlg( )
161{
162 Init();
163}
164
165bootloaderDeInstallDlg::bootloaderDeInstallDlg( wxWindow* parent,
166 wxWindowID id, const wxString& caption,
167 const wxPoint& pos, const wxSize& size, long style )
168{
169 Init();
170 Create(parent, id, caption, pos, size, style);
171}
172
173void bootloaderDeInstallDlg::CreateControls()
174{
175 // A top-level sizer
176 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
177 this->SetSizer(topSizer);
178
179 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
180 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
181
182 // bitmap
183 wxBitmap sidebmp(wizard_xpm);
184
185 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
186 sideimage->SetBitmap(sidebmp);
187 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
188
189 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
190 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
191
192 // controls at the bottom
193 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
194 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
195}
196
197//init the local variables
198void bootloaderDeInstallDlg::Init()
199{
200
201}
202
203// create the window
204bool bootloaderDeInstallDlg::Create( wxWindow* parent,
205 wxWindowID id, const wxString& caption,
206 const wxPoint& pos, const wxSize& size, long style )
207{
208 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
209 return false;
210 CreateControls();
211 GetSizer()->Fit(this);
212 GetSizer()->SetSizeHints(this);
213 Centre();
214 return true;
215}
216
217// tranver data from the controls
218bool bootloaderDeInstallDlg::TransferDataFromWindow()
219{
220 return true;
221}
222
223// tranver data to the controls
224bool bootloaderDeInstallDlg::TransferDataToWindow()
225{
226 if(gv->curplat == wxT(""))
227 {
228 WARN_DIALOG(wxT("You have not selected a audio device"),
229 wxT("Select a Device"));
230 return false;
231 }
232 return true;
233}
234
235////////////////////////////////////////////////
236//// Font Installation
237/////////////////////////////////////////////////
238
239
240IMPLEMENT_CLASS( fontInstallDlg, wxDialog )
241
242BEGIN_EVENT_TABLE( fontInstallDlg, wxDialog )
243
244END_EVENT_TABLE()
245
246fontInstallDlg::fontInstallDlg( )
247{
248 Init();
249}
250
251fontInstallDlg::fontInstallDlg( wxWindow* parent,
252 wxWindowID id, const wxString& caption,
253 const wxPoint& pos, const wxSize& size, long style )
254{
255 Init();
256 Create(parent, id, caption, pos, size, style);
257}
258
259void fontInstallDlg::CreateControls()
260{
261 // A top-level sizer
262 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
263 this->SetSizer(topSizer);
264
265 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
266 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
267
268 // bitmap
269 wxBitmap sidebmp(wizard_xpm);
270
271 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
272 sideimage->SetBitmap(sidebmp);
273 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
274
275 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
276 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
277
278 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
279 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
280
281
282 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
283 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
284
285 // controls at the bottom
286 wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
287 topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
288
289}
290
291//init the local variables
292void fontInstallDlg::Init()
293{
294
295}
296
297// create the window
298bool fontInstallDlg::Create( wxWindow* parent,
299 wxWindowID id, const wxString& caption,
300 const wxPoint& pos, const wxSize& size, long style )
301{
302
303 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
304 return false;
305 CreateControls();
306 GetSizer()->Fit(this);
307 GetSizer()->SetSizeHints(this);
308 Centre();
309 return true;
310}
311
312
313// tranver data from the controls
314bool fontInstallDlg::TransferDataFromWindow()
315{
316 gv->curdestdir = m_devicepos->getDevicePos();
317 if(!wxDirExists(gv->curdestdir))
318 {
319 WARN_DIALOG(wxT("The Devicepostion is not valid"),
320 wxT("Select a Deviceposition"));
321 gv->curdestdir = wxT("");
322 return false;
323 }
324
325 return true;
326}
327
328// tranver data to the controls
329bool fontInstallDlg::TransferDataToWindow()
330{
331 m_devicepos->setDefault();
332 return true;
333}
334
335////////////////////////////////////////////////
336//// Rockbox DeInstallation
337/////////////////////////////////////////////////
338
339IMPLEMENT_CLASS( rockboxDeInstallDlg, wxDialog )
340
341BEGIN_EVENT_TABLE( rockboxDeInstallDlg, wxDialog )
342
343END_EVENT_TABLE()
344
345rockboxDeInstallDlg::rockboxDeInstallDlg( )
346{
347 Init();
348}
349
350rockboxDeInstallDlg::rockboxDeInstallDlg( wxWindow* parent,
351 wxWindowID id, const wxString& caption,
352 const wxPoint& pos, const wxSize& size, long style )
353{
354 Init();
355 Create(parent, id, caption, pos, size, style);
356}
357
358void rockboxDeInstallDlg::CreateControls()
359{
360 // A top-level sizer
361 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
362 this->SetSizer(topSizer);
363
364 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
365 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
366
367 // bitmap
368 wxBitmap sidebmp(wizard_xpm);
369
370 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
371 sideimage->SetBitmap(sidebmp);
372 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
373
374 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
375 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
376
377 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
378 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
379
380 // Full deinstallation ?
381 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
382 wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
383 "file created during installation. This means that when Rockbox is\n"
384 "uninstalled all your configuration files are preserved. However,\n"
385 "you can also perform a full uninstall, which will completely\n"
386 "remove all traces of Rockbox from your system, and can be used\n"
387 "even if Rockbox was previously installed manually."));
388 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
389
390 wxCheckBox* FullCheckBox = new wxCheckBox(this, ID_FULL_CHCKBX,
391 wxT("Perform a full uninstall"));
392 wxBoxSizer3->Add(FullCheckBox, 0, wxALL, 5);
393
394 // controls at the bottom
395 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
396 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
397
398}
399
400//init the local variables
401void rockboxDeInstallDlg::Init()
402{
403
404}
405
406// create the window
407bool rockboxDeInstallDlg::Create( wxWindow* parent,
408 wxWindowID id, const wxString& caption,
409 const wxPoint& pos, const wxSize& size, long style )
410{
411 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
412 return false;
413 CreateControls();
414 GetSizer()->Fit(this);
415 GetSizer()->SetSizeHints(this);
416 Centre();
417 return true;
418}
419
420
421// tranver data from the controls
422bool rockboxDeInstallDlg::TransferDataFromWindow()
423{
424
425 gv->curdestdir = m_devicepos->getDevicePos();
426 if(!wxDirExists(gv->curdestdir))
427 {
428 WARN_DIALOG(wxT("The Devicepostion is not valid"),
429 wxT("Select a Deviceposition"));
430 gv->curdestdir = wxT("");
431 return false;
432 }
433
434 wxCheckBox* fullchkbx = (wxCheckBox*) FindWindow(ID_FULL_CHCKBX);
435 gv->curisfull = fullchkbx->IsChecked();
436
437 return true;
438}
439
440// tranver data to the controls
441bool rockboxDeInstallDlg::TransferDataToWindow()
442{
443 m_devicepos->setDefault();
444 return true;
445}
446
447////////////////////////////////////////////////
448//// Themes Installation
449/////////////////////////////////////////////////
450
451IMPLEMENT_CLASS( themesInstallDlg, wxDialog )
452
453BEGIN_EVENT_TABLE( themesInstallDlg, wxDialog )
454
455END_EVENT_TABLE()
456
457themesInstallDlg::themesInstallDlg( )
458{
459
460}
461
462themesInstallDlg::themesInstallDlg( wxWindow* parent,
463 wxWindowID id, const wxString& caption,
464 const wxPoint& pos, const wxSize& size, long style )
465{
466 Create(parent, id, caption, pos, size, style);
467}
468
469void themesInstallDlg::CreateControls()
470{
471 // A top-level sizer
472 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
473 this->SetSizer(topSizer);
474
475 wxBoxSizer* topHoriSizer = new wxBoxSizer(wxHORIZONTAL);
476 topSizer->Add(topHoriSizer, 0, wxALIGN_LEFT|wxALL, 5);
477
478 // bitmap
479 wxBitmap sidebmp(wizard_xpm);
480
481 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
482 sideimage->SetBitmap(sidebmp);
483 topHoriSizer->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
484
485 wxBoxSizer* mainVertiSizer = new wxBoxSizer(wxVERTICAL);
486 topHoriSizer->Add(mainVertiSizer, 0, wxGROW|wxALL, 5);
487
488 wxBoxSizer* wxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
489 mainVertiSizer->Add(wxBoxSizer4, 0, wxGROW|wxALL, 0);
490
491 wxBoxSizer* wxBoxSizer5 = new wxBoxSizer(wxVERTICAL);
492 wxBoxSizer4->Add(wxBoxSizer5, 0, wxGROW|wxALL, 0);
493
494 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
495 wxBoxSizer5->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
496
497 m_theme = new ThemeCtrl(this,ID_THEME);
498 wxBoxSizer5->Add(m_theme, 0, wxALIGN_LEFT|wxALL, 5);
499
500 // controls at the bottom
501 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
502 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
503
504
505}
506
507
508// create the window
509bool themesInstallDlg::Create( wxWindow* parent,
510 wxWindowID id, const wxString& caption,
511 const wxPoint& pos, const wxSize& size, long style )
512{
513
514 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
515 return false;
516 CreateControls();
517 GetSizer()->Fit(this);
518 GetSizer()->SetSizeHints(this);
519 Centre();
520 return true;
521}
522
523
524// tranver data from the controls
525bool themesInstallDlg::TransferDataFromWindow()
526{
527
528 gv->curdestdir = m_devicepos->getDevicePos();
529 if(!wxDirExists(gv->curdestdir))
530 {
531 WARN_DIALOG(wxT("The Devicepostion is not valid"),
532 wxT("Select a Deviceposition"));
533 gv->curdestdir = wxT("");
534 return false;
535 }
536
537 gv->themesToInstall.Clear();
538 gv->themesToInstall = m_theme->getThemesToInstall();
539
540 if(gv->themesToInstall.GetCount() == 0)
541 {
542 WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
543 return false;
544 }
545
546 return true;
547}
548
549// tranver data to the controls
550bool themesInstallDlg::TransferDataToWindow()
551{
552 if(gv->curplat == wxT(""))
553 {
554 WARN_DIALOG(wxT("You have not selected a audio device"),
555 wxT("Select a Device"));
556 return false;
557 }
558
559 m_devicepos->setDefault();
560 m_theme->setDevice(gv->curplat);
561 return true;
562}
563////////////////////////////////////////////////
564//// Rockbox Installation
565/////////////////////////////////////////////////
566
567IMPLEMENT_CLASS( rockboxInstallDlg, wxDialog )
568
569BEGIN_EVENT_TABLE( rockboxInstallDlg, wxDialog )
570 EVT_RADIOBOX(ID_BUILD_BOX, rockboxInstallDlg::OnBuildBox)
571END_EVENT_TABLE()
572
573rockboxInstallDlg::rockboxInstallDlg( )
574{
575}
576
577rockboxInstallDlg::rockboxInstallDlg( wxWindow* parent,
578 wxWindowID id, const wxString& caption,
579 const wxPoint& pos, const wxSize& size, long style )
580{
581 Create(parent, id, caption, pos, size, style);
582}
583
584void rockboxInstallDlg::CreateControls()
585{
586 // A top-level sizer
587 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
588 this->SetSizer(topSizer);
589
590 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
591 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
592
593 // bitmap
594 wxBitmap sidebmp(wizard_xpm);
595
596 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
597 sideimage->SetBitmap(sidebmp);
598 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
599
600 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
601 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
602
603 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
604 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
605
606 // Build information
607 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
608 wxT("Please select the Rockbox version you would like "
609 "to install on your audio\ndevice:"));
610 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
611
612 wxArrayString array;
613 wxString buf;
614 buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
615 array.Add(buf);
616 array.Add(wxT("Archived Build"));
617 array.Add(wxT("Current Build "));
618
619 wxRadioBox* BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
620 wxDefaultPosition, wxDefaultSize, array, 0, wxRA_SPECIFY_ROWS);
621 wxBoxSizer3->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
622
623 wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
624 wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
625 wxVERTICAL);
626 wxStaticText* DetailText = new wxStaticText(this, ID_DETAIL_TXT, wxT(""));
627 wxBoxSizer3->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
628 WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
629
630 wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
631 wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
632 "local hard disk to save network traffic. If your local copy is\n"
633 "no longer working, tick this box to download a fresh copy.") );
634 wxBoxSizer3->Add(WxStaticText2, 0 , wxALL, 5);
635
636 wxCheckBox* NoCacheCheckBox = new wxCheckBox(this, ID_NOCACHE_CHCKBX,
637 wxT("Don't use locally cached copies of Rockbox") );
638 wxBoxSizer3->Add(NoCacheCheckBox, 0, wxALL, 5);
639 // controls at the bottom
640 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
641 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
642
643}
644
645// create the window
646bool rockboxInstallDlg::Create( wxWindow* parent,
647 wxWindowID id, const wxString& caption,
648 const wxPoint& pos, const wxSize& size, long style )
649{
650
651 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
652 return false;
653 CreateControls();
654 GetSizer()->Fit(this);
655 GetSizer()->SetSizeHints(this);
656 Centre();
657 return true;
658}
659
660void rockboxInstallDlg::OnBuildBox(wxCommandEvent& event)
661{
662 wxString str;
663 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
664 wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
665 wxStaticText* DetailText = (wxStaticText*)FindWindow(ID_DETAIL_TXT);
666
667 switch(BuildRadioBox->GetSelection() )
668 {
669 case BUILD_RELEASE:
670 str = _("This is the last released version of Rockbox, and is the\n"
671 "recommended version to install.");
672 NoCacheCheckBox->Enable();
673 break;
674 case BUILD_DAILY:
675 str = _("These are automatically built each day from the current\n"
676 "development source code. This generally has more features\n"
677 "than the last release but may be much less stable. Features\n"
678 "may change regularly.");
679 NoCacheCheckBox->Enable();
680 break;
681 case BUILD_BLEEDING:
682 str = _("This is the absolute up to the minute Rockbox built after\n"
683 "the last change was made.\n\n"
684 "Note: This option will always download a fresh copy from the\n"
685 "web server.\n");
686 NoCacheCheckBox->Enable(false);
687 break;
688 default:
689 break;
690 }
691
692 DetailText->SetLabel(str);
693
694 this->GetSizer()->Layout();
695 this->GetSizer()->Fit(this);
696 this->GetSizer()->SetSizeHints(this);
697 Refresh();
698}
699
700
701// tranver data from the controls
702bool rockboxInstallDlg::TransferDataFromWindow()
703{
704 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
705 wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
706
707 gv->curdestdir = m_devicepos->getDevicePos();
708 if(!wxDirExists(gv->curdestdir))
709 {
710 WARN_DIALOG(wxT("The Devicepostion is not valid"),
711 wxT("Select a Deviceposition"));
712 gv->curdestdir = wxT("");
713 return false;
714 }
715
716 gv->curbuild = BuildRadioBox->GetSelection();
717 gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
718 NoCacheCheckBox->IsChecked();
719
720 return true;
721}
722
723// tranver data to the controls
724bool rockboxInstallDlg::TransferDataToWindow()
725{
726 m_devicepos->setDefault();
727
728 if(gv->curplat == wxT(""))
729 {
730 WARN_DIALOG(wxT("You have not selected a audio device"),
731 wxT("Select a Device"));
732 return false;
733 }
734
735 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
736
737 int index =gv->plat_id.Index(gv->curplat);
738
739 wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
740 ID_BUILD_BOX);
741
742 if (gv->plat_released[index] )
743 {
744 BuildRadioBox->Enable(BUILD_RELEASE, true);
745 BuildRadioBox->SetSelection(BUILD_RELEASE);
746 } else {
747 BuildRadioBox->Enable(BUILD_RELEASE, false);
748 BuildRadioBox->SetSelection(BUILD_DAILY);
749
750 }
751 wxPostEvent(this, updateradiobox);
752 return true;
753}
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 @@
1#ifndef INSTALL_DIALOGS_H_INCLUDED
2#define INSTALL_DIALOGS_H_INCLUDED
3
4#include "rbutil.h"
5
6#include "rbutilCtrls.h"
7class bootloaderInstallDlg : public wxDialog
8{
9 DECLARE_CLASS( bootloaderInstallDlg )
10 DECLARE_EVENT_TABLE()
11public:
12enum {
13 ID_DEVICEPOS = 1002,
14 ID_FIRMWARE = 1003,
15 }; //End of Enum
16public:
17 bootloaderInstallDlg( );
18 bootloaderInstallDlg( wxWindow* parent,
19 wxWindowID id = wxID_ANY,
20 const wxString& caption = wxT("Bootloader Installation"),
21 const wxPoint& pos = wxDefaultPosition,
22 const wxSize& size = wxDefaultSize,
23 long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
24 // Member initialization
25 void Init();
26 //Creation
27 bool Create( wxWindow* parent,
28 wxWindowID id = wxID_ANY,
29 const wxString& caption = wxT("Bootloader Installation"),
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
33 // Creates the controls and sizers
34 void CreateControls();
35
36 bool TransferDataFromWindow();
37 bool TransferDataToWindow();
38
39private:
40
41 DevicePositionCtrl* m_devicepos;
42 FirmwarePositionCtrl* m_firmwarepos;
43
44
45};
46
47class bootloaderDeInstallDlg : public wxDialog
48{
49 DECLARE_CLASS( bootloaderDeInstallDlg )
50 DECLARE_EVENT_TABLE()
51public:
52enum {
53 ID_DEVICE = 1001,
54
55 }; //End of Enum
56public:
57 bootloaderDeInstallDlg( );
58 bootloaderDeInstallDlg( wxWindow* parent,
59 wxWindowID id = wxID_ANY,
60 const wxString& caption = wxT("Bootloader Deinstallation"),
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
64 /// Member initialization
65 void Init();
66 /// Creation
67 bool Create( wxWindow* parent,
68 wxWindowID id = wxID_ANY,
69 const wxString& caption = wxT("Bootloader Deinstallation"),
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxDefaultSize,
72 long style =wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
73 /// Creates the controls and sizers
74 void CreateControls();
75
76 bool TransferDataFromWindow();
77 bool TransferDataToWindow();
78
79private:
80 DeviceSelectorCtrl* m_deviceselector;
81};
82
83
84class fontInstallDlg : public wxDialog
85{
86 DECLARE_CLASS( fontInstallDlg )
87 DECLARE_EVENT_TABLE()
88public:
89enum {
90 ID_DEVICEPOS = 1002,
91 }; //End of Enum
92public:
93 fontInstallDlg( );
94 fontInstallDlg( wxWindow* parent,
95 wxWindowID id = wxID_ANY,
96 const wxString& caption = wxT("Font Installation"),
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize,
99 long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
100 /// Member initialization
101 void Init();
102 /// Creation
103 bool Create( wxWindow* parent,
104 wxWindowID id = wxID_ANY,
105 const wxString& caption = wxT("Font Installation"),
106 const wxPoint& pos = wxDefaultPosition,
107 const wxSize& size = wxDefaultSize,
108 long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
109 /// Creates the controls and sizers
110 void CreateControls();
111
112 bool TransferDataFromWindow();
113 bool TransferDataToWindow();
114
115private:
116 DevicePositionCtrl* m_devicepos;
117};
118
119
120class rockboxDeInstallDlg : public wxDialog
121{
122 DECLARE_CLASS( rockboxDeInstallDlg )
123 DECLARE_EVENT_TABLE()
124public:
125enum {
126 ID_DEVICEPOS = 1002,
127 ID_FULL_CHCKBX = 1003,
128 }; //End of Enum
129public:
130 rockboxDeInstallDlg( );
131 rockboxDeInstallDlg( wxWindow* parent,
132 wxWindowID id = wxID_ANY,
133 const wxString& caption = wxT("Rockbox Deinstallation"),
134 const wxPoint& pos = wxDefaultPosition,
135 const wxSize& size = wxDefaultSize,
136 long style =wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
137 /// Member initialization
138 void Init();
139 /// Creation
140 bool Create( wxWindow* parent,
141 wxWindowID id = wxID_ANY,
142 const wxString& caption = wxT("Rockbox Deinstallation"),
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize,
145 long style =wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
146 /// Creates the controls and sizers
147 void CreateControls();
148
149 bool TransferDataFromWindow();
150 bool TransferDataToWindow();
151
152private:
153 DevicePositionCtrl* m_devicepos;
154};
155
156class themesInstallDlg : public wxDialog
157{
158 DECLARE_CLASS( themesInstallDlg )
159 DECLARE_EVENT_TABLE()
160public:
161enum {
162 ID_DEVICE = 1001,
163 ID_DEVICEPOS = 1002,
164 ID_THEME = 1006,
165 }; //End of Enum
166public:
167 themesInstallDlg( );
168 themesInstallDlg( wxWindow* parent,
169 wxWindowID id = wxID_ANY,
170 const wxString& caption = wxT("Themes Installation"),
171 const wxPoint& pos = wxDefaultPosition,
172 const wxSize& size = wxDefaultSize,
173 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
174 // Creation
175 bool Create( wxWindow* parent,
176 wxWindowID id = wxID_ANY,
177 const wxString& caption = wxT("Themes Installation"),
178 const wxPoint& pos = wxDefaultPosition,
179 const wxSize& size = wxDefaultSize,
180 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
181 // Creates the controls and sizers
182 void CreateControls();
183
184 bool TransferDataFromWindow();
185 bool TransferDataToWindow();
186
187private:
188 wxString currentPreview;
189 DevicePositionCtrl* m_devicepos;
190 ThemeCtrl* m_theme;
191
192};
193
194class rockboxInstallDlg : public wxDialog
195{
196 DECLARE_CLASS( rockboxInstallDlg )
197 DECLARE_EVENT_TABLE()
198public:
199enum {
200 ID_DEVICEPOS = 1002,
201 ID_BUILD_BOX = 1006,
202 ID_DEVICE_POS_CTRL = 1007,
203 ID_DETAIL_TXT = 1008,
204 ID_NOCACHE_CHCKBX =1009,
205
206 }; //End of Enum
207public:
208 rockboxInstallDlg( );
209 rockboxInstallDlg( wxWindow* parent,
210 wxWindowID id = wxID_ANY,
211 const wxString& caption = wxT("Rockbox Installation"),
212 const wxPoint& pos = wxDefaultPosition,
213 const wxSize& size = wxDefaultSize,
214 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
215 // Creation
216 bool Create( wxWindow* parent,
217 wxWindowID id = wxID_ANY,
218 const wxString& caption = wxT("Rockbox Installation"),
219 const wxPoint& pos = wxDefaultPosition,
220 const wxSize& size = wxDefaultSize,
221 long style = wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER );
222 // Creates the controls and sizers
223 void CreateControls();
224
225 void OnBuildBox(wxCommandEvent& event);
226
227 bool TransferDataFromWindow();
228 bool TransferDataToWindow();
229
230private:
231 DevicePositionCtrl* m_devicepos;
232};
233
234#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 @@
1#define RBUTIL 1 1#define RBUTIL 1
2#include <wx/msw/wx.rc> 2#include <wx/msw/wx.rc>
3RBUTIL VERSIONINFO 3RBUTIL VERSIONINFO
4FILEVERSION 0,3,0,0 4FILEVERSION 0,3,1,0
5PRODUCTVERSION 0,3,0,0 5PRODUCTVERSION 0,3,1,0
6FILEOS 0x00000004 6FILEOS 0x00000004
7FILETYPE 0x00000001 7FILETYPE 0x00000001
8BEGIN 8BEGIN
@@ -10,8 +10,8 @@ BEGIN
10 BEGIN 10 BEGIN
11 BLOCK "FFFF0000" 11 BLOCK "FFFF0000"
12 BEGIN 12 BEGIN
13 VALUE "FileVersion", "0.3.0.2\0" 13 VALUE "FileVersion", "0.3.1.0\0"
14 VALUE "ProductVersion", "0.3.0.2\0" 14 VALUE "ProductVersion", "0.3.1.0\0"
15 VALUE "CompanyName", "Rockbox Team\0" 15 VALUE "CompanyName", "Rockbox Team\0"
16 VALUE "FileDescription", "Rockbox Utility\0" 16 VALUE "FileDescription", "Rockbox Utility\0"
17 VALUE "InternalName", "rbutil\0" 17 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 @@
101 <Unit filename="h120sums.h" /> 101 <Unit filename="h120sums.h" />
102 <Unit filename="h300sums.h" /> 102 <Unit filename="h300sums.h" />
103 <Unit filename="install_3d.xpm" /> 103 <Unit filename="install_3d.xpm" />
104 <Unit filename="install_dialogs.cpp" />
105 <Unit filename="install_dialogs.h" />
104 <Unit filename="installlog.cpp" /> 106 <Unit filename="installlog.cpp" />
105 <Unit filename="installlog.h" /> 107 <Unit filename="installlog.h" />
106 <Unit filename="ipodpatcher\ipodio-win32.c"> 108 <Unit filename="ipodpatcher\ipodio-win32.c">
@@ -136,8 +138,6 @@
136 <Unit filename="uninstall_3d.xpm" /> 138 <Unit filename="uninstall_3d.xpm" />
137 <Unit filename="untools2_3d.xpm" /> 139 <Unit filename="untools2_3d.xpm" />
138 <Unit filename="wizard.xpm" /> 140 <Unit filename="wizard.xpm" />
139 <Unit filename="wizard_pages.cpp" />
140 <Unit filename="wizard_pages.h" />
141 <Unit filename="wx_pch.h" /> 141 <Unit filename="wx_pch.h" />
142 <Extensions> 142 <Extensions>
143 <code_completion /> 143 <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)
125 buf, 100, NULL, wxPD_APP_MODAL | 125 buf, 100, NULL, wxPD_APP_MODAL |
126 wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME | 126 wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME |
127 wxPD_REMAINING_TIME | wxPD_CAN_ABORT); 127 wxPD_REMAINING_TIME | wxPD_CAN_ABORT);
128 progress->Update(0);
129 progress->SetSize(500,200); 128 progress->SetSize(500,200);
129 progress->Update(0);
130
130 131
131 input = true; 132 input = true;
132 wxURL* in_http = new wxURL(src); 133 wxURL* in_http = new wxURL(src);
@@ -750,3 +751,4 @@ bool rm_rf(wxString file)
750 return rc ? true : false; 751 return rc ? true : false;
751} 752}
752 753
754
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 @@
51#include <wx/file.h> 51#include <wx/file.h>
52#include <wx/wizard.h> 52#include <wx/wizard.h>
53#include <wx/event.h> 53#include <wx/event.h>
54#include <wx/statline.h>
55#include <wx/valgen.h>
56#include <wx/thread.h>
57#include <wx/regex.h>
58#include <wx/tokenzr.h>
59#include <wx/notebook.h>
54 60
55#ifdef __WXMSW__ 61#ifdef __WXMSW__
56#define PATH_SEP "\\" 62#define PATH_SEP "\\"
@@ -88,8 +94,6 @@ public:
88 wxArrayInt plat_needsbootloader; 94 wxArrayInt plat_needsbootloader;
89 wxArrayString plat_bootloadermethod; 95 wxArrayString plat_bootloadermethod;
90 wxArrayString plat_bootloadername; 96 wxArrayString plat_bootloadername;
91 wxArrayInt plat_autodetect;
92 wxArrayString plat_combinedname;
93 wxArrayString plat_resolution; 97 wxArrayString plat_resolution;
94 wxString download_url; 98 wxString download_url;
95 wxString daily_url; 99 wxString daily_url;
@@ -103,15 +107,13 @@ public:
103 107
104 // User configuration data. 108 // User configuration data.
105 wxString curplat; 109 wxString curplat;
106 unsigned int curplatnum; 110 // unsigned int curplatnum;
107 wxString curdestdir; 111 wxString curdestdir;
112 wxString curfirmware;
108 unsigned int curbuild; 113 unsigned int curbuild;
109 bool curisfull; 114 bool curisfull;
110 bool nocache; 115 bool nocache;
111 bool portable; 116 bool portable;
112 wxString curbootloadermethod;
113 wxString curbootloader;
114 wxString curfirmware;
115 wxString curresolution; 117 wxString curresolution;
116 wxArrayString themesToInstall; 118 wxArrayString themesToInstall;
117 119
@@ -155,4 +157,5 @@ bool rm_rf(wxString file);
155#define BOOTLOADER_ADD 0 157#define BOOTLOADER_ADD 0
156#define BOOTLOADER_REM 1 158#define BOOTLOADER_REM 1
157 159
160
158#endif 161#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
43needsbootloader=no 43needsbootloader=no
44bootloadermethod= 44bootloadermethod=
45bootloadername= 45bootloadername=
46autodetect=no
47combinedname=
48resolution=11x2x1 46resolution=11x2x1
49 47
50[recorder] 48[recorder]
@@ -54,8 +52,6 @@ released=yes
54needsbootloader=no 52needsbootloader=no
55bootloadermethod= 53bootloadermethod=
56bootloadername= 54bootloadername=
57autodetect=no
58combinedname=
59resolution=112x64x1 55resolution=112x64x1
60 56
61[recorder8mb] 57[recorder8mb]
@@ -65,8 +61,6 @@ released=no
65needsbootloader=no 61needsbootloader=no
66bootloadermethod= 62bootloadermethod=
67bootloadername= 63bootloadername=
68autodetect=no
69combinedname=
70resolution=112x64x1 64resolution=112x64x1
71 65
72[recorderv2] 66[recorderv2]
@@ -76,8 +70,6 @@ released=yes
76needsbootloader=no 70needsbootloader=no
77bootloadermethod= 71bootloadermethod=
78bootloadername= 72bootloadername=
79autodetect=no
80combinedname=
81resolution=112x64x1 73resolution=112x64x1
82 74
83[fmrecorder] 75[fmrecorder]
@@ -87,8 +79,6 @@ released=yes
87needsbootloader=no 79needsbootloader=no
88bootloadermethod= 80bootloadermethod=
89bootloadername= 81bootloadername=
90autodetect=no
91combinedname=
92resolution=112x64x1 82resolution=112x64x1
93 83
94[fmrecorder8mb] 84[fmrecorder8mb]
@@ -98,8 +88,6 @@ released=no
98needsbootloader=no 88needsbootloader=no
99bootloadermethod= 89bootloadermethod=
100bootloadername= 90bootloadername=
101autodetect=no
102combinedname=
103resolution=112x64x1 91resolution=112x64x1
104 92
105[ondiosp] 93[ondiosp]
@@ -109,8 +97,6 @@ released=yes
109needsbootloader=no 97needsbootloader=no
110bootloadermethod= 98bootloadermethod=
111bootloadername= 99bootloadername=
112autodetect=no
113combinedname=
114resolution=112x64x1 100resolution=112x64x1
115 101
116[ondiofm] 102[ondiofm]
@@ -120,8 +106,6 @@ released=yes
120needsbootloader=no 106needsbootloader=no
121bootloadermethod= 107bootloadermethod=
122bootloadername= 108bootloadername=
123autodetect=no
124combinedname=
125resolution=112x64x1 109resolution=112x64x1
126 110
127[h100] 111[h100]
@@ -131,8 +115,6 @@ released=no
131needsbootloader=yes 115needsbootloader=yes
132bootloadermethod=fwpatcher 116bootloadermethod=fwpatcher
133bootloadername=bootloader-h100.bin 117bootloadername=bootloader-h100.bin
134autodetect=no
135combinedname=
136resolution=160x128x2 118resolution=160x128x2
137 119
138[h120] 120[h120]
@@ -142,8 +124,6 @@ released=no
142needsbootloader=yes 124needsbootloader=yes
143bootloadermethod=fwpatcher 125bootloadermethod=fwpatcher
144bootloadername=bootloader-h120.bin 126bootloadername=bootloader-h120.bin
145autodetect=no
146combinedname=
147resolution=160x128x2 127resolution=160x128x2
148 128
149[h300] 129[h300]
@@ -153,8 +133,6 @@ released=no
153needsbootloader=yes 133needsbootloader=yes
154bootloadermethod=fwpatcher 134bootloadermethod=fwpatcher
155bootloadername=bootloader-h300.bin 135bootloadername=bootloader-h300.bin
156autodetect=no
157combinedname=
158resolution=220x176x16 136resolution=220x176x16
159 137
160[h10_5gbums] 138[h10_5gbums]
@@ -164,8 +142,6 @@ released=no
164needsbootloader=yes 142needsbootloader=yes
165bootloadermethod=h10 143bootloadermethod=h10
166bootloadername=H10.mi4 144bootloadername=H10.mi4
167autodetect=no
168combinedname=
169resolution=128x128x16 145resolution=128x128x16
170 146
171[h10_5gbmtp] 147[h10_5gbmtp]
@@ -175,8 +151,6 @@ released=no
175needsbootloader=yes 151needsbootloader=yes
176bootloadermethod=h10 152bootloadermethod=h10
177bootloadername=H10_5GB-MTP/H10.mi4 153bootloadername=H10_5GB-MTP/H10.mi4
178autodetect=no
179combinedname=
180resolution=128x128x16 154resolution=128x128x16
181 155
182[h10] 156[h10]
@@ -186,8 +160,6 @@ released=no
186needsbootloader=yes 160needsbootloader=yes
187bootloadermethod=h10 161bootloadermethod=h10
188bootloadername=H10_20GC.mi4 162bootloadername=H10_20GC.mi4
189autodetect=no
190combinedname=
191resolution=160x128x16 163resolution=160x128x16
192 164
193[ipodcolor] 165[ipodcolor]
@@ -196,9 +168,7 @@ platform=ipodcolor
196released=no 168released=no
197needsbootloader=yes 169needsbootloader=yes
198bootloadermethod=ipodpatcher 170bootloadermethod=ipodpatcher
199bootloadername=none 171bootloadername=ipodcolor
200autodetect=yes
201combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
202resolution=220x176x16 172resolution=220x176x16
203 173
204[ipodnano] 174[ipodnano]
@@ -207,9 +177,7 @@ platform=ipodnano
207released=no 177released=no
208needsbootloader=yes 178needsbootloader=yes
209bootloadermethod=ipodpatcher 179bootloadermethod=ipodpatcher
210bootloadername=none 180bootloadername=ipodnano
211autodetect=yes
212combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
213resolution=176x132x16 181resolution=176x132x16
214 182
215[ipod4gray] 183[ipod4gray]
@@ -218,9 +186,7 @@ platform=ipod4gray
218released=no 186released=no
219needsbootloader=yes 187needsbootloader=yes
220bootloadermethod=ipodpatcher 188bootloadermethod=ipodpatcher
221bootloadername=none 189bootloadername=ipod4g
222autodetect=yes
223combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
224resolution=160x128x2 190resolution=160x128x2
225 191
226[ipodvideo] 192[ipodvideo]
@@ -229,9 +195,7 @@ platform=ipodvideo
229released=no 195released=no
230needsbootloader=yes 196needsbootloader=yes
231bootloadermethod=ipodpatcher 197bootloadermethod=ipodpatcher
232bootloadername=none 198bootloadername=ipodvideo
233autodetect=yes
234combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
235resolution=320x240x16 199resolution=320x240x16
236 200
237[ipod3g] 201[ipod3g]
@@ -240,9 +204,7 @@ platform=ipod3g
240released=no 204released=no
241needsbootloader=yes 205needsbootloader=yes
242bootloadermethod=ipodpatcher 206bootloadermethod=ipodpatcher
243bootloadername=none 207bootloadername=ipod3g
244autodetect=yes
245combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
246resolution=160x128x2 208resolution=160x128x2
247 209
248[ipodmini1g] 210[ipodmini1g]
@@ -251,9 +213,7 @@ platform=ipodmini1g
251released=no 213released=no
252needsbootloader=yes 214needsbootloader=yes
253bootloadermethod=ipodpatcher 215bootloadermethod=ipodpatcher
254bootloadername=none 216bootloadername=ipodmini
255autodetect=yes
256combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
257resolution=138x110x2 217resolution=138x110x2
258 218
259[ipodmini2g] 219[ipodmini2g]
@@ -262,9 +222,7 @@ platform=ipodmini2g
262released=no 222released=no
263needsbootloader=yes 223needsbootloader=yes
264bootloadermethod=ipodpatcher 224bootloadermethod=ipodpatcher
265bootloadername=none 225bootloadername=ipodmini2g
266autodetect=yes
267combinedname=Ipod mini 1g, mini 2g, 3g, 4g, color, video, nano 1g
268resolution=138x110x2 226resolution=138x110x2
269 227
270[iaudiox5] 228[iaudiox5]
@@ -274,8 +232,6 @@ released=no
274needsbootloader=yes 232needsbootloader=yes
275bootloadermethod=iaudio 233bootloadermethod=iaudio
276bootloadername=x5_fw.bin 234bootloadername=x5_fw.bin
277autodetect=no
278combinedname=
279resolution=160x128x16 235resolution=160x128x16
280 236
281[iaudiox5v] 237[iaudiox5v]
@@ -285,8 +241,6 @@ released=no
285needsbootloader=yes 241needsbootloader=yes
286bootloadermethod=iaudio 242bootloadermethod=iaudio
287bootloadername=x5v_fw.bin 243bootloadername=x5v_fw.bin
288autodetect=no
289combinedname=
290resolution=160x128x2 244resolution=160x128x2
291 245
292[iaudiom5] 246[iaudiom5]
@@ -296,8 +250,6 @@ released=no
296needsbootloader=yes 250needsbootloader=yes
297bootloadermethod=iaudio 251bootloadermethod=iaudio
298bootloadername=m5_fw.bin 252bootloadername=m5_fw.bin
299autodetect=no
300combinedname=
301resolution=160x128x16 253resolution=160x128x16
302 254
303[gigabeatf] 255[gigabeatf]
@@ -306,6 +258,4 @@ platform=gigabeatf
306needsbootloader=yes 258needsbootloader=yes
307bootloadermethod=gigabeatf 259bootloadermethod=gigabeatf
308bootloadername=FWIMG01.DAT 260bootloadername=FWIMG01.DAT
309autodetect=no
310combinedname=
311resolution=240x320x16 261resolution=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()
80 80
81 rbutilFrm *myFrame = new rbutilFrm(NULL); 81 rbutilFrm *myFrame = new rbutilFrm(NULL);
82 SetTopWindow(myFrame); 82 SetTopWindow(myFrame);
83
83 myFrame->Show(TRUE); 84 myFrame->Show(TRUE);
84 85
85 initIpodpatcher(); // reserve mem for ipodpatcher 86 initIpodpatcher(); // reserve mem for ipodpatcher
@@ -171,12 +172,6 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
171 gv->GlobalConfig->Read(buf.Format(wxT("/%s/bootloadername"), 172 gv->GlobalConfig->Read(buf.Format(wxT("/%s/bootloadername"),
172 cur.c_str()), &tmpstr); 173 cur.c_str()), &tmpstr);
173 gv->plat_bootloadername.Add(tmpstr); 174 gv->plat_bootloadername.Add(tmpstr);
174 gv->GlobalConfig->Read(buf.Format(wxT("/%s/autodetect"),
175 cur.c_str()), &tmpstr);
176 gv->plat_autodetect.Add( (tmpstr == wxT("yes")) ? true : false ) ;
177 gv->GlobalConfig->Read(buf.Format(wxT("/%s/combinedname"),
178 cur.c_str()), &tmpstr);
179 gv->plat_combinedname.Add(tmpstr);
180 gv->GlobalConfig->Read(buf.Format(wxT("/%s/resolution"), 175 gv->GlobalConfig->Read(buf.Format(wxT("/%s/resolution"),
181 cur.c_str()), &tmpstr); 176 cur.c_str()), &tmpstr);
182 gv->plat_resolution.Add(tmpstr); 177 gv->plat_resolution.Add(tmpstr);
@@ -187,9 +182,6 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
187 gv->GlobalConfig->SetPath(wxT("/general")); 182 gv->GlobalConfig->SetPath(wxT("/general"));
188 gv->GlobalConfig->Read(wxT("default_platform"), &tmpstr, wxT("cthulhu")); 183 gv->GlobalConfig->Read(wxT("default_platform"), &tmpstr, wxT("cthulhu"));
189 184
190 for (i=0; i< gv->plat_id.GetCount(); i++) {
191 if (gv->plat_id[i] == tmpstr) gv->curplatnum = i;
192 }
193 185
194 gv->GlobalConfig->Read(wxT("last_release"), &tmpstr); 186 gv->GlobalConfig->Read(wxT("last_release"), &tmpstr);
195 gv->last_release = tmpstr; 187 gv->last_release = tmpstr;
@@ -255,6 +247,7 @@ void rbutilFrmApp::ReadUserConfig()
255 gv->UserConfig->SetPath(wxT("/defaults")); 247 gv->UserConfig->SetPath(wxT("/defaults"));
256 if (gv->UserConfig->Read(wxT("curdestdir"), &str) ) gv->curdestdir = str; 248 if (gv->UserConfig->Read(wxT("curdestdir"), &str) ) gv->curdestdir = str;
257 if (gv->UserConfig->Read(wxT("curplatform"), &str) ) gv->curplat = str; 249 if (gv->UserConfig->Read(wxT("curplatform"), &str) ) gv->curplat = str;
250 if (gv->UserConfig->Read(wxT("curfirmware"), &str) ) gv->curfirmware = str;
258 gv->UserConfig->SetPath(stack); 251 gv->UserConfig->SetPath(stack);
259} 252}
260 253
@@ -263,6 +256,7 @@ void rbutilFrmApp::WriteUserConfig()
263 gv->UserConfig->SetPath(wxT("/defaults")); 256 gv->UserConfig->SetPath(wxT("/defaults"));
264 gv->UserConfig->Write(wxT("curdestdir"), gv->curdestdir); 257 gv->UserConfig->Write(wxT("curdestdir"), gv->curdestdir);
265 gv->UserConfig->Write(wxT("curplatform"), gv->curplat); 258 gv->UserConfig->Write(wxT("curplatform"), gv->curplat);
259 gv->UserConfig->Write(wxT("curfirmware"), gv->curfirmware);
266 260
267 delete gv->UserConfig; 261 delete gv->UserConfig;
268 262
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 @@
1
2#include "rbutilCtrls.h"
3#include "bootloaders.h"
4
5/////////////////////////////////////////////////////////////
6//// Controls
7////////////////////////////////////////////////////////////////
8
9/////////////////////////////////////////////
10//// Image Ctrl
11//////////////////////////////////////////////
12
13BEGIN_EVENT_TABLE(ImageCtrl, wxControl)
14 EVT_PAINT(ImageCtrl::OnPaint)
15END_EVENT_TABLE()
16
17IMPLEMENT_DYNAMIC_CLASS(ImageCtrl, wxControl)
18
19bool ImageCtrl::Create(wxWindow* parent, wxWindowID id,
20 const wxPoint& pos, const wxSize& size, long style,
21 const wxValidator& validator)
22{
23 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
24
25return true;
26}
27
28void ImageCtrl::OnPaint(wxPaintEvent& event)
29{
30 wxPaintDC dc(this);
31 dc.DrawBitmap(m_bitmap,0,0,false);
32}
33
34void ImageCtrl::SetBitmap(wxBitmap bmp)
35{
36 m_bitmap = bmp;
37 Refresh();
38
39}
40
41wxSize ImageCtrl::DoGetBestSize() const
42{
43 wxSize bestsize;
44 bestsize.x = m_bitmap.GetWidth();
45 bestsize.y = m_bitmap.GetHeight();
46 return bestsize;
47}
48
49
50
51/////////////////////////////////////////////
52//// Theme Control
53//////////////////////////////////////////////
54
55BEGIN_EVENT_TABLE(ThemeCtrl, wxControl)
56 EVT_LISTBOX(ID_THEME_LST, ThemeCtrl::OnThemesLst)
57END_EVENT_TABLE()
58
59IMPLEMENT_DYNAMIC_CLASS(ThemeCtrl, wxControl)
60
61bool ThemeCtrl::Create(wxWindow* parent, wxWindowID id,
62 const wxPoint& pos, const wxSize& size, long style,
63 const wxValidator& validator)
64{
65 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
66
67 CreateControls();
68
69 GetSizer()->Fit(this);
70
71 GetSizer()->SetSizeHints(this);
72return true;
73}
74
75void ThemeCtrl::CreateControls()
76{
77 // A top-level sizer
78 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
79 this->SetSizer(topSizer);
80
81 wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
82 topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
83
84 //Device Selection
85 wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
86 horizontalSizer->Add(wxBoxSizer7,0,wxGROW | wxALL,0);
87
88 wxStaticText* m_desc = new wxStaticText( this, wxID_STATIC,
89 wxT("Select one or more Themes to install"), wxDefaultPosition,
90 wxDefaultSize, 0 );
91 wxBoxSizer7->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
92
93 m_themeList = new wxListBox(this,ID_THEME_LST,wxDefaultPosition,
94 wxDefaultSize,0,NULL,wxLB_EXTENDED);
95 wxBoxSizer7->Add(m_themeList, 0, wxALIGN_LEFT|wxALL, 5);
96
97 // Preview Picture
98 wxBoxSizer* wxBoxSizer9 = new wxBoxSizer(wxVERTICAL);
99 horizontalSizer->Add(wxBoxSizer9,0,wxGROW | wxALL,0);
100
101 wxStaticText* preview_desc= new wxStaticText(this,wxID_ANY,wxT("Preview:"));
102 wxBoxSizer9->Add(preview_desc,0,wxGROW | wxALL,5);
103
104 m_PreviewBitmap = new ImageCtrl(this,ID_PREVIEW_BITMAP );
105 wxBoxSizer9->Add(m_PreviewBitmap,0,wxALIGN_LEFT | wxALL,5);
106
107 wxStaticBox* groupbox= new wxStaticBox(this,wxID_ANY,wxT("Selected Theme:"));
108 wxStaticBoxSizer* styleSizer = new wxStaticBoxSizer( groupbox, wxVERTICAL );
109 topSizer->Add(styleSizer,0,wxGROW|wxALL,0);
110
111 // horizontal sizer
112 wxBoxSizer* wxBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
113 styleSizer->Add(wxBoxSizer8,0,wxGROW | wxALL,0);
114
115 // File size
116 wxStaticText* size_desc= new wxStaticText(this,wxID_ANY,wxT("Filesize:"));
117 wxBoxSizer8->Add(size_desc,0,wxGROW | wxALL,5);
118
119 m_size= new wxStaticText(this,ID_FILESIZE,wxT(""));
120 wxBoxSizer8->Add(m_size,0,wxGROW | wxALL,5);
121
122 // Description
123 wxStaticText* desc_desc= new wxStaticText(this,wxID_ANY,wxT("Description:"));
124 styleSizer->Add(desc_desc,0,wxGROW | wxALL,5);
125
126 m_themedesc= new wxStaticText(this,ID_DESC,wxT(""));
127 styleSizer->Add(m_themedesc,0,wxGROW | wxALL,5);
128
129 topSizer->Fit(this);
130 topSizer->SetSizeHints(this);
131 Layout();
132
133}
134
135void ThemeCtrl::Init()
136{
137 m_Themes.Clear();
138 m_Themes_path.Clear();
139 m_Themes_size.Clear();
140 m_Themes_image.Clear();
141 m_Themes_desc.Clear();
142
143}
144
145void ThemeCtrl::setDevice(wxString device)
146{
147
148 int index = gv->plat_id.Index(device);
149 if(index == -1) return;
150
151 if(gv->plat_resolution[index] == m_currentResolution)
152 return;
153 else
154 m_currentResolution = gv->plat_resolution[index];
155
156 // load the themelist
157 Init();
158 m_size->SetLabel(wxT(""));
159 m_themedesc->SetLabel(wxT(""));
160 m_themeList->Clear();
161
162 //get correct Themes list
163 wxString src,dest,err;
164
165 src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),m_currentResolution.c_str());
166 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"),
167 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
168
169 if(DownloadURL(src, dest))
170 {
171 MESG_DIALOG(wxT("Unable to download themes list."));
172 return;
173 }
174
175 //read and parse Themes list
176 wxString themelistraw;
177 wxFFile themefile;
178 if(!themefile.Open(dest)) //open file
179 {
180 MESG_DIALOG(wxT("Unable to open themes list."));
181 return;
182 }
183 if(!themefile.ReadAll(&themelistraw)) //read complete file
184 {
185 MESG_DIALOG(wxT("Unable to read themes list."));
186 return;
187 }
188 wxRegEx reAll(wxT("<body >(.+)</body>")); //extract body part
189 if(! reAll.Matches(themelistraw))
190 {
191 MESG_DIALOG(wxT("Themes list is in wrong Format."));
192 return;
193 }
194 wxString lines = reAll.GetMatch(themelistraw,1);
195
196 // prepare text
197 lines.Replace(wxT("<br />"),wxT(""),true); //replace <br /> with nothing
198 lines.Replace(wxT("\n"),wxT(""),true); //replace \n with nothing
199 lines.Trim(true); //strip WS at end
200 lines.Trim(false); //strip WS at beginning
201 wxStringTokenizer tkz(lines,wxT("|")); //tokenize it
202
203 while ( tkz.HasMoreTokens() ) // read all entrys
204 {
205 m_Themes.Add(tkz.GetNextToken()); //Theme name
206 m_Themes_path.Add(tkz.GetNextToken()); //Theme path
207 m_Themes_size.Add(tkz.GetNextToken()); //File size
208 m_Themes_image.Add(tkz.GetNextToken()); //Screenshot
209 m_Themes_desc.Add(tkz.GetNextToken()); //Description
210
211 m_themeList->Append(m_Themes.Last());
212 }
213
214 this->GetSizer()->Layout();
215 this->GetSizer()->Fit(this);
216 this->GetSizer()->SetSizeHints(this);
217 m_parent->GetSizer()->Layout();
218 m_parent->GetSizer()->Fit(m_parent);
219 m_parent->GetSizer()->SetSizeHints(m_parent);
220}
221
222
223void ThemeCtrl::OnThemesLst(wxCommandEvent& event)
224{
225 // wxCriticalSectionLocker locker(m_ThemeSelectSection);
226
227 wxArrayInt selected;
228 int numSelected = m_themeList->GetSelections(selected);
229 if(numSelected == 0) return;
230
231 int index = selected[0];
232
233 m_size->SetLabel(m_Themes_size[index]);
234 m_themedesc->SetLabel(m_Themes_desc[index]);
235 m_themedesc->Wrap(200); // wrap desc
236
237 wxString src,dest;
238
239 int pos = m_Themes_image[index].Find('/',true);
240 wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
241
242 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
243 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
244
245 if(!wxDirExists(dest))
246 wxMkdir(dest);
247
248 //this is a URL no PATH_SEP
249 src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),m_currentResolution.c_str(),filename.c_str());
250 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
251 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str(),filename.c_str());
252
253 if(DownloadURL(src, dest))
254 {
255 MESG_DIALOG(wxT("Unable to download image."));
256 return;
257 }
258
259 m_currentimage = dest;
260 wxBitmap bmp;
261 bmp.LoadFile(m_currentimage,wxBITMAP_TYPE_PNG);
262 m_PreviewBitmap->SetBitmap(bmp);
263
264 Refresh();
265 this->GetSizer()->Layout();
266 this->GetSizer()->Fit(this);
267 this->GetSizer()->SetSizeHints(this);
268
269 m_parent->GetSizer()->Layout();
270 m_parent->GetSizer()->Fit(m_parent);
271 m_parent->GetSizer()->SetSizeHints(m_parent);
272
273}
274
275
276 wxArrayString ThemeCtrl::getThemesToInstall()
277 {
278 wxArrayString themes;
279 wxArrayInt selected;
280 int numSelected = m_themeList->GetSelections(selected);
281
282 for(int i=0; i < numSelected; i++)
283 {
284 themes.Add(m_Themes_path[selected[i]]);
285 }
286 return themes;
287
288 }
289
290/////////////////////////////////////////////
291//// Ok Cancel Control
292//////////////////////////////////////////////
293
294BEGIN_EVENT_TABLE(OkCancelCtrl, wxControl)
295
296END_EVENT_TABLE()
297
298IMPLEMENT_DYNAMIC_CLASS(OkCancelCtrl, wxControl)
299
300bool OkCancelCtrl::Create(wxWindow* parent, wxWindowID id,
301 const wxPoint& pos, const wxSize& size, long style,
302 const wxValidator& validator)
303{
304 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
305
306 CreateControls();
307 GetSizer()->Fit(this);
308 GetSizer()->SetSizeHints(this);
309return true;
310}
311
312void OkCancelCtrl::CreateControls()
313{
314 // A top-level sizer
315 wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL);
316 this->SetSizer(topSizer);
317
318 // The OK button
319 m_OkBtn = new wxButton ( this, wxID_OK, wxT("&OK"),
320 wxDefaultPosition, wxDefaultSize, 0 );
321 topSizer->Add(m_OkBtn, 0, wxALL, 5);
322 // The Cancel button
323 m_CancelBtn = new wxButton ( this, wxID_CANCEL,
324 wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
325 topSizer->Add(m_CancelBtn, 0, wxALL, 5);
326
327 Layout();
328
329}
330
331
332/////////////////////////////////////////////
333//// Device Selector
334//////////////////////////////////////////////
335
336BEGIN_EVENT_TABLE(DeviceSelectorCtrl, wxControl)
337 EVT_BUTTON(ID_AUTODETECT_BTN, DeviceSelectorCtrl::OnAutoDetect)
338 EVT_COMBOBOX(ID_DEVICE_CBX,DeviceSelectorCtrl::OnComboBox)
339END_EVENT_TABLE()
340
341IMPLEMENT_DYNAMIC_CLASS(DeviceSelectorCtrl, wxControl)
342
343bool DeviceSelectorCtrl::Create(wxWindow* parent, wxWindowID id,
344 const wxPoint& pos, const wxSize& size, long style,
345 const wxValidator& validator)
346{
347 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
348
349 CreateControls();
350 GetSizer()->Fit(this);
351 GetSizer()->SetSizeHints(this);
352return true;
353}
354
355void DeviceSelectorCtrl::CreateControls()
356{
357 // A top-level sizer
358 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
359 this->SetSizer(topSizer);
360
361 //Device Selection
362
363 wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
364 topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
365 m_desc = new wxStaticText( this, wxID_STATIC,
366 wxT("Device:"), wxDefaultPosition,
367 wxDefaultSize, 0 );
368 horizontalSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
369
370 m_deviceCbx = new wxComboBox(this, ID_DEVICE_CBX,wxT(""),
371 wxDefaultPosition,wxDefaultSize,gv->plat_name,wxCB_READONLY);
372
373 m_deviceCbx->SetToolTip(wxT("Select your Device."));
374 m_deviceCbx->SetHelpText(wxT("Select your Device."));
375
376 horizontalSizer->Add(m_deviceCbx, 0, wxALIGN_LEFT|wxALL, 5);
377
378 wxButton* m_autodetectBtn = new wxButton(this, ID_AUTODETECT_BTN, wxT("Autodetect"),
379 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
380 wxT("AutodetectBtn"));
381
382 m_autodetectBtn->SetToolTip(wxT("Autodetection of the Device."));
383 m_autodetectBtn->SetHelpText(wxT("Autodetection of the Device."));
384
385 horizontalSizer->Add(m_autodetectBtn,0,wxGROW | wxALL,5);
386 Layout();
387
388}
389
390wxString DeviceSelectorCtrl::getDevice()
391{
392 return m_currentDevice;
393}
394
395void DeviceSelectorCtrl::setDefault()
396{
397 int index = gv->plat_id.Index(gv->curplat);
398 if(index == -1) return;
399 m_deviceCbx->SetValue(gv->plat_name[index]);
400}
401
402void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event)
403{
404 int index = gv->plat_name.Index(m_deviceCbx->GetValue());
405 if(index == -1) m_currentDevice = wxT("");
406
407 gv->curplat = gv->plat_id[index];
408}
409
410void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
411{
412 struct ipod_t ipod;
413 int n = ipod_scan(&ipod);
414 if(n == 1)
415 {
416 wxString temp(ipod.targetname,wxConvUTF8);
417 int index = gv->plat_bootloadername.Index(temp);
418 m_deviceCbx->SetValue(gv->plat_name[index]);
419 gv->curplat=gv->plat_id[index];
420 }
421 else if (n > 1)
422 {
423 WARN_DIALOG(wxT("More then one device Ipod detected, please connect only One"),
424 wxT("Detecting a Device"));
425 return;
426 }
427 else
428 {
429 WARN_DIALOG(wxT("No Device detected. (This function currently only works for Ipods)."),
430 wxT("Detecting a Device"));
431 return;
432 }
433
434}
435
436/////////////////////////////////////////////
437//// DevicePosition Selector
438//////////////////////////////////////////////
439
440BEGIN_EVENT_TABLE(DevicePositionCtrl, wxControl)
441 EVT_BUTTON(ID_BROWSE_BTN, DevicePositionCtrl::OnBrowseBtn)
442END_EVENT_TABLE()
443
444IMPLEMENT_DYNAMIC_CLASS(DevicePositionCtrl, wxControl)
445
446bool DevicePositionCtrl::Create(wxWindow* parent, wxWindowID id,
447 const wxPoint& pos, const wxSize& size, long style,
448 const wxValidator& validator)
449{
450 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
451
452 CreateControls();
453 GetSizer()->Fit(this);
454 GetSizer()->SetSizeHints(this);
455return true;
456}
457
458void DevicePositionCtrl::CreateControls()
459{
460 // A top-level sizer
461 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
462 this->SetSizer(topSizer);
463
464 //Device Selection
465 m_desc = new wxStaticText( this, wxID_STATIC,
466 wxT("Select your Device in the Filesystem"), wxDefaultPosition,
467 wxDefaultSize, 0 );
468 topSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
469
470 wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
471 topSizer->Add(horizontalSizer, 0, wxGROW|wxALL, 5);
472
473 m_devicePos = new wxTextCtrl(this,wxID_ANY,gv->curdestdir);
474 m_devicePos->SetToolTip(wxT("Select your Devicefolder"));
475 m_devicePos->SetHelpText(wxT("Select your Devicefolder"));
476 horizontalSizer->Add(m_devicePos,0,wxGROW | wxALL,5);
477
478 m_browseBtn = new wxButton(this, ID_BROWSE_BTN, wxT("Browse"),
479 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
480 wxT("BrowseBtn"));
481 m_browseBtn->SetToolTip(wxT("Browse for your Device"));
482 m_browseBtn->SetHelpText(wxT("Browse for your Device"));
483 horizontalSizer->Add(m_browseBtn,0,wxGROW | wxALL,5);
484
485 topSizer->Fit(this);
486 Layout();
487
488}
489
490wxString DevicePositionCtrl::getDevicePos()
491{
492 return m_devicePos->GetValue();
493
494}
495
496void DevicePositionCtrl::setDefault()
497{
498 m_devicePos->SetValue(gv->curdestdir);
499}
500
501void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
502{
503 const wxString& temp = wxDirSelector(
504 wxT("Please select the location of your audio device"), gv->curdestdir);
505
506 if (!temp.empty())
507 {
508 m_devicePos->SetValue(temp);
509 }
510
511}
512
513/////////////////////////////////////////////
514//// FirmwarePosition Selector
515//////////////////////////////////////////////
516
517BEGIN_EVENT_TABLE(FirmwarePositionCtrl, wxControl)
518 EVT_BUTTON(ID_BROWSE_BTN, FirmwarePositionCtrl::OnBrowseBtn)
519END_EVENT_TABLE()
520
521IMPLEMENT_DYNAMIC_CLASS(FirmwarePositionCtrl, wxControl)
522
523bool FirmwarePositionCtrl::Create(wxWindow* parent, wxWindowID id,
524 const wxPoint& pos, const wxSize& size, long style,
525 const wxValidator& validator)
526{
527 if (!wxControl::Create(parent, id, pos, size, style, validator)) return false;
528
529 CreateControls();
530 GetSizer()->Fit(this);
531 GetSizer()->SetSizeHints(this);
532return true;
533}
534
535void FirmwarePositionCtrl::CreateControls()
536{
537 // A top-level sizer
538 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
539 this->SetSizer(topSizer);
540
541 //Device Selection
542 m_desc = new wxStaticText( this, wxID_STATIC,
543 wxT("Select original Firmware form the Manufacturer"), wxDefaultPosition,
544 wxDefaultSize, 0 );
545 topSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
546
547 wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
548 topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
549
550 m_firmwarePos = new wxTextCtrl(this,wxID_ANY,gv->curdestdir);
551 m_firmwarePos->SetToolTip(wxT("Select the original Firmware"));
552 m_firmwarePos->SetHelpText(wxT("Select the original Firmware"));
553 horizontalSizer->Add(m_firmwarePos,0,wxGROW | wxALL,5);
554
555 m_browseBtn = new wxButton(this, ID_BROWSE_BTN, wxT("Browse"),
556 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
557 wxT("BrowseBtn"));
558 m_browseBtn->SetToolTip(wxT("Browse for the original Firmware"));
559 m_browseBtn->SetHelpText(wxT("Browse for the original Firmware"));
560 horizontalSizer->Add(m_browseBtn,0,wxGROW | wxALL,5);
561
562 Layout();
563
564}
565
566wxString FirmwarePositionCtrl::getFirmwarePos()
567{
568 return m_firmwarePos->GetValue();
569
570}
571
572void FirmwarePositionCtrl::setDefault()
573{
574 m_firmwarePos->SetValue(gv->curfirmware);
575}
576
577void FirmwarePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
578{
579 wxString temp = wxFileSelector(
580 wxT("Please select the location of the original Firmware"), gv->curdestdir,wxT(""),wxT(""),wxT("*.hex"));
581
582 if (!temp.empty())
583 {
584 m_firmwarePos->SetValue(temp);
585 }
586
587}
588
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 @@
1#ifndef RBUTILCTRLS_H_INCLUDED
2#define RBUTILCTRLS_H_INCLUDED
3
4#include "rbutil.h"
5
6
7class ImageCtrl: public wxControl
8{
9DECLARE_DYNAMIC_CLASS(ImageCtrl)
10DECLARE_EVENT_TABLE()
11
12public:
13 // Constructors
14 ImageCtrl() { }
15 ImageCtrl(wxWindow* parent, wxWindowID id,
16 const wxPoint& pos = wxDefaultPosition,
17 const wxSize& size = wxDefaultSize,
18 long style = wxNO_BORDER,
19 const wxValidator& validator = wxDefaultValidator)
20 {
21 Create(parent, id, pos, size, style, validator);
22 }
23 // Creation
24 bool Create(wxWindow* parent, wxWindowID id,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = wxNO_BORDER,
28 const wxValidator& validator = wxDefaultValidator);
29
30 // Event handlers
31 void OnPaint(wxPaintEvent& event);
32
33 wxSize DoGetBestSize() const ;
34
35 void SetBitmap(wxBitmap bmp);
36
37protected:
38 wxBitmap m_bitmap;
39
40};
41
42class ThemeCtrl: public wxControl
43{
44DECLARE_DYNAMIC_CLASS(ThemeCtrl)
45DECLARE_EVENT_TABLE()
46public:
47enum {
48 ID_DESC = 10001,
49 ID_FILESIZE= 10002,
50 ID_INSTALLCHECKBOX= 10003,
51 ID_PREVIEW_BITMAP = 10004,
52 ID_THEME_LST = 10005,
53 }; //End of Enum
54
55public:
56 // Constructors
57 ThemeCtrl() { Init(); }
58 ThemeCtrl(wxWindow* parent, wxWindowID id,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = wxNO_BORDER,
62 const wxValidator& validator = wxDefaultValidator)
63 {
64 Init();
65 Create(parent, id, pos, size, style, validator);
66 }
67 // Creation
68 bool Create(wxWindow* parent, wxWindowID id,
69 const wxPoint& pos = wxDefaultPosition,
70 const wxSize& size = wxDefaultSize,
71 long style = wxNO_BORDER,
72 const wxValidator& validator = wxDefaultValidator);
73
74 // Creates the controls and sizers
75 void CreateControls();
76 // Common initialization
77 void Init();
78 // Event handlers
79 void OnThemesLst(wxCommandEvent& event);
80 void OnCheckBox(wxCommandEvent& event);
81
82 void setDevice(wxString device);
83 wxArrayString getThemesToInstall();
84
85protected:
86 wxString m_currentimage;
87 wxString m_currentResolution;
88
89 wxStaticText* m_desc;
90 wxListBox* m_themeList;
91 wxStaticText* m_size;
92 wxStaticText* m_themedesc;
93 ImageCtrl* m_PreviewBitmap;
94
95 wxArrayString m_Themes;
96 wxArrayString m_Themes_path;
97 wxArrayString m_Themes_size;
98 wxArrayString m_Themes_image;
99 wxArrayString m_Themes_desc;
100
101};
102
103class OkCancelCtrl: public wxControl
104{
105DECLARE_DYNAMIC_CLASS(OkCancelCtrl)
106DECLARE_EVENT_TABLE()
107
108public:
109 // Constructors
110 OkCancelCtrl() { Init(); }
111 OkCancelCtrl(wxWindow* parent, wxWindowID id,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize,
114 long style = wxNO_BORDER,
115 const wxValidator& validator = wxDefaultValidator)
116 {
117 Init();
118 Create(parent, id, pos, size, style, validator);
119 }
120 // Creation
121 bool Create(wxWindow* parent, wxWindowID id,
122 const wxPoint& pos = wxDefaultPosition,
123 const wxSize& size = wxDefaultSize,
124 long style = wxNO_BORDER,
125 const wxValidator& validator = wxDefaultValidator);
126
127 // Creates the controls and sizers
128 void CreateControls();
129 // Common initialization
130 void Init() { }
131
132protected:
133 wxButton* m_OkBtn;
134 wxButton* m_CancelBtn;
135
136};
137
138class DeviceSelectorCtrl: public wxControl
139{
140DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl)
141DECLARE_EVENT_TABLE()
142public:
143enum {
144 ID_DEVICE_CBX = 10001,
145 ID_AUTODETECT_BTN= 10002,
146 }; //End of Enum
147
148public:
149 // Constructors
150 DeviceSelectorCtrl() { }
151 DeviceSelectorCtrl(wxWindow* parent, wxWindowID id,
152 const wxPoint& pos = wxDefaultPosition,
153 const wxSize& size = wxDefaultSize,
154 long style = wxNO_BORDER,
155 const wxValidator& validator = wxDefaultValidator)
156 {
157 Create(parent, id, pos, size, style, validator);
158 }
159 // Creation
160 bool Create(wxWindow* parent, wxWindowID id,
161 const wxPoint& pos = wxDefaultPosition,
162 const wxSize& size = wxDefaultSize,
163 long style = wxNO_BORDER,
164 const wxValidator& validator = wxDefaultValidator);
165
166 // Creates the controls and sizers
167 void CreateControls();
168 // Event handlers
169 void OnAutoDetect(wxCommandEvent& event);
170 void OnComboBox(wxCommandEvent& event);
171 // Accessors
172 wxString getDevice();
173 void setDefault();
174
175protected:
176 wxString m_currentDevice;
177 wxComboBox* m_deviceCbx;
178 wxStaticText* m_desc;
179 wxButton* m_autodetectBtn;
180
181};
182
183
184class DevicePositionCtrl: public wxControl
185{
186DECLARE_DYNAMIC_CLASS(DevicePositionCtrl)
187DECLARE_EVENT_TABLE()
188public:
189enum {
190 ID_BROWSE_BTN = 10003,
191 }; //End of Enum
192
193public:
194 // Constructors
195 DevicePositionCtrl() { Init(); }
196 DevicePositionCtrl(wxWindow* parent, wxWindowID id,
197 const wxPoint& pos = wxDefaultPosition,
198 const wxSize& size = wxDefaultSize,
199 long style = wxNO_BORDER,
200 const wxValidator& validator = wxDefaultValidator)
201 {
202 Init();
203 Create(parent, id, pos, size, style, validator);
204 }
205 // Creation
206 bool Create(wxWindow* parent, wxWindowID id,
207 const wxPoint& pos = wxDefaultPosition,
208 const wxSize& size = wxDefaultSize,
209 long style = wxNO_BORDER,
210 const wxValidator& validator = wxDefaultValidator);
211
212 // Creates the controls and sizers
213 void CreateControls();
214 // Common initialization
215 void Init() { }
216 // Event handlers
217 void OnBrowseBtn(wxCommandEvent& event);
218 // Accessors
219 wxString getDevicePos();
220
221 void setDefault();
222
223protected:
224 wxTextCtrl* m_devicePos;
225 wxStaticText* m_desc;
226 wxButton* m_browseBtn;
227
228};
229
230
231class FirmwarePositionCtrl: public wxControl
232{
233DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl)
234DECLARE_EVENT_TABLE()
235public:
236enum {
237 ID_BROWSE_BTN = 10004,
238 }; //End of Enum
239
240public:
241 // Constructors
242 FirmwarePositionCtrl() { Init(); }
243 FirmwarePositionCtrl(wxWindow* parent, wxWindowID id,
244 const wxPoint& pos = wxDefaultPosition,
245 const wxSize& size = wxDefaultSize,
246 long style = wxNO_BORDER,
247 const wxValidator& validator = wxDefaultValidator)
248 {
249 Init();
250 Create(parent, id, pos, size, style, validator);
251 }
252 // Creation
253 bool Create(wxWindow* parent, wxWindowID id,
254 const wxPoint& pos = wxDefaultPosition,
255 const wxSize& size = wxDefaultSize,
256 long style = wxNO_BORDER,
257 const wxValidator& validator = wxDefaultValidator);
258
259 // Creates the controls and sizers
260 void CreateControls();
261 // Common initialization
262 void Init() { }
263 // Event handlers
264 void OnBrowseBtn(wxCommandEvent& event);
265 // Accessors
266 wxString getFirmwarePos();
267 void setDefault();
268
269protected:
270 wxTextCtrl* m_firmwarePos;
271 wxStaticText* m_desc;
272 wxButton* m_browseBtn;
273
274};
275
276
277
278#endif
279
280#ifndef RBUTILCTRLS_H_INCLUDED
281#define RBUTILCTRLS_H_INCLUDED
282
283#include "rbutil.h"
284
285
286class ImageCtrl: public wxControl
287{
288DECLARE_DYNAMIC_CLASS(ImageCtrl)
289DECLARE_EVENT_TABLE()
290
291public:
292 // Constructors
293 ImageCtrl() { }
294 ImageCtrl(wxWindow* parent, wxWindowID id,
295 const wxPoint& pos = wxDefaultPosition,
296 const wxSize& size = wxDefaultSize,
297 long style = wxNO_BORDER,
298 const wxValidator& validator = wxDefaultValidator)
299 {
300 Create(parent, id, pos, size, style, validator);
301 }
302 // Creation
303 bool Create(wxWindow* parent, wxWindowID id,
304 const wxPoint& pos = wxDefaultPosition,
305 const wxSize& size = wxDefaultSize,
306 long style = wxNO_BORDER,
307 const wxValidator& validator = wxDefaultValidator);
308
309 // Event handlers
310 void OnPaint(wxPaintEvent& event);
311
312 wxSize DoGetBestSize() const ;
313
314 void SetBitmap(wxBitmap bmp);
315
316protected:
317 wxBitmap m_bitmap;
318
319};
320
321class ThemeCtrl: public wxControl
322{
323DECLARE_DYNAMIC_CLASS(ThemeCtrl)
324DECLARE_EVENT_TABLE()
325public:
326enum {
327 ID_DESC = 10001,
328 ID_FILESIZE= 10002,
329 ID_INSTALLCHECKBOX= 10003,
330 ID_PREVIEW_BITMAP = 10004,
331 ID_THEME_LST = 10005,
332 }; //End of Enum
333
334public:
335 // Constructors
336 ThemeCtrl() { Init(); }
337 ThemeCtrl(wxWindow* parent, wxWindowID id,
338 const wxPoint& pos = wxDefaultPosition,
339 const wxSize& size = wxDefaultSize,
340 long style = wxNO_BORDER,
341 const wxValidator& validator = wxDefaultValidator)
342 {
343 Init();
344 Create(parent, id, pos, size, style, validator);
345 }
346 // Creation
347 bool Create(wxWindow* parent, wxWindowID id,
348 const wxPoint& pos = wxDefaultPosition,
349 const wxSize& size = wxDefaultSize,
350 long style = wxNO_BORDER,
351 const wxValidator& validator = wxDefaultValidator);
352
353 // Creates the controls and sizers
354 void CreateControls();
355 // Common initialization
356 void Init();
357 // Event handlers
358 void OnThemesLst(wxCommandEvent& event);
359 void OnCheckBox(wxCommandEvent& event);
360
361 void setDevice(wxString device);
362 wxArrayString getThemesToInstall();
363
364protected:
365 wxString m_currentimage;
366 wxString m_currentResolution;
367
368 wxStaticText* m_desc;
369 wxListBox* m_themeList;
370 wxStaticText* m_size;
371 wxStaticText* m_themedesc;
372 ImageCtrl* m_PreviewBitmap;
373
374 wxArrayString m_Themes;
375 wxArrayString m_Themes_path;
376 wxArrayString m_Themes_size;
377 wxArrayString m_Themes_image;
378 wxArrayString m_Themes_desc;
379
380 wxCriticalSection m_setDeviceSection;
381 wxCriticalSection m_ThemeSelectSection;
382
383};
384
385class OkCancelCtrl: public wxControl
386{
387DECLARE_DYNAMIC_CLASS(OkCancelCtrl)
388DECLARE_EVENT_TABLE()
389
390public:
391 // Constructors
392 OkCancelCtrl() { Init(); }
393 OkCancelCtrl(wxWindow* parent, wxWindowID id,
394 const wxPoint& pos = wxDefaultPosition,
395 const wxSize& size = wxDefaultSize,
396 long style = wxNO_BORDER,
397 const wxValidator& validator = wxDefaultValidator)
398 {
399 Init();
400 Create(parent, id, pos, size, style, validator);
401 }
402 // Creation
403 bool Create(wxWindow* parent, wxWindowID id,
404 const wxPoint& pos = wxDefaultPosition,
405 const wxSize& size = wxDefaultSize,
406 long style = wxNO_BORDER,
407 const wxValidator& validator = wxDefaultValidator);
408
409 // Creates the controls and sizers
410 void CreateControls();
411 // Common initialization
412 void Init() { }
413
414protected:
415 wxButton* m_OkBtn;
416 wxButton* m_CancelBtn;
417
418};
419
420class DeviceSelectorCtrl: public wxControl
421{
422DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl)
423DECLARE_EVENT_TABLE()
424public:
425enum {
426 ID_DEVICE_CBX = 10001,
427 ID_AUTODETECT_BTN= 10002,
428 }; //End of Enum
429
430public:
431 // Constructors
432 DeviceSelectorCtrl() { }
433 DeviceSelectorCtrl(wxWindow* parent, wxWindowID id,bool bootmode,
434 const wxPoint& pos = wxDefaultPosition,
435 const wxSize& size = wxDefaultSize,
436 long style = wxNO_BORDER,
437 const wxValidator& validator = wxDefaultValidator)
438 {
439 Create(parent, id,bootmode, pos, size, style, validator);
440 }
441 // Creation
442 bool Create(wxWindow* parent, wxWindowID id,bool bootmode,
443 const wxPoint& pos = wxDefaultPosition,
444 const wxSize& size = wxDefaultSize,
445 long style = wxNO_BORDER,
446 const wxValidator& validator = wxDefaultValidator);
447
448 // Creates the controls and sizers
449 void CreateControls(bool bootmode);
450 // Event handlers
451 void OnAutoDetect(wxCommandEvent& event);
452 void OnComboBox(wxCommandEvent& event);
453 // Accessors
454 wxString getDevice();
455 void setDefault();
456
457protected:
458 wxString m_currentDevice;
459 wxComboBox* m_deviceCbx;
460 wxStaticText* m_desc;
461 wxButton* m_autodetectBtn;
462
463};
464
465
466class DevicePositionCtrl: public wxControl
467{
468DECLARE_DYNAMIC_CLASS(DevicePositionCtrl)
469DECLARE_EVENT_TABLE()
470public:
471enum {
472 ID_BROWSE_BTN = 10003,
473 }; //End of Enum
474
475public:
476 // Constructors
477 DevicePositionCtrl() { Init(); }
478 DevicePositionCtrl(wxWindow* parent, wxWindowID id,
479 const wxPoint& pos = wxDefaultPosition,
480 const wxSize& size = wxDefaultSize,
481 long style = wxNO_BORDER,
482 const wxValidator& validator = wxDefaultValidator)
483 {
484 Init();
485 Create(parent, id, pos, size, style, validator);
486 }
487 // Creation
488 bool Create(wxWindow* parent, wxWindowID id,
489 const wxPoint& pos = wxDefaultPosition,
490 const wxSize& size = wxDefaultSize,
491 long style = wxNO_BORDER,
492 const wxValidator& validator = wxDefaultValidator);
493
494 // Creates the controls and sizers
495 void CreateControls();
496 // Common initialization
497 void Init() { }
498 // Event handlers
499 void OnBrowseBtn(wxCommandEvent& event);
500 // Accessors
501 wxString getDevicePos();
502
503 void setDefault();
504
505protected:
506 wxTextCtrl* m_devicePos;
507 wxStaticText* m_desc;
508 wxButton* m_browseBtn;
509
510};
511
512
513class FirmwarePositionCtrl: public wxControl
514{
515DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl)
516DECLARE_EVENT_TABLE()
517public:
518enum {
519 ID_BROWSE_BTN = 10004,
520 }; //End of Enum
521
522public:
523 // Constructors
524 FirmwarePositionCtrl() { Init(); }
525 FirmwarePositionCtrl(wxWindow* parent, wxWindowID id,
526 const wxPoint& pos = wxDefaultPosition,
527 const wxSize& size = wxDefaultSize,
528 long style = wxNO_BORDER,
529 const wxValidator& validator = wxDefaultValidator)
530 {
531 Init();
532 Create(parent, id, pos, size, style, validator);
533 }
534 // Creation
535 bool Create(wxWindow* parent, wxWindowID id,
536 const wxPoint& pos = wxDefaultPosition,
537 const wxSize& size = wxDefaultSize,
538 long style = wxNO_BORDER,
539 const wxValidator& validator = wxDefaultValidator);
540
541 // Creates the controls and sizers
542 void CreateControls();
543 // Common initialization
544 void Init() { }
545 // Event handlers
546 void OnBrowseBtn(wxCommandEvent& event);
547 // Accessors
548 wxString getFirmwarePos();
549 void setDefault();
550
551protected:
552 wxTextCtrl* m_firmwarePos;
553 wxStaticText* m_desc;
554 wxButton* m_browseBtn;
555
556};
557
558
559
560#endif
561
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 @@
31#include "themes_3d.xpm" 31#include "themes_3d.xpm"
32 32
33#include "bootloaders.h" 33#include "bootloaders.h"
34#include "install_dialogs.h"
34 35
35#include "wizard.xpm"
36 36
37//---------------------------------------------------------------------------- 37//----------------------------------------------------------------------------
38// rbutilFrm 38// rbutilFrm
@@ -66,26 +66,46 @@ rbutilFrm::~rbutilFrm() {}
66 66
67void rbutilFrm::CreateGUIControls(void) 67void rbutilFrm::CreateGUIControls(void)
68{ 68{
69 wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()")); 69 wxLogVerbose(wxT("=== begin rbutilFrm::CreateGUIControls()"));
70 70
71 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxHORIZONTAL); 71 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
72 this->SetSizer(WxBoxSizer1); 72 this->SetSizer(WxBoxSizer1);
73 this->SetAutoLayout(TRUE); 73 this->SetAutoLayout(TRUE);
74 74
75 WxPanel1 = new wxPanel(this, ID_WXPANEL1, wxPoint(0,0), wxSize(400,600)); 75 wxPanel* mainPanel = new wxPanel(this,wxID_ANY);
76 WxBoxSizer1->Add(WxPanel1,1,wxGROW | wxALL,0); 76 WxBoxSizer1->Add(mainPanel,0,wxALL,0);
77 77 wxBoxSizer* WxBoxSizer0 = new wxBoxSizer(wxVERTICAL);
78 mainPanel->SetSizer(WxBoxSizer0);
79 mainPanel->SetAutoLayout(TRUE);
80
81 wxBitmap rockboxbmp(rblogo_xpm);
82 ImageCtrl* rockboxbmpCtrl = new ImageCtrl(mainPanel,wxID_ANY);
83 rockboxbmpCtrl->SetBitmap(rockboxbmp);
84 WxBoxSizer0->Add(rockboxbmpCtrl,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5);
85
86 myDeviceSelector = new DeviceSelectorCtrl(mainPanel,wxID_ANY);
87 myDeviceSelector->setDefault();
88 WxBoxSizer0->Add(myDeviceSelector,0,wxALL,5);
89
90 wxNotebook* tabwindow = new wxNotebook(mainPanel,wxID_ANY);
91 WxBoxSizer0->Add(tabwindow,0,wxALL,5);
92
93 wxPanel* installpage = new wxPanel(tabwindow,wxID_ANY);
94 wxPanel* themepage = new wxPanel(tabwindow,wxID_ANY);
95 wxPanel* uninstallpage = new wxPanel(tabwindow,wxID_ANY);
96 tabwindow->AddPage(installpage,wxT("Installation"),true);
97 tabwindow->AddPage(themepage,wxT("Themes"));
98 tabwindow->AddPage(uninstallpage,wxT("Uninstallation"));
99
100 /*********************
101 Install Page
102 ***********************/
103
78 wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxVERTICAL); 104 wxBoxSizer* WxBoxSizer2 = new wxBoxSizer(wxVERTICAL);
79 WxPanel1->SetSizer(WxBoxSizer2); 105 installpage->SetSizer(WxBoxSizer2);
80 WxPanel1->SetAutoLayout(TRUE); 106 installpage->SetAutoLayout(TRUE);
81 107
82 wxBitmap WxStaticBitmap1_BITMAP(rblogo_xpm); 108 wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(installpage,
83 WxStaticBitmap1 = new wxStaticBitmap(WxPanel1, ID_WXSTATICBITMAP1,
84 WxStaticBitmap1_BITMAP, wxPoint(0,0), wxSize(400,123));
85 WxStaticBitmap1->Enable(false);
86 WxBoxSizer2->Add(WxStaticBitmap1,0,wxALIGN_CENTER_HORIZONTAL | wxALL,5);
87
88 wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(WxPanel1,
89 wxID_ANY, wxT("Please choose an option")); 109 wxID_ANY, wxT("Please choose an option"));
90 wxStaticBoxSizer* WxStaticBoxSizer3 = 110 wxStaticBoxSizer* WxStaticBoxSizer3 =
91 new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxHORIZONTAL); 111 new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxHORIZONTAL);
@@ -94,16 +114,16 @@ void rbutilFrm::CreateGUIControls(void)
94 wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(2,2,0,0); 114 wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(2,2,0,0);
95 WxStaticBoxSizer3->Add(WxFlexGridSizer1,0,wxGROW | wxALL,0); 115 WxStaticBoxSizer3->Add(WxFlexGridSizer1,0,wxGROW | wxALL,0);
96 116
97 wxBitmap BootloaderInstallButton (tools2_3d_xpm); 117 wxBitmap BootloaderInstallButton (tools2_3d_xpm);
98 WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADER_BTN, 118 WxBitmapButton4 = new wxBitmapButton(installpage, ID_BOOTLOADER_BTN,
99 BootloaderInstallButton, wxPoint(0,0), wxSize(64,54), 119 BootloaderInstallButton, wxPoint(0,0), wxSize(64,54),
100 wxRAISED_BORDER | wxBU_AUTODRAW); 120 wxRAISED_BORDER | wxBU_AUTODRAW);
101 WxBitmapButton4->SetToolTip(wxT("Instructions for installing the " 121 WxBitmapButton4->SetToolTip(wxT("Instructions for installing the "
102 "Rockbox bootloader on your audio device")); 122 "Rockbox bootloader on your audio device"));
103 WxFlexGridSizer1->Add(WxBitmapButton4, 0, 123 WxFlexGridSizer1->Add(WxBitmapButton4, 0,
104 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 124 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
105 125
106 wxStaticText* WxStaticText5 = new wxStaticText(WxPanel1, wxID_ANY, 126 wxStaticText* WxStaticText5 = new wxStaticText(installpage, wxID_ANY,
107 wxT("Bootloader installation instructions\n\n" 127 wxT("Bootloader installation instructions\n\n"
108 "Before Rockbox can be installed on your audio player, you " 128 "Before Rockbox can be installed on your audio player, you "
109 "may have to\ninstall a bootloader. This can not currently " 129 "may have to\ninstall a bootloader. This can not currently "
@@ -113,7 +133,7 @@ void rbutilFrm::CreateGUIControls(void)
113 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 133 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
114 134
115 wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm); 135 wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
116 WxBitmapButton1 = new wxBitmapButton(WxPanel1, ID_INSTALL_BTN, 136 WxBitmapButton1 = new wxBitmapButton(installpage, ID_INSTALL_BTN,
117 WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54), 137 WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54),
118 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator, 138 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
119 wxT("WxBitmapButton1")); 139 wxT("WxBitmapButton1"));
@@ -121,69 +141,102 @@ void rbutilFrm::CreateGUIControls(void)
121 WxFlexGridSizer1->Add(WxBitmapButton1,0, 141 WxFlexGridSizer1->Add(WxBitmapButton1,0,
122 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 142 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
123 143
124 WxStaticText2 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT2, 144 WxStaticText2 = new wxStaticText(installpage, ID_WXSTATICTEXT2,
125 wxT("Install Rockbox on your audio player")); 145 wxT("Install Rockbox on your audio player"));
126 WxFlexGridSizer1->Add(WxStaticText2,0, 146 WxFlexGridSizer1->Add(WxStaticText2,0,
127 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 147 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
128 148
149/* ********************+
150 Theme Page
151 ***********************/
152
153 wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
154 themepage->SetSizer(WxBoxSizer3);
155 themepage->SetAutoLayout(TRUE);
156
157 wxStaticBox* WxStaticBoxSizer4_StaticBoxObj = new wxStaticBox(themepage,
158 wxID_ANY, wxT("Please choose an option"));
159 wxStaticBoxSizer* WxStaticBoxSizer4 =
160 new wxStaticBoxSizer(WxStaticBoxSizer4_StaticBoxObj,wxHORIZONTAL);
161 WxBoxSizer3->Add(WxStaticBoxSizer4,1,wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
162
163 wxFlexGridSizer* WxFlexGridSizer2 = new wxFlexGridSizer(2,2,0,0);
164 WxStaticBoxSizer4->Add(WxFlexGridSizer2,0,wxGROW | wxALL,0);
165
129 wxBitmap FontInstallButton (fonts_3d_xpm); 166 wxBitmap FontInstallButton (fonts_3d_xpm);
130 WxBitmapButton3 = new wxBitmapButton(WxPanel1, ID_FONT_BTN, 167 WxBitmapButton3 = new wxBitmapButton(themepage, ID_FONT_BTN,
131 FontInstallButton, wxPoint(0,0), wxSize(64,54), 168 FontInstallButton, wxPoint(0,0), wxSize(64,54),
132 wxRAISED_BORDER | wxBU_AUTODRAW); 169 wxRAISED_BORDER | wxBU_AUTODRAW);
133 WxBitmapButton3->SetToolTip(wxT("Download the most up to date " 170 WxBitmapButton3->SetToolTip(wxT("Download the most up to date "
134 "Rockbox fonts.")); 171 "Rockbox fonts."));
135 WxFlexGridSizer1->Add(WxBitmapButton3, 0, 172 WxFlexGridSizer2->Add(WxBitmapButton3, 0,
136 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 173 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
137 174
138 wxStaticText* WxStaticText4 = new wxStaticText(WxPanel1, wxID_ANY, 175 wxStaticText* WxStaticText4 = new wxStaticText(themepage, wxID_ANY,
139 wxT("Install the Rockbox fonts package\n\n" 176 wxT("Install the Rockbox fonts package\n\n"
140 "This step is only needed if you have installed " 177 "This step is only needed if you have installed "
141 "a daily build and want\nthe full set of Rockbox fonts. You " 178 "a daily build and want\nthe full set of Rockbox fonts. You "
142 "will not need to download these\nagain unless you uninstall " 179 "will not need to download these\nagain unless you uninstall "
143 "Rockbox.")); 180 "Rockbox."));
144 WxFlexGridSizer1->Add(WxStaticText4, 0, 181 WxFlexGridSizer2->Add(WxStaticText4, 0,
145 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 182 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
146 183
147
148 wxBitmap ThemesInstallButton (themes_3d_xpm); 184 wxBitmap ThemesInstallButton (themes_3d_xpm);
149 WxBitmapButton5 = new wxBitmapButton(WxPanel1, ID_THEMES_BTN, 185 WxBitmapButton5 = new wxBitmapButton(themepage, ID_THEMES_BTN,
150 ThemesInstallButton, wxPoint(0,0), wxSize(64,54), 186 ThemesInstallButton, wxPoint(0,0), wxSize(64,54),
151 wxRAISED_BORDER | wxBU_AUTODRAW); 187 wxRAISED_BORDER | wxBU_AUTODRAW);
152 WxBitmapButton5->SetToolTip(wxT("Download other Themes for Rockbox.")); 188 WxBitmapButton5->SetToolTip(wxT("Download other Themes for Rockbox."));
153 WxFlexGridSizer1->Add(WxBitmapButton5, 0, 189 WxFlexGridSizer2->Add(WxBitmapButton5, 0,
154 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 190 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
155 191
156 wxStaticText* WxStaticText6 = new wxStaticText(WxPanel1, wxID_ANY, 192 wxStaticText* WxStaticText6 = new wxStaticText(themepage, wxID_ANY,
157 wxT("Install more Themes for Rockbox.\n\n")); 193 wxT("Install more Themes for Rockbox.\n\n"));
158 WxFlexGridSizer1->Add(WxStaticText6, 0, 194 WxFlexGridSizer2->Add(WxStaticText6, 0,
159 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 195 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
160 196
197 /* ********************+
198 Uninstall Page
199 ***********************/
200
201 wxBoxSizer* WxBoxSizer4 = new wxBoxSizer(wxVERTICAL);
202 uninstallpage->SetSizer(WxBoxSizer4);
203 uninstallpage->SetAutoLayout(TRUE);
204
205 wxStaticBox* WxStaticBoxSizer5_StaticBoxObj = new wxStaticBox(uninstallpage,
206 wxID_ANY, wxT("Please choose an option"));
207 wxStaticBoxSizer* WxStaticBoxSizer5 =
208 new wxStaticBoxSizer(WxStaticBoxSizer5_StaticBoxObj,wxHORIZONTAL);
209 WxBoxSizer4->Add(WxStaticBoxSizer5,1,wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
210
211 wxFlexGridSizer* WxFlexGridSizer3 = new wxFlexGridSizer(2,2,0,0);
212 WxStaticBoxSizer5->Add(WxFlexGridSizer3,0,wxGROW | wxALL,0);
213
161 wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm); 214 wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
162 WxBitmapButton2 = new wxBitmapButton(WxPanel1, ID_REMOVE_BTN, 215 WxBitmapButton2 = new wxBitmapButton(uninstallpage, ID_REMOVE_BTN,
163 WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54), 216 WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54),
164 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator, 217 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
165 wxT("WxBitmapButton2")); 218 wxT("WxBitmapButton2"));
166 WxBitmapButton2->SetToolTip(wxT("Uninstall Rockbox")); 219 WxBitmapButton2->SetToolTip(wxT("Uninstall Rockbox"));
167 WxFlexGridSizer1->Add(WxBitmapButton2,0, 220 WxFlexGridSizer3->Add(WxBitmapButton2,0,
168 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 221 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
169 222
170 WxStaticText3 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT3, 223 WxStaticText3 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT3,
171 wxT("Remove Rockbox from your audio player")); 224 wxT("Remove Rockbox from your audio player"));
172 WxFlexGridSizer1->Add(WxStaticText3,0, 225 WxFlexGridSizer3->Add(WxStaticText3,0,
173 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 226 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
174 227
175 wxBitmap WxBitmapButton4_BITMAP (untools2_3d_xpm); 228 wxBitmap WxBitmapButton4_BITMAP (untools2_3d_xpm);
176 WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADERREMOVE_BTN, 229 WxBitmapButton4 = new wxBitmapButton(uninstallpage, ID_BOOTLOADERREMOVE_BTN,
177 WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54), 230 WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54),
178 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator, 231 wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
179 wxT("WxBitmapButton4")); 232 wxT("WxBitmapButton4"));
180 WxBitmapButton4->SetToolTip(wxT("Uninstall Bootloader")); 233 WxBitmapButton4->SetToolTip(wxT("Uninstall Bootloader"));
181 WxFlexGridSizer1->Add(WxBitmapButton4,0, 234 WxFlexGridSizer3->Add(WxBitmapButton4,0,
182 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5); 235 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL,5);
183 236
184 WxStaticText4 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT4, 237 WxStaticText4 = new wxStaticText(uninstallpage, ID_WXSTATICTEXT4,
185 wxT("Remove Rockbox Bootloader from your audio player")); 238 wxT("Remove Rockbox Bootloader from your audio player"));
186 WxFlexGridSizer1->Add(WxStaticText4,0, 239 WxFlexGridSizer3->Add(WxStaticText4,0,
187 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5); 240 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
188 241
189 WxMenuBar1 = new wxMenuBar(); 242 WxMenuBar1 = new wxMenuBar();
@@ -203,7 +256,7 @@ void rbutilFrm::CreateGUIControls(void)
203 wxITEM_NORMAL); 256 wxITEM_NORMAL);
204 257
205 this->SetMenuBar(WxMenuBar1); 258 this->SetMenuBar(WxMenuBar1);
206 259 Layout();
207 GetSizer()->Fit(this); 260 GetSizer()->Fit(this);
208 GetSizer()->SetSizeHints(this); 261 GetSizer()->SetSizeHints(this);
209 if (gv->portable) 262 if (gv->portable)
@@ -217,7 +270,7 @@ void rbutilFrm::CreateGUIControls(void)
217 wxIcon rbutilFrm_ICON (rbutilFrm_XPM); 270 wxIcon rbutilFrm_ICON (rbutilFrm_XPM);
218 this->SetIcon(rbutilFrm_XPM); 271 this->SetIcon(rbutilFrm_XPM);
219 this->SetToolTip(wxT("Install Rockbox")); 272 this->SetToolTip(wxT("Install Rockbox"));
220 273
221 wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls")); 274 wxLogVerbose(wxT("=== end rbutilFrm::CreateGUIControls"));
222} 275}
223 276
@@ -229,6 +282,7 @@ void rbutilFrm::rbutilFrmClose(wxCloseEvent& event)
229} 282}
230 283
231 284
285
232/* 286/*
233 * OnFileExit 287 * OnFileExit
234 */ 288 */
@@ -299,93 +353,63 @@ void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
299{ 353{
300 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)")); 354 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
301 355
302 wxWizard *wizard = new wxWizard(this, wxID_ANY, 356 bootloaderDeInstallDlg dialog(NULL, wxID_ANY,
303 wxT("Rockbox Bootloader Uninstallation Wizard"), 357 wxT("Bootloader Deinstallation"));
304 wxBitmap(wizard_xpm),
305 wxDefaultPosition,
306 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
307 wxBootPlatformPage* page1 = new wxBootPlatformPage(wizard);
308 wxBootLocationPage* page2 = new wxBootLocationPage(wizard); // Only one of these pages are shown
309 wxIpodLocationPage* page3 = new wxIpodLocationPage(wizard); // depending on Device selected
310 358
311 page1->SetNext(page2); 359 if (dialog.ShowModal() == wxID_OK)
312 page2->SetPrev(page1);
313 page2->SetNext(page3);
314 page3->SetPrev(page2);
315
316 wizard->GetPageAreaSizer()->Add(page1);
317
318
319 if (wizard->RunWizard(page1) )
320 { 360 {
321 // uninstall the bootloader 361 int index = gv->plat_id.Index(gv->curplat);
322 if(gv->curbootloadermethod == wxT("ipodpatcher")) 362 wxString bootloadermethod = gv->plat_bootloadermethod[index];
323 {
324 363
325 if(ipodpatcher(BOOTLOADER_REM)) 364 if(bootloadermethod == wxT("ipodpatcher"))
365 {
366 wxString bootloadername = wxT("bootloader-");
367 bootloadername.Append(gv->plat_bootloadername[index] );
368 if(ipodpatcher(BOOTLOADER_REM,bootloadername))
326 { 369 {
327 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.") 370 MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
328 ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
329 msg->ShowModal();
330 delete msg;
331 } 371 }
332 else 372 else
333 { 373 {
334 MESG_DIALOG(wxT("The Uninstallation has failed.") ); 374 MESG_DIALOG(wxT("The Uninstallation failed.") );
335 } 375 }
336 } 376 }
337 else if(gv->curbootloadermethod == wxT("gigabeatf")) 377 else if(bootloadermethod== wxT("gigabeatf"))
338 { 378 {
339 379
340 if(gigabeatf(BOOTLOADER_REM)) 380 if(gigabeatf(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir))
341 { 381 {
342 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.") 382 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
343 ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
344 msg->ShowModal();
345 delete msg;
346 } 383 }
347 else 384 else
348 MESG_DIALOG(wxT("The Uninstallation has failed.") ); 385 MESG_DIALOG(wxT("The Uninstallation failed.") );
349 } 386 }
350 else if(gv->curbootloadermethod == wxT("h10")) 387 else if(bootloadermethod == wxT("iaudio") )
351 { 388 {
352 if(h10(BOOTLOADER_REM)) 389 MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
353 { 390 "you need to download and install an Original Firmware from the Manufacturer."));
354 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been uninstalled.")
355 ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION);
356 msg->ShowModal();
357 delete msg;
358 }
359 else
360 MESG_DIALOG(wxT("The Uninstallation has failed.") );
361
362 } 391 }
363 else if(gv->curbootloadermethod == wxT("iaudio") ) 392 else if(bootloadermethod == wxT("fwpatcher"))
364 { 393 {
365 wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n" 394 MESG_DIALOG(wxT("To uninstall the Bootloader on this Device,\n"
366 "you need to download and install an Original Firmware from the Manufacturer.") 395 "you need to download and install an original Firmware from the Manufacturer.\n"
367 ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION); 396 "To do this, you need to boot into the original Firmware."));
368 msg->ShowModal();
369 delete msg;
370 } 397 }
371 else if(gv->curbootloadermethod == wxT("fwpatcher") ) 398 else if(bootloadermethod == wxT("h10"))
372 { 399 {
373 wxMessageDialog* msg = new wxMessageDialog(this, wxT("To uninstall the Bootloader on this Device,\n" 400 if(h10(BOOTLOADER_REM,gv->plat_bootloadername[index],gv->curdestdir))
374 "you need to download and install an original Firmware from the Manufacturer.\n" 401 {
375 "To do this, you need to boot into the original Firmware.") 402 MESG_DIALOG(wxT("The Bootloader has been uninstalled."));
376 ,wxT("Uninstallation"), wxOK |wxICON_INFORMATION); 403 }
377 msg->ShowModal(); 404 else
378 delete msg; 405 MESG_DIALOG(wxT("The Uninstallation failed.") );
379 } 406 }
380 else 407 else
381 { 408 {
382 MESG_DIALOG(wxT("Unsupported Bootloader Method") ); 409 MESG_DIALOG(wxT("Unsupported Bootloader Uninstall method.") );
383 } 410 }
384 } 411 }
385 else 412
386 {
387 MESG_DIALOG(wxT("The bootloader Uninstallation wizard was cancelled") );
388 }
389 413
390 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn")); 414 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderRemoveBtn"));
391} 415}
@@ -394,104 +418,73 @@ void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
394{ 418{
395 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)")); 419 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
396 420
397 wxWizard *wizard = new wxWizard(this, wxID_ANY, 421 bootloaderInstallDlg dialog(NULL, wxID_ANY,
398 wxT("Rockbox Installation Wizard"), 422 wxT("Bootloader Installation"));
399 wxBitmap(wizard_xpm), 423
400 wxDefaultPosition, 424 if (dialog.ShowModal() == wxID_OK)
401 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
402 wxBootPlatformPage* page1 = new wxBootPlatformPage(wizard);
403 wxFirmwareLocationPage* page2 = new wxFirmwareLocationPage(wizard); //this page is optional
404 wxBootLocationPage* page3 = new wxBootLocationPage(wizard); // Only one of these pages are shown
405 wxIpodLocationPage* page4 = new wxIpodLocationPage(wizard); // depending on Device selected
406
407 page1->SetNext(page2);
408 page2->SetPrev(page1);
409 page2->SetNext(page3);
410 page3->SetPrev(page2);
411 page3->SetNext(page4);
412 page4->SetPrev(page3);
413
414 wizard->GetPageAreaSizer()->Add(page1);
415
416 if (wizard->RunWizard(page1) )
417 { 425 {
418 // start installation depending on player 426 int index = gv->plat_id.Index(gv->curplat);
419 if(gv->curbootloadermethod == wxT("ipodpatcher")) 427 wxString bootloadermethod = gv->plat_bootloadermethod[index];
420 {
421 428
422 if(ipodpatcher(BOOTLOADER_ADD)) 429 if(bootloadermethod == wxT("ipodpatcher"))
430 {
431 wxString bootloadername = wxT("bootloader-");
432 bootloadername.Append(gv->plat_bootloadername[index] );
433 if(ipodpatcher(BOOTLOADER_ADD,bootloadername))
423 { 434 {
424 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.") 435 MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
425 ,wxT("Installation"), wxOK |wxICON_INFORMATION);
426 msg->ShowModal();
427 delete msg;
428 } 436 }
429 else 437 else
430 { 438 {
431 MESG_DIALOG(wxT("The installation has failed.") ); 439 MESG_DIALOG(wxT("The installation has failed.") );
432 } 440 }
433 } 441 }
434 else if(gv->curbootloadermethod == wxT("gigabeatf")) 442 else if(bootloadermethod== wxT("gigabeatf"))
435 { 443 {
436 444
437 if(gigabeatf(BOOTLOADER_ADD)) 445 if(gigabeatf(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
438 { 446 {
439 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.") 447 MESG_DIALOG(wxT("The Bootloader has been installed on your device."));
440 ,wxT("Installation"), wxOK |wxICON_INFORMATION);
441 msg->ShowModal();
442 delete msg;
443 } 448 }
444 else 449 else
445 MESG_DIALOG(wxT("The installation has failed.") ); 450 MESG_DIALOG(wxT("The installation has failed.") );
446 } 451 }
447 else if(gv->curbootloadermethod == wxT("iaudio") ) 452 else if(bootloadermethod == wxT("iaudio") )
448 { 453 {
449 if(iaudiox5(BOOTLOADER_ADD)) 454 if(iaudiox5(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
450 { 455 {
451 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been installed on your device.\n" 456 MESG_DIALOG(wxT("The Bootloader has been installed on your device.\n"
452 "Now turn OFF your Device, unplug USB,and insert Charger\n" 457 "Now turn OFF your Device, unplug USB,and insert Charger\n"
453 "Your Device will automatically upgrade the flash with the Rockbox bootloader") 458 "Your Device will automatically upgrade the flash with the Rockbox bootloader"));
454 ,wxT("Installation"), wxOK |wxICON_INFORMATION);
455 msg->ShowModal();
456 delete msg;
457 } 459 }
458 else 460 else
459 MESG_DIALOG(wxT("The installation has failed.") ); 461 MESG_DIALOG(wxT("The installation has failed.") );
460 } 462 }
461 else if(gv->curbootloadermethod == wxT("fwpatcher")) 463 else if(bootloadermethod == wxT("fwpatcher"))
462 { 464 {
463 if(fwpatcher(BOOTLOADER_ADD)) 465 if(fwpatcher(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir,gv->curfirmware))
464 { 466 {
465 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n" 467 MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"
466 "Now use the Firmware upgrade option of your Device\n") 468 "Now use the Firmware upgrade option of your Device\n"));
467 ,wxT("Installation"), wxOK |wxICON_INFORMATION);
468 msg->ShowModal();
469 delete msg;
470 } 469 }
471 else 470 else
472 MESG_DIALOG(wxT("The installation has failed.") ); 471 MESG_DIALOG(wxT("The installation has failed.") );
473 } 472 }
474 else if(gv->curbootloadermethod == wxT("h10")) 473 else if(bootloadermethod == wxT("h10"))
475 { 474 {
476 if(h10(BOOTLOADER_ADD)) 475 if(h10(BOOTLOADER_ADD,gv->plat_bootloadername[index],gv->curdestdir))
477 { 476 {
478 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Bootloader has been patched and copied on your device.\n") 477 MESG_DIALOG(wxT("The Bootloader has been patched and copied on your device.\n"));
479 ,wxT("Installation"), wxOK |wxICON_INFORMATION);
480 msg->ShowModal();
481 delete msg;
482 } 478 }
483 else 479 else
484 MESG_DIALOG(wxT("The installation has failed.") ); 480 MESG_DIALOG(wxT("The installation has failed.") );
485 } 481 }
486 else 482 else
487 { 483 {
488 MESG_DIALOG(wxT("Unsupported Bootloader Method") ); 484 MESG_DIALOG(wxT("Unsupported Bootloader Install method.") );
489 } 485 }
490 } 486 }
491 else 487
492 {
493 MESG_DIALOG(wxT("The bootloader installation wizard was cancelled") );
494 }
495 488
496 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn")); 489 wxLogVerbose(wxT("=== end rbutilFrm::OnBootloaderBtn"));
497 490
@@ -507,22 +500,10 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
507 wxFileConfig* buildinfo; 500 wxFileConfig* buildinfo;
508 wxDateSpan oneday; 501 wxDateSpan oneday;
509 502
510 wxWizard *wizard = new wxWizard(this, wxID_ANY, 503 rockboxInstallDlg dialog(NULL, wxID_ANY,
511 wxT("Rockbox Installation Wizard"), 504 wxT("Rockbox Installation"));
512 wxBitmap(wizard_xpm), 505
513 wxDefaultPosition, 506 if (dialog.ShowModal() == wxID_OK)
514 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
515 wxPlatformPage* page1 = new wxPlatformPage(wizard);
516 wxLocationPage* page2 = new wxLocationPage(wizard);
517 wxBuildPage* page3 = new wxBuildPage(wizard);
518 page1->SetNext(page2);
519 page2->SetPrev(page1);
520 page2->SetNext(page3);
521 page3->SetPrev(page2);
522
523 wizard->GetPageAreaSizer()->Add(page1);
524
525 if (wizard->RunWizard(page1) )
526 { 507 {
527 switch (gv->curbuild) 508 switch (gv->curbuild)
528 { 509 {
@@ -613,9 +594,6 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
613 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); 594 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
614 ERR_DIALOG(buf, wxT("Install")); 595 ERR_DIALOG(buf, wxT("Install"));
615 } 596 }
616 } else
617 {
618 MESG_DIALOG(wxT("The installation wizard was cancelled") );
619 } 597 }
620 598
621 wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn")); 599 wxLogVerbose(wxT("=== end rbutilFrm::OnInstallBtn"));
@@ -631,17 +609,12 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
631 wxFileConfig* buildinfo; 609 wxFileConfig* buildinfo;
632 wxDateSpan oneday; 610 wxDateSpan oneday;
633 611
634 wxWizard *wizard = new wxWizard(this, wxID_ANY, 612 fontInstallDlg dialog(NULL, wxID_ANY,
635 wxT("Rockbox Font Installation Wizard"), 613 wxT("Font Installation"));
636 wxBitmap(wizard_xpm),
637 wxDefaultPosition,
638 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
639 wxLocationPage* page1 = new wxLocationPage(wizard);
640
641 wizard->GetPageAreaSizer()->Add(page1);
642 614
643 if (wizard->RunWizard(page1) ) 615 if (dialog.ShowModal() == wxID_OK)
644 { 616 {
617
645 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ; 618 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
646 if (! wxDirExists(buf) ) 619 if (! wxDirExists(buf) )
647 { 620 {
@@ -710,11 +683,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
710 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); 683 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
711 ERR_DIALOG(buf, wxT("Font Install")); 684 ERR_DIALOG(buf, wxT("Font Install"));
712 } 685 }
713 } else
714 {
715 MESG_DIALOG(wxT("The font installation wizard was cancelled") );
716 } 686 }
717
718 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn")); 687 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
719} 688}
720 689
@@ -722,25 +691,13 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
722void rbutilFrm::OnThemesBtn(wxCommandEvent& event) 691void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
723{ 692{
724 wxString src, dest, buf; 693 wxString src, dest, buf;
725 wxTimeSpan day(24);
726 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)")); 694 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
727 695
728 wxWizard *wizard = new wxWizard(this, wxID_ANY, 696
729 wxT("Rockbox Themes Installation Wizard"), 697 themesInstallDlg dialog(NULL, wxID_ANY,
730 wxBitmap(wizard_xpm), 698 wxT("Theme Installation"));
731 wxDefaultPosition, 699
732 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); 700 if (dialog.ShowModal() == wxID_OK)
733 wxPlatformPage* page1 = new wxPlatformPage(wizard);
734 wxLocationPage* page2 = new wxLocationPage(wizard);
735 wxThemesPage* page3 = new wxThemesPage(wizard);
736 page1->SetNext(page2);
737 page2->SetPrev(page1);
738 page2->SetNext(page3);
739 page3->SetPrev(page2);
740
741 wizard->GetPageAreaSizer()->Add(page1);
742
743 if (wizard->RunWizard(page1) )
744 { 701 {
745 bool success=true; 702 bool success=true;
746 for(unsigned int i=0 ;i < gv->themesToInstall.GetCount();i++) 703 for(unsigned int i=0 ;i < gv->themesToInstall.GetCount();i++)
@@ -756,35 +713,21 @@ void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
756 { 713 {
757 MESG_DIALOG(wxT("The Theme installation completed successfully.") ); 714 MESG_DIALOG(wxT("The Theme installation completed successfully.") );
758 } 715 }
759
760
761 }
762 else
763 {
764 MESG_DIALOG(wxT("The Themes installation wizard was cancelled") );
765 } 716 }
766 717
718
767 wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)")); 719 wxLogVerbose(wxT("=== end rbutilFrm::OnThemesBtn(event)"));
768} 720}
769 721
770 722
771void rbutilFrm::OnRemoveBtn(wxCommandEvent& event) 723void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
772{ 724{
773 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)")); 725 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
774 726
775 wxWizard *wizard = new wxWizard(this, wxID_ANY, 727 rockboxDeInstallDlg dialog(NULL, wxID_ANY,
776 wxT("Rockbox Uninstallation Wizard"), 728 wxT("Rockbox Deinstallation"));
777 wxBitmap(wizard_xpm),
778 wxDefaultPosition,
779 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
780 wxLocationPage* page1 = new wxLocationPage(wizard);
781 wxFullUninstallPage *page2 = new wxFullUninstallPage(wizard);
782 page1->SetNext(page2);
783 page2->SetPrev(page1);
784 729
785 wizard->GetPageAreaSizer()->Add(page1); 730 if (dialog.ShowModal() == wxID_OK)
786
787 if (wizard->RunWizard(page1) )
788 { 731 {
789 if (Uninstall(gv->curdestdir, gv->curisfull) ) 732 if (Uninstall(gv->curdestdir, gv->curisfull) )
790 { 733 {
@@ -798,9 +741,6 @@ void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
798 msg->ShowModal(); 741 msg->ShowModal();
799 delete msg; 742 delete msg;
800 } 743 }
801 } else
802 {
803 MESG_DIALOG(wxT("The uninstallation wizard was cancelled.") );
804 } 744 }
805 745
806 wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn")); 746 wxLogVerbose(wxT("=== end rbutilFrm::OnRemoveBtn"));
@@ -813,30 +753,19 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
813 wxFileSystem fs; 753 wxFileSystem fs;
814 wxDateSpan oneday; 754 wxDateSpan oneday;
815 755
816 wxWizard *wizard = new wxWizard(this, wxID_ANY, 756 fontInstallDlg dialog(NULL, wxID_ANY,
817 wxT("Rockbox Utility Portable Installation Wizard"), 757 wxT("Rockbox Utility Portable Installation"));
818 wxBitmap(wizard_xpm),
819 wxDefaultPosition,
820 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
821 wxLocationPage* page1 = new wxLocationPage(wizard);
822 758
823 wizard->GetPageAreaSizer()->Add(page1); 759 if (dialog.ShowModal() == wxID_OK)
824
825 if (wizard->RunWizard(page1) )
826 { 760 {
827 if ( InstallRbutil(gv->curdestdir) ) 761 if ( InstallRbutil(gv->curdestdir) )
828 { 762 {
829 wxMessageDialog* msg = new wxMessageDialog(this, wxT("The Rockbox Utility has been installed on your device.") 763 MESG_DIALOG(wxT("The Rockbox Utility has been installed on your device."));
830 ,wxT("Installation"), wxOK |wxICON_INFORMATION); 764
831 msg->ShowModal();
832 delete msg;
833 } else 765 } else
834 { 766 {
835 ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install")); 767 ERR_DIALOG(wxT("Installation failed"), wxT("Portable Install"));
836 } 768 }
837 } else
838 {
839 MESG_DIALOG(wxT("The portable installation wizard was cancelled") );
840 } 769 }
841 770
842 wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable")); 771 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 @@
41#include <wx/richtext/richtextctrl.h> 41#include <wx/richtext/richtextctrl.h>
42 42
43#include "rbutil.h" 43#include "rbutil.h"
44#include "wizard_pages.h" 44#include "rbutilCtrls.h"
45 45
46class rbutilFrm : public wxFrame 46class rbutilFrm : public wxFrame
47{ 47{
@@ -56,6 +56,7 @@ public:
56 wxMINIMIZE_BOX | wxCLOSE_BOX); 56 wxMINIMIZE_BOX | wxCLOSE_BOX);
57 virtual ~rbutilFrm(); 57 virtual ~rbutilFrm();
58public: 58public:
59 DeviceSelectorCtrl* myDeviceSelector;
59 wxMenuBar *WxMenuBar1; 60 wxMenuBar *WxMenuBar1;
60 wxStaticText *WxStaticText3; 61 wxStaticText *WxStaticText3;
61 wxBitmapButton *WxBitmapButton2; 62 wxBitmapButton *WxBitmapButton2;
@@ -107,7 +108,7 @@ public:
107 void OnBootloaderBtn(wxCommandEvent& event); 108 void OnBootloaderBtn(wxCommandEvent& event);
108 void OnPortableInstall(wxCommandEvent& event); 109 void OnPortableInstall(wxCommandEvent& event);
109 void OnBootloaderRemoveBtn(wxCommandEvent& event); 110 void OnBootloaderRemoveBtn(wxCommandEvent& event);
110 111
111}; 112};
112 113
113#endif 114#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: wizardpages.cpp
10 *
11 * Copyright (C) 2005 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include "wizard_pages.h"
22#include "bootloaders.h"
23
24
25#include <wx/regex.h>
26#include <wx/tokenzr.h>
27
28/////// Bootplatform page ///////////////////////////////////77
29wxBootPlatformPage::wxBootPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent)
30{
31 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
32
33 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
34 wxT("Please select the model of audio device that you would like to"
35 "\ninstall the Rockbox Bootloader on from the list below:"));
36 WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
37
38 wxArrayString arrayStringFor_WxListBox1;
39 for (unsigned int i=0; i< gv->plat_name.GetCount(); i++) {
40 if (gv->plat_needsbootloader[i])
41 {
42 if(gv->plat_autodetect[i])
43 {
44 if(arrayStringFor_WxListBox1.Index(gv->plat_combinedname[i]) == wxNOT_FOUND)
45 arrayStringFor_WxListBox1.Add(gv->plat_combinedname[i]);
46 }
47 else
48 {
49 arrayStringFor_WxListBox1.Add(gv->plat_name[i]);
50 }
51 }
52 }
53
54 BootPlatformListBox = new wxListBox(this, wxID_ANY, wxDefaultPosition,
55 wxDefaultSize, arrayStringFor_WxListBox1, wxLB_SINGLE);
56 WxBoxSizer1->Add(BootPlatformListBox,0,wxGROW | wxALL,5);
57
58 SetSizer(WxBoxSizer1);
59 WxBoxSizer1->Fit(this);
60
61 for (unsigned int i=0; i< gv->plat_id.GetCount(); i++) {
62 if (gv->plat_id[i] == gv->curplat) BootPlatformListBox->SetSelection(i);
63 }
64
65}
66
67wxWizardPage * wxBootPlatformPage::GetNext() const
68{
69 if(gv->curbootloadermethod != wxT("fwpatcher")&& gv->curbootloadermethod != wxT("ipodpatcher"))
70 {
71 if(wxWizardPageSimple::GetNext()->GetNext() != NULL) // not iriver hx0 and ipod, skip one page
72 return wxWizardPageSimple::GetNext()->GetNext();
73 }
74 else if(gv->curbootloadermethod == wxT("ipodpatcher"))
75 {
76 if(wxWizardPageSimple::GetNext()->GetNext() != NULL)
77 if(wxWizardPageSimple::GetNext()->GetNext()->GetNext() != NULL)
78 return wxWizardPageSimple::GetNext()->GetNext()->GetNext(); //ipod, skip 2 pages
79 else
80 return wxWizardPageSimple::GetNext()->GetNext(); //ipod, skip 1 page (for uninstallation)
81 }
82
83 // all others , no skip
84 return wxWizardPageSimple::GetNext();
85}
86
87bool wxBootPlatformPage::TransferDataFromWindow()
88{
89 if (BootPlatformListBox->GetSelection() == wxNOT_FOUND )
90 {
91 WARN_DIALOG(wxT("You must select an audio device type before proceeding"),
92 wxT("Select Platform"));
93 return false;
94 } else
95 {
96 int idx = gv->plat_name.Index(BootPlatformListBox->GetStringSelection());
97 if(idx == wxNOT_FOUND) idx =gv->plat_combinedname.Index(BootPlatformListBox->GetStringSelection());
98 gv->curplatnum = idx;
99 gv->curplat = gv->plat_id[gv->curplatnum];
100 gv->curbootloadermethod = gv->plat_bootloadermethod[gv->curplatnum];
101 gv->curbootloader = gv->plat_bootloadername[gv->curplatnum];
102
103 return true;
104 }
105}
106//// Plattfor Page //////////////////////////
107wxPlatformPage::wxPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent)
108{
109 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
110
111 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
112 wxT("Please select the model of audio device that you would like to"
113 "\ninstall Rockbox on from the list below:"));
114 WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
115
116 wxArrayString arrayStringFor_WxListBox1;
117 PlatformListBox = new wxListBox(this, wxID_ANY, wxDefaultPosition,
118 wxDefaultSize, gv->plat_name, wxLB_SINGLE);
119 WxBoxSizer1->Add(PlatformListBox,0,wxGROW | wxALL,5);
120
121 SetSizer(WxBoxSizer1);
122 WxBoxSizer1->Fit(this);
123 for (unsigned int i=0; i< gv->plat_id.GetCount(); i++) {
124 if (gv->plat_id[i] == gv->curplat) PlatformListBox->SetSelection(i);
125 }
126}
127
128bool wxPlatformPage::TransferDataFromWindow()
129{
130 if (PlatformListBox->GetSelection() == wxNOT_FOUND )
131 {
132 WARN_DIALOG(wxT("You must select an audio device type before proceeding"),
133 wxT("Select Platform"));
134 return false;
135 } else
136 {
137 gv->curplatnum = PlatformListBox->GetSelection();
138 gv->curplat = gv->plat_id[gv->curplatnum];
139 gv->curresolution = gv->plat_resolution[gv->curplatnum];
140 return true;
141 }
142}
143
144
145//////////////// ThemeImage Dialog /////////////////
146BEGIN_EVENT_TABLE(wxThemeImageDialog,wxDialog)
147 EVT_PAINT(wxThemeImageDialog::OnPaint)
148 EVT_CLOSE(wxThemeImageDialog::OnClose)
149END_EVENT_TABLE();
150wxThemeImageDialog::wxThemeImageDialog(wxWindow* parent,wxWindowID id,wxString title,wxBitmap bmp) :
151 wxDialog(parent, id, title)
152{
153 wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
154 m_bitmap = bmp;
155
156 sizerTop->SetMinSize(64,64);
157
158 SetSizer(sizerTop);
159
160 sizerTop->SetSizeHints(this);
161 sizerTop->Fit(this);
162
163}
164
165void wxThemeImageDialog::OnClose(wxCloseEvent& event)
166{
167 event.Veto();
168 this->Show(false);
169}
170
171void wxThemeImageDialog::SetImage(wxBitmap bmp)
172{
173 m_bitmap = bmp;
174 this->GetSizer()->SetMinSize(m_bitmap.GetWidth(),m_bitmap.GetHeight());
175 this->GetSizer()->Fit(this);
176 Layout();
177 Refresh();
178}
179
180void wxThemeImageDialog::OnPaint(wxPaintEvent& WXUNUSED(event))
181{
182 wxPaintDC dc( this );
183 dc.DrawBitmap( m_bitmap, 0, 0, true /* use mask */ );
184}
185
186////////////////// Themes page ////////////////////////
187BEGIN_EVENT_TABLE(wxThemesPage,wxWizardPageSimple)
188 EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxThemesPage::OnPageShown)
189 EVT_WIZARD_PAGE_CHANGING (wxID_ANY, wxThemesPage::OnWizardPageChanging)
190 EVT_LISTBOX (ID_LISTBOX,wxThemesPage::OnListBox)
191 EVT_BUTTON (ID_PREVIEW_BTN, wxThemesPage::OnPreviewBtn)
192 EVT_CHECKBOX (ID_INSTALLCHECKBOX, wxThemesPage::OnCheckBox)
193END_EVENT_TABLE();
194
195wxThemesPage::wxThemesPage(wxWizard *parent) : wxWizardPageSimple(parent)
196{
197 m_parent = parent;
198
199 myImageDialog = new wxThemeImageDialog(this,wxID_ANY,wxT("Preview"),NULL);
200 myImageDialog->Show(false);
201
202 wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
203
204 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
205 wxT("Please select the Theme you would like to"
206 "\ninstall on your Device from the list below:"));
207 mainSizer->Add(WxStaticText1,0,wxGROW | wxALL,5);
208
209 // create theme listbox
210 wxArrayString list;
211 for(int i = 0; i< 35;i++)
212 list.Add(wxT(""));
213 ThemesListBox= new wxListBox(this, ID_LISTBOX, wxDefaultPosition,
214 wxDefaultSize,list, wxLB_SINGLE);
215 mainSizer->Add(ThemesListBox,10,wxGROW | wxALL,5);
216
217 // create groupbox
218 wxStaticBox* groupbox= new wxStaticBox(this,wxID_ANY,wxT("Selected Theme:"));
219 wxBoxSizer* styleSizer = new wxStaticBoxSizer( groupbox, wxVERTICAL );
220 mainSizer->Add(styleSizer,11,wxGROW | wxALL,5);
221
222 // horizontal sizer
223 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
224 styleSizer->Add(wxBoxSizer2,0,wxGROW | wxALL,0);
225
226 // preview button
227 m_previewBtn = new wxButton(this, ID_PREVIEW_BTN, wxT("Preview"),
228 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
229 wxT("PreviewBtn"));
230 wxBoxSizer2->Add(m_previewBtn,0,wxGROW | wxALL,5);
231
232 // checkbox for Install
233 m_InstallCheckBox= new wxCheckBox(this,ID_INSTALLCHECKBOX,wxT("Install")
234 ,wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
235 wxT("InstallCheckbox"));
236 wxBoxSizer2->Add(m_InstallCheckBox,0,wxGROW | wxALL,5);
237
238 // horizontal sizer
239 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
240 styleSizer->Add(wxBoxSizer3,0,wxGROW | wxALL,0);
241
242 // File size
243 wxStaticText* size= new wxStaticText(this,wxID_ANY,wxT("Filesize:"));
244 wxBoxSizer3->Add(size,0,wxGROW | wxALL,5);
245
246 m_size= new wxStaticText(this,wxID_ANY,wxT(""));
247 wxBoxSizer3->Add(m_size,0,wxGROW | wxALL,5);
248
249 // Description
250 wxStaticText* desc= new wxStaticText(this,wxID_ANY,wxT("Description:"));
251 styleSizer->Add(desc,0,wxGROW | wxALL,5);
252
253 m_desc= new wxStaticText(this,wxID_ANY,wxT(""));
254 styleSizer->Add(m_desc,0,wxGROW | wxALL,5);
255
256 SetSizer(mainSizer);
257 mainSizer->Fit(this);
258
259}
260
261bool wxThemesPage::TransferDataFromWindow()
262{
263 gv->themesToInstall.Clear();
264
265 for(unsigned int i=0; i < m_installTheme.GetCount(); i++)
266 {
267 if(m_installTheme[i])
268 {
269 gv->themesToInstall.Add(m_Themes_path[i]);
270 }
271 }
272
273 return true;
274
275}
276
277void wxThemesPage::OnWizardPageChanging(wxWizardEvent& event)
278{
279 if(event.GetDirection()) // going forwards in the Wizard
280 {
281 if(gv->themesToInstall.GetCount() == 0)
282 {
283 WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
284 event.Veto();
285 }
286 }
287}
288
289void wxThemesPage::OnCheckBox(wxCommandEvent& event)
290{
291 int index = ThemesListBox->GetSelection(); //get Index
292 if(index == wxNOT_FOUND)
293 return;
294
295 m_installTheme[index]= ! m_installTheme[index]; // Toggle install
296
297}
298
299void wxThemesPage::OnListBox(wxCommandEvent& event)
300{
301 int index = ThemesListBox->GetSelection(); //get Index
302 if(index == wxNOT_FOUND)
303 return;
304
305 m_desc->SetLabel(m_Themes_desc[index]); //set Desc
306 m_desc->Wrap(270); // wrap desc
307 m_size->SetLabel(m_Themes_size[index]+wxT(" kb")); //set file size
308 m_InstallCheckBox->SetValue(m_installTheme[index]); // set the install checkbox
309
310 this->GetSizer()->Layout();
311
312 if(myImageDialog->IsShown())
313 {
314 wxString src,dest;
315
316 int pos = m_Themes_image[index].Find('/',true);
317 wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
318
319 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
320 gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
321
322 if(!wxDirExists(dest))
323 wxMkdir(dest);
324
325 //this is a URL no PATH_SEP
326 src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),gv->curresolution.c_str(),filename.c_str());
327 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
328 gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str(),filename.c_str());
329
330 if(DownloadURL(src, dest))
331 {
332 MESG_DIALOG(wxT("Unable to download image."));
333 return;
334 }
335
336 wxBitmap bmp;
337 bmp.LoadFile(dest,wxBITMAP_TYPE_PNG);
338 myImageDialog->SetImage(bmp);
339 }
340
341}
342
343void wxThemesPage::OnPreviewBtn(wxCommandEvent& event)
344{
345
346 int index = ThemesListBox->GetSelection();
347 if(index == wxNOT_FOUND)
348 return;
349
350 wxString src,dest;
351
352 int pos = m_Themes_image[index].Find('/',true);
353 wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
354
355 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
356 gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
357
358 if(!wxDirExists(dest))
359 wxMkdir(dest);
360
361 //this is a URL no PATH_SEP
362 src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),gv->curresolution.c_str(),filename.c_str());
363 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
364 gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str(),filename.c_str());
365
366 if(DownloadURL(src, dest))
367 {
368 MESG_DIALOG(wxT("Unable to download image."));
369 return;
370 }
371
372 wxBitmap bmp;
373 bmp.LoadFile(dest,wxBITMAP_TYPE_PNG);
374
375 myImageDialog->SetImage(bmp);
376
377 myImageDialog->Show(true);
378
379}
380
381void wxThemesPage::OnPageShown(wxWizardEvent& event)
382{
383 // clear Theme info
384 m_Themes.Clear();
385 m_Themes_image.Clear();
386 m_Themes_path.Clear();
387 m_Themes_desc.Clear();
388 m_Themes_size.Clear();
389 m_installTheme.Clear();
390 m_desc->SetLabel(wxT(""));
391 m_size->SetLabel(wxT(""));
392 m_InstallCheckBox->SetValue(false);
393
394 //get correct Themes list
395 wxString src,dest,err;
396
397 src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),gv->curresolution.c_str());
398 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"),
399 gv->stdpaths->GetUserDataDir().c_str(),gv->curresolution.c_str());
400
401 if(DownloadURL(src, dest))
402 {
403 MESG_DIALOG(wxT("Unable to download themes list."));
404 return;
405 }
406
407 //read and parse Themes list
408 wxString themelistraw;
409 wxFFile themefile;
410 if(!themefile.Open(dest)) //open file
411 {
412 MESG_DIALOG(wxT("Unable to open themes list."));
413 return;
414 }
415 if(!themefile.ReadAll(&themelistraw)) //read complete file
416 {
417 MESG_DIALOG(wxT("Unable to read themes list."));
418 return;
419 }
420 wxRegEx reAll(wxT("<body >(.+)</body>")); //extract body part
421 if(! reAll.Matches(themelistraw))
422 {
423 MESG_DIALOG(wxT("Themes list is in wrong Format."));
424 return;
425 }
426 wxString lines = reAll.GetMatch(themelistraw,1);
427
428 // prepare text
429 lines.Replace(wxT("<br />"),wxT(""),true); //replace <br /> with nothing
430 lines.Replace(wxT("\n"),wxT(""),true); //replace \n with nothing
431 lines.Trim(true); //strip WS at end
432 lines.Trim(false); //strip WS at beginning
433 wxStringTokenizer tkz(lines,wxT("|")); //tokenize it
434
435 while ( tkz.HasMoreTokens() ) // read all entrys
436 {
437 m_Themes.Add(tkz.GetNextToken()); //Theme name
438 m_Themes_path.Add(tkz.GetNextToken()); //Theme path
439 m_Themes_size.Add(tkz.GetNextToken()); //File size
440 m_Themes_image.Add(tkz.GetNextToken()); //Screenshot
441 m_Themes_desc.Add(tkz.GetNextToken()); //Description
442 m_installTheme.Add(false); //Theme should be installed ?
443 }
444
445 // set ThemeList
446 ThemesListBox->Set(m_Themes);
447}
448
449 //////////////////// Ipod Locaction Page /////////////////////////////
450BEGIN_EVENT_TABLE(wxIpodLocationPage,wxWizardPageSimple)
451 EVT_BUTTON (ID_IPODLOCATION_BTN, wxIpodLocationPage::OnIpodLocationBtn)
452 EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxIpodLocationPage::OnWizardPageChanging)
453END_EVENT_TABLE();
454
455wxIpodLocationPage::wxIpodLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
456{
457
458 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
459
460 // Header text
461 IpodLocationLabel = new wxStaticText(this, wxID_ANY,
462 wxT("Rockbox utility needs to know the device where your ipod\n"
463 "device is located on your computer. Use the\n"
464 "Scan Button:"));
465 WxBoxSizer1->Add(IpodLocationLabel,0,wxGROW | wxALL, 5);
466
467 // device location
468 wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
469 WxBoxSizer1->Add(WxBoxSizer3,0,
470 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
471
472 IpodLocationText = new wxStaticText(this, wxID_ANY, wxT(""),
473 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
474 WxBoxSizer3->Add(IpodLocationText,1,
475 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
476
477 IpodLocationBtn = new wxButton(this, ID_IPODLOCATION_BTN, wxT("Scan"),
478 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
479 wxT("IpodLocationBtn"));
480 IpodLocationBtn->SetToolTip(wxT("Scan for your Ipod"));
481 WxBoxSizer3->Add(IpodLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
482
483 // Extra text
484 IpodLocationExtraText = new wxStaticText(this,wxID_ANY, wxT(""));
485 WxBoxSizer1->Add(IpodLocationExtraText,0,wxGROW | wxALL, 5);
486
487 SetSizer(WxBoxSizer1);
488 WxBoxSizer1->Fit(this);
489}
490
491wxWizardPage* wxIpodLocationPage::GetPrev() const
492{
493 if(gv->curbootloadermethod == wxT("ipodpatcher")) //if ipod, skip previous
494 {
495 if(wxWizardPageSimple::GetPrev()->GetPrev() != NULL)
496 return wxWizardPageSimple::GetPrev()->GetPrev();
497
498 }
499 return wxWizardPageSimple::GetPrev();
500}
501
502void wxIpodLocationPage::OnWizardPageChanging(wxWizardEvent& event)
503{
504 if(event.GetDirection()) // going forwards in the Wizard
505 {
506 if(gv->curbootloadermethod==wxT("ipodpatcher"))
507 {
508 if(IpodLocationText->GetLabel() == wxT("no Ipod found") ||
509 IpodLocationText->GetLabel() ==wxT("More than 1 Ipod found") ||
510 IpodLocationText->GetLabel() ==wxT(""))
511 {
512 WARN_DIALOG(wxT("No valid ipod found!"), wxT("Select Location"));
513 event.Veto(); //stop pagechanging
514 }
515 }
516 }
517}
518
519void wxIpodLocationPage::OnIpodLocationBtn(wxCommandEvent& event)
520{
521 wxLogVerbose(wxT("=== begin wxIpodLocationPage::OnIpodLocationBtn"));
522 struct ipod_t ipod;
523 int n = ipod_scan(&ipod);
524 gv->curbootloader=wxT("");
525
526 if(n == 0)
527 IpodLocationText->SetLabel(wxT("no Ipod found"));
528 else if( n==1)
529 {
530 gv->curbootloader=wxT("bootloader-");
531 gv->curbootloader.Append(wxString(ipod.targetname, wxConvUTF8));
532 IpodLocationText->SetLabel(wxString(ipod.modelstr, wxConvUTF8));
533 }
534 else
535 IpodLocationText->SetLabel(wxT("More than 1 Ipod found"));
536
537 if(ipod.macpod)
538 IpodLocationExtraText->SetLabel(wxT("This Ipod is a Mac formated Ipod\n"
539 "Rockbox will not work on this.\n"
540 "You have to convert it first to Fat32"));
541 wxLogVerbose(wxT("=== end wxIpodLocationPage::OnIpodLocationBtn"));
542
543}
544
545BEGIN_EVENT_TABLE(wxBootLocationPage,wxWizardPageSimple)
546 EVT_BUTTON (ID_BOOTLOCATION_BTN, wxBootLocationPage::OnBootLocationBtn)
547 EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxBootLocationPage::OnWizardPageChanging)
548 EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxBootLocationPage::OnPageShown)
549END_EVENT_TABLE();
550
551wxBootLocationPage::wxBootLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
552 {
553
554 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
555
556 // Header text
557 BootLocationLabel = new wxStaticText(this, wxID_ANY,
558 wxT("Rockbox utility needs to know the folder where your audio\n"
559 "device is located on your computer. Currently Rockbox utility\n"
560 "is configured to use the following location:"));
561 WxBoxSizer1->Add(BootLocationLabel,0,wxGROW | wxALL, 5);
562
563 // device location
564 wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
565 WxBoxSizer1->Add(WxBoxSizer3,0,
566 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
567
568 if (gv->curdestdir == wxT("")) gv->curdestdir = wxT("<none>");
569 BootLocationText = new wxStaticText(this, wxID_ANY, gv->curdestdir,
570 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
571 WxBoxSizer3->Add(BootLocationText,1,
572 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
573
574 BootLocationBtn = new wxButton(this, ID_BOOTLOCATION_BTN, wxT("Change"),
575 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
576 wxT("BootLocationBtn"));
577 BootLocationBtn->SetToolTip(wxT("Select the location of your audio device"));
578 WxBoxSizer3->Add(BootLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
579
580
581 BootLocationInfo = new wxStaticText(this, wxID_ANY, wxT(""),
582 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
583 WxBoxSizer1->Add(BootLocationInfo,0,
584 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
585
586 SetSizer(WxBoxSizer1);
587 WxBoxSizer1->Fit(this);
588}
589
590wxWizardPage* wxBootLocationPage::GetPrev() const
591{
592 if(gv->curbootloadermethod != wxT("fwpatcher"))
593 {
594 if(wxWizardPageSimple::GetPrev()->GetPrev() != NULL)
595 return wxWizardPageSimple::GetPrev()->GetPrev();
596
597 }
598
599 return wxWizardPageSimple::GetPrev();
600}
601
602wxWizardPage* wxBootLocationPage::GetNext() const
603{
604 if(gv->curbootloadermethod == wxT("ipodpatcher"))
605 {
606 return wxWizardPageSimple::GetNext(); // if ipod then this is not the last page
607 }
608 else return NULL; // else this is the last page
609}
610
611void wxBootLocationPage::OnPageShown(wxWizardEvent& event)
612{
613 if(gv->curplat == wxT("h10") || gv->curplat == wxT("h10_5gb"))
614 {
615 BootLocationInfo->SetLabel(wxT("Your Device needs to be in UMS Mode. \n\n"
616 "If it is an MTP device, you can do this by \n"
617 "reseting you Device via the Pinhole,or disconnecting the Battery \n"
618 "then connecting it via the Data cable with the PC. \n"
619 "Then press and hold Next,push the Power button, and \n"
620 "continue to hold the Next button until the \n"
621 "USB-Connected Screen appears." ));
622 }
623 else
624 {
625 BootLocationInfo->SetLabel(wxT(""));
626 }
627
628}
629
630void wxBootLocationPage::OnWizardPageChanging(wxWizardEvent& event)
631{
632 if(event.GetDirection()) // going forwards in the Wizard
633 {
634 if(!wxDirExists(BootLocationText->GetLabel()))
635 {
636 WARN_DIALOG(wxT("You have not selected a valid location for your audio "
637 "device"), wxT("Select Location"));
638 event.Veto();
639 }
640
641 }
642}
643
644bool wxBootLocationPage::TransferDataFromWindow()
645{
646 gv->curdestdir = BootLocationText->GetLabel();
647 return true;
648
649}
650
651
652void wxBootLocationPage::OnBootLocationBtn(wxCommandEvent& event)
653{
654 const wxString& temp = wxDirSelector(
655 wxT("Please select the location of your audio device"), gv->curdestdir);
656 wxLogVerbose(wxT("=== begin wxBootLocationPage::OnBootLocationBtn(event)"));
657 if (!temp.empty())
658 {
659 BootLocationText->SetLabel(temp);
660 }
661 wxLogVerbose(wxT("=== end wxBootLocationPage::OnBootLocationBtn"));
662
663}
664
665
666BEGIN_EVENT_TABLE(wxFirmwareLocationPage,wxWizardPageSimple)
667 EVT_BUTTON (ID_FIRMWARELOCATION_BTN, wxFirmwareLocationPage::OnFirmwareFilenameBtn)
668 EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxFirmwareLocationPage::OnWizardPageChanging)
669END_EVENT_TABLE();
670
671wxFirmwareLocationPage::wxFirmwareLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
672{
673
674 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
675
676 // Header text
677 FirmwareLocationText = new wxStaticText(this, wxID_ANY,
678 wxT("For this step Rockbox Utility needs an original Firmware.\n"
679 "You can download this from the Manufacturers Website."));
680 WxBoxSizer1->Add(FirmwareLocationText,0,wxGROW | wxALL, 5);
681
682 // Filename text
683 wxBoxSizer* WxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
684 WxBoxSizer1->Add(WxBoxSizer4,0,
685 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
686
687 FirmwareLocationFilename = new wxStaticText(this, wxID_ANY, gv->curfirmware,
688 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
689 WxBoxSizer4->Add(FirmwareLocationFilename,1,
690 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
691
692 // Button
693 FirmwareLocationBtn = new wxButton(this, ID_FIRMWARELOCATION_BTN, wxT("Explore"),
694 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
695 wxT("FirmwareLocationBtn"));
696 FirmwareLocationBtn->SetToolTip(wxT("Select the location of the downloaded Firmware"));
697 WxBoxSizer4->Add(FirmwareLocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
698
699
700 SetSizer(WxBoxSizer1);
701 WxBoxSizer1->Fit(this);
702}
703
704void wxFirmwareLocationPage::OnWizardPageChanging(wxWizardEvent& event)
705{
706 if(event.GetDirection()) // going forwards in the Wizard
707 {
708 if( !wxFileExists(gv->curfirmware))
709 {
710 WARN_DIALOG(wxT("You have not selected a valid location for the firmware "
711 "file"), wxT("Select File"));
712 event.Veto();
713 }
714 }
715
716}
717
718void wxFirmwareLocationPage::OnFirmwareFilenameBtn(wxCommandEvent& event)
719{
720 wxString temp = wxFileSelector(
721 wxT("Please select the location of the original Firmware"), gv->curdestdir,wxT(""),wxT(""),wxT("*.hex"));
722 wxLogVerbose(wxT("=== begin wxFirmwareLocationPage::OnFirmwareFilenameBtn(event)"));
723 if (!temp.empty())
724 {
725 gv->curfirmware=temp;
726 if(temp.Length() > 30)
727 {
728 temp.Remove(0, temp.Length()-30);
729 temp.Prepend(wxT("..."));
730 }
731 FirmwareLocationFilename->SetLabel(temp);
732 }
733 wxLogVerbose(wxT("=== end wxFirmwareLocationPage::OnFirmwareFilenameBtn"));
734}
735
736BEGIN_EVENT_TABLE(wxLocationPage,wxWizardPageSimple)
737 EVT_BUTTON (ID_LOCATION_BTN, wxLocationPage::OnLocationBtn)
738 EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxLocationPage::OnWizardPageChanging)
739 EVT_WIZARD_PAGE_CHANGED(wxID_ANY, wxLocationPage::OnPageShown)
740END_EVENT_TABLE();
741
742wxLocationPage::wxLocationPage(wxWizard* parent) : wxWizardPageSimple(parent)
743 {
744 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
745
746 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
747 wxT("Rockbox utility needs to know the folder where your audio\n"
748 "device is located on your computer. Currently Rockbox utility\n"
749 "is configured to use the following location:"));
750 WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL, 5);
751
752 wxBoxSizer* WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
753 WxBoxSizer1->Add(WxBoxSizer3,0,
754 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
755
756 if (gv->curdestdir == wxT("")) gv->curdestdir = wxT("<none>");
757 LocationText = new wxStaticText(this, wxID_ANY, gv->curdestdir,
758 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
759 WxBoxSizer3->Add(LocationText,1,
760 wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
761
762 wxButton* LocationBtn = new wxButton(this, ID_LOCATION_BTN, wxT("Change"),
763 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
764 wxT("LocationBtn"));
765 LocationBtn->SetToolTip(wxT("Select the location of your audio device"));
766 WxBoxSizer3->Add(LocationBtn,0,wxALIGN_CENTER_VERTICAL | wxALL, 5);
767
768 LocationInfo = new wxStaticText(this, wxID_ANY, wxT(""),
769 wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
770 WxBoxSizer1->Add(LocationInfo,0,wxGROW | wxALL, 5);
771
772 SetSizer(WxBoxSizer1);
773 WxBoxSizer1->Fit(this);
774}
775
776
777void wxLocationPage::OnPageShown(wxWizardEvent& event)
778{
779 if(gv->curplat == wxT("h10") || gv->curplat == wxT("h10_5gb"))
780 {
781 LocationInfo->SetLabel(wxT("Your Device needs to be in UMS Mode. \n\n"
782 "If it is an MTP device, you can do this by \n"
783 "reseting you Device via the Pinhole,or disconnecting the Battery \n"
784 "then connecting it via the Data cable with the PC. \n"
785 "Then press and hold Next,push the Power button, and \n"
786 "continue to hold the Next button until the \n"
787 "USB-Connected Screen appears." ));
788 }
789 else
790 {
791 LocationInfo->SetLabel(wxT(""));
792 }
793
794
795}
796
797void wxLocationPage::OnWizardPageChanging(wxWizardEvent& event)
798{
799 if(event.GetDirection()) // going forwards in the Wizard
800 {
801 if(!wxDirExists(LocationText->GetLabel()))
802 {
803 WARN_DIALOG(wxT("You have not selected a valid location for your audio "
804 "device"), wxT("Select Location"));
805 event.Veto();
806 }
807 }
808}
809
810bool wxLocationPage::TransferDataFromWindow()
811{
812 gv->curdestdir = LocationText->GetLabel();
813 return true;
814}
815
816void wxLocationPage::OnLocationBtn(wxCommandEvent& event)
817{
818 const wxString& temp = wxDirSelector(
819 wxT("Please select the location of your audio device"), gv->curdestdir);
820 wxLogVerbose(wxT("=== begin wxLocationPage::OnLocationBtn(event)"));
821 if (!temp.empty())
822 {
823 LocationText->SetLabel(temp);
824 }
825 wxLogVerbose(wxT("=== end wxLocationPage::OnLocationBtn"));
826}
827
828BEGIN_EVENT_TABLE(wxBuildPage,wxWizardPageSimple)
829 EVT_RADIOBOX (ID_BUILD_BOX, wxBuildPage::OnBuildBox)
830 EVT_WIZARD_PAGE_CHANGED (wxID_ANY, wxBuildPage::OnPageShown)
831END_EVENT_TABLE();
832
833
834wxBuildPage::wxBuildPage(wxWizard *parent) : wxWizardPageSimple(parent)
835{
836 wxString buf;
837
838 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
839
840 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
841 wxT("Please select the Rockbox version you would like "
842 "to install on your audio\ndevice:"));
843 WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
844
845 wxArrayString* array = new wxArrayString();
846 buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
847 array->Add(buf);
848 array->Add(wxT("Archived Build"));
849 array->Add(wxT("Current Build "));
850
851 BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
852 wxDefaultPosition, wxDefaultSize, *array, 0, wxRA_SPECIFY_ROWS);
853 WxBoxSizer1->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
854 delete array;
855
856 wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
857 wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
858 wxVERTICAL);
859 DetailText = new wxStaticText(this, wxID_ANY, wxT(""));
860 WxBoxSizer1->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
861 WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
862
863 wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
864 wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
865 "local hard disk to save network traffic. If your local copy is\n"
866 "no longer working, tick this box to download a fresh copy.") );
867 WxBoxSizer1->Add(WxStaticText2, 0 , wxALL, 5);
868
869 NoCacheCheckBox = new wxCheckBox(this, wxID_ANY,
870 wxT("Don't use locally cached copies of Rockbox") );
871 WxBoxSizer1->Add(NoCacheCheckBox, 0, wxALL, 5);
872
873 SetSizer(WxBoxSizer1);
874 WxBoxSizer1->Fit(this);
875 WxBoxSizer1->SetSizeHints(this);
876}
877
878bool wxBuildPage::TransferDataFromWindow()
879{
880 gv->curbuild = BuildRadioBox->GetSelection();
881 gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
882 NoCacheCheckBox->IsChecked();
883 return true;
884}
885
886void wxBuildPage::OnBuildBox(wxCommandEvent& event)
887{
888 wxString str;
889
890 switch(BuildRadioBox->GetSelection() )
891 {
892 case BUILD_RELEASE:
893 str = _("This is the last released version of Rockbox, and is the\n"
894 "recommended version to install.");
895 NoCacheCheckBox->Enable();
896 break;
897 case BUILD_DAILY:
898 str = _("These are automatically built each day from the current\n"
899 "development source code. This generally has more features\n"
900 "than the last release but may be much less stable. Features\n"
901 "may change regularly.");
902 NoCacheCheckBox->Enable();
903 break;
904 case BUILD_BLEEDING:
905 str = _("This is the absolute up to the minute Rockbox built after\n"
906 "the last change was made.\n\n"
907 "Note: This option will always download a fresh copy from the\n"
908 "web server.\n");
909 NoCacheCheckBox->Enable(false);
910 break;
911 default:
912 break;
913 }
914
915 DetailText->SetLabel(str);
916}
917
918void wxBuildPage::OnPageShown(wxWizardEvent& event)
919{
920 wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
921 ID_BUILD_BOX);
922
923 if (gv->plat_released[gv->curplatnum] )
924 {
925 BuildRadioBox->Enable(BUILD_RELEASE, true);
926 BuildRadioBox->SetSelection(BUILD_RELEASE);
927 } else {
928 BuildRadioBox->Enable(BUILD_RELEASE, false);
929 BuildRadioBox->SetSelection(BUILD_DAILY);
930
931 }
932
933 wxPostEvent(this, updateradiobox);
934}
935
936wxFullUninstallPage::wxFullUninstallPage(wxWizard* parent) :
937 wxWizardPageSimple(parent)
938{
939 wxString buf;
940
941 wxBoxSizer* WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
942
943 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
944 wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
945 "file created during installation. This means that when Rockbox is\n"
946 "uninstalled all your configuration files are preserved. However,\n"
947 "you can also perform a full uninstall, which will completely\n"
948 "remove all traces of Rockbox from your system, and can be used\n"
949 "even if Rockbox was previously installed manually.\n\n"
950 "Archos users will need to reinstall any firmware upgrades obtained\n"
951 "from Archos after a full uninstall."));
952 WxBoxSizer1->Add(WxStaticText1,0,wxGROW | wxALL,5);
953
954 FullCheckBox = new wxCheckBox(this, wxID_ANY,
955 wxT("Perform a full uninstall"));
956 WxBoxSizer1->Add(FullCheckBox, 0, wxALL, 5);
957
958 SetSizer(WxBoxSizer1);
959 WxBoxSizer1->Fit(this);
960 WxBoxSizer1->SetSizeHints(this);
961}
962
963bool wxFullUninstallPage::TransferDataFromWindow()
964{
965 gv->curisfull = FullCheckBox->IsChecked();
966 return true;
967}
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: wizard_pages.h
10 *
11 * Copyright (C) 2005 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21
22#ifndef __wizard_pages_HPP_
23#define __wizard_pages_HPP_
24
25#include "rbutil.h"
26
27
28////// Dialog for Preview of Theme //////////////
29class wxThemeImageDialog : public wxDialog
30{
31private:
32 DECLARE_EVENT_TABLE()
33
34public:
35 wxThemeImageDialog(wxWindow* parent,wxWindowID id,wxString title,wxBitmap bmp);
36 void OnPaint(wxPaintEvent& WXUNUSED(event));
37 void SetImage(wxBitmap bmp);
38 void OnClose(wxCloseEvent& event);
39
40private:
41 wxBitmap m_bitmap;
42};
43
44
45
46class wxThemesPage : public wxWizardPageSimple
47{
48private:
49 DECLARE_EVENT_TABLE()
50
51public:
52 enum {
53 ID_PREVIEW_BTN = 1000,
54 ID_LISTBOX = 1001,
55 ID_INSTALLCHECKBOX = 1002,
56 };
57
58public:
59 wxThemesPage(wxWizard *parent);
60 virtual bool TransferDataFromWindow(void);
61 void OnPageShown(wxWizardEvent& event);
62 void OnPreviewBtn(wxCommandEvent& event);
63 void OnListBox(wxCommandEvent& event);
64 void OnCheckBox(wxCommandEvent& event);
65 void OnWizardPageChanging(wxWizardEvent& event);
66
67public:
68 wxListBox* ThemesListBox;
69 wxButton* m_previewBtn;
70 wxStaticText* m_desc;
71 wxStaticText* m_size;
72 wxCheckBox* m_InstallCheckBox;
73 wxThemeImageDialog* myImageDialog;
74
75 wxArrayString m_Themes;
76 wxArrayString m_Themes_path;
77 wxArrayString m_Themes_image;
78 wxArrayString m_Themes_desc;
79 wxArrayString m_Themes_size;
80 wxArrayInt m_installTheme;
81
82};
83
84class wxBootPlatformPage : public wxWizardPageSimple
85{
86public:
87 wxBootPlatformPage(wxWizard *parent);
88 virtual bool TransferDataFromWindow(void);
89 virtual wxWizardPage *GetNext() const;
90 void SetNext(wxWizardPage * next) {wxWizardPageSimple::SetNext(next); my_next = next;}
91
92public:
93 wxListBox* BootPlatformListBox;
94 wxWizardPage *my_next;
95};
96
97class wxIpodLocationPage : public wxWizardPageSimple
98{
99private:
100 DECLARE_EVENT_TABLE()
101
102public:
103 enum {
104 ID_IPODLOCATION_BTN = 1000,
105 };
106public:
107 wxIpodLocationPage(wxWizard* parent);
108 void OnIpodLocationBtn(wxCommandEvent& event);
109 void OnWizardPageChanging(wxWizardEvent& event);
110 virtual wxWizardPage *GetPrev() const;
111 void SetPrev(wxWizardPage * prev) {wxWizardPageSimple::SetPrev(prev); my_prev = prev;}
112
113private:
114 wxStaticText* IpodLocationText;
115 wxStaticText* IpodLocationLabel;
116 wxStaticText* IpodLocationExtraText;
117 wxButton* IpodLocationBtn;
118 wxWizardPage *my_prev;
119};
120
121
122
123class wxBootLocationPage : public wxWizardPageSimple
124{
125private:
126 DECLARE_EVENT_TABLE()
127
128public:
129 enum {
130 ID_BOOTLOCATION_BTN = 1000,
131 };
132
133public:
134 wxBootLocationPage(wxWizard* parent);
135 virtual bool TransferDataFromWindow(void);
136 void OnBootLocationBtn(wxCommandEvent& event);
137 void OnPageShown(wxWizardEvent& event);
138 void OnWizardPageChanging(wxWizardEvent& event);
139 virtual wxWizardPage *GetPrev() const;
140 virtual wxWizardPage *GetNext() const;
141 void SetPrev(wxWizardPage * prev) {wxWizardPageSimple::SetPrev(prev); my_prev = prev;}
142
143private:
144 wxStaticText* BootLocationText;
145 wxStaticText* BootLocationLabel;
146 wxStaticText* BootLocationInfo;
147 wxButton* BootLocationBtn;
148 wxWizardPage *my_prev;
149
150};
151
152class wxFirmwareLocationPage : public wxWizardPageSimple
153{
154 private:
155 DECLARE_EVENT_TABLE()
156
157public:
158 enum {
159 ID_FIRMWARELOCATION_BTN = 1000,
160 };
161
162public:
163 wxFirmwareLocationPage(wxWizard* parent);
164 void OnFirmwareFilenameBtn(wxCommandEvent& event);
165 void OnWizardPageChanging(wxWizardEvent& event);
166
167private:
168 wxStaticText* FirmwareLocationText;
169 wxStaticText* FirmwareLocationFilename;
170 wxButton* FirmwareLocationBtn;
171
172};
173
174
175class wxPlatformPage : public wxWizardPageSimple
176{
177public:
178 wxPlatformPage(wxWizard *parent);
179 virtual bool TransferDataFromWindow(void);
180
181public:
182 wxListBox* PlatformListBox;
183};
184
185class wxLocationPage : public wxWizardPageSimple
186{
187private:
188 DECLARE_EVENT_TABLE()
189
190public:
191 enum {
192 ID_LOCATION_BTN = 1000,
193 };
194
195public:
196 wxLocationPage(wxWizard* parent);
197 virtual bool TransferDataFromWindow(void);
198 void OnWizardPageChanging(wxWizardEvent& event);
199 void OnLocationBtn(wxCommandEvent& event);
200 void OnPageShown(wxWizardEvent& event);
201
202private:
203 wxStaticText* LocationText;
204 wxStaticText* BootLocationInfo;
205 wxStaticText* LocationInfo;
206};
207
208class wxBuildPage : public wxWizardPageSimple
209{
210private:
211 DECLARE_EVENT_TABLE()
212
213public:
214 enum {
215 ID_BUILD_BOX = 1000,
216 };
217
218public:
219 wxBuildPage(wxWizard *parent);
220 virtual bool TransferDataFromWindow(void);
221 void OnBuildBox(wxCommandEvent& event);
222 void OnPageShown(wxWizardEvent& event);
223
224private:
225 wxRadioBox* BuildRadioBox;
226 wxStaticText* DetailText;
227 wxCheckBox* NoCacheCheckBox;
228};
229
230class wxFullUninstallPage : public wxWizardPageSimple
231{
232public:
233 wxFullUninstallPage(wxWizard *parent);
234 virtual bool TransferDataFromWindow(void);
235
236private:
237 wxCheckBox* FullCheckBox;
238};
239
240
241#endif