diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-05-09 18:17:05 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-05-09 18:17:05 +0000 |
commit | 9ca29354e1de9859044bdcfce0309b0509bafb90 (patch) | |
tree | 2f2a56fbea6834eee6484d2e6d5eddcf5bfc2e73 /rbutil/rbutilqt/base | |
parent | 09085a30f665a2382496bc6cddf92b8833653776 (diff) | |
download | rockbox-9ca29354e1de9859044bdcfce0309b0509bafb90.tar.gz rockbox-9ca29354e1de9859044bdcfce0309b0509bafb90.zip |
rbutil: enforce parents for bootloader install classes. and rework OF handling a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20892 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallbase.h | 35 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallfile.h | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallhex.cpp | 21 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallhex.h | 5 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallipod.h | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallmi4.h | 2 |
6 files changed, 44 insertions, 23 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.h b/rbutil/rbutilqt/base/bootloaderinstallbase.h index 0916935208..470a23a7ab 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.h +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.h | |||
@@ -24,39 +24,50 @@ | |||
24 | #include "progressloggerinterface.h" | 24 | #include "progressloggerinterface.h" |
25 | #include "httpget.h" | 25 | #include "httpget.h" |
26 | 26 | ||
27 | 27 | //! baseclass for all Bootloader installs | |
28 | class BootloaderInstallBase : public QObject | 28 | class BootloaderInstallBase : public QObject |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | |||
32 | public: | 31 | public: |
33 | enum Capability | 32 | enum Capability |
34 | { Install = 0x01, Uninstall = 0x02, Backup = 0x04, | 33 | { Install = 0x01, Uninstall = 0x02, Backup = 0x04, |
35 | IsFile = 0x08, IsRaw = 0x10, NeedsFlashing = 0x20, | 34 | IsFile = 0x08, IsRaw = 0x10, NeedsOf = 0x20, |
36 | CanCheckInstalled = 0x40, CanCheckVersion = 0x80 }; | 35 | CanCheckInstalled = 0x40, CanCheckVersion = 0x80 }; |
37 | Q_DECLARE_FLAGS(Capabilities, Capability) | 36 | Q_DECLARE_FLAGS(Capabilities, Capability) |
38 | 37 | ||
39 | enum BootloaderType | 38 | enum BootloaderType |
40 | { BootloaderNone, BootloaderRockbox, BootloaderOther, BootloaderUnknown }; | 39 | { BootloaderNone, BootloaderRockbox, BootloaderOther, BootloaderUnknown }; |
41 | 40 | ||
42 | BootloaderInstallBase(QObject *parent = 0) : QObject(parent) | 41 | BootloaderInstallBase(QObject *parent) : QObject(parent) |
43 | { } | 42 | { } |
44 | 43 | ||
45 | virtual bool install(void) | 44 | //! install the bootloader, must be implemented |
46 | { return false; } | 45 | virtual bool install(void) = 0; |
47 | virtual bool uninstall(void) | 46 | //! uninstall the bootloader, must be implemented |
48 | { return false; } | 47 | virtual bool uninstall(void) = 0; |
49 | virtual BootloaderType installed(void); | 48 | //! returns the installed bootloader |
50 | virtual Capabilities capabilities(void); | 49 | virtual BootloaderType installed(void)=0; |
50 | //! returns the capabilities of the bootloader class | ||
51 | virtual Capabilities capabilities(void)=0; | ||
52 | //! returns a OF Firmware hint or empty if there is none | ||
53 | virtual QString ofHint() {return QString();} | ||
54 | |||
55 | |||
56 | //! backup a already installed bootloader | ||
51 | bool backup(QString to); | 57 | bool backup(QString to); |
52 | 58 | ||
59 | //! set the differen filenames and paths | ||
53 | void setBlFile(QString f) | 60 | void setBlFile(QString f) |
54 | { m_blfile = f; } | 61 | { m_blfile = f; } |
55 | void setBlUrl(QUrl u) | 62 | void setBlUrl(QUrl u) |
56 | { m_blurl = u; } | 63 | { m_blurl = u; } |
57 | void setLogfile(QString f) | 64 | void setLogfile(QString f) |
58 | { m_logfile = f; } | 65 | { m_logfile = f; } |
59 | 66 | void setOfFile(QString f) | |
67 | {m_offile = f;} | ||
68 | |||
69 | //! returns a port Install Hint or empty if there is none | ||
70 | //! static and in the base class, so the installer classes dont need to be modified for new targets | ||
60 | static QString postinstallHints(QString model); | 71 | static QString postinstallHints(QString model); |
61 | 72 | ||
62 | protected slots: | 73 | protected slots: |
@@ -76,7 +87,7 @@ class BootloaderInstallBase : public QObject | |||
76 | QUrl m_blurl; //! bootloader download URL | 87 | QUrl m_blurl; //! bootloader download URL |
77 | QTemporaryFile m_tempfile; //! temporary file for download | 88 | QTemporaryFile m_tempfile; //! temporary file for download |
78 | QDateTime m_blversion; //! download timestamp used for version information | 89 | QDateTime m_blversion; //! download timestamp used for version information |
79 | 90 | QString m_offile; //! path to the offile | |
80 | signals: | 91 | signals: |
81 | void downloadDone(void); //! internal signal sent when download finished. | 92 | void downloadDone(void); //! internal signal sent when download finished. |
82 | void done(bool); | 93 | void done(bool); |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.h b/rbutil/rbutilqt/base/bootloaderinstallfile.h index 075f047ed2..f77ec7f20d 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallfile.h +++ b/rbutil/rbutilqt/base/bootloaderinstallfile.h | |||
@@ -30,7 +30,7 @@ class BootloaderInstallFile : public BootloaderInstallBase | |||
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | BootloaderInstallFile(QObject *parent = 0); | 33 | BootloaderInstallFile(QObject *parent); |
34 | bool install(void); | 34 | bool install(void); |
35 | bool uninstall(void); | 35 | bool uninstall(void); |
36 | BootloaderInstallBase::BootloaderType installed(void); | 36 | BootloaderInstallBase::BootloaderType installed(void); |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp index a52f8d0584..31659981f7 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallhex.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallhex.cpp | |||
@@ -44,10 +44,23 @@ BootloaderInstallHex::BootloaderInstallHex(QObject *parent) | |||
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | QString BootloaderInstallHex::ofHint() | ||
48 | { | ||
49 | return tr("Bootloader installation requires you to provide " | ||
50 | "a firmware file of the original firmware (hex file). " | ||
51 | "You need to download this file yourself due to legal " | ||
52 | "reasons. Please refer to the " | ||
53 | "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and the " | ||
54 | "<a href='http://www.rockbox.org/wiki/IriverBoot" | ||
55 | "#Download_and_extract_a_recent_ve'>IriverBoot</a> wiki page on " | ||
56 | "how to obtain this file.<br/>" | ||
57 | "Press Ok to continue and browse your computer for the firmware " | ||
58 | "file."); | ||
59 | } | ||
47 | 60 | ||
48 | bool BootloaderInstallHex::install(void) | 61 | bool BootloaderInstallHex::install(void) |
49 | { | 62 | { |
50 | if(m_hex.isEmpty()) | 63 | if(m_offile.isEmpty()) |
51 | return false; | 64 | return false; |
52 | m_hashindex = -1; | 65 | m_hashindex = -1; |
53 | 66 | ||
@@ -55,7 +68,7 @@ bool BootloaderInstallHex::install(void) | |||
55 | emit logItem(tr("checking MD5 hash of input file ..."), LOGINFO); | 68 | emit logItem(tr("checking MD5 hash of input file ..."), LOGINFO); |
56 | QByteArray filedata; | 69 | QByteArray filedata; |
57 | // read hex file into QByteArray | 70 | // read hex file into QByteArray |
58 | QFile file(m_hex); | 71 | QFile file(m_offile); |
59 | file.open(QIODevice::ReadOnly); | 72 | file.open(QIODevice::ReadOnly); |
60 | filedata = file.readAll(); | 73 | filedata = file.readAll(); |
61 | file.close(); | 74 | file.close(); |
@@ -97,7 +110,7 @@ bool BootloaderInstallHex::install(void) | |||
97 | emit logItem(tr("Descrambling file"), LOGINFO); | 110 | emit logItem(tr("Descrambling file"), LOGINFO); |
98 | m_descrambled.open(); | 111 | m_descrambled.open(); |
99 | int result; | 112 | int result; |
100 | result = iriver_decode(m_hex.toAscii().data(), | 113 | result = iriver_decode(m_offile.toAscii().data(), |
101 | m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE); | 114 | m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE); |
102 | qDebug() << "iriver_decode" << result; | 115 | qDebug() << "iriver_decode" << result; |
103 | 116 | ||
@@ -223,7 +236,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallHex::installed(void) | |||
223 | 236 | ||
224 | BootloaderInstallBase::Capabilities BootloaderInstallHex::capabilities(void) | 237 | BootloaderInstallBase::Capabilities BootloaderInstallHex::capabilities(void) |
225 | { | 238 | { |
226 | return (Install | NeedsFlashing); | 239 | return (Install | NeedsOf); |
227 | } | 240 | } |
228 | 241 | ||
229 | QString BootloaderInstallHex::scrambleError(int err) | 242 | QString BootloaderInstallHex::scrambleError(int err) |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallhex.h b/rbutil/rbutilqt/base/bootloaderinstallhex.h index 04b657a193..1b64d4925f 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallhex.h +++ b/rbutil/rbutilqt/base/bootloaderinstallhex.h | |||
@@ -37,12 +37,9 @@ class BootloaderInstallHex : public BootloaderInstallBase | |||
37 | bool uninstall(void); | 37 | bool uninstall(void); |
38 | BootloaderInstallBase::BootloaderType installed(void); | 38 | BootloaderInstallBase::BootloaderType installed(void); |
39 | Capabilities capabilities(void); | 39 | Capabilities capabilities(void); |
40 | 40 | QString ofHint(); | |
41 | void setHexfile(QString h) | ||
42 | { m_hex = h; } | ||
43 | 41 | ||
44 | private: | 42 | private: |
45 | QString m_hex; | ||
46 | int m_hashindex; | 43 | int m_hashindex; |
47 | int m_model; | 44 | int m_model; |
48 | QTemporaryFile m_descrambled; | 45 | QTemporaryFile m_descrambled; |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.h b/rbutil/rbutilqt/base/bootloaderinstallipod.h index 5867b754f1..7e24ae1539 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallipod.h +++ b/rbutil/rbutilqt/base/bootloaderinstallipod.h | |||
@@ -31,7 +31,7 @@ class BootloaderInstallIpod : public BootloaderInstallBase | |||
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | 32 | ||
33 | public: | 33 | public: |
34 | BootloaderInstallIpod(QObject *parent = 0); | 34 | BootloaderInstallIpod(QObject *parent); |
35 | ~BootloaderInstallIpod(); | 35 | ~BootloaderInstallIpod(); |
36 | bool install(void); | 36 | bool install(void); |
37 | bool uninstall(void); | 37 | bool uninstall(void); |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallmi4.h b/rbutil/rbutilqt/base/bootloaderinstallmi4.h index c746b0c87f..313f61ad12 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallmi4.h +++ b/rbutil/rbutilqt/base/bootloaderinstallmi4.h | |||
@@ -30,7 +30,7 @@ class BootloaderInstallMi4 : public BootloaderInstallBase | |||
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | BootloaderInstallMi4(QObject *parent = 0); | 33 | BootloaderInstallMi4(QObject *parent); |
34 | bool install(void); | 34 | bool install(void); |
35 | bool uninstall(void); | 35 | bool uninstall(void); |
36 | BootloaderInstallBase::BootloaderType installed(void); | 36 | BootloaderInstallBase::BootloaderType installed(void); |