summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2007-06-10 20:52:20 +0000
committerAntoine Cellerier <dionoea@videolan.org>2007-06-10 20:52:20 +0000
commit71eedc7a5be6b01fc910967e93ef7f3acf92eeaf (patch)
tree9587a4003cd192c65966f225324bc73464e46f48
parentd86e1a4998fdad8b6dafc92ebb0ab85c026c9a08 (diff)
downloadrockbox-71eedc7a5be6b01fc910967e93ef7f3acf92eeaf.tar.gz
rockbox-71eedc7a5be6b01fc910967e93ef7f3acf92eeaf.zip
When clicking on one of the rbutil actions, ask the user if he wants to try autodetecting his device if none was selected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13611 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilCtrls.cpp5
-rw-r--r--rbutil/rbutilCtrls.h2
-rw-r--r--rbutil/rbutilFrm.cpp83
-rw-r--r--rbutil/rbutilFrm.h4
4 files changed, 53 insertions, 41 deletions
diff --git a/rbutil/rbutilCtrls.cpp b/rbutil/rbutilCtrls.cpp
index e8a3f9e320..f30442c66d 100644
--- a/rbutil/rbutilCtrls.cpp
+++ b/rbutil/rbutilCtrls.cpp
@@ -430,6 +430,11 @@ void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event)
430 430
431void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event) 431void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
432{ 432{
433 AutoDetect();
434}
435
436void DeviceSelectorCtrl::AutoDetect()
437{
433 struct ipod_t ipod; 438 struct ipod_t ipod;
434 int n = ipod_scan(&ipod); 439 int n = ipod_scan(&ipod);
435 if(n == 1) 440 if(n == 1)
diff --git a/rbutil/rbutilCtrls.h b/rbutil/rbutilCtrls.h
index 53690a251e..f31429fa16 100644
--- a/rbutil/rbutilCtrls.h
+++ b/rbutil/rbutilCtrls.h
@@ -177,6 +177,8 @@ public:
177 wxString getDevice(); 177 wxString getDevice();
178 void setDefault(); 178 void setDefault();
179 179
180 void AutoDetect();
181
180protected: 182protected:
181 wxString m_currentDevice; 183 wxString m_currentDevice;
182 wxComboBox* m_deviceCbx; 184 wxComboBox* m_deviceCbx;
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp
index fd9558905b..ce695b03a0 100644
--- a/rbutil/rbutilFrm.cpp
+++ b/rbutil/rbutilFrm.cpp
@@ -441,13 +441,9 @@ void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
441{ 441{
442 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)")); 442 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
443 443
444 int index = gv->plat_id.Index(gv->curplat); 444 int index = GetDeviceId();
445 if(index < 0) 445 if(index < 0)
446 {
447 WARN_DIALOG(wxT("No Device selected"),
448 wxT("Select a Device"));
449 return; 446 return;
450 }
451 447
452 wxString bootloadermethod = gv->plat_bootloadermethod[index]; 448 wxString bootloadermethod = gv->plat_bootloadermethod[index];
453 449
@@ -530,13 +526,10 @@ void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
530{ 526{
531 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)")); 527 wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
532 528
533 int index = gv->plat_id.Index(gv->curplat); 529 int index = GetDeviceId();
534 if(index < 0) 530 if(index < 0)
535 {
536 WARN_DIALOG(wxT("No Device selected"),
537 wxT("Select a Device"));
538 return; 531 return;
539 } 532
540 wxString bootloadermethod = gv->plat_bootloadermethod[index]; 533 wxString bootloadermethod = gv->plat_bootloadermethod[index];
541 534
542 if(!gv->plat_needsbootloader[index]) 535 if(!gv->plat_needsbootloader[index])
@@ -646,13 +639,9 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
646 wxFileConfig* buildinfo; 639 wxFileConfig* buildinfo;
647 wxDateSpan oneday; 640 wxDateSpan oneday;
648 641
649 int index = gv->plat_id.Index(gv->curplat); 642 int index = GetDeviceId();
650 if(index < 0) 643 if(index < 0)
651 {
652 WARN_DIALOG(wxT("No Device selected"),
653 wxT("Select a Device"));
654 return; 644 return;
655 }
656 645
657 // rockbox install dialog 646 // rockbox install dialog
658 rockboxInstallDlg dialog(NULL, wxID_ANY, 647 rockboxInstallDlg dialog(NULL, wxID_ANY,
@@ -770,13 +759,9 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
770 wxFileConfig* buildinfo; 759 wxFileConfig* buildinfo;
771 wxDateSpan oneday; 760 wxDateSpan oneday;
772 761
773 int index = gv->plat_id.Index(gv->curplat); 762 int index = GetDeviceId();
774 if(index < 0) 763 if(index < 0)
775 {
776 WARN_DIALOG(wxT("No Device selected"),
777 wxT("Select a Device"));
778 return; 764 return;
779 }
780 765
781 // font install dialog 766 // font install dialog
782 fontInstallDlg dialog(NULL, wxID_ANY, 767 fontInstallDlg dialog(NULL, wxID_ANY,
@@ -867,13 +852,9 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
867 wxString src, dest, buf; 852 wxString src, dest, buf;
868 wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)")); 853 wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)"));
869 854
870 int index = gv->plat_id.Index(gv->curplat); 855 int index = GetDeviceId();
871 if(index < 0) 856 if(index < 0)
872 {
873 WARN_DIALOG(wxT("No Device selected"),
874 wxT("Select a Device"));
875 return; 857 return;
876 }
877 858
878 // font install dialog, reused 859 // font install dialog, reused
879 fontInstallDlg dialog(NULL, wxID_ANY, 860 fontInstallDlg dialog(NULL, wxID_ANY,
@@ -934,13 +915,9 @@ void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
934 wxString src, dest, buf; 915 wxString src, dest, buf;
935 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)")); 916 wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
936 917
937 int index = gv->plat_id.Index(gv->curplat); 918 int index = GetDeviceId();
938 if(index < 0) 919 if(index < 0)
939 {
940 WARN_DIALOG(wxT("No Device selected"),
941 wxT("Select a Device"));
942 return; 920 return;
943 }
944 921
945 // Theme install dialog 922 // Theme install dialog
946 themesInstallDlg dialog(NULL, wxID_ANY, 923 themesInstallDlg dialog(NULL, wxID_ANY,
@@ -977,13 +954,9 @@ void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
977{ 954{
978 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)")); 955 wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
979 956
980 int index = gv->plat_id.Index(gv->curplat); 957 int index = GetDeviceId();
981 if(index < 0) 958 if(index < 0)
982 {
983 WARN_DIALOG(wxT("No Device selected"),
984 wxT("Select a Device"));
985 return; 959 return;
986 }
987 960
988 // Rockbox deinstall dialog 961 // Rockbox deinstall dialog
989 rockboxDeInstallDlg dialog(NULL, wxID_ANY, 962 rockboxDeInstallDlg dialog(NULL, wxID_ANY,
@@ -1020,13 +993,9 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
1020 wxFileSystem fs; 993 wxFileSystem fs;
1021 wxDateSpan oneday; 994 wxDateSpan oneday;
1022 995
1023 int index = gv->plat_id.Index(gv->curplat); 996 int index = GetDeviceId();
1024 if(index < 0) 997 if(index < 0)
1025 {
1026 WARN_DIALOG(wxT("No Device selected"),
1027 wxT("Select a Device"));
1028 return; 998 return;
1029 }
1030 999
1031 //portable install dialog ( reused font dialog) 1000 //portable install dialog ( reused font dialog)
1032 fontInstallDlg dialog(NULL, wxID_ANY, 1001 fontInstallDlg dialog(NULL, wxID_ANY,
@@ -1051,6 +1020,40 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
1051 wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable")); 1020 wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
1052} 1021}
1053 1022
1023int rbutilFrm::GetDeviceId()
1024{
1025 int index = gv->plat_id.Index(gv->curplat);
1026 if(index < 0)
1027 {
1028 if( wxMessageBox(wxT("No device selected. Do you want to autodetect "
1029 "the device?"),
1030 wxT("Warning"), wxYES_NO ) == wxYES )
1031 {
1032 myDeviceSelector->AutoDetect();
1033 index = gv->plat_id.Index(gv->curplat);
1034 if(index < 0)
1035 {
1036 WARN_DIALOG( wxT("Aborting"), wxT("Auto detection failed") );
1037 return index;
1038 }
1039 else
1040 {
1041 if( wxMessageBox(wxT("Found ") + gv->plat_name[index] +
1042 wxT(". Do you want to continue?"),
1043 wxT("Device found"), wxYES_NO ) == wxYES )
1044 return index;
1045 else
1046 return -1;
1047 }
1048 }
1049 else
1050 {
1051 return -1;
1052 }
1053 }
1054 return index;
1055}
1056
1054AboutDlg::AboutDlg(rbutilFrm* parent) 1057AboutDlg::AboutDlg(rbutilFrm* parent)
1055 : wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize, 1058 : wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize,
1056 wxDEFAULT_DIALOG_STYLE) 1059 wxDEFAULT_DIALOG_STYLE)
diff --git a/rbutil/rbutilFrm.h b/rbutil/rbutilFrm.h
index f33adc13f1..0d3b2526e4 100644
--- a/rbutil/rbutilFrm.h
+++ b/rbutil/rbutilFrm.h
@@ -61,7 +61,7 @@ public:
61 wxHtmlWindow* manual; 61 wxHtmlWindow* manual;
62 wxString curManualDevice; 62 wxString curManualDevice;
63 63
64 wxMenuBar *WxMenuBar1; 64 wxMenuBar *WxMenuBar1;
65 wxStaticText *WxStaticText3; 65 wxStaticText *WxStaticText3;
66 wxBitmapButton *WxBitmapButton2; 66 wxBitmapButton *WxBitmapButton2;
67 wxStaticText *WxStaticText2; 67 wxStaticText *WxStaticText2;
@@ -120,6 +120,8 @@ public:
120 void OnFileProxy(wxCommandEvent& event); 120 void OnFileProxy(wxCommandEvent& event);
121 void OnDoomBtn(wxCommandEvent& event); 121 void OnDoomBtn(wxCommandEvent& event);
122 122
123 int GetDeviceId();
124
123}; 125};
124 126
125#endif 127#endif