diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp index 87e414413d..72c7526241 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp @@ -20,16 +20,6 @@ #include #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 "bootloaderinstallmpio.h" -#include "bootloaderinstallimx.h" #include "utils.h" #include "ziputil.h" @@ -40,44 +30,6 @@ #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 if(type == "mpio") { - return new BootloaderInstallMpio(parent); - } - else if(type == "imx") { - return new BootloaderInstallImx(parent); - } - else { - return NULL; - } - -} - BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void) { return BootloaderUnknown; @@ -142,6 +94,7 @@ void BootloaderInstallBase::downloadBlFinish(bool error) emit downloadDone(); } + void BootloaderInstallBase::installBlfile(void) { qDebug() << "[BootloaderInstallBase] installBlFile(void)"; @@ -151,7 +104,6 @@ void BootloaderInstallBase::installBlfile(void) //! @brief backup OF file. //! @param to folder to write backup file to. Folder will get created. //! @return true on success, false on error. - bool BootloaderInstallBase::backup(QString to) { qDebug() << "[BootloaderInstallBase] Backing up bootloader file"; @@ -198,67 +150,6 @@ int BootloaderInstallBase::logInstall(LogMode mode) } -//! @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 += "
    "; - if(model != "sansafuzeplus") { - msg += tr("
  1. Safely remove your player.
  2. "); - } - if(model == "iriverh100" || model == "iriverh120" || model == "iriverh300" || - model == "ondavx747") { - 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.
    Important: updating the firmware is a " - "critical process that must not be interrupted. Make sure the " - "player is charged before starting the firmware update " - "process.
  6. " - "
  7. After the firmware has been updated reboot your player.
  8. "); - } - if(model == "sansafuzeplus") { - hint = true; - msg += tr("
  9. Remove any previously inserted microSD card
  10. "); - msg += tr("
  11. Disconnect your player. The player will reboot and " - "perform an update of the original firmware. " - "Please refer to your players manual on details.
    " - "Important: updating the firmware is a " - "critical process that must not be interrupted. Make sure the " - "player is charged before disconnecting the player.
  12. " - "
  13. After the firmware has been updated reboot your player.
  14. "); - } - if(model == "iaudiox5" || model == "iaudiom5" - || model == "iaudiox5v" || model == "iaudiom3" || model == "mpioh200") { - hint = true; - msg += tr("
  15. Turn the player off
  16. " - "
  17. Insert the charger
  18. "); - } - if(model == "gigabeatf") { - hint = true; - msg += tr("
  19. Unplug USB and power adaptors
  20. " - "
  21. Hold Power to turn the player off
  22. " - "
  23. Toggle the battery switch on the player
  24. " - "
  25. Hold Power to boot into Rockbox
  26. "); - } - 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(""); -} - - #if defined(Q_OS_MACX) void BootloaderInstallBase::waitRemount() { @@ -320,6 +211,7 @@ void BootloaderInstallBase::setBlFile(QStringList sl) } } + bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) { bool found = false; @@ -360,3 +252,4 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile) } return found; } + diff --git a/rbutil/rbutilqt/base/bootloaderinstallhelper.cpp b/rbutil/rbutilqt/base/bootloaderinstallhelper.cpp new file mode 100644 index 0000000000..fe962d2b1d --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstallhelper.cpp @@ -0,0 +1,133 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2012 Dominik Riebeling + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * This file is a modified version of the AMS installer by Dominik Wenger + * + ****************************************************************************/ + +#include + +#include "bootloaderinstallhelper.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 "bootloaderinstallmpio.h" +#include "bootloaderinstallimx.h" + +BootloaderInstallBase* BootloaderInstallHelper::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 if(type == "mpio") { + return new BootloaderInstallMpio(parent); + } + else if(type == "imx") { + return new BootloaderInstallImx(parent); + } + else { + return NULL; + } + +} + + +//! @brief Return post install hints string. +//! @param model model string +//! @return hints. +QString BootloaderInstallHelper::postinstallHints(QString model) +{ + bool hint = false; + QString msg = QObject::tr("Bootloader installation is almost complete. " + "Installation requires you to perform the " + "following steps manually:"); + + msg += "
    "; + if(model != "sansafuzeplus") { + msg += QObject::tr("
  1. Safely remove your player.
  2. "); + } + if(model == "iriverh100" || model == "iriverh120" || model == "iriverh300" || + model == "ondavx747") { + hint = true; + msg += QObject::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.
    Important: updating the firmware is a " + "critical process that must not be interrupted. Make sure the " + "player is charged before starting the firmware update " + "process.
  6. " + "
  7. After the firmware has been updated reboot your player.
  8. "); + } + if(model == "sansafuzeplus") { + hint = true; + msg += QObject::tr("
  9. Remove any previously inserted microSD card
  10. "); + msg += QObject::tr("
  11. Disconnect your player. The player will reboot and " + "perform an update of the original firmware. " + "Please refer to your players manual on details.
    " + "Important: updating the firmware is a " + "critical process that must not be interrupted. Make sure the " + "player is charged before disconnecting the player.
  12. " + "
  13. After the firmware has been updated reboot your player.
  14. "); + } + if(model == "iaudiox5" || model == "iaudiom5" + || model == "iaudiox5v" || model == "iaudiom3" || model == "mpioh200") { + hint = true; + msg += QObject::tr("
  15. Turn the player off
  16. " + "
  17. Insert the charger
  18. "); + } + if(model == "gigabeatf") { + hint = true; + msg += QObject::tr("
  19. Unplug USB and power adaptors
  20. " + "
  21. Hold Power to turn the player off
  22. " + "
  23. Toggle the battery switch on the player
  24. " + "
  25. Hold Power to boot into Rockbox
  26. "); + } + msg += "
"; + msg += QObject::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(); +} + diff --git a/rbutil/rbutilqt/base/bootloaderinstallhelper.h b/rbutil/rbutilqt/base/bootloaderinstallhelper.h new file mode 100644 index 0000000000..c89444d7a7 --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstallhelper.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2012 Dominik Riebeling + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * This file is a modified version of the AMS installer by Dominik Wenger + * + ****************************************************************************/ + +#ifndef BOOTLOADERINSTALLHELPER_H +#define BOOTLOADERINSTALLHELPER_H + +#include +#include "bootloaderinstallbase.h" + +class BootloaderInstallHelper : public QObject +{ + Q_OBJECT + public: + static BootloaderInstallBase* createBootloaderInstaller(QObject* parent, QString type); + static QString postinstallHints(QString model); +}; + +#endif + diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 4836cf567d..683f17c0af 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -44,7 +44,7 @@ #include "progressloggerinterface.h" #include "bootloaderinstallbase.h" -#include "bootloaderinstallmpio.h" +#include "bootloaderinstallhelper.h" #if defined(Q_OS_LINUX) #include @@ -673,8 +673,9 @@ void RbUtilQt::installBootloader() m_error = false; // create installer - BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this, - SystemInfo::value(SystemInfo::CurBootloaderMethod).toString()); + BootloaderInstallBase *bl = + BootloaderInstallHelper::createBootloaderInstaller(this, + SystemInfo::value(SystemInfo::CurBootloaderMethod).toString()); if(bl == NULL) { logger->addItem(tr("No install method known."), LOGERROR); logger->setFinished(); @@ -806,7 +807,7 @@ void RbUtilQt::installBootloaderPost(bool error) if(m_auto) return; - QString msg = BootloaderInstallBase::postinstallHints( + QString msg = BootloaderInstallHelper::postinstallHints( RbSettings::value(RbSettings::Platform).toString()); if(!msg.isEmpty()) { QMessageBox::information(this, tr("Manual steps required"), msg); @@ -1048,10 +1049,11 @@ void RbUtilQt::uninstallBootloader(void) QString platform = RbSettings::value(RbSettings::Platform).toString(); // create installer - BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this, - SystemInfo::value(SystemInfo::CurBootloaderMethod).toString()); + BootloaderInstallBase *bl + = BootloaderInstallHelper::createBootloaderInstaller(this, + SystemInfo::value(SystemInfo::CurBootloaderMethod).toString()); - if(bl == NULL ) { + if(bl == NULL) { logger->addItem(tr("No uninstall method for this target known."), LOGERROR); logger->setFinished(); return; diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri index 86813c4abe..6a74a7c52f 100644 --- a/rbutil/rbutilqt/rbutilqt.pri +++ b/rbutil/rbutilqt/rbutilqt.pri @@ -56,6 +56,7 @@ SOURCES += \ sysinfo.cpp \ systrace.cpp \ base/bootloaderinstallbase.cpp \ + base/bootloaderinstallhelper.cpp \ base/bootloaderinstallmi4.cpp \ base/bootloaderinstallhex.cpp \ base/bootloaderinstallipod.cpp \ @@ -123,6 +124,7 @@ HEADERS += \ base/system.h \ systrace.h \ base/bootloaderinstallbase.h \ + base/bootloaderinstallhelper.h \ base/bootloaderinstallmi4.h \ base/bootloaderinstallhex.h \ base/bootloaderinstallipod.h \