summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2010-05-07 18:18:43 +0000
committerDominik Wenger <domonoky@googlemail.com>2010-05-07 18:18:43 +0000
commit26826b5ae55cfdd827d3084ee1c4b06ff7ac5c14 (patch)
treeb80d4f9d6d753cef292356d47226b7a22c70adc0 /rbutil
parente919b5d5b929faf2af96ce0b36d8bc5b55236153 (diff)
downloadrockbox-26826b5ae55cfdd827d3084ee1c4b06ff7ac5c14.tar.gz
rockbox-26826b5ae55cfdd827d3084ee1c4b06ff7ac5c14.zip
rbutil: move bootloaderInstall object creation switches to bootloaderInstallBase .
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25882 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp41
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.h4
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp72
3 files changed, 61 insertions, 56 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
index 6a2db76392..3a94180aab 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
@@ -21,6 +21,14 @@
#include <QtCore>
#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"
#if defined(Q_OS_MACX)
@@ -29,6 +37,39 @@
#include <sys/mount.h>
#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)
{
return BootloaderUnknown;
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.h b/rbutil/rbutilqt/base/bootloaderinstallbase.h
index 07fbd9ebcf..dec140efdc 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallbase.h
+++ b/rbutil/rbutilqt/base/bootloaderinstallbase.h
@@ -69,7 +69,9 @@ class BootloaderInstallBase : public QObject
//! static and in the base class, so the installer classes dont need to
// be modified for new targets
static QString postinstallHints(QString model);
-
+
+ //! returns the correct BootloaderInstaller object for the requested type
+ static BootloaderInstallBase* createBootloaderInstaller(QObject* parent,QString type);
protected slots:
void downloadReqFinished(int id, bool error);
void downloadBlFinish(bool error);
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 1c27d48508..c9becc6eac 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -43,14 +43,6 @@
#include "progressloggerinterface.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)
@@ -673,38 +665,14 @@ void RbUtilQt::installBootloader()
m_error = false;
// create installer
- BootloaderInstallBase *bl;
- QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
- if(type == "mi4") {
- 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 {
+ BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
+ SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
+ if(bl == NULL) {
logger->addItem(tr("No install method known."), LOGERROR);
logger->setFinished();
return;
}
-
+
// set bootloader filename. Do this now as installed() needs it.
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath;
@@ -1015,29 +983,23 @@ void RbUtilQt::uninstallBootloader(void)
QString platform = RbSettings::value(RbSettings::Platform).toString();
// create installer
- BootloaderInstallBase *bl;
- QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
- if(type == "mi4") {
- 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);
+ BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
+ SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
+
+ if(bl == NULL ) {
+ logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
+ logger->setFinished();
+ return;
}
- else {
- logger->addItem(tr("No uninstall method known."), LOGERROR);
+ 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 blfilepath;
for(int a = 0; a < blfile.size(); a++) {