mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-13 23:22:34 -05:00
Support for running direct from the device itself. If installed on a local drive, rbutil provides a menu option to install itself on the device.
Cross-platform fix: Will now search the current directory for rbutil.ini in preference to the system application resource path. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11753 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8280c8c094
commit
3b0b27e134
6 changed files with 305 additions and 56 deletions
|
|
@ -1,8 +1,28 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: credits.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CREDITS_H_INCLUDED
|
#ifndef CREDITS_H_INCLUDED
|
||||||
#define CREDITS_H_INCLUDED
|
#define CREDITS_H_INCLUDED
|
||||||
|
|
||||||
#define RBUTIL_FULLNAME "The Rockbox Utility"
|
#define RBUTIL_FULLNAME "The Rockbox Utility"
|
||||||
#define RBUTIL_VERSION "Version 0.2.0.0"
|
#define RBUTIL_VERSION "Version 0.2.1.0"
|
||||||
|
|
||||||
static char* rbutil_developers[] = {
|
static char* rbutil_developers[] = {
|
||||||
"Christi Alice Scarborough",
|
"Christi Alice Scarborough",
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
//---------------------------------------------------------------------------
|
/***************************************************************************
|
||||||
//
|
* __________ __ ___.
|
||||||
// Name: rbutil.cpp
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
// Author: Christi Scarborough
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
// Created: 06-12-05 04:08
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
//
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
//---------------------------------------------------------------------------
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: rbutil.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include "rbutil.h"
|
#include "rbutil.h"
|
||||||
|
|
||||||
|
|
@ -526,6 +538,82 @@ wxString stream_err_str(int errnum)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InstallRbutil(wxString dest)
|
||||||
|
{
|
||||||
|
wxArrayString filestocopy;
|
||||||
|
wxString str, buf, dstr, destdir;
|
||||||
|
unsigned int i;
|
||||||
|
wxDir dir;
|
||||||
|
bool copied_exe = false;
|
||||||
|
|
||||||
|
destdir.Printf(wxT("%s" PATH_SEP "RockboxUtility"), dest.c_str());
|
||||||
|
if (! wxDirExists(destdir) )
|
||||||
|
{
|
||||||
|
if (! wxMkdir(destdir) )
|
||||||
|
{
|
||||||
|
buf.Printf(wxT("%s (%s)"),
|
||||||
|
_("Unable to create directory for installer"), destdir.c_str());
|
||||||
|
WARN_DIALOG(buf , _("Portable install") );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dir.GetAllFiles(gv->ResourceDir, &filestocopy, wxT("*"),
|
||||||
|
wxDIR_FILES);
|
||||||
|
if (filestocopy.GetCount() < 1)
|
||||||
|
{
|
||||||
|
WARN_DIALOG(_("No files to copy"), _("Portable install") );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the contents of the program directory
|
||||||
|
for (i = 0; i < filestocopy.GetCount(); i++)
|
||||||
|
{
|
||||||
|
if (filestocopy[i].AfterLast(PATH_SEP_CHR) == EXE_NAME)
|
||||||
|
{
|
||||||
|
copied_exe = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
dstr.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(),
|
||||||
|
filestocopy[i].AfterLast(PATH_SEP_CHR).c_str());
|
||||||
|
if (! wxCopyFile(filestocopy[i], dstr) )
|
||||||
|
{
|
||||||
|
buf.Printf(wxT("%s (%s -> %s)"),
|
||||||
|
_("Error copying file"), filestocopy[i].c_str(), dstr.c_str());
|
||||||
|
WARN_DIALOG(buf, _("Portable Install") );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! copied_exe)
|
||||||
|
{
|
||||||
|
str.Printf(wxT("%s" PATH_SEP EXE_NAME), gv->AppDir.c_str());
|
||||||
|
dstr.Printf(wxT("%s" PATH_SEP EXE_NAME), destdir.c_str(),
|
||||||
|
filestocopy[i].AfterLast(PATH_SEP_CHR).c_str());
|
||||||
|
if (! wxCopyFile(str, dstr) )
|
||||||
|
{
|
||||||
|
buf.Printf(wxT("Can't copy program binary %s -> %s"),
|
||||||
|
str.c_str(), dstr.c_str() );
|
||||||
|
WARN_DIALOG(buf, _("Portable Install") );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the local ini file so that it knows that it's a portable copy
|
||||||
|
gv->UserConfig->Flush();
|
||||||
|
dstr.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"), destdir.c_str());
|
||||||
|
if (! wxCopyFile(gv->UserConfigFile, dstr) )
|
||||||
|
{
|
||||||
|
buf.Printf(wxT("%s (%s -> %s)"),
|
||||||
|
_("Unable to install user config file"), gv->UserConfigFile.c_str(),
|
||||||
|
dstr.c_str() );
|
||||||
|
WARN_DIALOG(buf, _("Portable Install") );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool rm_rf(wxString file)
|
bool rm_rf(wxString file)
|
||||||
{
|
{
|
||||||
wxLogVerbose(_("=== begin rm-rf(%s)"), file.c_str() );
|
wxLogVerbose(_("=== begin rm-rf(%s)"), file.c_str() );
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
//---------------------------------------------------------------------------
|
/***************************************************************************
|
||||||
//
|
* __________ __ ___.
|
||||||
// Name: rbutil.h
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
// Author: Christi Scarborough
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
// Created: 03/12/2005 00:35:02
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
//
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
//---------------------------------------------------------------------------
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: rbutil.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
|
|
@ -43,8 +55,12 @@
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#define PATH_SEP "\\"
|
#define PATH_SEP "\\"
|
||||||
|
#define PATH_SEP_CHR '\\'
|
||||||
|
#define EXE_NAME "rbutil.exe"
|
||||||
#else
|
#else
|
||||||
#define PATH_SEP "/"
|
#define PATH_SEP "/"
|
||||||
|
#define PATH_SEP_CHR '/'
|
||||||
|
#define EXE_NAME "rbutil"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define UNINSTALL_FILE ".rockbox" PATH_SEP ".rbutil_install_data"
|
#define UNINSTALL_FILE ".rockbox" PATH_SEP ".rbutil_install_data"
|
||||||
|
|
@ -60,6 +76,11 @@ public:
|
||||||
// Program configuration data (rbutil.ini and environment)
|
// Program configuration data (rbutil.ini and environment)
|
||||||
wxFileConfig* GlobalConfig;
|
wxFileConfig* GlobalConfig;
|
||||||
wxFileConfig* UserConfig;
|
wxFileConfig* UserConfig;
|
||||||
|
wxString UserConfigFile;
|
||||||
|
wxString GlobalConfigFile;
|
||||||
|
wxString AppDir;
|
||||||
|
wxString ResourceDir;
|
||||||
|
|
||||||
wxString* ErrStr;
|
wxString* ErrStr;
|
||||||
wxStandardPaths* stdpaths;
|
wxStandardPaths* stdpaths;
|
||||||
wxArrayString plat_id;
|
wxArrayString plat_id;
|
||||||
|
|
@ -74,12 +95,13 @@ public:
|
||||||
wxString prog_name;
|
wxString prog_name;
|
||||||
|
|
||||||
// User configuration data.
|
// User configuration data.
|
||||||
wxString curplat;
|
wxString curplat;
|
||||||
unsigned int curplatnum;
|
unsigned int curplatnum;
|
||||||
wxString curdestdir;
|
wxString curdestdir;
|
||||||
unsigned int curbuild;
|
unsigned int curbuild;
|
||||||
bool curisfull;
|
bool curisfull;
|
||||||
bool nocache;
|
bool nocache;
|
||||||
|
bool portable;
|
||||||
|
|
||||||
// Global system variables
|
// Global system variables
|
||||||
wxFFile* logfile;
|
wxFFile* logfile;
|
||||||
|
|
@ -95,6 +117,7 @@ wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
|
||||||
int DownloadURL(wxString src, wxString dest);
|
int DownloadURL(wxString src, wxString dest);
|
||||||
int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
|
int UnzipFile(wxString src, wxString destdir, bool isInstall = false);
|
||||||
int Uninstall(const wxString dir, bool isFullUninstall = false);
|
int Uninstall(const wxString dir, bool isFullUninstall = false);
|
||||||
|
bool InstallRbutil(wxString dest);
|
||||||
wxString stream_err_str(int errnum);
|
wxString stream_err_str(int errnum);
|
||||||
bool rm_rf(wxString file);
|
bool rm_rf(wxString file);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
//---------------------------------------------------------------------------
|
/***************************************************************************
|
||||||
//
|
* __________ __ ___.
|
||||||
// Name: rbutilApp.cpp
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
// Author: Christi Scarborough
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
// Created: 03/12/2005 00:35:02
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
//
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
//---------------------------------------------------------------------------
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: rbutilApp.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include "rbutilApp.h"
|
#include "rbutilApp.h"
|
||||||
|
|
||||||
|
|
@ -19,6 +31,15 @@ bool rbutilFrmApp::OnInit()
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrmApp::Oninit()"));
|
wxLogVerbose(wxT("=== begin rbutilFrmApp::Oninit()"));
|
||||||
|
|
||||||
gv->stdpaths = new wxStandardPaths();
|
gv->stdpaths = new wxStandardPaths();
|
||||||
|
|
||||||
|
// Get application directory
|
||||||
|
// DANGER! GetDataDir() doesn't portably return the application directory
|
||||||
|
// We want to use the form below instead, but not until wxWidgets 2.8 is
|
||||||
|
// released.
|
||||||
|
// gv->AppDir = gv->stdpaths->GetExecutablePath()->BeforeLast(&pathsep);
|
||||||
|
buf = gv->stdpaths->GetDataDir(); buf.Append(PATH_SEP);
|
||||||
|
gv->AppDir = buf.BeforeLast(PATH_SEP_CHR).c_str();
|
||||||
|
|
||||||
buf = gv->stdpaths->GetUserDataDir();
|
buf = gv->stdpaths->GetUserDataDir();
|
||||||
if (! wxDirExists(buf) )
|
if (! wxDirExists(buf) )
|
||||||
{
|
{
|
||||||
|
|
@ -48,17 +69,15 @@ bool rbutilFrmApp::OnInit()
|
||||||
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
||||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||||
|
|
||||||
rbutilFrm *myFrame = new rbutilFrm(NULL);
|
if (!ReadGlobalConfig(NULL))
|
||||||
SetTopWindow(myFrame);
|
|
||||||
|
|
||||||
if (!ReadGlobalConfig(myFrame))
|
|
||||||
{
|
{
|
||||||
ERR_DIALOG(gv->ErrStr->GetData(), _("Rockbox Utility"));
|
ERR_DIALOG(gv->ErrStr->GetData(), _("Rockbox Utility"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadUserConfig();
|
ReadUserConfig();
|
||||||
|
|
||||||
|
rbutilFrm *myFrame = new rbutilFrm(NULL);
|
||||||
|
SetTopWindow(myFrame);
|
||||||
myFrame->Show(TRUE);
|
myFrame->Show(TRUE);
|
||||||
|
|
||||||
wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()"));
|
wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()"));
|
||||||
|
|
@ -96,8 +115,21 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
|
||||||
wxLogVerbose(wxT("=== begin rbutilFrmApp::ReadGlobalConfig(%p)"),
|
wxLogVerbose(wxT("=== begin rbutilFrmApp::ReadGlobalConfig(%p)"),
|
||||||
(void*) myFrame);
|
(void*) myFrame);
|
||||||
|
|
||||||
buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"),
|
// Cross-platform compatibility: look for rbutil.ini in the same dir as the
|
||||||
gv->stdpaths->GetDataDir().c_str() );
|
// executable before trying the standard data directory. On Windows these
|
||||||
|
// are of course the same directory.
|
||||||
|
buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->AppDir.c_str() );
|
||||||
|
|
||||||
|
if (! wxFileExists(buf) )
|
||||||
|
{
|
||||||
|
gv->ResourceDir = gv->stdpaths->GetResourcesDir();
|
||||||
|
buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"),
|
||||||
|
gv->ResourceDir.c_str() );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gv->ResourceDir = gv->AppDir;
|
||||||
|
}
|
||||||
|
|
||||||
wxFileInputStream* cfgis = new wxFileInputStream(buf);
|
wxFileInputStream* cfgis = new wxFileInputStream(buf);
|
||||||
|
|
||||||
if (!cfgis->CanRead()) {
|
if (!cfgis->CanRead()) {
|
||||||
|
|
@ -106,6 +138,7 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
gv->GlobalConfig = new wxFileConfig(*cfgis);
|
gv->GlobalConfig = new wxFileConfig(*cfgis);
|
||||||
|
gv->GlobalConfigFile = buf;
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
|
@ -167,9 +200,22 @@ void rbutilFrmApp::ReadUserConfig()
|
||||||
{
|
{
|
||||||
wxString buf, str, stack;
|
wxString buf, str, stack;
|
||||||
|
|
||||||
buf.Printf(wxT("%s" PATH_SEP "%s"), gv->stdpaths->GetUserDataDir().c_str(),
|
buf.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"),
|
||||||
wxT("RockboxUtility.cfg"));
|
gv->AppDir.c_str());
|
||||||
|
|
||||||
|
if (wxFileExists(buf) )
|
||||||
|
{
|
||||||
|
gv->portable = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gv->portable = false;
|
||||||
|
buf.Printf(wxT("%s" PATH_SEP "%s"),
|
||||||
|
gv->stdpaths->GetUserDataDir().c_str(), wxT("RockboxUtility.cfg"));
|
||||||
|
}
|
||||||
|
|
||||||
gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);
|
gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);
|
||||||
|
gv->UserConfigFile = buf;
|
||||||
stack = gv->UserConfig->GetPath();
|
stack = gv->UserConfig->GetPath();
|
||||||
|
|
||||||
gv->UserConfig->SetPath(wxT("/defaults"));
|
gv->UserConfig->SetPath(wxT("/defaults"));
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
//---------------------------------------------------------------------------
|
/***************************************************************************
|
||||||
//
|
* __________ __ ___.
|
||||||
// Name: rbutilFrm.cpp
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
// Author: Christi Scarborough
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
// Created: 03/12/2005 00:35:02
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
//
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
//---------------------------------------------------------------------------
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: rbutilFrm.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include "rbutilFrm.h"
|
#include "rbutilFrm.h"
|
||||||
#include "credits.h"
|
#include "credits.h"
|
||||||
|
|
@ -32,6 +44,7 @@ BEGIN_EVENT_TABLE(rbutilFrm,wxFrame)
|
||||||
EVT_MENU(ID_FILE_EXIT, rbutilFrm::OnFileExit)
|
EVT_MENU(ID_FILE_EXIT, rbutilFrm::OnFileExit)
|
||||||
EVT_MENU(ID_FILE_ABOUT, rbutilFrm::OnFileAbout)
|
EVT_MENU(ID_FILE_ABOUT, rbutilFrm::OnFileAbout)
|
||||||
EVT_MENU(ID_FILE_WIPECACHE, rbutilFrm::OnFileWipeCache)
|
EVT_MENU(ID_FILE_WIPECACHE, rbutilFrm::OnFileWipeCache)
|
||||||
|
EVT_MENU(ID_PORTABLE_INSTALL, rbutilFrm::OnPortableInstall)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
rbutilFrm::rbutilFrm( wxWindow *parent, wxWindowID id, const wxString &title,
|
rbutilFrm::rbutilFrm( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
|
|
@ -77,7 +90,7 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
wxBitmap BootloaderInstallButton (tools2_3d_xpm);
|
wxBitmap BootloaderInstallButton (tools2_3d_xpm);
|
||||||
WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADER_BTN,
|
WxBitmapButton4 = new wxBitmapButton(WxPanel1, ID_BOOTLOADER_BTN,
|
||||||
BootloaderInstallButton, wxPoint(0,50), wxSize(60,50),
|
BootloaderInstallButton, wxPoint(0,0), wxSize(64,54),
|
||||||
wxRAISED_BORDER | wxBU_AUTODRAW);
|
wxRAISED_BORDER | wxBU_AUTODRAW);
|
||||||
WxBitmapButton4->SetToolTip(_("Instructions for installing the "
|
WxBitmapButton4->SetToolTip(_("Instructions for installing the "
|
||||||
"Rockbox bootloader on your audio device"));
|
"Rockbox bootloader on your audio device"));
|
||||||
|
|
@ -95,7 +108,7 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
|
wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
|
||||||
WxBitmapButton1 = new wxBitmapButton(WxPanel1, ID_INSTALL_BTN,
|
WxBitmapButton1 = new wxBitmapButton(WxPanel1, ID_INSTALL_BTN,
|
||||||
WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(60,50),
|
WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54),
|
||||||
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
||||||
wxT("WxBitmapButton1"));
|
wxT("WxBitmapButton1"));
|
||||||
WxBitmapButton1->SetToolTip(_("Install Rockbox"));
|
WxBitmapButton1->SetToolTip(_("Install Rockbox"));
|
||||||
|
|
@ -110,7 +123,7 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
wxBitmap FontInstallButton (fonts_3d_xpm);
|
wxBitmap FontInstallButton (fonts_3d_xpm);
|
||||||
WxBitmapButton3 = new wxBitmapButton(WxPanel1, ID_FONT_BTN,
|
WxBitmapButton3 = new wxBitmapButton(WxPanel1, ID_FONT_BTN,
|
||||||
FontInstallButton, wxPoint(0,50), wxSize(60,50),
|
FontInstallButton, wxPoint(0,0), wxSize(64,54),
|
||||||
wxRAISED_BORDER | wxBU_AUTODRAW);
|
wxRAISED_BORDER | wxBU_AUTODRAW);
|
||||||
WxBitmapButton3->SetToolTip(_("Download the most up to date "
|
WxBitmapButton3->SetToolTip(_("Download the most up to date "
|
||||||
"Rockbox fonts."));
|
"Rockbox fonts."));
|
||||||
|
|
@ -128,7 +141,7 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
|
wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
|
||||||
WxBitmapButton2 = new wxBitmapButton(WxPanel1, ID_REMOVE_BTN,
|
WxBitmapButton2 = new wxBitmapButton(WxPanel1, ID_REMOVE_BTN,
|
||||||
WxBitmapButton2_BITMAP, wxPoint(0,50), wxSize(60,50),
|
WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54),
|
||||||
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
|
||||||
wxT("WxBitmapButton2"));
|
wxT("WxBitmapButton2"));
|
||||||
WxBitmapButton2->SetToolTip(_("Uninstall Rockbox"));
|
WxBitmapButton2->SetToolTip(_("Uninstall Rockbox"));
|
||||||
|
|
@ -147,6 +160,11 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_WIPECACHE,
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_WIPECACHE,
|
||||||
_("&Empty local download cache"), wxT(""), wxITEM_NORMAL);
|
_("&Empty local download cache"), wxT(""), wxITEM_NORMAL);
|
||||||
|
if (! gv->portable )
|
||||||
|
{
|
||||||
|
ID_FILE_MENU_Mnu_Obj->Append(ID_PORTABLE_INSTALL,
|
||||||
|
_("&Install Rockbox Utility on device"), wxT(""), wxITEM_NORMAL);
|
||||||
|
}
|
||||||
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_ABOUT, _("&About"), wxT(""),
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_ABOUT, _("&About"), wxT(""),
|
||||||
wxITEM_NORMAL);
|
wxITEM_NORMAL);
|
||||||
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_EXIT, _("E&xit\tCtrl+X"), wxT(""),
|
ID_FILE_MENU_Mnu_Obj->Append(ID_FILE_EXIT, _("E&xit\tCtrl+X"), wxT(""),
|
||||||
|
|
@ -156,7 +174,13 @@ void rbutilFrm::CreateGUIControls(void)
|
||||||
|
|
||||||
GetSizer()->Fit(this);
|
GetSizer()->Fit(this);
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
this->SetTitle(wxT("Rockbox Utility"));
|
if (gv->portable)
|
||||||
|
{
|
||||||
|
this->SetTitle(_("Rockbox Utility (portable)"));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
this->SetTitle(_("Rockbox Utility"));
|
||||||
|
}
|
||||||
this->Center();
|
this->Center();
|
||||||
wxIcon rbutilFrm_ICON (rbutilFrm_XPM);
|
wxIcon rbutilFrm_ICON (rbutilFrm_XPM);
|
||||||
this->SetIcon(rbutilFrm_XPM);
|
this->SetIcon(rbutilFrm_XPM);
|
||||||
|
|
@ -490,6 +514,39 @@ void rbutilFrm::OnRemoveBtn(wxCommandEvent& event)
|
||||||
wxLogVerbose("=== end rbutilFrm::OnRemoveBtn");
|
wxLogVerbose("=== end rbutilFrm::OnRemoveBtn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rbutilFrm::OnPortableInstall(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxString src, dest, buf;
|
||||||
|
wxLogVerbose("=== begin rbutilFrm::OnPortableInstall(event)");
|
||||||
|
wxFileSystem fs;
|
||||||
|
wxFileConfig* buildinfo;
|
||||||
|
wxDateSpan oneday;
|
||||||
|
|
||||||
|
wxWizard *wizard = new wxWizard(this, wxID_ANY,
|
||||||
|
_("Rockbox Utility Portable Installation Wizard"),
|
||||||
|
wxBitmap(wizard_xpm),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
||||||
|
wxLocationPage* page1 = new wxLocationPage(wizard);
|
||||||
|
|
||||||
|
wizard->GetPageAreaSizer()->Add(page1);
|
||||||
|
|
||||||
|
if (wizard->RunWizard(page1) )
|
||||||
|
{
|
||||||
|
if ( InstallRbutil(gv->curdestdir) )
|
||||||
|
{
|
||||||
|
MESG_DIALOG(_("The Rockbox Utility has been installed on your device.") );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ERR_DIALOG(_("Installation failed"), _("Portable Install"));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MESG_DIALOG(_("The portable installation wizard was cancelled") );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxLogVerbose("=== end rbutilFrm::OnUnstallPortable");
|
||||||
|
}
|
||||||
|
|
||||||
AboutDlg::AboutDlg(rbutilFrm* parent)
|
AboutDlg::AboutDlg(rbutilFrm* parent)
|
||||||
: wxDialog(parent, -1, _("About"), wxDefaultPosition, wxDefaultSize,
|
: wxDialog(parent, -1, _("About"), wxDefaultPosition, wxDefaultSize,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
//---------------------------------------------------------------------------
|
/***************************************************************************
|
||||||
//
|
* __________ __ ___.
|
||||||
// Name: rbutilFrm.h
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
// Author: Christi Scarborough
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
// Created: 03/12/2005 00:35:02
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
//
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
//---------------------------------------------------------------------------
|
* \/ \/ \/ \/ \/
|
||||||
|
* Module: rbutil
|
||||||
|
* File: rbutilFrm.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Christi Alice Scarborough
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __rbutilFrm_HPP_
|
#ifndef __rbutilFrm_HPP_
|
||||||
#define __rbutilFrm_HPP_
|
#define __rbutilFrm_HPP_
|
||||||
|
|
||||||
|
|
@ -60,6 +73,7 @@ public:
|
||||||
ID_FILE_EXIT = 1034,
|
ID_FILE_EXIT = 1034,
|
||||||
ID_FILE_ABOUT = 1035,
|
ID_FILE_ABOUT = 1035,
|
||||||
ID_FILE_WIPECACHE = 1036,
|
ID_FILE_WIPECACHE = 1036,
|
||||||
|
ID_PORTABLE_INSTALL = 1037,
|
||||||
|
|
||||||
ID_WXSTATICTEXT3 = 1032,
|
ID_WXSTATICTEXT3 = 1032,
|
||||||
ID_REMOVE_BTN = 1031,
|
ID_REMOVE_BTN = 1031,
|
||||||
|
|
@ -83,6 +97,7 @@ public:
|
||||||
void OnRemoveBtn(wxCommandEvent& event);
|
void OnRemoveBtn(wxCommandEvent& event);
|
||||||
void OnFontBtn(wxCommandEvent& event);
|
void OnFontBtn(wxCommandEvent& event);
|
||||||
void OnBootloaderBtn(wxCommandEvent& event);
|
void OnBootloaderBtn(wxCommandEvent& event);
|
||||||
|
void OnPortableInstall(wxCommandEvent& event);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue