replace the old rbutil title icon with the logo-like icon (which is already used...
[Rockbox.git] / rbutil / install_dialogs.cpp
blob331a07df4adf920d40da98058d05d56c965ff7b0
2 #include "install_dialogs.h"
3 #include "wizard.xpm"
7 ////////////////////////////////////////////////
8 //// Bootloader Installation
9 /////////////////////////////////////////////////
11 IMPLEMENT_CLASS( bootloaderInstallDlg, wxDialog )
13 BEGIN_EVENT_TABLE( bootloaderInstallDlg, wxDialog )
15 END_EVENT_TABLE()
17 bootloaderInstallDlg::bootloaderInstallDlg( )
19 Init();
22 bootloaderInstallDlg::bootloaderInstallDlg( wxWindow* parent,
23 wxWindowID id, const wxString& caption,
24 const wxPoint& pos, const wxSize& size, long style )
26 Init();
27 Create(parent, id, caption, pos, size, style);
30 void bootloaderInstallDlg::CreateControls()
32 // A top-level sizer
33 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
34 this->SetSizer(topSizer);
36 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
37 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
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);
45 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
46 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
48 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
49 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
51 m_firmwarepos = new FirmwarePositionCtrl(this,ID_FIRMWARE);
52 wxBoxSizer3->Add(m_firmwarepos, 0, wxALIGN_LEFT|wxALL, 5);
54 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
55 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
59 //init the local variables
60 void bootloaderInstallDlg::Init()
65 // create the window
66 bool bootloaderInstallDlg::Create( wxWindow* parent,
67 wxWindowID id, const wxString& caption,
68 const wxPoint& pos, const wxSize& size, long style )
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;
82 // tranver data from the controls
83 bool bootloaderInstallDlg::TransferDataFromWindow()
86 if( m_devicepos->IsShown())
88 gv->curdestdir = m_devicepos->getDevicePos();
89 if(!wxDirExists(gv->curdestdir))
91 WARN_DIALOG(wxT("The Devicepostion is not valid"),
92 wxT("Select a Deviceposition"));
93 gv->curdestdir = wxT("");
94 return false;
98 if(m_firmwarepos->IsShown())
100 gv->curfirmware = m_firmwarepos->getFirmwarePos();
101 if(!wxFileExists(gv->curfirmware))
103 WARN_DIALOG(wxT("The Firmware position is not valid"),
104 wxT("Select a original Firmware"));
105 gv->curfirmware = wxT("");
106 return false;
110 return true;
114 // tranver data to the controls
115 bool bootloaderInstallDlg::TransferDataToWindow()
117 if(gv->curplat == wxT(""))
119 WARN_DIALOG(wxT("You have not selected a audio device"),
120 wxT("Select a Device"));
121 return false;
123 int index = gv->plat_id.Index(gv->curplat);
125 if(!gv->plat_needsbootloader[index])
127 WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
128 wxT("Bootloader"));
129 return false;
132 if(gv->plat_bootloadermethod[index] != wxT("ipodpatcher") && gv->plat_bootloadermethod[index] != wxT("sansapatcher"))
134 m_devicepos->Show(true);
135 }else
137 m_devicepos->Show(false);
139 if(gv->plat_bootloadermethod[index] == wxT("fwpatcher"))
141 m_firmwarepos->Show(true);
142 }else
144 m_firmwarepos->Show(false);
147 m_devicepos->setDefault();
148 m_firmwarepos->setDefault();
149 return true;
151 ////////////////////////////////////////////////
152 //// Talk file creation
153 /////////////////////////////////////////////////
156 IMPLEMENT_CLASS( talkInstallDlg, wxDialog )
158 BEGIN_EVENT_TABLE( talkInstallDlg, wxDialog )
159 EVT_BUTTON(ID_BROWSE_ENC_BTN, talkInstallDlg::OnBrowseEncBtn)
160 EVT_BUTTON(ID_BROWSE_TTS_BTN, talkInstallDlg::OnBrowseTtsBtn)
161 END_EVENT_TABLE()
163 talkInstallDlg::talkInstallDlg(TalkFileCreator* talkcreator )
165 m_talkCreator = talkcreator;
166 Init();
169 talkInstallDlg::talkInstallDlg(TalkFileCreator* talkcreator, wxWindow* parent,
170 wxWindowID id, const wxString& caption,
171 const wxPoint& pos, const wxSize& size, long style )
173 m_talkCreator = talkcreator;
174 Init();
175 Create(parent, id, caption, pos, size, style);
178 void talkInstallDlg::CreateControls()
180 // A top-level sizer
181 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
182 this->SetSizer(topSizer);
184 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
185 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
187 // bitmap
188 wxBitmap sidebmp(wizard_xpm);
190 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
191 sideimage->SetBitmap(sidebmp);
192 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
194 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
195 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
197 // Device position
198 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
199 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
201 // Encoder
202 wxStaticBox* WxStaticBoxSizer2_StaticBoxObj = new wxStaticBox(this,
203 wxID_ANY, wxT("Encoder"));
204 wxStaticBoxSizer* WxStaticBoxSizer2 =
205 new wxStaticBoxSizer(WxStaticBoxSizer2_StaticBoxObj,wxVERTICAL);
206 wxBoxSizer3->Add(WxStaticBoxSizer2,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
208 m_Enc = new wxComboBox(this,ID_ENC_CBX,wxT("lame"),
209 wxDefaultPosition,wxDefaultSize,m_talkCreator->getSupportedEnc(),wxCB_READONLY);
210 m_Enc->SetToolTip(wxT("Select your Encoder."));
211 m_Enc->SetHelpText(wxT("Select your Encoder."));
212 WxStaticBoxSizer2->Add(m_Enc,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
214 wxStaticText* enc_desc = new wxStaticText( this, wxID_STATIC,
215 wxT("Select the Encoder executable"), wxDefaultPosition,
216 wxDefaultSize, 0 );
217 WxStaticBoxSizer2->Add(enc_desc, 0, wxALIGN_LEFT|wxALL, 5);
219 wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
220 WxStaticBoxSizer2->Add(horizontalSizer, 0, wxGROW|wxALL, 5);
222 m_EncExe = new wxTextCtrl(this,wxID_ANY,gv->pathToEnc);
223 m_EncExe->SetToolTip(wxT("Type the folder where your Encoder exe is"));
224 m_EncExe->SetHelpText(wxT("Type the folder where your Encoder exe is"));
225 horizontalSizer->Add(m_EncExe,0,wxGROW | wxALL,5);
227 m_browseEncBtn = new wxButton(this, ID_BROWSE_ENC_BTN, wxT("Browse"),
228 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
229 wxT("BrowseEncBtn"));
230 m_browseEncBtn->SetToolTip(wxT("Browse for your Encoder Exe"));
231 m_browseEncBtn->SetHelpText(wxT("Browse for your Encoder exe"));
232 horizontalSizer->Add(m_browseEncBtn,0,wxGROW | wxALL,5);
234 wxStaticText* enc_desc_opt = new wxStaticText( this, wxID_STATIC,
235 wxT("Encoder Options"), wxDefaultPosition,
236 wxDefaultSize, 0 );
237 WxStaticBoxSizer2->Add(enc_desc_opt, 0, wxALIGN_LEFT|wxALL, 5);
239 m_EncOpts = new wxTextCtrl(this,wxID_ANY,m_talkCreator->getEncOpts(wxT("lame")));
240 m_EncOpts->SetToolTip(wxT("Encoder Options"));
241 m_EncOpts->SetHelpText(wxT("Encoder Options"));
242 WxStaticBoxSizer2->Add(m_EncOpts, 0, wxALIGN_LEFT|wxALL, 5);
244 // TTS
245 wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(this,
246 wxID_ANY, wxT("Text to Speach"));
247 wxStaticBoxSizer* WxStaticBoxSizer3 =
248 new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxVERTICAL);
249 wxBoxSizer3->Add(WxStaticBoxSizer3,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
251 m_Tts = new wxComboBox(this,ID_TTS_CBX,wxT("espeak"),
252 wxDefaultPosition,wxDefaultSize,m_talkCreator->getSupportedTTS(),wxCB_READONLY);
253 m_Tts->SetToolTip(wxT("Select your TTS."));
254 m_Tts->SetHelpText(wxT("Select your TTS."));
255 WxStaticBoxSizer3->Add(m_Tts,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
257 wxStaticText* tts_desc = new wxStaticText( this, wxID_STATIC,
258 wxT("Select the TTS executable"), wxDefaultPosition,
259 wxDefaultSize, 0 );
260 WxStaticBoxSizer3->Add(tts_desc, 0, wxALIGN_LEFT|wxALL, 5);
262 wxBoxSizer* horizontalSizer2 = new wxBoxSizer(wxHORIZONTAL);
263 WxStaticBoxSizer3->Add(horizontalSizer2, 0, wxGROW|wxALL, 5);
265 m_TtsExe = new wxTextCtrl(this,wxID_ANY,gv->pathToTts);
266 m_TtsExe->SetToolTip(wxT("Type the folder where your TTS exe is"));
267 m_TtsExe->SetHelpText(wxT("Type the folder where your TTS exe is"));
268 horizontalSizer2->Add(m_TtsExe,0,wxGROW | wxALL,5);
270 m_browseTtsBtn = new wxButton(this, ID_BROWSE_TTS_BTN, wxT("Browse"),
271 wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
272 wxT("BrowseEncBtn"));
273 m_browseTtsBtn->SetToolTip(wxT("Browse for your Encoder Exe"));
274 m_browseTtsBtn->SetHelpText(wxT("Browse for your Encoder exe"));
275 horizontalSizer2->Add(m_browseTtsBtn,0,wxGROW | wxALL,5);
277 wxStaticText* tts_desc_opt = new wxStaticText( this, wxID_STATIC,
278 wxT("TTS Options"), wxDefaultPosition,
279 wxDefaultSize, 0 );
280 WxStaticBoxSizer3->Add(tts_desc_opt, 0, wxALIGN_LEFT|wxALL, 5);
282 m_TtsOpts = new wxTextCtrl(this,wxID_ANY,m_talkCreator->getTTsOpts(wxT("espeak")));
283 m_TtsOpts->SetToolTip(wxT("TTS Options"));
284 m_TtsOpts->SetHelpText(wxT("TTS Options"));
285 WxStaticBoxSizer3->Add(m_TtsOpts, 0, wxALIGN_LEFT|wxALL, 5);
287 m_OverwriteWave = new wxCheckBox(this,wxID_ANY,wxT("Overwrite Wav"));
288 m_OverwriteWave->SetToolTip(wxT("Overwrite Wavefiles"));
289 m_OverwriteWave->SetHelpText(wxT("Overwrite Wavefiles"));
290 wxBoxSizer3->Add(m_OverwriteWave,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
292 m_OverwriteTalk = new wxCheckBox(this,wxID_ANY,wxT("Overwrite Talk"));
293 m_OverwriteTalk->SetToolTip(wxT("Overwrite Talkfiles"));
294 m_OverwriteTalk->SetHelpText(wxT("Overwrite Talkfiles"));
295 wxBoxSizer3->Add(m_OverwriteTalk,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
297 m_RemoveWave = new wxCheckBox(this,wxID_ANY,wxT("Remove Wav"));
298 m_RemoveWave->SetToolTip(wxT("Remove Wavfiles"));
299 m_RemoveWave->SetHelpText(wxT("Remove Wavfiles"));
300 wxBoxSizer3->Add(m_RemoveWave,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
302 m_Recursive = new wxCheckBox(this,wxID_ANY,wxT("Recursive"));
303 m_Recursive->SetToolTip(wxT("Recursive"));
304 m_Recursive->SetHelpText(wxT("Recursive"));
305 wxBoxSizer3->Add(m_Recursive,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
307 m_StripExtensions = new wxCheckBox(this,wxID_ANY,wxT("Strip Extensions"));
308 m_StripExtensions->SetToolTip(wxT("Strip Extensions"));
309 m_StripExtensions->SetHelpText(wxT("Strip Extensions"));
310 wxBoxSizer3->Add(m_StripExtensions,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
312 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
313 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
315 // controls at the bottom
316 wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
317 topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
321 //init the local variables
322 void talkInstallDlg::Init()
327 // create the window
328 bool talkInstallDlg::Create( wxWindow* parent,
329 wxWindowID id, const wxString& caption,
330 const wxPoint& pos, const wxSize& size, long style )
333 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
334 return false;
335 CreateControls();
336 GetSizer()->Fit(this);
337 GetSizer()->SetSizeHints(this);
338 Centre();
339 return true;
342 void talkInstallDlg::OnBrowseEncBtn(wxCommandEvent& event)
344 const wxString& temp = wxFileSelector(
345 wxT("Please select the location of your encoder"), wxT(""),
346 wxT(""),wxT(""),wxT("*.*"),0, this);
348 if (!temp.empty())
350 m_EncExe->SetValue(temp);
354 void talkInstallDlg::OnBrowseTtsBtn(wxCommandEvent& event)
356 const wxString& temp = wxFileSelector(
357 wxT("Please select the location of your TTS engine"), wxT(""),
358 wxT(""),wxT(""),wxT("*.*"),0, this);
361 if (!temp.empty())
363 m_TtsExe->SetValue(temp);
367 // tranver data from the controls
368 bool talkInstallDlg::TransferDataFromWindow()
370 gv->curdestdir = m_devicepos->getDevicePos();
371 if(!wxDirExists(gv->curdestdir))
373 WARN_DIALOG(wxT("The Devicepostion is not valid"),
374 wxT("Select a Deviceposition"));
375 gv->curdestdir = wxT("");
376 return false;
378 m_talkCreator->setDir(gv->curdestdir);
380 gv->pathToEnc = m_EncExe->GetValue();
381 if(!wxFileExists(gv->pathToEnc))
383 WARN_DIALOG(wxT("The Encoder exe is not valid"),
384 wxT("Select an Encoder"));
385 gv->pathToEnc = wxT("");
386 return false;
388 m_talkCreator->setEncexe(gv->pathToEnc);
390 gv->pathToTts = m_TtsExe->GetValue();
391 if(!wxFileExists(gv->pathToTts))
393 WARN_DIALOG(wxT("The TTs exe is not valid"),
394 wxT("Select an TTS engine"));
395 gv->pathToTts = wxT("");
396 return false;
398 m_talkCreator->setTTSexe(gv->pathToTts);
400 m_talkCreator->setTTsType(m_Tts->GetValue());
401 m_talkCreator->setEncType(m_Enc->GetValue());
404 m_talkCreator->setOverwriteTalk(m_OverwriteWave->IsChecked());
405 m_talkCreator->setOverwriteWav(m_OverwriteTalk->IsChecked());
406 m_talkCreator->setRemoveWav(m_RemoveWave->IsChecked());
407 m_talkCreator->setRecursive(m_Recursive->IsChecked());
408 m_talkCreator->setStripExtensions(m_StripExtensions->IsChecked());
410 m_talkCreator->setEncOpts(m_EncOpts->GetValue());
411 m_talkCreator->setTTsOpts(m_TtsOpts->GetValue());
413 return true;
416 // tranver data to the controls
417 bool talkInstallDlg::TransferDataToWindow()
419 m_devicepos->setDefault();
421 m_OverwriteWave->SetValue(true);
422 m_OverwriteTalk->SetValue(true);
423 m_RemoveWave->SetValue(true);
424 m_Recursive->SetValue(true);
425 m_StripExtensions->SetValue(false);
429 return true;
432 ////////////////////////////////////////////////
433 //// Font Installation
434 /////////////////////////////////////////////////
437 IMPLEMENT_CLASS( fontInstallDlg, wxDialog )
439 BEGIN_EVENT_TABLE( fontInstallDlg, wxDialog )
441 END_EVENT_TABLE()
443 fontInstallDlg::fontInstallDlg( )
445 Init();
448 fontInstallDlg::fontInstallDlg( wxWindow* parent,
449 wxWindowID id, const wxString& caption,
450 const wxPoint& pos, const wxSize& size, long style )
452 Init();
453 Create(parent, id, caption, pos, size, style);
456 void fontInstallDlg::CreateControls()
458 // A top-level sizer
459 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
460 this->SetSizer(topSizer);
462 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
463 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
465 // bitmap
466 wxBitmap sidebmp(wizard_xpm);
468 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
469 sideimage->SetBitmap(sidebmp);
470 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
472 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
473 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
475 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
476 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
479 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
480 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
482 // controls at the bottom
483 wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
484 topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
488 //init the local variables
489 void fontInstallDlg::Init()
494 // create the window
495 bool fontInstallDlg::Create( wxWindow* parent,
496 wxWindowID id, const wxString& caption,
497 const wxPoint& pos, const wxSize& size, long style )
500 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
501 return false;
502 CreateControls();
503 GetSizer()->Fit(this);
504 GetSizer()->SetSizeHints(this);
505 Centre();
506 return true;
510 // tranver data from the controls
511 bool fontInstallDlg::TransferDataFromWindow()
513 gv->curdestdir = m_devicepos->getDevicePos();
514 if(!wxDirExists(gv->curdestdir))
516 WARN_DIALOG(wxT("The Devicepostion is not valid"),
517 wxT("Select a Deviceposition"));
518 gv->curdestdir = wxT("");
519 return false;
522 return true;
525 // tranver data to the controls
526 bool fontInstallDlg::TransferDataToWindow()
528 m_devicepos->setDefault();
529 return true;
532 ////////////////////////////////////////////////
533 //// Rockbox DeInstallation
534 /////////////////////////////////////////////////
536 IMPLEMENT_CLASS( rockboxDeInstallDlg, wxDialog )
538 BEGIN_EVENT_TABLE( rockboxDeInstallDlg, wxDialog )
540 END_EVENT_TABLE()
542 rockboxDeInstallDlg::rockboxDeInstallDlg( )
544 Init();
547 rockboxDeInstallDlg::rockboxDeInstallDlg( wxWindow* parent,
548 wxWindowID id, const wxString& caption,
549 const wxPoint& pos, const wxSize& size, long style )
551 Init();
552 Create(parent, id, caption, pos, size, style);
555 void rockboxDeInstallDlg::CreateControls()
557 // A top-level sizer
558 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
559 this->SetSizer(topSizer);
561 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
562 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
564 // bitmap
565 wxBitmap sidebmp(wizard_xpm);
567 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
568 sideimage->SetBitmap(sidebmp);
569 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
571 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
572 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
574 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
575 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
577 // Full deinstallation ?
578 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
579 wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
580 "file created during installation. This means that when Rockbox is\n"
581 "uninstalled all your configuration files are preserved. However,\n"
582 "you can also perform a full uninstall, which will completely\n"
583 "remove all traces of Rockbox from your system, and can be used\n"
584 "even if Rockbox was previously installed manually."));
585 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
587 wxCheckBox* FullCheckBox = new wxCheckBox(this, ID_FULL_CHCKBX,
588 wxT("Perform a full uninstall"));
589 wxBoxSizer3->Add(FullCheckBox, 0, wxALL, 5);
591 // controls at the bottom
592 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
593 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
597 //init the local variables
598 void rockboxDeInstallDlg::Init()
603 // create the window
604 bool rockboxDeInstallDlg::Create( wxWindow* parent,
605 wxWindowID id, const wxString& caption,
606 const wxPoint& pos, const wxSize& size, long style )
608 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
609 return false;
610 CreateControls();
611 GetSizer()->Fit(this);
612 GetSizer()->SetSizeHints(this);
613 Centre();
614 return true;
618 // tranver data from the controls
619 bool rockboxDeInstallDlg::TransferDataFromWindow()
622 gv->curdestdir = m_devicepos->getDevicePos();
623 if(!wxDirExists(gv->curdestdir))
625 WARN_DIALOG(wxT("The Devicepostion is not valid"),
626 wxT("Select a Deviceposition"));
627 gv->curdestdir = wxT("");
628 return false;
631 wxCheckBox* fullchkbx = (wxCheckBox*) FindWindow(ID_FULL_CHCKBX);
632 gv->curisfull = fullchkbx->IsChecked();
634 return true;
637 // tranver data to the controls
638 bool rockboxDeInstallDlg::TransferDataToWindow()
640 m_devicepos->setDefault();
641 return true;
644 ////////////////////////////////////////////////
645 //// Themes Installation
646 /////////////////////////////////////////////////
648 IMPLEMENT_CLASS( themesInstallDlg, wxDialog )
650 BEGIN_EVENT_TABLE( themesInstallDlg, wxDialog )
652 END_EVENT_TABLE()
654 themesInstallDlg::themesInstallDlg( )
659 themesInstallDlg::themesInstallDlg( wxWindow* parent,
660 wxWindowID id, const wxString& caption,
661 const wxPoint& pos, const wxSize& size, long style )
663 Create(parent, id, caption, pos, size, style);
666 void themesInstallDlg::CreateControls()
668 // A top-level sizer
669 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
670 this->SetSizer(topSizer);
672 wxBoxSizer* topHoriSizer = new wxBoxSizer(wxHORIZONTAL);
673 topSizer->Add(topHoriSizer, 0, wxALIGN_LEFT|wxALL, 5);
675 // bitmap
676 wxBitmap sidebmp(wizard_xpm);
678 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
679 sideimage->SetBitmap(sidebmp);
680 topHoriSizer->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
682 wxBoxSizer* mainVertiSizer = new wxBoxSizer(wxVERTICAL);
683 topHoriSizer->Add(mainVertiSizer, 0, wxGROW|wxALL, 5);
685 wxBoxSizer* wxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
686 mainVertiSizer->Add(wxBoxSizer4, 0, wxGROW|wxALL, 0);
688 wxBoxSizer* wxBoxSizer5 = new wxBoxSizer(wxVERTICAL);
689 wxBoxSizer4->Add(wxBoxSizer5, 0, wxGROW|wxALL, 0);
691 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
692 wxBoxSizer5->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
694 m_theme = new ThemeCtrl(this,ID_THEME);
695 wxBoxSizer5->Add(m_theme, 0, wxALIGN_LEFT|wxALL, 5);
697 // controls at the bottom
698 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
699 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
705 // create the window
706 bool themesInstallDlg::Create( wxWindow* parent,
707 wxWindowID id, const wxString& caption,
708 const wxPoint& pos, const wxSize& size, long style )
711 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
712 return false;
713 CreateControls();
714 GetSizer()->Fit(this);
715 GetSizer()->SetSizeHints(this);
716 Centre();
717 return true;
721 // tranver data from the controls
722 bool themesInstallDlg::TransferDataFromWindow()
725 gv->curdestdir = m_devicepos->getDevicePos();
726 if(!wxDirExists(gv->curdestdir))
728 WARN_DIALOG(wxT("The Devicepostion is not valid"),
729 wxT("Select a Deviceposition"));
730 gv->curdestdir = wxT("");
731 return false;
734 gv->themesToInstall.Clear();
735 gv->themesToInstall = m_theme->getThemesToInstall();
737 if(gv->themesToInstall.GetCount() == 0)
739 WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
740 return false;
743 return true;
746 // tranver data to the controls
747 bool themesInstallDlg::TransferDataToWindow()
749 if(gv->curplat == wxT(""))
751 WARN_DIALOG(wxT("You have not selected a audio device"),
752 wxT("Select a Device"));
753 return false;
756 m_devicepos->setDefault();
757 m_theme->setDevice(gv->curplat);
758 return true;
760 ////////////////////////////////////////////////
761 //// Rockbox Installation
762 /////////////////////////////////////////////////
764 IMPLEMENT_CLASS( rockboxInstallDlg, wxDialog )
766 BEGIN_EVENT_TABLE( rockboxInstallDlg, wxDialog )
767 EVT_RADIOBOX(ID_BUILD_BOX, rockboxInstallDlg::OnBuildBox)
768 END_EVENT_TABLE()
770 rockboxInstallDlg::rockboxInstallDlg( )
774 rockboxInstallDlg::rockboxInstallDlg( wxWindow* parent,
775 wxWindowID id, const wxString& caption,
776 const wxPoint& pos, const wxSize& size, long style )
778 Create(parent, id, caption, pos, size, style);
781 void rockboxInstallDlg::CreateControls()
783 // A top-level sizer
784 wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
785 this->SetSizer(topSizer);
787 wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
788 topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
790 // bitmap
791 wxBitmap sidebmp(wizard_xpm);
793 ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
794 sideimage->SetBitmap(sidebmp);
795 wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
797 wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
798 wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
800 m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
801 wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
803 // Build information
804 wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
805 wxT("Please select the Rockbox version you would like "
806 "to install on your audio\ndevice:"));
807 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
809 wxArrayString array;
810 array.Add(wxT("Rockbox stable version (") + gv->last_release + wxT(")"));
811 array.Add(wxT("Archived Build"));
812 array.Add(wxT("Current Build "));
814 wxRadioBox* BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
815 wxDefaultPosition, wxDefaultSize, array, 0, wxRA_SPECIFY_ROWS);
816 wxBoxSizer3->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
818 wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
819 wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
820 wxVERTICAL);
821 wxStaticText* DetailText = new wxStaticText(this, ID_DETAIL_TXT, wxT(""));
822 wxBoxSizer3->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
823 WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
825 wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
826 wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
827 "local hard disk to save network traffic. If your local copy is\n"
828 "no longer working, tick this box to download a fresh copy.") );
829 wxBoxSizer3->Add(WxStaticText2, 0 , wxALL, 5);
831 wxCheckBox* NoCacheCheckBox = new wxCheckBox(this, ID_NOCACHE_CHCKBX,
832 wxT("Don't use locally cached copies of Rockbox") );
833 wxBoxSizer3->Add(NoCacheCheckBox, 0, wxALL, 5);
834 // controls at the bottom
835 OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
836 topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
840 // create the window
841 bool rockboxInstallDlg::Create( wxWindow* parent,
842 wxWindowID id, const wxString& caption,
843 const wxPoint& pos, const wxSize& size, long style )
846 if (!wxDialog::Create( parent, id, caption, pos, size, style ))
847 return false;
848 CreateControls();
849 GetSizer()->Fit(this);
850 GetSizer()->SetSizeHints(this);
851 Centre();
852 return true;
855 void rockboxInstallDlg::OnBuildBox(wxCommandEvent& event)
857 wxString str;
858 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
859 wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
860 wxStaticText* DetailText = (wxStaticText*)FindWindow(ID_DETAIL_TXT);
862 switch(BuildRadioBox->GetSelection() )
864 case BUILD_RELEASE:
865 str = _("This is the last released version of Rockbox, and is the\n"
866 "recommended version to install.");
867 NoCacheCheckBox->Enable();
868 break;
869 case BUILD_DAILY:
870 str = _("These are automatically built each day from the current\n"
871 "development source code. This generally has more features\n"
872 "than the last release but may be much less stable. Features\n"
873 "may change regularly.");
874 NoCacheCheckBox->Enable();
875 break;
876 case BUILD_BLEEDING:
877 str = _("This is the absolute up to the minute Rockbox built after\n"
878 "the last change was made.\n\n"
879 "Note: This option will always download a fresh copy from the\n"
880 "web server.\n");
881 NoCacheCheckBox->Enable(false);
882 break;
883 default:
884 break;
887 DetailText->SetLabel(str);
889 this->GetSizer()->Layout();
890 this->GetSizer()->Fit(this);
891 this->GetSizer()->SetSizeHints(this);
892 Refresh();
896 // tranver data from the controls
897 bool rockboxInstallDlg::TransferDataFromWindow()
899 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
900 wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
902 gv->curdestdir = m_devicepos->getDevicePos();
903 if(!wxDirExists(gv->curdestdir))
905 WARN_DIALOG(wxT("The Devicepostion is not valid"),
906 wxT("Select a Deviceposition"));
907 gv->curdestdir = wxT("");
908 return false;
911 gv->curbuild = BuildRadioBox->GetSelection();
912 gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
913 NoCacheCheckBox->IsChecked();
915 return true;
918 // tranver data to the controls
919 bool rockboxInstallDlg::TransferDataToWindow()
921 m_devicepos->setDefault();
923 if(gv->curplat == wxT(""))
925 WARN_DIALOG(wxT("You have not selected a audio device"),
926 wxT("Select a Device"));
927 return false;
930 wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
932 int index =gv->plat_id.Index(gv->curplat);
934 wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
935 ID_BUILD_BOX);
937 if (gv->plat_released[index] )
939 BuildRadioBox->Enable(BUILD_RELEASE, true);
940 BuildRadioBox->SetSelection(BUILD_RELEASE);
941 } else {
942 BuildRadioBox->Enable(BUILD_RELEASE, false);
943 BuildRadioBox->SetSelection(BUILD_BLEEDING);
946 wxPostEvent(this, updateradiobox);
947 return true;