summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/bootloaderinstallhelper.cpp
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/bootloaderinstallhelper.cpp
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/bootloaderinstallhelper.cpp')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallhelper.cpp133
1 files changed, 133 insertions, 0 deletions
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2012 Dominik Riebeling
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 * This file is a modified version of the AMS installer by Dominik Wenger
18 *
19 ****************************************************************************/
20
21#include <QtCore>
22
23#include "bootloaderinstallhelper.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"
32#include "bootloaderinstallmpio.h"
33#include "bootloaderinstallimx.h"
34
35BootloaderInstallBase* BootloaderInstallHelper::createBootloaderInstaller(QObject* parent, QString type)
36{
37 if(type == "mi4") {
38 return new BootloaderInstallMi4(parent);
39 }
40 else if(type == "hex") {
41 return new BootloaderInstallHex(parent);
42 }
43 else if(type == "sansa") {
44 return new BootloaderInstallSansa(parent);
45 }
46 else if(type == "ipod") {
47 return new BootloaderInstallIpod(parent);
48 }
49 else if(type == "file") {
50 return new BootloaderInstallFile(parent);
51 }
52 else if(type == "chinachip") {
53 return new BootloaderInstallChinaChip(parent);
54 }
55 else if(type == "ams") {
56 return new BootloaderInstallAms(parent);
57 }
58 else if(type == "tcc") {
59 return new BootloaderInstallTcc(parent);
60 }
61 else if(type == "mpio") {
62 return new BootloaderInstallMpio(parent);
63 }
64 else if(type == "imx") {
65 return new BootloaderInstallImx(parent);
66 }
67 else {
68 return NULL;
69 }
70
71}
72
73
74//! @brief Return post install hints string.
75//! @param model model string
76//! @return hints.
77QString BootloaderInstallHelper::postinstallHints(QString model)
78{
79 bool hint = false;
80 QString msg = QObject::tr("Bootloader installation is almost complete. "
81 "Installation <b>requires</b> you to perform the "
82 "following steps manually:");
83
84 msg += "<ol>";
85 if(model != "sansafuzeplus") {
86 msg += QObject::tr("<li>Safely remove your player.</li>");
87 }
88 if(model == "iriverh100" || model == "iriverh120" || model == "iriverh300" ||
89 model == "ondavx747") {
90 hint = true;
91 msg += QObject::tr("<li>Reboot your player into the original firmware.</li>"
92 "<li>Perform a firmware upgrade using the update functionality "
93 "of the original firmware. Please refer to your player's manual "
94 "on details.<br/><b>Important:</b> updating the firmware is a "
95 "critical process that must not be interrupted. <b>Make sure the "
96 "player is charged before starting the firmware update "
97 "process.</b></li>"
98 "<li>After the firmware has been updated reboot your player.</li>");
99 }
100 if(model == "sansafuzeplus") {
101 hint = true;
102 msg += QObject::tr("<li>Remove any previously inserted microSD card</li>");
103 msg += QObject::tr("<li>Disconnect your player. The player will reboot and "
104 "perform an update of the original firmware. "
105 "Please refer to your players manual on details.<br/>"
106 "<b>Important:</b> updating the firmware is a "
107 "critical process that must not be interrupted. <b>Make sure the "
108 "player is charged before disconnecting the player.</b></li>"
109 "<li>After the firmware has been updated reboot your player.</li>");
110 }
111 if(model == "iaudiox5" || model == "iaudiom5"
112 || model == "iaudiox5v" || model == "iaudiom3" || model == "mpioh200") {
113 hint = true;
114 msg += QObject::tr("<li>Turn the player off</li>"
115 "<li>Insert the charger</li>");
116 }
117 if(model == "gigabeatf") {
118 hint = true;
119 msg += QObject::tr("<li>Unplug USB and power adaptors</li>"
120 "<li>Hold <i>Power</i> to turn the player off</li>"
121 "<li>Toggle the battery switch on the player</li>"
122 "<li>Hold <i>Power</i> to boot into Rockbox</li>");
123 }
124 msg += "</ol>";
125 msg += QObject::tr("<p><b>Note:</b> You can safely install other parts first, but "
126 "the above steps are <b>required</b> to finish the installation!</p>");
127
128 if(hint)
129 return msg;
130 else
131 return QString();
132}
133