Index: rbutil/rbutilqt/rbutilqt.cpp =================================================================== --- rbutil/rbutilqt/rbutilqt.cpp (revision 20848) +++ rbutil/rbutilqt/rbutilqt.cpp (working copy) @@ -716,21 +716,11 @@ } } - if(bl->capabilities() & BootloaderInstallBase::NeedsFlashing) + if(bl->capabilities() & BootloaderInstallBase::NeedsOf) { int ret; ret = QMessageBox::information(this, tr("Prerequisites"), - tr("Bootloader installation requires you to provide " - "a firmware file of the original firmware (hex file). " - "You need to download this file yourself due to legal " - "reasons. Please refer to the " - "manual and the " - "IriverBoot wiki page on " - "how to obtain this file.
" - "Press Ok to continue and browse your computer for the firmware " - "file."), - QMessageBox::Ok | QMessageBox::Abort); + bl->ofHint(),QMessageBox::Ok | QMessageBox::Abort); if(ret != QMessageBox::Ok) { // consider aborting an error to close window / abort automatic // installation. @@ -738,16 +728,16 @@ logger->addItem(tr("Bootloader installation aborted"), LOGINFO); return; } - // open dialog to browse to hex file - QString hexfile; - hexfile = QFileDialog::getOpenFileName(this, - tr("Select firmware file"), QDir::homePath(), "*.hex"); - if(!QFileInfo(hexfile).isReadable()) { + // open dialog to browse to of file + QString offile; + offile = QFileDialog::getOpenFileName(this, + tr("Select firmware file"), QDir::homePath()); + if(!QFileInfo(offile).isReadable()) { logger->addItem(tr("Error opening firmware file"), LOGERROR); m_error = true; return; } - ((BootloaderInstallHex*)bl)->setHexfile(hexfile); + bl->setOfFile(offile); } // the bootloader install class does NOT use any GUI stuff. @@ -788,9 +778,11 @@ // end here if automated install if(m_auto) return; - - QString msg = BootloaderInstallBase::postinstallHints( - settings->value(RbSettings::Platform).toString()); + + //get pointer to bootloader object + BootloaderInstallBase *bl = qobject_cast(QObject::sender()); + // display postInstallHints if available + QString msg = bl->postinstallHints(settings->value(RbSettings::Platform).toString()); if(!msg.isEmpty()) { QMessageBox::information(this, tr("Manual steps required"), msg); logger->close(); @@ -989,19 +981,19 @@ BootloaderInstallBase *bl; QString type = settings->value(RbSettings::CurBootloaderMethod).toString(); if(type == "mi4") { - bl = new BootloaderInstallMi4(); + bl = new BootloaderInstallMi4(this); } else if(type == "hex") { - bl = new BootloaderInstallHex(); + bl = new BootloaderInstallHex(this); } else if(type == "sansa") { - bl = new BootloaderInstallSansa(); + bl = new BootloaderInstallSansa(this); } else if(type == "ipod") { - bl = new BootloaderInstallIpod(); + bl = new BootloaderInstallIpod(this); } else if(type == "file") { - bl = new BootloaderInstallFile(); + bl = new BootloaderInstallFile(this); } else { logger->addItem(tr("No uninstall method known."), LOGERROR); Index: rbutil/rbutilqt/base/bootloaderinstallbase.cpp =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallbase.cpp (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallbase.cpp (working copy) @@ -141,47 +141,3 @@ } -//! @brief Return post install hints string. -//! @param model model string -//! @return hints. -QString BootloaderInstallBase::postinstallHints(QString model) -{ - bool hint = false; - QString msg = tr("Bootloader installation is almost complete. " - "Installation requires you to perform the " - "following steps manually:"); - - msg += "
    "; - msg += tr("
  1. Safely remove your player.
  2. "); - if(model == "h100" || model == "h120" || model == "h300") { - hint = true; - msg += tr("
  3. Reboot your player into the original firmware.
  4. " - "
  5. Perform a firmware upgrade using the update functionality " - "of the original firmware. Please refer to your player's manual " - "on details.
  6. " - "
  7. After the firmware has been updated reboot your player.
  8. "); - } - if(model == "iaudiox5" || model == "iaudiom5" - || model == "iaudiox5v" || model == "iaudiom3") { - hint = true; - msg += tr("
  9. Turn the player off
  10. " - "
  11. Insert the charger
  12. "); - } - if(model == "gigabeatf") { - hint = true; - msg += tr("
  13. Unplug USB and power adaptors
  14. " - "
  15. Hold Power to turn the player off
  16. " - "
  17. Toggle the battery switch on the player
  18. " - "
  19. Hold Power to boot into Rockbox
  20. "); - } - - msg += "
"; - msg += tr("

Note: You can safely install other parts first, but " - "the above steps are required to finish the installation!

"); - - if(hint) - return msg; - else - return QString(""); -} - Index: rbutil/rbutilqt/base/bootloaderinstallfile.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallfile.h (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallfile.h (working copy) @@ -30,11 +30,12 @@ Q_OBJECT public: - BootloaderInstallFile(QObject *parent = 0); + BootloaderInstallFile(QObject *parent); bool install(void); bool uninstall(void); BootloaderInstallBase::BootloaderType installed(void); Capabilities capabilities(void); + QString postinstallHints(QString model); private slots: void installStage2(void); Index: rbutil/rbutilqt/base/bootloaderinstallhex.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallhex.h (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallhex.h (working copy) @@ -37,12 +37,10 @@ bool uninstall(void); BootloaderInstallBase::BootloaderType installed(void); Capabilities capabilities(void); + QString ofHint(); + QString postinstallHints(QString model); - void setHexfile(QString h) - { m_hex = h; } - private: - QString m_hex; int m_hashindex; int m_model; QTemporaryFile m_descrambled; Index: rbutil/rbutilqt/base/bootloaderinstallmi4.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallmi4.h (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallmi4.h (working copy) @@ -30,7 +30,7 @@ Q_OBJECT public: - BootloaderInstallMi4(QObject *parent = 0); + BootloaderInstallMi4(QObject *parent); bool install(void); bool uninstall(void); BootloaderInstallBase::BootloaderType installed(void); Index: rbutil/rbutilqt/base/bootloaderinstallipod.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallipod.h (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallipod.h (working copy) @@ -31,7 +31,7 @@ Q_OBJECT public: - BootloaderInstallIpod(QObject *parent = 0); + BootloaderInstallIpod(QObject *parent); ~BootloaderInstallIpod(); bool install(void); bool uninstall(void); Index: rbutil/rbutilqt/base/bootloaderinstallfile.cpp =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallfile.cpp (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallfile.cpp (working copy) @@ -144,3 +144,29 @@ return Install | IsFile | CanCheckInstalled | Backup; } +QString BootloaderInstallFile::postinstallHints(QString model) +{ + QString msg = tr("Bootloader installation is almost complete. " + "Installation requires you to perform the " + "following steps manually:"); + + msg += "
    "; + msg += tr("
  1. Safely remove your player.
  2. "); + if(model == "iaudiox5" || model == "iaudiom5" + || model == "iaudiox5v" || model == "iaudiom3") { + msg += tr("
  3. Turn the player off
  4. " + "
  5. Insert the charger
  6. "); + } + if(model == "gigabeatf") { + msg += tr("
  7. Unplug USB and power adaptors
  8. " + "
  9. Hold Power to turn the player off
  10. " + "
  11. Toggle the battery switch on the player
  12. " + "
  13. Hold Power to boot into Rockbox
  14. "); + } + + msg += "
"; + msg += tr("

Note: You can safely install other parts first, but " + "the above steps are required to finish the installation!

"); + return msg; +} + Index: rbutil/rbutilqt/base/bootloaderinstallbase.h =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallbase.h (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallbase.h (working copy) @@ -24,41 +24,49 @@ #include "progressloggerinterface.h" #include "httpget.h" - +//! baseclass for all Bootloader installs class BootloaderInstallBase : public QObject { Q_OBJECT - public: enum Capability { Install = 0x01, Uninstall = 0x02, Backup = 0x04, - IsFile = 0x08, IsRaw = 0x10, NeedsFlashing = 0x20, + IsFile = 0x08, IsRaw = 0x10, NeedsOf = 0x20, CanCheckInstalled = 0x40, CanCheckVersion = 0x80 }; Q_DECLARE_FLAGS(Capabilities, Capability) enum BootloaderType { BootloaderNone, BootloaderRockbox, BootloaderOther, BootloaderUnknown }; - BootloaderInstallBase(QObject *parent = 0) : QObject(parent) + BootloaderInstallBase(QObject *parent) : QObject(parent) { } - virtual bool install(void) - { return false; } - virtual bool uninstall(void) - { return false; } - virtual BootloaderType installed(void); - virtual Capabilities capabilities(void); + //! install the bootloader, must be implemented + virtual bool install(void) = 0; + //! uninstall the bootloader, must be implemented + virtual bool uninstall(void) = 0; + //! returns the installed bootloader + virtual BootloaderType installed(void)=0; + //! returns the capabilities of the bootloader class + virtual Capabilities capabilities(void)=0; + //! returns a port Install Hint or empty if there is none + virtual QString postinstallHints(QString model) {return QString();} + //! returns a OF Firmware hint or empty if there is none + virtual QString ofHint() {return QString();} + + //! backup a already installed bootloader bool backup(QString to); + //! set the differen filenames and paths void setBlFile(QString f) { m_blfile = f; } void setBlUrl(QUrl u) { m_blurl = u; } void setLogfile(QString f) { m_logfile = f; } - - static QString postinstallHints(QString model); - + void setOfFile(QString f) + {m_offile = f;} + protected slots: void downloadReqFinished(int id, bool error); void downloadBlFinish(bool error); @@ -76,7 +84,7 @@ QUrl m_blurl; //! bootloader download URL QTemporaryFile m_tempfile; //! temporary file for download QDateTime m_blversion; //! download timestamp used for version information - + QString m_offile; //! path to the offile signals: void downloadDone(void); //! internal signal sent when download finished. void done(bool); Index: rbutil/rbutilqt/base/bootloaderinstallhex.cpp =================================================================== --- rbutil/rbutilqt/base/bootloaderinstallhex.cpp (revision 20848) +++ rbutil/rbutilqt/base/bootloaderinstallhex.cpp (working copy) @@ -44,10 +44,23 @@ { } +QString BootloaderInstallHex::ofHint() +{ + return tr("Bootloader installation requires you to provide " + "a firmware file of the original firmware (hex file). " + "You need to download this file yourself due to legal " + "reasons. Please refer to the " + "manual and the " + "IriverBoot wiki page on " + "how to obtain this file.
" + "Press Ok to continue and browse your computer for the firmware " + "file."); +} bool BootloaderInstallHex::install(void) { - if(m_hex.isEmpty()) + if(m_offile.isEmpty()) return false; m_hashindex = -1; @@ -55,7 +68,7 @@ emit logItem(tr("checking MD5 hash of input file ..."), LOGINFO); QByteArray filedata; // read hex file into QByteArray - QFile file(m_hex); + QFile file(m_offile); file.open(QIODevice::ReadOnly); filedata = file.readAll(); file.close(); @@ -97,7 +110,7 @@ emit logItem(tr("Descrambling file"), LOGINFO); m_descrambled.open(); int result; - result = iriver_decode(m_hex.toAscii().data(), + result = iriver_decode(m_offile.toAscii().data(), m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE); qDebug() << "iriver_decode" << result; @@ -223,7 +236,7 @@ BootloaderInstallBase::Capabilities BootloaderInstallHex::capabilities(void) { - return (Install | NeedsFlashing); + return (Install | NeedsOf); } QString BootloaderInstallHex::scrambleError(int err) @@ -243,3 +256,21 @@ return error; } +QString BootloaderInstallHex::postinstallHints(QString model) +{ + QString msg = tr("Bootloader installation is almost complete. " + "Installation requires you to perform the " + "following steps manually:"); + + msg += "
    "; + msg += tr("
  1. Safely remove your player.
  2. "); + msg += tr("
  3. Reboot your player into the original firmware.
  4. " + "
  5. Perform a firmware upgrade using the update functionality " + "of the original firmware. Please refer to your player's manual " + "on details.
  6. " + "
  7. After the firmware has been updated reboot your player.
  8. "); + msg += "
"; + msg += tr("

Note: You can safely install other parts first, but " + "the above steps are required to finish the installation!

"); + return msg; +}