1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
|
#include "install_dialogs.h"
#include "wizard.xpm"
////////////////////////////////////////////////
//// Bootloader Installation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( bootloaderInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( bootloaderInstallDlg, wxDialog )
END_EVENT_TABLE()
bootloaderInstallDlg::bootloaderInstallDlg( )
{
Init();
}
bootloaderInstallDlg::bootloaderInstallDlg( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create(parent, id, caption, pos, size, style);
}
void bootloaderInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
m_firmwarepos = new FirmwarePositionCtrl(this,ID_FIRMWARE);
wxBoxSizer3->Add(m_firmwarepos, 0, wxALIGN_LEFT|wxALL, 5);
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
}
//init the local variables
void bootloaderInstallDlg::Init()
{
}
// create the window
bool bootloaderInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
// tranver data from the controls
bool bootloaderInstallDlg::TransferDataFromWindow()
{
if( m_devicepos->IsShown())
{
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
}
if(m_firmwarepos->IsShown())
{
gv->curfirmware = m_firmwarepos->getFirmwarePos();
if(!wxFileExists(gv->curfirmware))
{
WARN_DIALOG(wxT("The Firmware position is not valid"),
wxT("Select a original Firmware"));
gv->curfirmware = wxT("");
return false;
}
}
return true;
}
// tranver data to the controls
bool bootloaderInstallDlg::TransferDataToWindow()
{
if(gv->curplat == wxT(""))
{
WARN_DIALOG(wxT("You have not selected a audio device"),
wxT("Select a Device"));
return false;
}
int index = gv->plat_id.Index(gv->curplat);
if(!gv->plat_needsbootloader[index])
{
WARN_DIALOG(wxT("This Device doesnt need a Bootloader"),
wxT("Bootloader"));
return false;
}
if(gv->plat_bootloadermethod[index] != wxT("ipodpatcher") && gv->plat_bootloadermethod[index] != wxT("sansapatcher"))
{
m_devicepos->Show(true);
}else
{
m_devicepos->Show(false);
}
if(gv->plat_bootloadermethod[index] == wxT("fwpatcher"))
{
m_firmwarepos->Show(true);
}else
{
m_firmwarepos->Show(false);
}
m_devicepos->setDefault();
m_firmwarepos->setDefault();
return true;
}
////////////////////////////////////////////////
//// Talk file creation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( talkInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( talkInstallDlg, wxDialog )
EVT_BUTTON(ID_BROWSE_ENC_BTN, talkInstallDlg::OnBrowseEncBtn)
EVT_BUTTON(ID_BROWSE_TTS_BTN, talkInstallDlg::OnBrowseTtsBtn)
END_EVENT_TABLE()
talkInstallDlg::talkInstallDlg(TalkFileCreator* talkcreator )
{
m_talkCreator = talkcreator;
Init();
}
talkInstallDlg::talkInstallDlg(TalkFileCreator* talkcreator, wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
m_talkCreator = talkcreator;
Init();
Create(parent, id, caption, pos, size, style);
}
void talkInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
// Device position
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
// Encoder
wxStaticBox* WxStaticBoxSizer2_StaticBoxObj = new wxStaticBox(this,
wxID_ANY, wxT("Encoder"));
wxStaticBoxSizer* WxStaticBoxSizer2 =
new wxStaticBoxSizer(WxStaticBoxSizer2_StaticBoxObj,wxVERTICAL);
wxBoxSizer3->Add(WxStaticBoxSizer2,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_Enc = new wxComboBox(this,ID_ENC_CBX,wxT("lame"),
wxDefaultPosition,wxDefaultSize,m_talkCreator->getSupportedEnc(),wxCB_READONLY);
m_Enc->SetToolTip(wxT("Select your Encoder."));
m_Enc->SetHelpText(wxT("Select your Encoder."));
WxStaticBoxSizer2->Add(m_Enc,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
wxStaticText* enc_desc = new wxStaticText( this, wxID_STATIC,
wxT("Select the Encoder executable"), wxDefaultPosition,
wxDefaultSize, 0 );
WxStaticBoxSizer2->Add(enc_desc, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
WxStaticBoxSizer2->Add(horizontalSizer, 0, wxGROW|wxALL, 5);
m_EncExe = new wxTextCtrl(this,wxID_ANY,gv->pathToEnc);
m_EncExe->SetToolTip(wxT("Type the folder where your Encoder exe is"));
m_EncExe->SetHelpText(wxT("Type the folder where your Encoder exe is"));
horizontalSizer->Add(m_EncExe,0,wxGROW | wxALL,5);
m_browseEncBtn = new wxButton(this, ID_BROWSE_ENC_BTN, wxT("Browse"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
wxT("BrowseEncBtn"));
m_browseEncBtn->SetToolTip(wxT("Browse for your Encoder Exe"));
m_browseEncBtn->SetHelpText(wxT("Browse for your Encoder exe"));
horizontalSizer->Add(m_browseEncBtn,0,wxGROW | wxALL,5);
wxStaticText* enc_desc_opt = new wxStaticText( this, wxID_STATIC,
wxT("Encoder Options"), wxDefaultPosition,
wxDefaultSize, 0 );
WxStaticBoxSizer2->Add(enc_desc_opt, 0, wxALIGN_LEFT|wxALL, 5);
m_EncOpts = new wxTextCtrl(this,wxID_ANY,m_talkCreator->getEncOpts(wxT("lame")));
m_EncOpts->SetToolTip(wxT("Encoder Options"));
m_EncOpts->SetHelpText(wxT("Encoder Options"));
WxStaticBoxSizer2->Add(m_EncOpts, 0, wxALIGN_LEFT|wxALL, 5);
// TTS
wxStaticBox* WxStaticBoxSizer3_StaticBoxObj = new wxStaticBox(this,
wxID_ANY, wxT("Text to Speach"));
wxStaticBoxSizer* WxStaticBoxSizer3 =
new wxStaticBoxSizer(WxStaticBoxSizer3_StaticBoxObj,wxVERTICAL);
wxBoxSizer3->Add(WxStaticBoxSizer3,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_Tts = new wxComboBox(this,ID_TTS_CBX,wxT("espeak"),
wxDefaultPosition,wxDefaultSize,m_talkCreator->getSupportedTTS(),wxCB_READONLY);
m_Tts->SetToolTip(wxT("Select your TTS."));
m_Tts->SetHelpText(wxT("Select your TTS."));
WxStaticBoxSizer3->Add(m_Tts,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
wxStaticText* tts_desc = new wxStaticText( this, wxID_STATIC,
wxT("Select the TTS executable"), wxDefaultPosition,
wxDefaultSize, 0 );
WxStaticBoxSizer3->Add(tts_desc, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* horizontalSizer2 = new wxBoxSizer(wxHORIZONTAL);
WxStaticBoxSizer3->Add(horizontalSizer2, 0, wxGROW|wxALL, 5);
m_TtsExe = new wxTextCtrl(this,wxID_ANY,gv->pathToTts);
m_TtsExe->SetToolTip(wxT("Type the folder where your TTS exe is"));
m_TtsExe->SetHelpText(wxT("Type the folder where your TTS exe is"));
horizontalSizer2->Add(m_TtsExe,0,wxGROW | wxALL,5);
m_browseTtsBtn = new wxButton(this, ID_BROWSE_TTS_BTN, wxT("Browse"),
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
wxT("BrowseEncBtn"));
m_browseTtsBtn->SetToolTip(wxT("Browse for your Encoder Exe"));
m_browseTtsBtn->SetHelpText(wxT("Browse for your Encoder exe"));
horizontalSizer2->Add(m_browseTtsBtn,0,wxGROW | wxALL,5);
wxStaticText* tts_desc_opt = new wxStaticText( this, wxID_STATIC,
wxT("TTS Options"), wxDefaultPosition,
wxDefaultSize, 0 );
WxStaticBoxSizer3->Add(tts_desc_opt, 0, wxALIGN_LEFT|wxALL, 5);
m_TtsOpts = new wxTextCtrl(this,wxID_ANY,m_talkCreator->getTTsOpts(wxT("espeak")));
m_TtsOpts->SetToolTip(wxT("TTS Options"));
m_TtsOpts->SetHelpText(wxT("TTS Options"));
WxStaticBoxSizer3->Add(m_TtsOpts, 0, wxALIGN_LEFT|wxALL, 5);
m_OverwriteWave = new wxCheckBox(this,wxID_ANY,wxT("Overwrite Wav"));
m_OverwriteWave->SetToolTip(wxT("Overwrite Wavefiles"));
m_OverwriteWave->SetHelpText(wxT("Overwrite Wavefiles"));
wxBoxSizer3->Add(m_OverwriteWave,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_OverwriteTalk = new wxCheckBox(this,wxID_ANY,wxT("Overwrite Talk"));
m_OverwriteTalk->SetToolTip(wxT("Overwrite Talkfiles"));
m_OverwriteTalk->SetHelpText(wxT("Overwrite Talkfiles"));
wxBoxSizer3->Add(m_OverwriteTalk,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_RemoveWave = new wxCheckBox(this,wxID_ANY,wxT("Remove Wav"));
m_RemoveWave->SetToolTip(wxT("Remove Wavfiles"));
m_RemoveWave->SetHelpText(wxT("Remove Wavfiles"));
wxBoxSizer3->Add(m_RemoveWave,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_Recursive = new wxCheckBox(this,wxID_ANY,wxT("Recursive"));
m_Recursive->SetToolTip(wxT("Recursive"));
m_Recursive->SetHelpText(wxT("Recursive"));
wxBoxSizer3->Add(m_Recursive,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
m_StripExtensions = new wxCheckBox(this,wxID_ANY,wxT("Strip Extensions"));
m_StripExtensions->SetToolTip(wxT("Strip Extensions"));
m_StripExtensions->SetHelpText(wxT("Strip Extensions"));
wxBoxSizer3->Add(m_StripExtensions,0,wxALIGN_CENTER_HORIZONTAL|wxGROW | wxALL, 5);
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
// controls at the bottom
wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
}
//init the local variables
void talkInstallDlg::Init()
{
}
// create the window
bool talkInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
void talkInstallDlg::OnBrowseEncBtn(wxCommandEvent& event)
{
const wxString& temp = wxFileSelector(
wxT("Please select the location of your encoder"), wxT(""),
wxT(""),wxT(""),wxT("*.*"),0, this);
if (!temp.empty())
{
m_EncExe->SetValue(temp);
}
}
void talkInstallDlg::OnBrowseTtsBtn(wxCommandEvent& event)
{
const wxString& temp = wxFileSelector(
wxT("Please select the location of your TTS engine"), wxT(""),
wxT(""),wxT(""),wxT("*.*"),0, this);
if (!temp.empty())
{
m_TtsExe->SetValue(temp);
}
}
// tranver data from the controls
bool talkInstallDlg::TransferDataFromWindow()
{
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
m_talkCreator->setDir(gv->curdestdir);
gv->pathToEnc = m_EncExe->GetValue();
if(!wxFileExists(gv->pathToEnc))
{
WARN_DIALOG(wxT("The Encoder exe is not valid"),
wxT("Select an Encoder"));
gv->pathToEnc = wxT("");
return false;
}
m_talkCreator->setEncexe(gv->pathToEnc);
gv->pathToTts = m_TtsExe->GetValue();
if(!wxFileExists(gv->pathToTts))
{
WARN_DIALOG(wxT("The TTs exe is not valid"),
wxT("Select an TTS engine"));
gv->pathToTts = wxT("");
return false;
}
m_talkCreator->setTTSexe(gv->pathToTts);
m_talkCreator->setTTsType(m_Tts->GetValue());
m_talkCreator->setEncType(m_Enc->GetValue());
m_talkCreator->setOverwriteTalk(m_OverwriteWave->IsChecked());
m_talkCreator->setOverwriteWav(m_OverwriteTalk->IsChecked());
m_talkCreator->setRemoveWav(m_RemoveWave->IsChecked());
m_talkCreator->setRecursive(m_Recursive->IsChecked());
m_talkCreator->setStripExtensions(m_StripExtensions->IsChecked());
m_talkCreator->setEncOpts(m_EncOpts->GetValue());
m_talkCreator->setTTsOpts(m_TtsOpts->GetValue());
return true;
}
// tranver data to the controls
bool talkInstallDlg::TransferDataToWindow()
{
m_devicepos->setDefault();
m_OverwriteWave->SetValue(true);
m_OverwriteTalk->SetValue(true);
m_RemoveWave->SetValue(true);
m_Recursive->SetValue(true);
m_StripExtensions->SetValue(false);
return true;
}
////////////////////////////////////////////////
//// Font Installation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( fontInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( fontInstallDlg, wxDialog )
END_EVENT_TABLE()
fontInstallDlg::fontInstallDlg( )
{
Init();
}
fontInstallDlg::fontInstallDlg( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create(parent, id, caption, pos, size, style);
}
void fontInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
// controls at the bottom
wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
topSizer->Add(wxBoxSizer7, 0, wxGROW | wxALL, 5);
}
//init the local variables
void fontInstallDlg::Init()
{
}
// create the window
bool fontInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
// tranver data from the controls
bool fontInstallDlg::TransferDataFromWindow()
{
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
return true;
}
// tranver data to the controls
bool fontInstallDlg::TransferDataToWindow()
{
m_devicepos->setDefault();
return true;
}
////////////////////////////////////////////////
//// Rockbox DeInstallation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( rockboxDeInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( rockboxDeInstallDlg, wxDialog )
END_EVENT_TABLE()
rockboxDeInstallDlg::rockboxDeInstallDlg( )
{
Init();
}
rockboxDeInstallDlg::rockboxDeInstallDlg( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create(parent, id, caption, pos, size, style);
}
void rockboxDeInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
// Full deinstallation ?
wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
wxT("Rockbox Utility normally uninstalls Rockbox using an uninstall\n"
"file created during installation. This means that when Rockbox is\n"
"uninstalled all your configuration files are preserved. However,\n"
"you can also perform a full uninstall, which will completely\n"
"remove all traces of Rockbox from your system, and can be used\n"
"even if Rockbox was previously installed manually."));
wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
wxCheckBox* FullCheckBox = new wxCheckBox(this, ID_FULL_CHCKBX,
wxT("Perform a full uninstall"));
wxBoxSizer3->Add(FullCheckBox, 0, wxALL, 5);
// controls at the bottom
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
}
//init the local variables
void rockboxDeInstallDlg::Init()
{
}
// create the window
bool rockboxDeInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
// tranver data from the controls
bool rockboxDeInstallDlg::TransferDataFromWindow()
{
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
wxCheckBox* fullchkbx = (wxCheckBox*) FindWindow(ID_FULL_CHCKBX);
gv->curisfull = fullchkbx->IsChecked();
return true;
}
// tranver data to the controls
bool rockboxDeInstallDlg::TransferDataToWindow()
{
m_devicepos->setDefault();
return true;
}
////////////////////////////////////////////////
//// Themes Installation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( themesInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( themesInstallDlg, wxDialog )
END_EVENT_TABLE()
themesInstallDlg::themesInstallDlg( )
{
}
themesInstallDlg::themesInstallDlg( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
void themesInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* topHoriSizer = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(topHoriSizer, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
topHoriSizer->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* mainVertiSizer = new wxBoxSizer(wxVERTICAL);
topHoriSizer->Add(mainVertiSizer, 0, wxGROW|wxALL, 5);
wxBoxSizer* wxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
mainVertiSizer->Add(wxBoxSizer4, 0, wxGROW|wxALL, 0);
wxBoxSizer* wxBoxSizer5 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer4->Add(wxBoxSizer5, 0, wxGROW|wxALL, 0);
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer5->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
m_theme = new ThemeCtrl(this,ID_THEME);
wxBoxSizer5->Add(m_theme, 0, wxALIGN_LEFT|wxALL, 5);
// controls at the bottom
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
}
// create the window
bool themesInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
// tranver data from the controls
bool themesInstallDlg::TransferDataFromWindow()
{
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
gv->themesToInstall.Clear();
gv->themesToInstall = m_theme->getThemesToInstall();
if(gv->themesToInstall.GetCount() == 0)
{
WARN_DIALOG(wxT("You have not selected a Theme to Install"), wxT("Select a Theme"));
return false;
}
return true;
}
// tranver data to the controls
bool themesInstallDlg::TransferDataToWindow()
{
if(gv->curplat == wxT(""))
{
WARN_DIALOG(wxT("You have not selected a audio device"),
wxT("Select a Device"));
return false;
}
m_devicepos->setDefault();
m_theme->setDevice(gv->curplat);
return true;
}
////////////////////////////////////////////////
//// Rockbox Installation
/////////////////////////////////////////////////
IMPLEMENT_CLASS( rockboxInstallDlg, wxDialog )
BEGIN_EVENT_TABLE( rockboxInstallDlg, wxDialog )
EVT_RADIOBOX(ID_BUILD_BOX, rockboxInstallDlg::OnBuildBox)
END_EVENT_TABLE()
rockboxInstallDlg::rockboxInstallDlg( )
{
}
rockboxInstallDlg::rockboxInstallDlg( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
void rockboxInstallDlg::CreateControls()
{
// A top-level sizer
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
this->SetSizer(topSizer);
wxBoxSizer* wxBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(wxBoxSizer2, 0, wxALIGN_LEFT|wxALL, 5);
// bitmap
wxBitmap sidebmp(wizard_xpm);
ImageCtrl* sideimage = new ImageCtrl(this,wxID_ANY);
sideimage->SetBitmap(sidebmp);
wxBoxSizer2->Add(sideimage,0,wxALIGN_LEFT | wxALL,5);
wxBoxSizer* wxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer2->Add(wxBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
m_devicepos = new DevicePositionCtrl(this,ID_DEVICEPOS);
wxBoxSizer3->Add(m_devicepos, 0, wxALIGN_LEFT|wxALL, 5);
// Build information
wxStaticText* WxStaticText1 = new wxStaticText(this, wxID_ANY,
wxT("Please select the Rockbox version you would like "
"to install on your audio\ndevice:"));
wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
wxArrayString array;
array.Add(wxT("Rockbox stable version (") + gv->last_release + wxT(")"));
array.Add(wxT("Archived Build"));
array.Add(wxT("Current Build "));
wxRadioBox* BuildRadioBox = new wxRadioBox(this, ID_BUILD_BOX, wxT("Version"),
wxDefaultPosition, wxDefaultSize, array, 0, wxRA_SPECIFY_ROWS);
wxBoxSizer3->Add(BuildRadioBox, 0, wxGROW | wxALL, 5);
wxStaticBox* WxStaticBox1 = new wxStaticBox(this, wxID_ANY, wxT("Details:"));
wxStaticBoxSizer* WxStaticBoxSizer2 = new wxStaticBoxSizer(WxStaticBox1,
wxVERTICAL);
wxStaticText* DetailText = new wxStaticText(this, ID_DETAIL_TXT, wxT(""));
wxBoxSizer3->Add(WxStaticBoxSizer2, 1, wxGROW | wxALL, 5);
WxStaticBoxSizer2->Add(DetailText, 1, wxGROW | wxALL, 5);
wxStaticText* WxStaticText2 = new wxStaticText(this, wxID_ANY,
wxT("Rockbox Utility stores copies of Rockbox it has downloaded on the\n"
"local hard disk to save network traffic. If your local copy is\n"
"no longer working, tick this box to download a fresh copy.") );
wxBoxSizer3->Add(WxStaticText2, 0 , wxALL, 5);
wxCheckBox* NoCacheCheckBox = new wxCheckBox(this, ID_NOCACHE_CHCKBX,
wxT("Don't use locally cached copies of Rockbox") );
wxBoxSizer3->Add(NoCacheCheckBox, 0, wxALL, 5);
// controls at the bottom
OkCancelCtrl* okCancel = new OkCancelCtrl(this,wxID_ANY);
topSizer->Add(okCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
}
// create the window
bool rockboxInstallDlg::Create( wxWindow* parent,
wxWindowID id, const wxString& caption,
const wxPoint& pos, const wxSize& size, long style )
{
if (!wxDialog::Create( parent, id, caption, pos, size, style ))
return false;
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
return true;
}
void rockboxInstallDlg::OnBuildBox(wxCommandEvent& event)
{
wxString str;
wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
wxStaticText* DetailText = (wxStaticText*)FindWindow(ID_DETAIL_TXT);
switch(BuildRadioBox->GetSelection() )
{
case BUILD_RELEASE:
str = _("This is the last released version of Rockbox, and is the\n"
"recommended version to install.");
NoCacheCheckBox->Enable();
break;
case BUILD_DAILY:
str = _("These are automatically built each day from the current\n"
"development source code. This generally has more features\n"
"than the last release but may be much less stable. Features\n"
"may change regularly.");
NoCacheCheckBox->Enable();
break;
case BUILD_BLEEDING:
str = _("This is the absolute up to the minute Rockbox built after\n"
"the last change was made.\n\n"
"Note: This option will always download a fresh copy from the\n"
"web server.\n");
NoCacheCheckBox->Enable(false);
break;
default:
break;
}
DetailText->SetLabel(str);
this->GetSizer()->Layout();
this->GetSizer()->Fit(this);
this->GetSizer()->SetSizeHints(this);
Refresh();
}
// tranver data from the controls
bool rockboxInstallDlg::TransferDataFromWindow()
{
wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
wxCheckBox* NoCacheCheckBox = (wxCheckBox*) FindWindow(ID_NOCACHE_CHCKBX);
gv->curdestdir = m_devicepos->getDevicePos();
if(!wxDirExists(gv->curdestdir))
{
WARN_DIALOG(wxT("The Devicepostion is not valid"),
wxT("Select a Deviceposition"));
gv->curdestdir = wxT("");
return false;
}
gv->curbuild = BuildRadioBox->GetSelection();
gv->nocache = (gv->curbuild == BUILD_BLEEDING) ? true :
NoCacheCheckBox->IsChecked();
return true;
}
// tranver data to the controls
bool rockboxInstallDlg::TransferDataToWindow()
{
m_devicepos->setDefault();
if(gv->curplat == wxT(""))
{
WARN_DIALOG(wxT("You have not selected a audio device"),
wxT("Select a Device"));
return false;
}
wxRadioBox* BuildRadioBox = (wxRadioBox*) FindWindow(ID_BUILD_BOX);
int index =gv->plat_id.Index(gv->curplat);
wxCommandEvent updateradiobox(wxEVT_COMMAND_RADIOBOX_SELECTED,
ID_BUILD_BOX);
if (gv->plat_released[index] )
{
BuildRadioBox->Enable(BUILD_RELEASE, true);
BuildRadioBox->SetSelection(BUILD_RELEASE);
} else {
BuildRadioBox->Enable(BUILD_RELEASE, false);
BuildRadioBox->SetSelection(BUILD_BLEEDING);
}
wxPostEvent(this, updateradiobox);
return true;
}
|