summaryrefslogtreecommitdiff
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
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
-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 @@
21#include <QtCore> 21#include <QtCore>
22 22
23#include "bootloaderinstallbase.h" 23#include "bootloaderinstallbase.h"
24#include "bootloaderinstallmi4.h"
25#include "bootloaderinstallhex.h"
26#include "bootloaderinstallipod.h"
27#include "bootloaderinstallsansa.h"
28#include "bootloaderinstallfile.h"
29#include "bootloaderinstallchinachip.h"
30#include "bootloaderinstallams.h"
31#include "bootloaderinstalltcc.h"
24#include "utils.h" 32#include "utils.h"
25 33
26#if defined(Q_OS_MACX) 34#if defined(Q_OS_MACX)
@@ -29,6 +37,39 @@
29#include <sys/mount.h> 37#include <sys/mount.h>
30#endif 38#endif
31 39
40
41BootloaderInstallBase* BootloaderInstallBase::createBootloaderInstaller(QObject* parent,QString type)
42{
43 if(type == "mi4") {
44 return new BootloaderInstallMi4(parent);
45 }
46 else if(type == "hex") {
47 return new BootloaderInstallHex(parent);
48 }
49 else if(type == "sansa") {
50 return new BootloaderInstallSansa(parent);
51 }
52 else if(type == "ipod") {
53 return new BootloaderInstallIpod(parent);
54 }
55 else if(type == "file") {
56 return new BootloaderInstallFile(parent);
57 }
58 else if(type == "chinachip") {
59 return new BootloaderInstallChinaChip(parent);
60 }
61 else if(type == "ams") {
62 return new BootloaderInstallAms(parent);
63 }
64 else if(type == "tcc") {
65 return new BootloaderInstallTcc(parent);
66 }
67 else {
68 return NULL;
69 }
70
71}
72
32BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void) 73BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void)
33{ 74{
34 return BootloaderUnknown; 75 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
69 //! static and in the base class, so the installer classes dont need to 69 //! static and in the base class, so the installer classes dont need to
70 // be modified for new targets 70 // be modified for new targets
71 static QString postinstallHints(QString model); 71 static QString postinstallHints(QString model);
72 72
73 //! returns the correct BootloaderInstaller object for the requested type
74 static BootloaderInstallBase* createBootloaderInstaller(QObject* parent,QString type);
73 protected slots: 75 protected slots:
74 void downloadReqFinished(int id, bool error); 76 void downloadReqFinished(int id, bool error);
75 void downloadBlFinish(bool error); 77 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 @@
43#include "progressloggerinterface.h" 43#include "progressloggerinterface.h"
44 44
45#include "bootloaderinstallbase.h" 45#include "bootloaderinstallbase.h"
46#include "bootloaderinstallmi4.h"
47#include "bootloaderinstallhex.h"
48#include "bootloaderinstallipod.h"
49#include "bootloaderinstallsansa.h"
50#include "bootloaderinstallfile.h"
51#include "bootloaderinstallchinachip.h"
52#include "bootloaderinstallams.h"
53#include "bootloaderinstalltcc.h"
54 46
55 47
56#if defined(Q_OS_LINUX) 48#if defined(Q_OS_LINUX)
@@ -673,38 +665,14 @@ void RbUtilQt::installBootloader()
673 m_error = false; 665 m_error = false;
674 666
675 // create installer 667 // create installer
676 BootloaderInstallBase *bl; 668 BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
677 QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString(); 669 SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
678 if(type == "mi4") { 670 if(bl == NULL) {
679 bl = new BootloaderInstallMi4(this);
680 }
681 else if(type == "hex") {
682 bl = new BootloaderInstallHex(this);
683 }
684 else if(type == "sansa") {
685 bl = new BootloaderInstallSansa(this);
686 }
687 else if(type == "ipod") {
688 bl = new BootloaderInstallIpod(this);
689 }
690 else if(type == "file") {
691 bl = new BootloaderInstallFile(this);
692 }
693 else if(type == "chinachip") {
694 bl = new BootloaderInstallChinaChip(this);
695 }
696 else if(type == "ams") {
697 bl = new BootloaderInstallAms(this);
698 }
699 else if(type == "tcc") {
700 bl = new BootloaderInstallTcc(this);
701 }
702 else {
703 logger->addItem(tr("No install method known."), LOGERROR); 671 logger->addItem(tr("No install method known."), LOGERROR);
704 logger->setFinished(); 672 logger->setFinished();
705 return; 673 return;
706 } 674 }
707 675
708 // set bootloader filename. Do this now as installed() needs it. 676 // set bootloader filename. Do this now as installed() needs it.
709 QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList(); 677 QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
710 QStringList blfilepath; 678 QStringList blfilepath;
@@ -1015,29 +983,23 @@ void RbUtilQt::uninstallBootloader(void)
1015 QString platform = RbSettings::value(RbSettings::Platform).toString(); 983 QString platform = RbSettings::value(RbSettings::Platform).toString();
1016 984
1017 // create installer 985 // create installer
1018 BootloaderInstallBase *bl; 986 BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
1019 QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString(); 987 SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
1020 if(type == "mi4") { 988
1021 bl = new BootloaderInstallMi4(this); 989 if(bl == NULL ) {
1022 } 990 logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
1023 else if(type == "hex") { 991 logger->setFinished();
1024 bl = new BootloaderInstallHex(this); 992 return;
1025 }
1026 else if(type == "sansa") {
1027 bl = new BootloaderInstallSansa(this);
1028 }
1029 else if(type == "ipod") {
1030 bl = new BootloaderInstallIpod(this);
1031 }
1032 else if(type == "file") {
1033 bl = new BootloaderInstallFile(this);
1034 } 993 }
1035 else { 994 if( (bl->capabilities() & BootloaderInstallBase::Uninstall) == 0)
1036 logger->addItem(tr("No uninstall method known."), LOGERROR); 995 {
996 logger->addItem(tr("Rockbox Utility can not uninstall the bootloader on this target."
997 "Try a normal firmware update to remove the booloader."), LOGERROR);
1037 logger->setFinished(); 998 logger->setFinished();
999 delete bl;
1038 return; 1000 return;
1039 } 1001 }
1040 1002
1041 QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList(); 1003 QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
1042 QStringList blfilepath; 1004 QStringList blfilepath;
1043 for(int a = 0; a < blfile.size(); a++) { 1005 for(int a = 0; a < blfile.size(); a++) {