forked from len0rd/rockbox
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
This commit is contained in:
parent
d86e1a4998
commit
71eedc7a5b
4 changed files with 53 additions and 41 deletions
|
|
@ -429,6 +429,11 @@ void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
|
void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
AutoDetect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceSelectorCtrl::AutoDetect()
|
||||||
{
|
{
|
||||||
struct ipod_t ipod;
|
struct ipod_t ipod;
|
||||||
int n = ipod_scan(&ipod);
|
int n = ipod_scan(&ipod);
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,8 @@ public:
|
||||||
wxString getDevice();
|
wxString getDevice();
|
||||||
void setDefault();
|
void setDefault();
|
||||||
|
|
||||||
|
void AutoDetect();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_currentDevice;
|
wxString m_currentDevice;
|
||||||
wxComboBox* m_deviceCbx;
|
wxComboBox* m_deviceCbx;
|
||||||
|
|
|
||||||
|
|
@ -441,13 +441,9 @@ void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderRemoveBtn(event)"));
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
wxString bootloadermethod = gv->plat_bootloadermethod[index];
|
wxString bootloadermethod = gv->plat_bootloadermethod[index];
|
||||||
|
|
||||||
|
|
@ -530,13 +526,10 @@ void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnBootloaderBtn(event)"));
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
wxString bootloadermethod = gv->plat_bootloadermethod[index];
|
wxString bootloadermethod = gv->plat_bootloadermethod[index];
|
||||||
|
|
||||||
if(!gv->plat_needsbootloader[index])
|
if(!gv->plat_needsbootloader[index])
|
||||||
|
|
@ -646,13 +639,9 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
||||||
wxFileConfig* buildinfo;
|
wxFileConfig* buildinfo;
|
||||||
wxDateSpan oneday;
|
wxDateSpan oneday;
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// rockbox install dialog
|
// rockbox install dialog
|
||||||
rockboxInstallDlg dialog(NULL, wxID_ANY,
|
rockboxInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -770,13 +759,9 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
||||||
wxFileConfig* buildinfo;
|
wxFileConfig* buildinfo;
|
||||||
wxDateSpan oneday;
|
wxDateSpan oneday;
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// font install dialog
|
// font install dialog
|
||||||
fontInstallDlg dialog(NULL, wxID_ANY,
|
fontInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -867,13 +852,9 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
|
||||||
wxString src, dest, buf;
|
wxString src, dest, buf;
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)"));
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnDoomBtn(event)"));
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// font install dialog, reused
|
// font install dialog, reused
|
||||||
fontInstallDlg dialog(NULL, wxID_ANY,
|
fontInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -934,13 +915,9 @@ void rbutilFrm::OnThemesBtn(wxCommandEvent& event)
|
||||||
wxString src, dest, buf;
|
wxString src, dest, buf;
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnThemesBtn(event)"));
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Theme install dialog
|
// Theme install dialog
|
||||||
themesInstallDlg dialog(NULL, wxID_ANY,
|
themesInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -977,13 +954,9 @@ void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
|
wxLogVerbose(wxT("=== begin rbutilFrm::OnRemoveBtn(event)"));
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Rockbox deinstall dialog
|
// Rockbox deinstall dialog
|
||||||
rockboxDeInstallDlg dialog(NULL, wxID_ANY,
|
rockboxDeInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -1020,13 +993,9 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
|
||||||
wxFileSystem fs;
|
wxFileSystem fs;
|
||||||
wxDateSpan oneday;
|
wxDateSpan oneday;
|
||||||
|
|
||||||
int index = gv->plat_id.Index(gv->curplat);
|
int index = GetDeviceId();
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
{
|
|
||||||
WARN_DIALOG(wxT("No Device selected"),
|
|
||||||
wxT("Select a Device"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//portable install dialog ( reused font dialog)
|
//portable install dialog ( reused font dialog)
|
||||||
fontInstallDlg dialog(NULL, wxID_ANY,
|
fontInstallDlg dialog(NULL, wxID_ANY,
|
||||||
|
|
@ -1051,6 +1020,40 @@ void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
|
||||||
wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
|
wxLogVerbose(wxT("=== end rbutilFrm::OnUnstallPortable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rbutilFrm::GetDeviceId()
|
||||||
|
{
|
||||||
|
int index = gv->plat_id.Index(gv->curplat);
|
||||||
|
if(index < 0)
|
||||||
|
{
|
||||||
|
if( wxMessageBox(wxT("No device selected. Do you want to autodetect "
|
||||||
|
"the device?"),
|
||||||
|
wxT("Warning"), wxYES_NO ) == wxYES )
|
||||||
|
{
|
||||||
|
myDeviceSelector->AutoDetect();
|
||||||
|
index = gv->plat_id.Index(gv->curplat);
|
||||||
|
if(index < 0)
|
||||||
|
{
|
||||||
|
WARN_DIALOG( wxT("Aborting"), wxT("Auto detection failed") );
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( wxMessageBox(wxT("Found ") + gv->plat_name[index] +
|
||||||
|
wxT(". Do you want to continue?"),
|
||||||
|
wxT("Device found"), wxYES_NO ) == wxYES )
|
||||||
|
return index;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
AboutDlg::AboutDlg(rbutilFrm* parent)
|
AboutDlg::AboutDlg(rbutilFrm* parent)
|
||||||
: wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize,
|
: wxDialog(parent, -1, wxT("About"), wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE)
|
wxDEFAULT_DIALOG_STYLE)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public:
|
||||||
wxHtmlWindow* manual;
|
wxHtmlWindow* manual;
|
||||||
wxString curManualDevice;
|
wxString curManualDevice;
|
||||||
|
|
||||||
wxMenuBar *WxMenuBar1;
|
wxMenuBar *WxMenuBar1;
|
||||||
wxStaticText *WxStaticText3;
|
wxStaticText *WxStaticText3;
|
||||||
wxBitmapButton *WxBitmapButton2;
|
wxBitmapButton *WxBitmapButton2;
|
||||||
wxStaticText *WxStaticText2;
|
wxStaticText *WxStaticText2;
|
||||||
|
|
@ -120,6 +120,8 @@ public:
|
||||||
void OnFileProxy(wxCommandEvent& event);
|
void OnFileProxy(wxCommandEvent& event);
|
||||||
void OnDoomBtn(wxCommandEvent& event);
|
void OnDoomBtn(wxCommandEvent& event);
|
||||||
|
|
||||||
|
int GetDeviceId();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue