summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-01 10:09:14 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-01 10:49:48 +0200
commit92ef7bd3289a5c4d15bd0de6fb8950af4036891b (patch)
tree70cd94f5908325da884d7093488002206941ba5e /rbutil/rbutilqt/base
parent0dd200b33a624131190b0cffffb00a1cf4f7fd41 (diff)
downloadrockbox-92ef7bd3289a5c4d15bd0de6fb8950af4036891b.tar.gz
rockbox-92ef7bd3289a5c4d15bd0de6fb8950af4036891b.zip
Move bootloader class initialiation into helper.
Create a BootloaderInstallHelper class for handling post installation hints and creating the installation instance depending on the player model. This removes the base class handling its derived classes which always has been weird, and removes the need to change the base class when adding a new installation method, since the base shouldn't be affected. Change-Id: I2a156d70fd1cff6c48bdd46d10c33d75c953ea90
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp113
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallhelper.cpp133
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallhelper.h36
3 files changed, 172 insertions, 110 deletions
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 <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 "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 <b>requires</b> you to perform the "
- "following steps manually:");
-
- msg += "<ol>";
- if(model != "sansafuzeplus") {
- msg += tr("<li>Safely remove your player.</li>");
- }
- if(model == "iriverh100" || model == "iriverh120" || model == "iriverh300" ||
- model == "ondavx747") {
- hint = true;
- msg += tr("<li>Reboot your player into the original firmware.</li>"
- "<li>Perform a firmware upgrade using the update functionality "
- "of the original firmware. Please refer to your player's manual "
- "on details.<br/><b>Important:</b> updating the firmware is a "
- "critical process that must not be interrupted. <b>Make sure the "
- "player is charged before starting the firmware update "
- "process.</b></li>"
- "<li>After the firmware has been updated reboot your player.</li>");
- }
- if(model == "sansafuzeplus") {
- hint = true;
- msg += tr("<li>Remove any previously inserted microSD card</li>");
- msg += tr("<li>Disconnect your player. The player will reboot and "
- "perform an update of the original firmware. "
- "Please refer to your players manual on details.<br/>"
- "<b>Important:</b> updating the firmware is a "
- "critical process that must not be interrupted. <b>Make sure the "
- "player is charged before disconnecting the player.</b></li>"
- "<li>After the firmware has been updated reboot your player.</li>");
- }
- if(model == "iaudiox5" || model == "iaudiom5"
- || model == "iaudiox5v" || model == "iaudiom3" || model == "mpioh200") {
- hint = true;
- msg += tr("<li>Turn the player off</li>"
- "<li>Insert the charger</li>");
- }
- if(model == "gigabeatf") {
- hint = true;
- msg += tr("<li>Unplug USB and power adaptors</li>"
- "<li>Hold <i>Power</i> to turn the player off</li>"
- "<li>Toggle the battery switch on the player</li>"
- "<li>Hold <i>Power</i> to boot into Rockbox</li>");
- }
- msg += "</ol>";
- msg += tr("<p><b>Note:</b> You can safely install other parts first, but "
- "the above steps are <b>required</b> to finish the installation!</p>");
-
- 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 <QtCore>
+
+#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 <b>requires</b> you to perform the "
+ "following steps manually:");
+
+ msg += "<ol>";
+ if(model != "sansafuzeplus") {
+ msg += QObject::tr("<li>Safely remove your player.</li>");
+ }
+ if(model == "iriverh100" || model == "iriverh120" || model == "iriverh300" ||
+ model == "ondavx747") {
+ hint = true;
+ msg += QObject::tr("<li>Reboot your player into the original firmware.</li>"
+ "<li>Perform a firmware upgrade using the update functionality "
+ "of the original firmware. Please refer to your player's manual "
+ "on details.<br/><b>Important:</b> updating the firmware is a "
+ "critical process that must not be interrupted. <b>Make sure the "
+ "player is charged before starting the firmware update "
+ "process.</b></li>"
+ "<li>After the firmware has been updated reboot your player.</li>");
+ }
+ if(model == "sansafuzeplus") {
+ hint = true;
+ msg += QObject::tr("<li>Remove any previously inserted microSD card</li>");
+ msg += QObject::tr("<li>Disconnect your player. The player will reboot and "
+ "perform an update of the original firmware. "
+ "Please refer to your players manual on details.<br/>"
+ "<b>Important:</b> updating the firmware is a "
+ "critical process that must not be interrupted. <b>Make sure the "
+ "player is charged before disconnecting the player.</b></li>"
+ "<li>After the firmware has been updated reboot your player.</li>");
+ }
+ if(model == "iaudiox5" || model == "iaudiom5"
+ || model == "iaudiox5v" || model == "iaudiom3" || model == "mpioh200") {
+ hint = true;
+ msg += QObject::tr("<li>Turn the player off</li>"
+ "<li>Insert the charger</li>");
+ }
+ if(model == "gigabeatf") {
+ hint = true;
+ msg += QObject::tr("<li>Unplug USB and power adaptors</li>"
+ "<li>Hold <i>Power</i> to turn the player off</li>"
+ "<li>Toggle the battery switch on the player</li>"
+ "<li>Hold <i>Power</i> to boot into Rockbox</li>");
+ }
+ msg += "</ol>";
+ msg += QObject::tr("<p><b>Note:</b> You can safely install other parts first, but "
+ "the above steps are <b>required</b> to finish the installation!</p>");
+
+ 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 <QtCore>
+#include "bootloaderinstallbase.h"
+
+class BootloaderInstallHelper : public QObject
+{
+ Q_OBJECT
+ public:
+ static BootloaderInstallBase* createBootloaderInstaller(QObject* parent, QString type);
+ static QString postinstallHints(QString model);
+};
+
+#endif
+