diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2007-07-27 22:46:49 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2007-07-27 22:46:49 +0000 |
commit | 64f36a19e43b771a410ece775cba7f4dbe5ad4e1 (patch) | |
tree | 5765d16834b1f08adcf14ee4c30fe67dfcf7e103 | |
parent | 794c9684307ecab734e24d7f41e8ec5954dd0cd3 (diff) | |
download | rockbox-64f36a19e43b771a410ece775cba7f4dbe5ad4e1.tar.gz rockbox-64f36a19e43b771a410ece775cba7f4dbe5ad4e1.zip |
rbutilQt: first attempt for bootloader installation. Sansa and irivers are still missing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14032 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/rbutilqt/installbl.cpp | 124 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbl.h | 66 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbootloader.cpp | 702 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbootloader.h | 94 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbootloaderfrm.ui | 108 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 18 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.h | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 27 |
8 files changed, 1137 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/installbl.cpp b/rbutil/rbutilqt/installbl.cpp new file mode 100644 index 0000000000..eae8fc20f6 --- /dev/null +++ b/rbutil/rbutilqt/installbl.cpp | |||
@@ -0,0 +1,124 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id: installbl.cpp 14027 2007-07-27 17:42:49Z domonoky $ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "installbl.h" | ||
21 | #include "ui_installfrm.h" | ||
22 | #include "ui_installprogressfrm.h" | ||
23 | |||
24 | |||
25 | InstallBl::InstallBl(QWidget *parent) : QDialog(parent) | ||
26 | { | ||
27 | ui.setupUi(this); | ||
28 | connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder())); | ||
29 | } | ||
30 | |||
31 | void InstallBl::setProxy(QUrl proxy_url) | ||
32 | { | ||
33 | proxy = proxy_url; | ||
34 | qDebug() << "Install::setProxy" << proxy; | ||
35 | } | ||
36 | |||
37 | void InstallBl::setMountPoint(QString mount) | ||
38 | { | ||
39 | QFileInfo m(mount); | ||
40 | if(m.isDir()) { | ||
41 | ui.lineMountPoint->clear(); | ||
42 | ui.lineMountPoint->insert(mount); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | void InstallBl::browseFolder() | ||
47 | { | ||
48 | QFileDialog browser(this); | ||
49 | if(QFileInfo(ui.lineMountPoint->text()).isDir()) | ||
50 | browser.setDirectory(ui.lineMountPoint->text()); | ||
51 | else | ||
52 | browser.setDirectory("/media"); | ||
53 | browser.setReadOnly(true); | ||
54 | browser.setFileMode(QFileDialog::DirectoryOnly); | ||
55 | browser.setAcceptMode(QFileDialog::AcceptOpen); | ||
56 | if(browser.exec()) { | ||
57 | qDebug() << browser.directory(); | ||
58 | QStringList files = browser.selectedFiles(); | ||
59 | setMountPoint(files.at(0)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void InstallBl::accept() | ||
64 | { | ||
65 | QDialog *downloadProgress = new QDialog(this); | ||
66 | dp.setupUi(downloadProgress); | ||
67 | // connect close button now as it's needed if we break upon an error | ||
68 | connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); | ||
69 | // show dialog with error if mount point is wrong | ||
70 | if(QFileInfo(ui.lineMountPoint->text()).isDir()) { | ||
71 | mountPoint = ui.lineMountPoint->text(); | ||
72 | userSettings->setValue("defaults/mountpoint", mountPoint); | ||
73 | } | ||
74 | else { | ||
75 | dp.listProgress->addItem(tr("Mount point is wrong!")); | ||
76 | dp.buttonAbort->setText(tr("&Ok")); | ||
77 | downloadProgress->show(); | ||
78 | return; | ||
79 | } | ||
80 | userSettings->sync(); | ||
81 | |||
82 | binstaller = new BootloaderInstaller(this); | ||
83 | |||
84 | binstaller->setMountPoint(mountPoint); | ||
85 | binstaller->setProxy(proxy); | ||
86 | QString plattform = userSettings->value("defaults/platform").toString(); | ||
87 | |||
88 | binstaller->setDevice(plattform); | ||
89 | binstaller->setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString()); | ||
90 | binstaller->setBootloaderName(devices->value(plattform + "/bootloadername").toString()); | ||
91 | binstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString()); | ||
92 | |||
93 | binstaller->install(&dp); | ||
94 | |||
95 | connect(binstaller, SIGNAL(done(bool)), this, SLOT(done(bool))); | ||
96 | |||
97 | downloadProgress->show(); | ||
98 | } | ||
99 | |||
100 | |||
101 | void InstallBl::done(bool error) | ||
102 | { | ||
103 | qDebug() << "Install::done, error:" << error; | ||
104 | |||
105 | if(error) | ||
106 | { | ||
107 | connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close())); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close())); | ||
112 | delete binstaller; | ||
113 | } | ||
114 | |||
115 | void InstallBl::setDeviceSettings(QSettings *dev) | ||
116 | { | ||
117 | devices = dev; | ||
118 | qDebug() << "Install::setDeviceSettings:" << devices; | ||
119 | } | ||
120 | |||
121 | void InstallBl::setUserSettings(QSettings *user) | ||
122 | { | ||
123 | userSettings = user; | ||
124 | } | ||
diff --git a/rbutil/rbutilqt/installbl.h b/rbutil/rbutilqt/installbl.h new file mode 100644 index 0000000000..927cfa9b10 --- /dev/null +++ b/rbutil/rbutilqt/installbl.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id: installbl.h 14027 2007-07-27 17:42:49Z domonoky $ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef INSTALLBL_H | ||
21 | #define INSTALLBL_H | ||
22 | |||
23 | #include <QtGui> | ||
24 | |||
25 | #include <QSettings> | ||
26 | |||
27 | #include "ui_installbootloaderfrm.h" | ||
28 | #include "ui_installprogressfrm.h" | ||
29 | |||
30 | #include "installbootloader.h" | ||
31 | |||
32 | class InstallBl : public QDialog | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | public: | ||
36 | InstallBl(QWidget *parent = 0); | ||
37 | void setProxy(QUrl); | ||
38 | void setMountPoint(QString); | ||
39 | void setUserSettings(QSettings*); | ||
40 | void setDeviceSettings(QSettings*); | ||
41 | |||
42 | public slots: | ||
43 | void accept(void); | ||
44 | |||
45 | private: | ||
46 | Ui::InstallBootloaderFrm ui; | ||
47 | Ui::InstallProgressFrm dp; | ||
48 | QUrl proxy; | ||
49 | QSettings *devices; | ||
50 | QSettings *userSettings; | ||
51 | QDialog *downloadProgress; | ||
52 | QHttp *download; | ||
53 | QFile *target; | ||
54 | QString file; | ||
55 | QString fileName; | ||
56 | QString mountPoint; | ||
57 | BootloaderInstaller* binstaller; | ||
58 | |||
59 | private slots: | ||
60 | void browseFolder(void); | ||
61 | void done(bool); | ||
62 | |||
63 | }; | ||
64 | |||
65 | |||
66 | #endif | ||
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp new file mode 100644 index 0000000000..5c278ee5a7 --- /dev/null +++ b/rbutil/rbutilqt/installbootloader.cpp | |||
@@ -0,0 +1,702 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id: installbootloader.cpp 13990 2007-07-25 22:26:10Z Dominik Wenger $ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "installbootloader.h" | ||
21 | |||
22 | BootloaderInstaller::BootloaderInstaller(QObject* parent): QObject(parent) | ||
23 | { | ||
24 | |||
25 | } | ||
26 | |||
27 | void BootloaderInstaller::install(Ui::InstallProgressFrm* dp) | ||
28 | { | ||
29 | m_dp = dp; | ||
30 | m_install = true; | ||
31 | m_dp->listProgress->addItem(tr("Starting bootloader installation")); | ||
32 | |||
33 | if(m_bootloadermethod == "gigabeatf") | ||
34 | { | ||
35 | // connect internal signal | ||
36 | connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare())); | ||
37 | connect(this,SIGNAL(finish()),this,SLOT(gigabeatFinish())); | ||
38 | } | ||
39 | else if(m_bootloadermethod == "iaudio") | ||
40 | { | ||
41 | // connect internal signal | ||
42 | connect(this,SIGNAL(prepare()),this,SLOT(iaudioPrepare())); | ||
43 | connect(this,SIGNAL(finish()),this,SLOT(iaudioFinish())); | ||
44 | } | ||
45 | else if(m_bootloadermethod == "h10") | ||
46 | { | ||
47 | // connect internal signal | ||
48 | connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare())); | ||
49 | connect(this,SIGNAL(finish()),this,SLOT(h10Finish())); | ||
50 | } | ||
51 | else if(m_bootloadermethod == "ipodpatcher") | ||
52 | { | ||
53 | // connect internal signal | ||
54 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); | ||
55 | connect(this,SIGNAL(finish()),this,SLOT(ipodFinish())); | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | m_dp->listProgress->addItem(tr("unsupported install Method")); | ||
60 | emit done(true); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | emit prepare(); | ||
65 | } | ||
66 | |||
67 | void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp) | ||
68 | { | ||
69 | m_dp = dp; | ||
70 | m_install = false; | ||
71 | m_dp->listProgress->addItem(tr("Starting bootloader uninstallation")); | ||
72 | |||
73 | if(m_bootloadermethod == "gigabeatf") | ||
74 | { | ||
75 | // connect internal signal | ||
76 | connect(this,SIGNAL(prepare()),this,SLOT(gigabeatPrepare())); | ||
77 | } | ||
78 | else if(m_bootloadermethod == "iaudio") | ||
79 | { | ||
80 | m_dp->listProgress->addItem(tr("No uninstallation possible")); | ||
81 | emit done(true); | ||
82 | return; | ||
83 | } | ||
84 | else if(m_bootloadermethod == "iaudio") | ||
85 | { | ||
86 | // connect internal signal | ||
87 | connect(this,SIGNAL(prepare()),this,SLOT(h10Prepare())); | ||
88 | } | ||
89 | else if(m_bootloadermethod == "ipodpatcher") | ||
90 | { | ||
91 | // connect internal signal | ||
92 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); | ||
93 | } | ||
94 | else | ||
95 | { | ||
96 | m_dp->listProgress->addItem(tr("unsupported install Method")); | ||
97 | emit done(true); | ||
98 | return; | ||
99 | } | ||
100 | |||
101 | emit prepare(); | ||
102 | } | ||
103 | |||
104 | void BootloaderInstaller::downloadRequestFinished(int id, bool error) | ||
105 | { | ||
106 | qDebug() << "BootloaderInstall::downloadRequestFinished" << id << error; | ||
107 | qDebug() << "error:" << getter->errorString(); | ||
108 | |||
109 | downloadDone(error); | ||
110 | } | ||
111 | |||
112 | void BootloaderInstaller::downloadDone(bool error) | ||
113 | { | ||
114 | qDebug() << "Install::downloadDone, error:" << error; | ||
115 | |||
116 | // update progress bar | ||
117 | |||
118 | int max = m_dp->progressBar->maximum(); | ||
119 | if(max == 0) { | ||
120 | max = 100; | ||
121 | m_dp->progressBar->setMaximum(max); | ||
122 | } | ||
123 | m_dp->progressBar->setValue(max); | ||
124 | if(getter->httpResponse() != 200) { | ||
125 | m_dp->listProgress->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse())); | ||
126 | m_dp->buttonAbort->setText(tr("&Ok")); | ||
127 | emit done(true); | ||
128 | return; | ||
129 | } | ||
130 | if(error) { | ||
131 | m_dp->listProgress->addItem(tr("Download error: %1").arg(getter->errorString())); | ||
132 | m_dp->buttonAbort->setText(tr("&Ok")); | ||
133 | emit done(true); | ||
134 | return; | ||
135 | } | ||
136 | else m_dp->listProgress->addItem(tr("Download finished.")); | ||
137 | |||
138 | emit finish(); | ||
139 | |||
140 | } | ||
141 | |||
142 | void BootloaderInstaller::updateDataReadProgress(int read, int total) | ||
143 | { | ||
144 | m_dp->progressBar->setMaximum(total); | ||
145 | m_dp->progressBar->setValue(read); | ||
146 | qDebug() << "progress:" << read << "/" << total; | ||
147 | } | ||
148 | |||
149 | |||
150 | /************************************************** | ||
151 | *** gigabeat secific code | ||
152 | ***************************************************/ | ||
153 | |||
154 | void BootloaderInstaller::gigabeatPrepare() | ||
155 | { | ||
156 | if(m_install) // Installation | ||
157 | { | ||
158 | QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; | ||
159 | |||
160 | m_dp->listProgress->addItem(tr("Downloading file %1.%2") | ||
161 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); | ||
162 | |||
163 | // temporary file needs to be opened to get the filename | ||
164 | downloadFile.open(); | ||
165 | m_tempfilename = downloadFile.fileName(); | ||
166 | downloadFile.close(); | ||
167 | // get the real file. | ||
168 | getter = new HttpGet(this); | ||
169 | getter->setProxy(m_proxy); | ||
170 | getter->setFile(&downloadFile); | ||
171 | getter->getFile(QUrl(url)); | ||
172 | // connect signals from HttpGet | ||
173 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
174 | //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); | ||
175 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
176 | |||
177 | } | ||
178 | else //UnInstallation | ||
179 | { | ||
180 | QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/FWIMG01.DAT"; | ||
181 | QString firmwareOrig = firmware.append(".ORIG"); | ||
182 | |||
183 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
184 | |||
185 | // check if original firmware exists | ||
186 | if(!firmwareOrigFI.exists()) | ||
187 | { | ||
188 | m_dp->listProgress->addItem(tr("Could not find the Original Firmware at: %1") | ||
189 | .arg(firmwareOrig)); | ||
190 | emit done(true); | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | QFile firmwareFile(firmware); | ||
195 | QFile firmwareOrigFile(firmwareOrig); | ||
196 | |||
197 | //remove modified firmware | ||
198 | if(!firmwareFile.remove()) | ||
199 | { | ||
200 | m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1") | ||
201 | .arg(firmware)); | ||
202 | emit done(true); | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | //copy original firmware | ||
207 | if(!firmwareOrigFile.copy(firmware)) | ||
208 | { | ||
209 | m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2") | ||
210 | .arg(firmwareOrig,firmware)); | ||
211 | emit done(true); | ||
212 | return; | ||
213 | } | ||
214 | |||
215 | emit done(false); //success | ||
216 | } | ||
217 | |||
218 | } | ||
219 | |||
220 | void BootloaderInstaller::gigabeatFinish() | ||
221 | { | ||
222 | // this step is only need for installation, so no code for uninstall here | ||
223 | |||
224 | m_dp->listProgress->addItem(tr("Finishing bootloader install")); | ||
225 | |||
226 | QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername; | ||
227 | |||
228 | QFileInfo firmwareFI(firmware); | ||
229 | |||
230 | // check if firmware exists | ||
231 | if(!firmwareFI.exists()) | ||
232 | { | ||
233 | m_dp->listProgress->addItem(tr("Could not find the Firmware at: %1") | ||
234 | .arg(firmware)); | ||
235 | emit done(true); | ||
236 | return; | ||
237 | } | ||
238 | |||
239 | QString firmwareOrig = firmware; | ||
240 | firmwareOrig.append(".ORIG"); | ||
241 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
242 | |||
243 | // rename the firmware, if there is no original firmware there | ||
244 | if(!firmwareOrigFI.exists()) | ||
245 | { | ||
246 | QFile firmwareFile(firmware); | ||
247 | if(!firmwareFile.rename(firmwareOrig)) | ||
248 | { | ||
249 | m_dp->listProgress->addItem(tr("Could not rename: %1 to %2") | ||
250 | .arg(firmware,firmwareOrig)); | ||
251 | emit done(true); | ||
252 | return; | ||
253 | } | ||
254 | } | ||
255 | else // or remove the normal firmware, if the original is there | ||
256 | { | ||
257 | QFile firmwareFile(firmware); | ||
258 | firmwareFile.remove(); | ||
259 | } | ||
260 | |||
261 | //copy the firmware | ||
262 | if(!downloadFile.copy(firmware)) | ||
263 | { | ||
264 | m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") | ||
265 | .arg(m_tempfilename,firmware)); | ||
266 | emit done(true); | ||
267 | return; | ||
268 | } | ||
269 | |||
270 | downloadFile.remove(); | ||
271 | |||
272 | m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); | ||
273 | m_dp->buttonAbort->setText(tr("&Ok")); | ||
274 | |||
275 | emit done(false); // success | ||
276 | |||
277 | } | ||
278 | |||
279 | /************************************************** | ||
280 | *** iaudio secific code | ||
281 | ***************************************************/ | ||
282 | void BootloaderInstaller::iaudioPrepare() | ||
283 | { | ||
284 | |||
285 | QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername; | ||
286 | |||
287 | m_dp->listProgress->addItem(tr("Downloading file %1.%2") | ||
288 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); | ||
289 | |||
290 | // temporary file needs to be opened to get the filename | ||
291 | downloadFile.open(); | ||
292 | m_tempfilename = downloadFile.fileName(); | ||
293 | downloadFile.close(); | ||
294 | // get the real file. | ||
295 | getter = new HttpGet(this); | ||
296 | getter->setProxy(m_proxy); | ||
297 | getter->setFile(&downloadFile); | ||
298 | getter->getFile(QUrl(url)); | ||
299 | // connect signals from HttpGet | ||
300 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
301 | //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); | ||
302 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
303 | |||
304 | } | ||
305 | |||
306 | void BootloaderInstaller::iaudioFinish() | ||
307 | { | ||
308 | QString firmware = m_mountpoint + "/FIRMWARE/" + m_bootloadername; | ||
309 | |||
310 | //copy the firmware | ||
311 | if(!downloadFile.copy(firmware)) | ||
312 | { | ||
313 | m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") | ||
314 | .arg(m_tempfilename,firmware)); | ||
315 | emit done(true); | ||
316 | return; | ||
317 | } | ||
318 | |||
319 | downloadFile.remove(); | ||
320 | |||
321 | m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); | ||
322 | m_dp->buttonAbort->setText(tr("&Ok")); | ||
323 | |||
324 | emit done(false); // success | ||
325 | |||
326 | } | ||
327 | |||
328 | |||
329 | /************************************************** | ||
330 | *** h10 secific code | ||
331 | ***************************************************/ | ||
332 | void BootloaderInstaller::h10Prepare() | ||
333 | { | ||
334 | if(m_install) // Installation | ||
335 | { | ||
336 | QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; | ||
337 | |||
338 | m_dp->listProgress->addItem(tr("Downloading file %1.%2") | ||
339 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); | ||
340 | |||
341 | // temporary file needs to be opened to get the filename | ||
342 | downloadFile.open(); | ||
343 | m_tempfilename = downloadFile.fileName(); | ||
344 | downloadFile.close(); | ||
345 | // get the real file. | ||
346 | getter = new HttpGet(this); | ||
347 | getter->setProxy(m_proxy); | ||
348 | getter->setFile(&downloadFile); | ||
349 | getter->getFile(QUrl(url)); | ||
350 | // connect signals from HttpGet | ||
351 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
352 | //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); | ||
353 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
354 | } | ||
355 | else // Uninstallation | ||
356 | { | ||
357 | |||
358 | QString firmwarename = m_bootloadername.section('/', -1); | ||
359 | |||
360 | QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; | ||
361 | QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4"; | ||
362 | |||
363 | QFileInfo firmwareFI(firmware); | ||
364 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
365 | { | ||
366 | firmware = m_mountpoint + "/SYSTEM/H10EMP.mi4"; //attempt other firmwarename | ||
367 | firmwareFI.setFile(firmware); | ||
368 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
369 | { | ||
370 | m_dp->listProgress->addItem(tr("Firmware doesn not exist: %1") | ||
371 | .arg(firmware)); | ||
372 | emit done(true); | ||
373 | return; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
378 | if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player | ||
379 | { | ||
380 | m_dp->listProgress->addItem(tr("Original Firmware doesn not exist: %1") | ||
381 | .arg(firmwareOrig)); | ||
382 | emit done(true); | ||
383 | return; | ||
384 | } | ||
385 | |||
386 | QFile firmwareFile(firmware); | ||
387 | QFile firmwareOrigFile(firmwareOrig); | ||
388 | |||
389 | //remove modified firmware | ||
390 | if(!firmwareFile.remove()) | ||
391 | { | ||
392 | m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1") | ||
393 | .arg(firmware)); | ||
394 | emit done(true); | ||
395 | return; | ||
396 | } | ||
397 | |||
398 | //copy original firmware | ||
399 | if(!firmwareOrigFile.copy(firmware)) | ||
400 | { | ||
401 | m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2") | ||
402 | .arg(firmwareOrig,firmware)); | ||
403 | emit done(true); | ||
404 | return; | ||
405 | } | ||
406 | |||
407 | emit done(false); //success | ||
408 | |||
409 | } | ||
410 | } | ||
411 | |||
412 | void BootloaderInstaller::h10Finish() | ||
413 | { | ||
414 | QString firmwarename = m_bootloadername.section('/', -1); | ||
415 | |||
416 | QString firmware = m_mountpoint + "/SYSTEM/" + firmwarename; | ||
417 | QString firmwareOrig = m_mountpoint + "/SYSTEM/Original.mi4"; | ||
418 | |||
419 | QFileInfo firmwareFI(firmware); | ||
420 | |||
421 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
422 | { | ||
423 | firmware = m_mountpoint + "/SYSTEM/H10EMP.mi4"; //attempt other firmwarename | ||
424 | firmwareFI.setFile(firmware); | ||
425 | if(!firmwareFI.exists()) //Firmware dosent exists on player | ||
426 | { | ||
427 | m_dp->listProgress->addItem(tr("Firmware does not exist: %1") | ||
428 | .arg(firmware)); | ||
429 | emit done(true); | ||
430 | return; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | QFileInfo firmwareOrigFI(firmwareOrig); | ||
435 | |||
436 | if(!firmwareOrigFI.exists()) //there is already a original firmware | ||
437 | { | ||
438 | QFile firmwareFile(firmware); | ||
439 | if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original | ||
440 | { | ||
441 | m_dp->listProgress->addItem(tr("Could not rename: %1 to %2") | ||
442 | .arg(firmware,firmwareOrig)); | ||
443 | emit done(true); | ||
444 | return; | ||
445 | } | ||
446 | } | ||
447 | else | ||
448 | { | ||
449 | QFile firmwareFile(firmware); | ||
450 | firmwareFile.remove(); | ||
451 | } | ||
452 | //copy the firmware | ||
453 | if(!downloadFile.copy(firmware)) | ||
454 | { | ||
455 | m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") | ||
456 | .arg(m_tempfilename,firmware)); | ||
457 | emit done(true); | ||
458 | return; | ||
459 | } | ||
460 | |||
461 | downloadFile.remove(); | ||
462 | |||
463 | m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); | ||
464 | m_dp->buttonAbort->setText(tr("&Ok")); | ||
465 | |||
466 | emit done(false); // success | ||
467 | |||
468 | } | ||
469 | |||
470 | /************************************************** | ||
471 | *** ipod secific code | ||
472 | ***************************************************/ | ||
473 | int verbose =0; | ||
474 | // reserves memory for ipodpatcher | ||
475 | bool initIpodpatcher() | ||
476 | { | ||
477 | if (ipod_alloc_buffer(§orbuf,BUFFER_SIZE) < 0) return true; | ||
478 | else return false; | ||
479 | } | ||
480 | |||
481 | void BootloaderInstaller::ipodPrepare() | ||
482 | { | ||
483 | m_dp->listProgress->addItem(tr("Searching for ipods")); | ||
484 | struct ipod_t ipod; | ||
485 | |||
486 | int n = ipod_scan(&ipod); | ||
487 | if (n == 0) | ||
488 | { | ||
489 | m_dp->listProgress->addItem(tr("No Ipods found")); | ||
490 | emit done(true); | ||
491 | return; | ||
492 | } | ||
493 | if (n > 1) | ||
494 | { | ||
495 | m_dp->listProgress->addItem(tr("Too many Ipods found")); | ||
496 | emit done(true); | ||
497 | } | ||
498 | |||
499 | if(m_install) // Installation | ||
500 | { | ||
501 | |||
502 | QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod"; | ||
503 | |||
504 | m_dp->listProgress->addItem(tr("Downloading file %1.%2") | ||
505 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); | ||
506 | |||
507 | // temporary file needs to be opened to get the filename | ||
508 | downloadFile.open(); | ||
509 | m_tempfilename = downloadFile.fileName(); | ||
510 | downloadFile.close(); | ||
511 | // get the real file. | ||
512 | getter = new HttpGet(this); | ||
513 | getter->setProxy(m_proxy); | ||
514 | getter->setFile(&downloadFile); | ||
515 | getter->getFile(QUrl(url)); | ||
516 | // connect signals from HttpGet | ||
517 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
518 | //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); | ||
519 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
520 | |||
521 | } | ||
522 | else // Uninstallation | ||
523 | { | ||
524 | if (ipod_open(&ipod, 0) < 0) | ||
525 | { | ||
526 | m_dp->listProgress->addItem(tr("could not open ipod")); | ||
527 | emit done(true); | ||
528 | return; | ||
529 | } | ||
530 | |||
531 | if (read_partinfo(&ipod,0) < 0) | ||
532 | { | ||
533 | m_dp->listProgress->addItem(tr("could not read partitiontable")); | ||
534 | emit done(true); | ||
535 | return; | ||
536 | } | ||
537 | |||
538 | if (ipod.pinfo[0].start==0) | ||
539 | { | ||
540 | m_dp->listProgress->addItem(tr("No partition 0 on disk")); | ||
541 | |||
542 | int i; | ||
543 | double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; | ||
544 | m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); | ||
545 | for ( i = 0; i < 4; i++ ) | ||
546 | { | ||
547 | if (ipod.pinfo[i].start != 0) | ||
548 | { | ||
549 | m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( | ||
550 | i).arg( | ||
551 | ipod.pinfo[i].start).arg( | ||
552 | ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( | ||
553 | ipod.pinfo[i].size/sectors_per_MB).arg( | ||
554 | get_parttype(ipod.pinfo[i].type)).arg( | ||
555 | ipod.pinfo[i].type)); | ||
556 | } | ||
557 | } | ||
558 | emit done(true); | ||
559 | return; | ||
560 | } | ||
561 | |||
562 | read_directory(&ipod); | ||
563 | |||
564 | if (ipod.nimages <= 0) | ||
565 | { | ||
566 | m_dp->listProgress->addItem(tr("Failed to read firmware directory")); | ||
567 | emit done(true); | ||
568 | return; | ||
569 | } | ||
570 | if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) | ||
571 | { | ||
572 | m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg( | ||
573 | ipod.ipod_directory[0].vers)); | ||
574 | emit done(true); | ||
575 | return; | ||
576 | } | ||
577 | |||
578 | if (ipod.macpod) | ||
579 | { | ||
580 | m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); | ||
581 | } | ||
582 | |||
583 | if (ipod_reopen_rw(&ipod) < 0) | ||
584 | { | ||
585 | m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode")); | ||
586 | emit done(true); | ||
587 | return; | ||
588 | } | ||
589 | |||
590 | if (ipod.ipod_directory[0].entryOffset==0) { | ||
591 | m_dp->listProgress->addItem(tr("No bootloader detected.")); | ||
592 | emit done(true); | ||
593 | return; | ||
594 | } | ||
595 | |||
596 | if (delete_bootloader(&ipod)==0) | ||
597 | { | ||
598 | m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); | ||
599 | emit done(true); | ||
600 | ipod_close(&ipod); | ||
601 | return; | ||
602 | } | ||
603 | else | ||
604 | { | ||
605 | m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); | ||
606 | emit done(true); | ||
607 | return; | ||
608 | } | ||
609 | } | ||
610 | } | ||
611 | |||
612 | void BootloaderInstaller::ipodFinish() | ||
613 | { | ||
614 | struct ipod_t ipod; | ||
615 | ipod_scan(&ipod); | ||
616 | |||
617 | if (ipod_open(&ipod, 0) < 0) | ||
618 | { | ||
619 | m_dp->listProgress->addItem(tr("could not open ipod")); | ||
620 | emit done(true); | ||
621 | return; | ||
622 | } | ||
623 | |||
624 | if (read_partinfo(&ipod,0) < 0) | ||
625 | { | ||
626 | m_dp->listProgress->addItem(tr("could not read partitiontable")); | ||
627 | emit done(true); | ||
628 | return; | ||
629 | } | ||
630 | |||
631 | if (ipod.pinfo[0].start==0) | ||
632 | { | ||
633 | m_dp->listProgress->addItem(tr("No partition 0 on disk")); | ||
634 | |||
635 | int i; | ||
636 | double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; | ||
637 | |||
638 | m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); | ||
639 | |||
640 | for ( i = 0; i < 4; i++ ) | ||
641 | { | ||
642 | if (ipod.pinfo[i].start != 0) | ||
643 | { | ||
644 | m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( | ||
645 | i).arg( | ||
646 | ipod.pinfo[i].start).arg( | ||
647 | ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( | ||
648 | ipod.pinfo[i].size/sectors_per_MB).arg( | ||
649 | get_parttype(ipod.pinfo[i].type)).arg( | ||
650 | ipod.pinfo[i].type)); | ||
651 | } | ||
652 | } | ||
653 | emit done(true); | ||
654 | return; | ||
655 | } | ||
656 | |||
657 | read_directory(&ipod); | ||
658 | |||
659 | if (ipod.nimages <= 0) | ||
660 | { | ||
661 | m_dp->listProgress->addItem(tr("Failed to read firmware directory")); | ||
662 | emit done(true); | ||
663 | return; | ||
664 | } | ||
665 | if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) | ||
666 | { | ||
667 | m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg( | ||
668 | ipod.ipod_directory[0].vers)); | ||
669 | emit done(true); | ||
670 | return; | ||
671 | } | ||
672 | |||
673 | if (ipod.macpod) | ||
674 | { | ||
675 | m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); | ||
676 | } | ||
677 | |||
678 | if (ipod_reopen_rw(&ipod) < 0) | ||
679 | { | ||
680 | m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode")); | ||
681 | emit done(true); | ||
682 | return; | ||
683 | } | ||
684 | |||
685 | if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) | ||
686 | { | ||
687 | m_dp->listProgress->addItem(tr("Successfully added Bootloader")); | ||
688 | emit done(true); | ||
689 | ipod_close(&ipod); | ||
690 | return; | ||
691 | } | ||
692 | else | ||
693 | { | ||
694 | m_dp->listProgress->addItem(tr("failed to add Bootloader")); | ||
695 | ipod_close(&ipod); | ||
696 | emit done(true); | ||
697 | return; | ||
698 | } | ||
699 | |||
700 | } | ||
701 | |||
702 | |||
diff --git a/rbutil/rbutilqt/installbootloader.h b/rbutil/rbutilqt/installbootloader.h new file mode 100644 index 0000000000..24d1fe33e4 --- /dev/null +++ b/rbutil/rbutilqt/installbootloader.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * $Id: installbootloader.h 13990 2007-07-25 22:26:10Z Dominik Wenger $ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef INSTALLBOOTLOADER_H | ||
21 | #define INSTALLBOOTLOADER_H | ||
22 | |||
23 | #include <QtGui> | ||
24 | |||
25 | #include "ui_installprogressfrm.h" | ||
26 | #include "httpget.h" | ||
27 | |||
28 | extern "C" { | ||
29 | // Ipodpatcher | ||
30 | #include "../ipodpatcher/ipodpatcher.h" | ||
31 | }; | ||
32 | |||
33 | bool initIpodpatcher(); | ||
34 | |||
35 | class BootloaderInstaller : public QObject | ||
36 | { | ||
37 | Q_OBJECT | ||
38 | |||
39 | public: | ||
40 | BootloaderInstaller(QObject* parent); | ||
41 | ~BootloaderInstaller() {} | ||
42 | |||
43 | void install(Ui::InstallProgressFrm* dp); | ||
44 | void uninstall(Ui::InstallProgressFrm* dp); | ||
45 | |||
46 | void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;} | ||
47 | void setProxy(QUrl proxy) {m_proxy= proxy;} | ||
48 | void setDevice(QString device) {m_device= device;} | ||
49 | void setBootloaderMethod(QString method) {m_bootloadermethod= method;} | ||
50 | void setBootloaderName(QString name){m_bootloadername= name;} | ||
51 | void setBootloaderBaseUrl(QString baseUrl){m_bootloaderUrlBase = baseUrl;} | ||
52 | |||
53 | signals: | ||
54 | void done(bool error); //installation finished. | ||
55 | |||
56 | // internal signals. Dont use this from out side. | ||
57 | void prepare(); | ||
58 | void finish(); | ||
59 | |||
60 | private slots: | ||
61 | void updateDataReadProgress(int, int); | ||
62 | void downloadDone(bool); | ||
63 | void downloadRequestFinished(int, bool); | ||
64 | |||
65 | // gigabeat specific routines | ||
66 | void gigabeatPrepare(); | ||
67 | void gigabeatFinish(); | ||
68 | |||
69 | //iaudio specific routines | ||
70 | void iaudioPrepare(); | ||
71 | void iaudioFinish(); | ||
72 | |||
73 | //h10 specific routines | ||
74 | void h10Prepare(); | ||
75 | void h10Finish(); | ||
76 | |||
77 | //ipod specific routines | ||
78 | void ipodPrepare(); | ||
79 | void ipodFinish(); | ||
80 | |||
81 | private: | ||
82 | QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername; | ||
83 | QString m_bootloaderUrlBase,m_tempfilename; | ||
84 | QUrl m_proxy; | ||
85 | bool m_install; | ||
86 | |||
87 | |||
88 | HttpGet *getter; | ||
89 | QTemporaryFile downloadFile; | ||
90 | |||
91 | Ui::InstallProgressFrm* m_dp; | ||
92 | |||
93 | }; | ||
94 | #endif | ||
diff --git a/rbutil/rbutilqt/installbootloaderfrm.ui b/rbutil/rbutilqt/installbootloaderfrm.ui new file mode 100644 index 0000000000..93af750143 --- /dev/null +++ b/rbutil/rbutilqt/installbootloaderfrm.ui | |||
@@ -0,0 +1,108 @@ | |||
1 | <ui version="4.0" > | ||
2 | <class>InstallBootloaderFrm</class> | ||
3 | <widget class="QDialog" name="InstallBootloaderFrm" > | ||
4 | <property name="windowModality" > | ||
5 | <enum>Qt::WindowModal</enum> | ||
6 | </property> | ||
7 | <property name="geometry" > | ||
8 | <rect> | ||
9 | <x>0</x> | ||
10 | <y>0</y> | ||
11 | <width>673</width> | ||
12 | <height>453</height> | ||
13 | </rect> | ||
14 | </property> | ||
15 | <property name="windowTitle" > | ||
16 | <string>Install Bootloader</string> | ||
17 | </property> | ||
18 | <layout class="QGridLayout" > | ||
19 | <item rowspan="8" row="0" column="0" > | ||
20 | <widget class="QLabel" name="label" > | ||
21 | <property name="text" > | ||
22 | <string/> | ||
23 | </property> | ||
24 | <property name="pixmap" > | ||
25 | <pixmap resource="rbutilqt.qrc" >:/icons/icons/wizard.xpm</pixmap> | ||
26 | </property> | ||
27 | </widget> | ||
28 | </item> | ||
29 | <item row="0" column="1" colspan="3" > | ||
30 | <widget class="QLabel" name="label_2" > | ||
31 | <property name="text" > | ||
32 | <string>Select your device in the filesystem</string> | ||
33 | </property> | ||
34 | </widget> | ||
35 | </item> | ||
36 | <item row="1" column="1" colspan="2" > | ||
37 | <widget class="QLineEdit" name="lineMountPoint" /> | ||
38 | </item> | ||
39 | <item row="1" column="3" > | ||
40 | <widget class="QToolButton" name="buttonBrowse" > | ||
41 | <property name="text" > | ||
42 | <string>&Browse</string> | ||
43 | </property> | ||
44 | </widget> | ||
45 | </item> | ||
46 | <item row="7" column="2" colspan="2" > | ||
47 | <widget class="QDialogButtonBox" name="buttonBox" > | ||
48 | <property name="orientation" > | ||
49 | <enum>Qt::Horizontal</enum> | ||
50 | </property> | ||
51 | <property name="standardButtons" > | ||
52 | <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> | ||
53 | </property> | ||
54 | </widget> | ||
55 | </item> | ||
56 | <item rowspan="4" row="2" column="1" colspan="3" > | ||
57 | <spacer> | ||
58 | <property name="orientation" > | ||
59 | <enum>Qt::Vertical</enum> | ||
60 | </property> | ||
61 | <property name="sizeHint" > | ||
62 | <size> | ||
63 | <width>20</width> | ||
64 | <height>40</height> | ||
65 | </size> | ||
66 | </property> | ||
67 | </spacer> | ||
68 | </item> | ||
69 | </layout> | ||
70 | </widget> | ||
71 | <resources> | ||
72 | <include location="rbutilqt.qrc" /> | ||
73 | </resources> | ||
74 | <connections> | ||
75 | <connection> | ||
76 | <sender>buttonBox</sender> | ||
77 | <signal>accepted()</signal> | ||
78 | <receiver>InstallBootloaderFrm</receiver> | ||
79 | <slot>accept()</slot> | ||
80 | <hints> | ||
81 | <hint type="sourcelabel" > | ||
82 | <x>248</x> | ||
83 | <y>254</y> | ||
84 | </hint> | ||
85 | <hint type="destinationlabel" > | ||
86 | <x>157</x> | ||
87 | <y>274</y> | ||
88 | </hint> | ||
89 | </hints> | ||
90 | </connection> | ||
91 | <connection> | ||
92 | <sender>buttonBox</sender> | ||
93 | <signal>rejected()</signal> | ||
94 | <receiver>InstallBootloaderFrm</receiver> | ||
95 | <slot>reject()</slot> | ||
96 | <hints> | ||
97 | <hint type="sourcelabel" > | ||
98 | <x>316</x> | ||
99 | <y>260</y> | ||
100 | </hint> | ||
101 | <hint type="destinationlabel" > | ||
102 | <x>286</x> | ||
103 | <y>274</y> | ||
104 | </hint> | ||
105 | </hints> | ||
106 | </connection> | ||
107 | </connections> | ||
108 | </ui> | ||
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 90744b5c85..d891acd0f3 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -25,7 +25,9 @@ | |||
25 | #include "ui_aboutbox.h" | 25 | #include "ui_aboutbox.h" |
26 | #include "configure.h" | 26 | #include "configure.h" |
27 | #include "install.h" | 27 | #include "install.h" |
28 | #include "installbl.h" | ||
28 | #include "httpget.h" | 29 | #include "httpget.h" |
30 | #include "installbootloader.h" | ||
29 | 31 | ||
30 | RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | 32 | RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) |
31 | { | 33 | { |
@@ -71,6 +73,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | |||
71 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); | 73 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); |
72 | connect(ui.comboBoxDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDevice(int))); | 74 | connect(ui.comboBoxDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDevice(int))); |
73 | connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(install())); | 75 | connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(install())); |
76 | connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl())); | ||
74 | 77 | ||
75 | // disable unimplemented stuff | 78 | // disable unimplemented stuff |
76 | ui.buttonThemes->setEnabled(false); | 79 | ui.buttonThemes->setEnabled(false); |
@@ -80,7 +83,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | |||
80 | ui.buttonGames->setEnabled(false); | 83 | ui.buttonGames->setEnabled(false); |
81 | ui.buttonFonts->setEnabled(false); | 84 | ui.buttonFonts->setEnabled(false); |
82 | ui.buttonComplete->setEnabled(false); | 85 | ui.buttonComplete->setEnabled(false); |
86 | ui.buttonDetect->setEnabled(false); | ||
83 | 87 | ||
88 | initIpodpatcher(); | ||
84 | downloadInfo(); | 89 | downloadInfo(); |
85 | 90 | ||
86 | } | 91 | } |
@@ -229,3 +234,16 @@ void RbUtilQt::install() | |||
229 | 234 | ||
230 | installWindow->show(); | 235 | installWindow->show(); |
231 | } | 236 | } |
237 | |||
238 | void RbUtilQt::installBl() | ||
239 | { | ||
240 | InstallBl *installWindow = new InstallBl(this); | ||
241 | installWindow->setUserSettings(userSettings); | ||
242 | installWindow->setDeviceSettings(devices); | ||
243 | if(userSettings->value("defaults/proxytype") == "manual") | ||
244 | installWindow->setProxy(QUrl(userSettings->value("defaults/proxy").toString())); | ||
245 | installWindow->setMountPoint(userSettings->value("defaults/mountpoint").toString()); | ||
246 | |||
247 | installWindow->show(); | ||
248 | } | ||
249 | |||
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 89a3610fba..324fe55e55 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * | 8 | * |
9 | * Copyright (C) 2007 by Dominik Riebeling | 9 | * Copyright (C) 2007 by Dominik Riebeling |
10 | * $Id:$ | 10 | * $Id$ |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -26,7 +26,6 @@ | |||
26 | #include <QSettings> | 26 | #include <QSettings> |
27 | #include <QTemporaryFile> | 27 | #include <QTemporaryFile> |
28 | 28 | ||
29 | |||
30 | class RbUtilQt : public QMainWindow | 29 | class RbUtilQt : public QMainWindow |
31 | { | 30 | { |
32 | Q_OBJECT | 31 | Q_OBJECT |
@@ -50,6 +49,7 @@ class RbUtilQt : public QMainWindow | |||
50 | void configDialog(void); | 49 | void configDialog(void); |
51 | void updateDevice(int); | 50 | void updateDevice(int); |
52 | void install(void); | 51 | void install(void); |
52 | void installBl(void); | ||
53 | void downloadDone(bool); | 53 | void downloadDone(bool); |
54 | void downloadDone(int, bool); | 54 | void downloadDone(int, bool); |
55 | void downloadInfo(void); | 55 | void downloadInfo(void); |
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index 1491ab9d69..ef558de6a8 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -5,7 +5,11 @@ SOURCES += rbutilqt.cpp \ | |||
5 | configure.cpp \ | 5 | configure.cpp \ |
6 | zip/zip.cpp \ | 6 | zip/zip.cpp \ |
7 | zip/unzip.cpp \ | 7 | zip/unzip.cpp \ |
8 | installzip.cpp | 8 | installzip.cpp \ |
9 | installbootloader.cpp \ | ||
10 | installbl.cpp \ | ||
11 | ../ipodpatcher/ipodpatcher.c | ||
12 | |||
9 | 13 | ||
10 | HEADERS += rbutilqt.h \ | 14 | HEADERS += rbutilqt.h \ |
11 | settings.h \ | 15 | settings.h \ |
@@ -18,8 +22,14 @@ HEADERS += rbutilqt.h \ | |||
18 | zip/unzip_p.h \ | 22 | zip/unzip_p.h \ |
19 | zip/zip_p.h \ | 23 | zip/zip_p.h \ |
20 | version.h \ | 24 | version.h \ |
21 | installzip.h | 25 | installzip.h \ |
22 | 26 | installbootloader.h \ | |
27 | installbl.h \ | ||
28 | ../ipodpatcher/ipodpatcher.h \ | ||
29 | ../ipodpatcher/ipodio.h \ | ||
30 | ../ipodpatcher/parttypes.h | ||
31 | |||
32 | |||
23 | TEMPLATE = app | 33 | TEMPLATE = app |
24 | CONFIG += release \ | 34 | CONFIG += release \ |
25 | warn_on \ | 35 | warn_on \ |
@@ -30,8 +40,17 @@ FORMS += rbutilqtfrm.ui \ | |||
30 | aboutbox.ui \ | 40 | aboutbox.ui \ |
31 | installfrm.ui \ | 41 | installfrm.ui \ |
32 | installprogressfrm.ui \ | 42 | installprogressfrm.ui \ |
33 | configurefrm.ui | 43 | configurefrm.ui \ |
44 | installbootloaderfrm.ui | ||
34 | RESOURCES += rbutilqt.qrc | 45 | RESOURCES += rbutilqt.qrc |
35 | 46 | ||
36 | TRANSLATIONS += rbutil_de.ts | 47 | TRANSLATIONS += rbutil_de.ts |
37 | QT += network | 48 | QT += network |
49 | |||
50 | win32{ | ||
51 | SOURCES += ../ipodpatcher/ipodio-win32.c | ||
52 | } | ||
53 | |||
54 | !win32{ | ||
55 | SOURCES += ../ipodpatcher/ipodio-posix.c | ||
56 | } | ||