mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-12 22:52:28 -05:00
rbutil: move bootloaderInstall object creation switches to bootloaderInstallBase .
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25882 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e919b5d5b9
commit
26826b5ae5
3 changed files with 62 additions and 57 deletions
|
|
@ -21,6 +21,14 @@
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
#include "bootloaderinstallbase.h"
|
#include "bootloaderinstallbase.h"
|
||||||
|
#include "bootloaderinstallmi4.h"
|
||||||
|
#include "bootloaderinstallhex.h"
|
||||||
|
#include "bootloaderinstallipod.h"
|
||||||
|
#include "bootloaderinstallsansa.h"
|
||||||
|
#include "bootloaderinstallfile.h"
|
||||||
|
#include "bootloaderinstallchinachip.h"
|
||||||
|
#include "bootloaderinstallams.h"
|
||||||
|
#include "bootloaderinstalltcc.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#if defined(Q_OS_MACX)
|
#if defined(Q_OS_MACX)
|
||||||
|
|
@ -29,6 +37,39 @@
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
BootloaderInstallBase* BootloaderInstallBase::createBootloaderInstaller(QObject* parent,QString type)
|
||||||
|
{
|
||||||
|
if(type == "mi4") {
|
||||||
|
return new BootloaderInstallMi4(parent);
|
||||||
|
}
|
||||||
|
else if(type == "hex") {
|
||||||
|
return new BootloaderInstallHex(parent);
|
||||||
|
}
|
||||||
|
else if(type == "sansa") {
|
||||||
|
return new BootloaderInstallSansa(parent);
|
||||||
|
}
|
||||||
|
else if(type == "ipod") {
|
||||||
|
return new BootloaderInstallIpod(parent);
|
||||||
|
}
|
||||||
|
else if(type == "file") {
|
||||||
|
return new BootloaderInstallFile(parent);
|
||||||
|
}
|
||||||
|
else if(type == "chinachip") {
|
||||||
|
return new BootloaderInstallChinaChip(parent);
|
||||||
|
}
|
||||||
|
else if(type == "ams") {
|
||||||
|
return new BootloaderInstallAms(parent);
|
||||||
|
}
|
||||||
|
else if(type == "tcc") {
|
||||||
|
return new BootloaderInstallTcc(parent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void)
|
BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void)
|
||||||
{
|
{
|
||||||
return BootloaderUnknown;
|
return BootloaderUnknown;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ class BootloaderInstallBase : public QObject
|
||||||
// be modified for new targets
|
// be modified for new targets
|
||||||
static QString postinstallHints(QString model);
|
static QString postinstallHints(QString model);
|
||||||
|
|
||||||
|
//! returns the correct BootloaderInstaller object for the requested type
|
||||||
|
static BootloaderInstallBase* createBootloaderInstaller(QObject* parent,QString type);
|
||||||
protected slots:
|
protected slots:
|
||||||
void downloadReqFinished(int id, bool error);
|
void downloadReqFinished(int id, bool error);
|
||||||
void downloadBlFinish(bool error);
|
void downloadBlFinish(bool error);
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,6 @@
|
||||||
#include "progressloggerinterface.h"
|
#include "progressloggerinterface.h"
|
||||||
|
|
||||||
#include "bootloaderinstallbase.h"
|
#include "bootloaderinstallbase.h"
|
||||||
#include "bootloaderinstallmi4.h"
|
|
||||||
#include "bootloaderinstallhex.h"
|
|
||||||
#include "bootloaderinstallipod.h"
|
|
||||||
#include "bootloaderinstallsansa.h"
|
|
||||||
#include "bootloaderinstallfile.h"
|
|
||||||
#include "bootloaderinstallchinachip.h"
|
|
||||||
#include "bootloaderinstallams.h"
|
|
||||||
#include "bootloaderinstalltcc.h"
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
|
|
@ -673,33 +665,9 @@ void RbUtilQt::installBootloader()
|
||||||
m_error = false;
|
m_error = false;
|
||||||
|
|
||||||
// create installer
|
// create installer
|
||||||
BootloaderInstallBase *bl;
|
BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
|
||||||
QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
|
SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
|
||||||
if(type == "mi4") {
|
if(bl == NULL) {
|
||||||
bl = new BootloaderInstallMi4(this);
|
|
||||||
}
|
|
||||||
else if(type == "hex") {
|
|
||||||
bl = new BootloaderInstallHex(this);
|
|
||||||
}
|
|
||||||
else if(type == "sansa") {
|
|
||||||
bl = new BootloaderInstallSansa(this);
|
|
||||||
}
|
|
||||||
else if(type == "ipod") {
|
|
||||||
bl = new BootloaderInstallIpod(this);
|
|
||||||
}
|
|
||||||
else if(type == "file") {
|
|
||||||
bl = new BootloaderInstallFile(this);
|
|
||||||
}
|
|
||||||
else if(type == "chinachip") {
|
|
||||||
bl = new BootloaderInstallChinaChip(this);
|
|
||||||
}
|
|
||||||
else if(type == "ams") {
|
|
||||||
bl = new BootloaderInstallAms(this);
|
|
||||||
}
|
|
||||||
else if(type == "tcc") {
|
|
||||||
bl = new BootloaderInstallTcc(this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
logger->addItem(tr("No install method known."), LOGERROR);
|
logger->addItem(tr("No install method known."), LOGERROR);
|
||||||
logger->setFinished();
|
logger->setFinished();
|
||||||
return;
|
return;
|
||||||
|
|
@ -1015,28 +983,22 @@ void RbUtilQt::uninstallBootloader(void)
|
||||||
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
||||||
|
|
||||||
// create installer
|
// create installer
|
||||||
BootloaderInstallBase *bl;
|
BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
|
||||||
QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
|
SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
|
||||||
if(type == "mi4") {
|
|
||||||
bl = new BootloaderInstallMi4(this);
|
if(bl == NULL ) {
|
||||||
}
|
logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
|
||||||
else if(type == "hex") {
|
|
||||||
bl = new BootloaderInstallHex(this);
|
|
||||||
}
|
|
||||||
else if(type == "sansa") {
|
|
||||||
bl = new BootloaderInstallSansa(this);
|
|
||||||
}
|
|
||||||
else if(type == "ipod") {
|
|
||||||
bl = new BootloaderInstallIpod(this);
|
|
||||||
}
|
|
||||||
else if(type == "file") {
|
|
||||||
bl = new BootloaderInstallFile(this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
logger->addItem(tr("No uninstall method known."), LOGERROR);
|
|
||||||
logger->setFinished();
|
logger->setFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if( (bl->capabilities() & BootloaderInstallBase::Uninstall) == 0)
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Rockbox Utility can not uninstall the bootloader on this target."
|
||||||
|
"Try a normal firmware update to remove the booloader."), LOGERROR);
|
||||||
|
logger->setFinished();
|
||||||
|
delete bl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
|
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
|
||||||
QStringList blfilepath;
|
QStringList blfilepath;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue