summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2007-07-29 18:07:31 +0000
committerDominik Wenger <domonoky@googlemail.com>2007-07-29 18:07:31 +0000
commit917e0acd644f286604a99d707730f7bead9caa08 (patch)
tree0027de66b16a2b8242590e8953b58860b8f56f39
parentc414f46971521b8f431db369cd6d4ccd74334f2c (diff)
downloadrockbox-917e0acd644f286604a99d707730f7bead9caa08.tar.gz
rockbox-917e0acd644f286604a99d707730f7bead9caa08.zip
rbutilQt: changed the progress/error logger, there is now an abstract interface and a progressloggergui implementation of it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14060 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/install.cpp29
-rw-r--r--rbutil/rbutilqt/install.h6
-rw-r--r--rbutil/rbutilqt/installbl.cpp352
-rw-r--r--rbutil/rbutilqt/installbl.h5
-rw-r--r--rbutil/rbutilqt/installbootloader.cpp210
-rw-r--r--rbutil/rbutilqt/installbootloader.h8
-rw-r--r--rbutil/rbutilqt/installzip.cpp43
-rw-r--r--rbutil/rbutilqt/installzip.h6
-rw-r--r--rbutil/rbutilqt/installzipwindow.cpp254
-rw-r--r--rbutil/rbutilqt/installzipwindow.h134
-rw-r--r--rbutil/rbutilqt/irivertools/irivertools.cpp50
-rw-r--r--rbutil/rbutilqt/irivertools/irivertools.h8
-rw-r--r--rbutil/rbutilqt/progressloggergui.cpp69
-rw-r--r--rbutil/rbutilqt/progressloggergui.h55
-rw-r--r--rbutil/rbutilqt/progressloggerinterface.h51
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro5
16 files changed, 724 insertions, 561 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index f75765adc1..49bdb14c53 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -19,8 +19,6 @@
19 19
20#include "install.h" 20#include "install.h"
21#include "ui_installfrm.h" 21#include "ui_installfrm.h"
22#include "ui_installprogressfrm.h"
23
24 22
25Install::Install(QWidget *parent) : QDialog(parent) 23Install::Install(QWidget *parent) : QDialog(parent)
26{ 24{
@@ -98,17 +96,17 @@ void Install::browseFolder()
98 96
99void Install::accept() 97void Install::accept()
100{ 98{
101 downloadProgress = new QDialog(this); 99 logger = new ProgressLoggerGui(this);
102 dp.setupUi(downloadProgress); 100 logger->show();
101
103 // show dialog with error if mount point is wrong 102 // show dialog with error if mount point is wrong
104 if(QFileInfo(ui.lineMountPoint->text()).isDir()) { 103 if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
105 mountPoint = ui.lineMountPoint->text(); 104 mountPoint = ui.lineMountPoint->text();
106 userSettings->setValue("defaults/mountpoint", mountPoint); 105 userSettings->setValue("defaults/mountpoint", mountPoint);
107 } 106 }
108 else { 107 else {
109 dp.listProgress->addItem(tr("Mount point is wrong!")); 108 logger->addItem(tr("Mount point is wrong!"));
110 dp.buttonAbort->setText(tr("&Ok")); 109 logger->abort();
111 downloadProgress->show();
112 return; 110 return;
113 } 111 }
114 112
@@ -147,26 +145,25 @@ void Install::accept()
147 installer->setProxy(proxy); 145 installer->setProxy(proxy);
148 installer->setLogSection("rockboxbase"); 146 installer->setLogSection("rockboxbase");
149 installer->setMountPoint(mountPoint); 147 installer->setMountPoint(mountPoint);
150 installer->install(&dp); 148 installer->install(logger);
151 149
152 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); 150 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
153 151
154 downloadProgress->show();
155} 152}
156 153
157 154// Zip installer has finished
158void Install::done(bool error) 155void Install::done(bool error)
159{ 156{
160 qDebug() << "Install::done, error:" << error; 157 qDebug() << "Install::done, error:" << error;
161 158
162 if(error) 159 if(error)
163 { 160 {
164 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); 161 logger->abort();
165 return; 162 return;
166 } 163 }
167 164
168 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close())); 165 // no error, close the window, when the logger is closed
169 connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close())); 166 connect(logger,SIGNAL(closed()),this,SLOT(close()));
170 167
171} 168}
172 169
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h
index 79dcf0cee7..90afb068b1 100644
--- a/rbutil/rbutilqt/install.h
+++ b/rbutil/rbutilqt/install.h
@@ -25,8 +25,8 @@
25#include <QSettings> 25#include <QSettings>
26 26
27#include "ui_installfrm.h" 27#include "ui_installfrm.h"
28#include "ui_installprogressfrm.h"
29#include "installzip.h" 28#include "installzip.h"
29#include "progressloggergui.h"
30 30
31class Install : public QDialog 31class Install : public QDialog
32{ 32{
@@ -42,16 +42,14 @@ class Install : public QDialog
42 42
43 public slots: 43 public slots:
44 void accept(void); 44 void accept(void);
45// void extractBuild(bool);
46 45
47 private: 46 private:
48 Ui::InstallFrm ui; 47 Ui::InstallFrm ui;
49 Ui::InstallProgressFrm dp; 48 ProgressLoggerGui* logger;
50 QUrl proxy; 49 QUrl proxy;
51 QString releasever; 50 QString releasever;
52 QSettings *devices; 51 QSettings *devices;
53 QSettings *userSettings; 52 QSettings *userSettings;
54 QDialog *downloadProgress;
55 QHttp *download; 53 QHttp *download;
56 QFile *target; 54 QFile *target;
57 QString file; 55 QString file;
diff --git a/rbutil/rbutilqt/installbl.cpp b/rbutil/rbutilqt/installbl.cpp
index b36909b8f6..3eaf9afdaf 100644
--- a/rbutil/rbutilqt/installbl.cpp
+++ b/rbutil/rbutilqt/installbl.cpp
@@ -1,176 +1,176 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installbl.cpp 14027 2007-07-27 17:42:49Z domonoky $ 10 * $Id: installbl.cpp 14027 2007-07-27 17:42:49Z domonoky $
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.
14 * 14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "installbl.h" 20#include "installbl.h"
21#include "ui_installprogressfrm.h" 21#include "ui_installprogressfrm.h"
22 22
23 23
24InstallBl::InstallBl(QWidget *parent) : QDialog(parent) 24InstallBl::InstallBl(QWidget *parent) : QDialog(parent)
25{ 25{
26 ui.setupUi(this); 26 ui.setupUi(this);
27 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder())); 27 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
28 connect(ui.buttonBrowseOF, SIGNAL(clicked()), this, SLOT(browseOF())); 28 connect(ui.buttonBrowseOF, SIGNAL(clicked()), this, SLOT(browseOF()));
29 29
30} 30}
31 31
32void InstallBl::setProxy(QUrl proxy_url) 32void InstallBl::setProxy(QUrl proxy_url)
33{ 33{
34 proxy = proxy_url; 34 proxy = proxy_url;
35 qDebug() << "Install::setProxy" << proxy; 35 qDebug() << "Install::setProxy" << proxy;
36} 36}
37 37
38void InstallBl::setMountPoint(QString mount) 38void InstallBl::setMountPoint(QString mount)
39{ 39{
40 QFileInfo m(mount); 40 QFileInfo m(mount);
41 if(m.isDir()) { 41 if(m.isDir()) {
42 ui.lineMountPoint->clear(); 42 ui.lineMountPoint->clear();
43 ui.lineMountPoint->insert(mount); 43 ui.lineMountPoint->insert(mount);
44 } 44 }
45} 45}
46 46
47void InstallBl::setOFPath(QString path) 47void InstallBl::setOFPath(QString path)
48{ 48{
49 QFileInfo m(path); 49 QFileInfo m(path);
50 if(m.exists()) { 50 if(m.exists()) {
51 ui.lineOriginalFirmware->clear(); 51 ui.lineOriginalFirmware->clear();
52 ui.lineOriginalFirmware->insert(path); 52 ui.lineOriginalFirmware->insert(path);
53 } 53 }
54} 54}
55 55
56void InstallBl::browseFolder() 56void InstallBl::browseFolder()
57{ 57{
58 QFileDialog browser(this); 58 QFileDialog browser(this);
59 if(QFileInfo(ui.lineMountPoint->text()).isDir()) 59 if(QFileInfo(ui.lineMountPoint->text()).isDir())
60 browser.setDirectory(ui.lineMountPoint->text()); 60 browser.setDirectory(ui.lineMountPoint->text());
61 else 61 else
62 browser.setDirectory("/media"); 62 browser.setDirectory("/media");
63 browser.setReadOnly(true); 63 browser.setReadOnly(true);
64 browser.setFileMode(QFileDialog::DirectoryOnly); 64 browser.setFileMode(QFileDialog::DirectoryOnly);
65 browser.setAcceptMode(QFileDialog::AcceptOpen); 65 browser.setAcceptMode(QFileDialog::AcceptOpen);
66 if(browser.exec()) { 66 if(browser.exec()) {
67 qDebug() << browser.directory(); 67 qDebug() << browser.directory();
68 QStringList files = browser.selectedFiles(); 68 QStringList files = browser.selectedFiles();
69 setMountPoint(files.at(0)); 69 setMountPoint(files.at(0));
70 } 70 }
71} 71}
72 72
73void InstallBl::browseOF() 73void InstallBl::browseOF()
74{ 74{
75 QFileDialog browser(this); 75 QFileDialog browser(this);
76 if(QFileInfo(ui.lineOriginalFirmware->text()).exists()) 76 if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
77 browser.setDirectory(ui.lineOriginalFirmware->text()); 77 browser.setDirectory(ui.lineOriginalFirmware->text());
78 else 78 else
79 browser.setDirectory("/media"); 79 browser.setDirectory("/media");
80 browser.setReadOnly(true); 80 browser.setReadOnly(true);
81 browser.setAcceptMode(QFileDialog::AcceptOpen); 81 browser.setAcceptMode(QFileDialog::AcceptOpen);
82 if(browser.exec()) { 82 if(browser.exec()) {
83 qDebug() << browser.directory(); 83 qDebug() << browser.directory();
84 QStringList files = browser.selectedFiles(); 84 QStringList files = browser.selectedFiles();
85 setOFPath(files.at(0)); 85 setOFPath(files.at(0));
86 } 86 }
87} 87}
88 88
89void InstallBl::accept() 89void InstallBl::accept()
90{ 90{
91 downloadProgress = new QDialog(this); 91 // create logger
92 dp.setupUi(downloadProgress); 92 logger = new ProgressLoggerGui(this);
93 // show dialog with error if mount point is wrong 93 logger->show();
94 if(QFileInfo(ui.lineMountPoint->text()).isDir()) { 94
95 mountPoint = ui.lineMountPoint->text(); 95 // show dialog with error if mount point is wrong
96 userSettings->setValue("defaults/mountpoint", mountPoint); 96 if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
97 } 97 mountPoint = ui.lineMountPoint->text();
98 else { 98 userSettings->setValue("defaults/mountpoint", mountPoint);
99 dp.listProgress->addItem(tr("Mount point is wrong!")); 99 }
100 dp.buttonAbort->setText(tr("&Ok")); 100 else {
101 downloadProgress->show(); 101 logger->addItem(tr("Mount point is wrong!"));
102 return; 102 logger->abort();
103 } 103 return;
104 104 }
105 if(QFileInfo(ui.lineOriginalFirmware->text()).exists()) 105
106 { 106 if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
107 m_OrigFirmware = ui.lineOriginalFirmware->text(); 107 {
108 } 108 m_OrigFirmware = ui.lineOriginalFirmware->text();
109 else 109 }
110 { 110 else
111 dp.listProgress->addItem(tr("Original Firmware Path is wrong!")); 111 {
112 dp.buttonAbort->setText(tr("&Ok")); 112 logger->addItem(tr("Original Firmware Path is wrong!"));
113 downloadProgress->show(); 113 logger->abort();
114 return; 114 return;
115 } 115 }
116 userSettings->sync(); 116 userSettings->sync();
117 117
118 binstaller = new BootloaderInstaller(this); 118 binstaller = new BootloaderInstaller(this);
119 119
120 binstaller->setMountPoint(mountPoint); 120 binstaller->setMountPoint(mountPoint);
121 binstaller->setProxy(proxy); 121 binstaller->setProxy(proxy);
122 QString plattform = userSettings->value("defaults/platform").toString(); 122 QString plattform = userSettings->value("defaults/platform").toString();
123 123
124 binstaller->setDevice(plattform); 124 binstaller->setDevice(plattform);
125 binstaller->setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString()); 125 binstaller->setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
126 binstaller->setBootloaderName(devices->value(plattform + "/bootloadername").toString()); 126 binstaller->setBootloaderName(devices->value(plattform + "/bootloadername").toString());
127 binstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString()); 127 binstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
128 binstaller->setOrigFirmwarePath(m_OrigFirmware); 128 binstaller->setOrigFirmwarePath(m_OrigFirmware);
129 129
130 binstaller->install(&dp); 130 binstaller->install(logger);
131 131
132 connect(binstaller, SIGNAL(done(bool)), this, SLOT(done(bool))); 132 connect(binstaller, SIGNAL(done(bool)), this, SLOT(done(bool)));
133 133
134 downloadProgress->show(); 134}
135} 135
136 136
137 137void InstallBl::done(bool error)
138void InstallBl::done(bool error) 138{
139{ 139 qDebug() << "Install::done, error:" << error;
140 qDebug() << "Install::done, error:" << error; 140
141 141 if(error)
142 if(error) 142 {
143 { 143 logger->abort();
144 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); 144 return;
145 return; 145 }
146 } 146
147 147 // no error, close the window, when the logger is closed
148 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close())); 148 connect(logger,SIGNAL(closed()),this,SLOT(close()));
149 connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close())); 149
150} 150}
151 151
152void InstallBl::setDeviceSettings(QSettings *dev) 152void InstallBl::setDeviceSettings(QSettings *dev)
153{ 153{
154 devices = dev; 154 devices = dev;
155 155
156 if(userSettings->value("defaults/platform").toString() == "h100" || 156 if(userSettings->value("defaults/platform").toString() == "h100" ||
157 userSettings->value("defaults/platform").toString() == "h120" || 157 userSettings->value("defaults/platform").toString() == "h120" ||
158 userSettings->value("defaults/platform").toString() == "h300") 158 userSettings->value("defaults/platform").toString() == "h300")
159 { 159 {
160 ui.buttonBrowseOF->show(); 160 ui.buttonBrowseOF->show();
161 ui.lineOriginalFirmware->show(); 161 ui.lineOriginalFirmware->show();
162 ui.label_3->show(); 162 ui.label_3->show();
163 } 163 }
164 else 164 else
165 { 165 {
166 ui.buttonBrowseOF->hide(); 166 ui.buttonBrowseOF->hide();
167 ui.lineOriginalFirmware->hide(); 167 ui.lineOriginalFirmware->hide();
168 ui.label_3->hide(); 168 ui.label_3->hide();
169 } 169 }
170 qDebug() << "Install::setDeviceSettings:" << devices; 170 qDebug() << "Install::setDeviceSettings:" << devices;
171} 171}
172 172
173void InstallBl::setUserSettings(QSettings *user) 173void InstallBl::setUserSettings(QSettings *user)
174{ 174{
175 userSettings = user; 175 userSettings = user;
176} 176}
diff --git a/rbutil/rbutilqt/installbl.h b/rbutil/rbutilqt/installbl.h
index 9da19eff08..2376c51c4d 100644
--- a/rbutil/rbutilqt/installbl.h
+++ b/rbutil/rbutilqt/installbl.h
@@ -25,7 +25,7 @@
25#include <QSettings> 25#include <QSettings>
26 26
27#include "ui_installbootloaderfrm.h" 27#include "ui_installbootloaderfrm.h"
28#include "ui_installprogressfrm.h" 28#include "progressloggergui.h"
29 29
30#include "installbootloader.h" 30#include "installbootloader.h"
31#include "irivertools/irivertools.h" 31#include "irivertools/irivertools.h"
@@ -46,11 +46,10 @@ class InstallBl : public QDialog
46 46
47 private: 47 private:
48 Ui::InstallBootloaderFrm ui; 48 Ui::InstallBootloaderFrm ui;
49 Ui::InstallProgressFrm dp; 49 ProgressLoggerGui* logger;
50 QUrl proxy; 50 QUrl proxy;
51 QSettings *devices; 51 QSettings *devices;
52 QSettings *userSettings; 52 QSettings *userSettings;
53 QDialog *downloadProgress;
54 QHttp *download; 53 QHttp *download;
55 QFile *target; 54 QFile *target;
56 QString file; 55 QString file;
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp
index 1061210649..7ee90c6ced 100644
--- a/rbutil/rbutilqt/installbootloader.cpp
+++ b/rbutil/rbutilqt/installbootloader.cpp
@@ -24,11 +24,11 @@ BootloaderInstaller::BootloaderInstaller(QObject* parent): QObject(parent)
24 24
25} 25}
26 26
27void BootloaderInstaller::install(Ui::InstallProgressFrm* dp) 27void BootloaderInstaller::install(ProgressloggerInterface* dp)
28{ 28{
29 m_dp = dp; 29 m_dp = dp;
30 m_install = true; 30 m_install = true;
31 m_dp->listProgress->addItem(tr("Starting bootloader installation")); 31 m_dp->addItem(tr("Starting bootloader installation"));
32 32
33 if(m_bootloadermethod == "gigabeatf") 33 if(m_bootloadermethod == "gigabeatf")
34 { 34 {
@@ -68,7 +68,7 @@ void BootloaderInstaller::install(Ui::InstallProgressFrm* dp)
68 } 68 }
69 else 69 else
70 { 70 {
71 m_dp->listProgress->addItem(tr("unsupported install Method")); 71 m_dp->addItem(tr("unsupported install Method"));
72 emit done(true); 72 emit done(true);
73 return; 73 return;
74 } 74 }
@@ -76,11 +76,11 @@ void BootloaderInstaller::install(Ui::InstallProgressFrm* dp)
76 emit prepare(); 76 emit prepare();
77} 77}
78 78
79void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp) 79void BootloaderInstaller::uninstall(ProgressloggerInterface* dp)
80{ 80{
81 m_dp = dp; 81 m_dp = dp;
82 m_install = false; 82 m_install = false;
83 m_dp->listProgress->addItem(tr("Starting bootloader uninstallation")); 83 m_dp->addItem(tr("Starting bootloader uninstallation"));
84 84
85 if(m_bootloadermethod == "gigabeatf") 85 if(m_bootloadermethod == "gigabeatf")
86 { 86 {
@@ -89,7 +89,7 @@ void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp)
89 } 89 }
90 else if(m_bootloadermethod == "iaudio") 90 else if(m_bootloadermethod == "iaudio")
91 { 91 {
92 m_dp->listProgress->addItem(tr("No uninstallation possible")); 92 m_dp->addItem(tr("No uninstallation possible"));
93 emit done(true); 93 emit done(true);
94 return; 94 return;
95 } 95 }
@@ -110,13 +110,13 @@ void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp)
110 } 110 }
111 else if(m_bootloadermethod == "fwpatcher") 111 else if(m_bootloadermethod == "fwpatcher")
112 { 112 {
113 m_dp->listProgress->addItem(tr("No uninstallation possible")); 113 m_dp->addItem(tr("No uninstallation possible"));
114 emit done(true); 114 emit done(true);
115 return; 115 return;
116 } 116 }
117 else 117 else
118 { 118 {
119 m_dp->listProgress->addItem(tr("unsupported install Method")); 119 m_dp->addItem(tr("unsupported install Method"));
120 emit done(true); 120 emit done(true);
121 return; 121 return;
122 } 122 }
@@ -138,25 +138,25 @@ void BootloaderInstaller::downloadDone(bool error)
138 138
139 // update progress bar 139 // update progress bar
140 140
141 int max = m_dp->progressBar->maximum(); 141 int max = m_dp->getProgressMax();
142 if(max == 0) { 142 if(max == 0) {
143 max = 100; 143 max = 100;
144 m_dp->progressBar->setMaximum(max); 144 m_dp->setProgressMax(max);
145 } 145 }
146 m_dp->progressBar->setValue(max); 146 m_dp->setProgressValue(max);
147 if(getter->httpResponse() != 200) { 147 if(getter->httpResponse() != 200) {
148 m_dp->listProgress->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse())); 148 m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
149 m_dp->buttonAbort->setText(tr("&Ok")); 149 m_dp->abort();
150 emit done(true); 150 emit done(true);
151 return; 151 return;
152 } 152 }
153 if(error) { 153 if(error) {
154 m_dp->listProgress->addItem(tr("Download error: %1").arg(getter->errorString())); 154 m_dp->addItem(tr("Download error: %1").arg(getter->errorString()));
155 m_dp->buttonAbort->setText(tr("&Ok")); 155 m_dp->abort();
156 emit done(true); 156 emit done(true);
157 return; 157 return;
158 } 158 }
159 else m_dp->listProgress->addItem(tr("Download finished.")); 159 else m_dp->addItem(tr("Download finished."));
160 160
161 emit finish(); 161 emit finish();
162 162
@@ -164,8 +164,8 @@ void BootloaderInstaller::downloadDone(bool error)
164 164
165void BootloaderInstaller::updateDataReadProgress(int read, int total) 165void BootloaderInstaller::updateDataReadProgress(int read, int total)
166{ 166{
167 m_dp->progressBar->setMaximum(total); 167 m_dp->setProgressMax(total);
168 m_dp->progressBar->setValue(read); 168 m_dp->setProgressValue(read);
169 qDebug() << "progress:" << read << "/" << total; 169 qDebug() << "progress:" << read << "/" << total;
170} 170}
171 171
@@ -180,7 +180,7 @@ void BootloaderInstaller::gigabeatPrepare()
180 { 180 {
181 QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername; 181 QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername;
182 182
183 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 183 m_dp->addItem(tr("Downloading file %1.%2")
184 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 184 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
185 185
186 // temporary file needs to be opened to get the filename 186 // temporary file needs to be opened to get the filename
@@ -194,9 +194,8 @@ void BootloaderInstaller::gigabeatPrepare()
194 getter->getFile(QUrl(url)); 194 getter->getFile(QUrl(url));
195 // connect signals from HttpGet 195 // connect signals from HttpGet
196 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 196 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
197 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
198 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 197 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
199 198 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
200 } 199 }
201 else //UnInstallation 200 else //UnInstallation
202 { 201 {
@@ -208,7 +207,7 @@ void BootloaderInstaller::gigabeatPrepare()
208 // check if original firmware exists 207 // check if original firmware exists
209 if(!firmwareOrigFI.exists()) 208 if(!firmwareOrigFI.exists())
210 { 209 {
211 m_dp->listProgress->addItem(tr("Could not find the Original Firmware at: %1") 210 m_dp->addItem(tr("Could not find the Original Firmware at: %1")
212 .arg(firmwareOrig)); 211 .arg(firmwareOrig));
213 emit done(true); 212 emit done(true);
214 return; 213 return;
@@ -220,7 +219,7 @@ void BootloaderInstaller::gigabeatPrepare()
220 //remove modified firmware 219 //remove modified firmware
221 if(!firmwareFile.remove()) 220 if(!firmwareFile.remove())
222 { 221 {
223 m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1") 222 m_dp->addItem(tr("Could not remove the Firmware at: %1")
224 .arg(firmware)); 223 .arg(firmware));
225 emit done(true); 224 emit done(true);
226 return; 225 return;
@@ -229,7 +228,7 @@ void BootloaderInstaller::gigabeatPrepare()
229 //copy original firmware 228 //copy original firmware
230 if(!firmwareOrigFile.copy(firmware)) 229 if(!firmwareOrigFile.copy(firmware))
231 { 230 {
232 m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2") 231 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
233 .arg(firmwareOrig,firmware)); 232 .arg(firmwareOrig,firmware));
234 emit done(true); 233 emit done(true);
235 return; 234 return;
@@ -244,7 +243,7 @@ void BootloaderInstaller::gigabeatFinish()
244{ 243{
245 // this step is only need for installation, so no code for uninstall here 244 // this step is only need for installation, so no code for uninstall here
246 245
247 m_dp->listProgress->addItem(tr("Finishing bootloader install")); 246 m_dp->addItem(tr("Finishing bootloader install"));
248 247
249 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername; 248 QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername;
250 249
@@ -253,7 +252,7 @@ void BootloaderInstaller::gigabeatFinish()
253 // check if firmware exists 252 // check if firmware exists
254 if(!firmwareFI.exists()) 253 if(!firmwareFI.exists())
255 { 254 {
256 m_dp->listProgress->addItem(tr("Could not find the Firmware at: %1") 255 m_dp->addItem(tr("Could not find the Firmware at: %1")
257 .arg(firmware)); 256 .arg(firmware));
258 emit done(true); 257 emit done(true);
259 return; 258 return;
@@ -269,7 +268,7 @@ void BootloaderInstaller::gigabeatFinish()
269 QFile firmwareFile(firmware); 268 QFile firmwareFile(firmware);
270 if(!firmwareFile.rename(firmwareOrig)) 269 if(!firmwareFile.rename(firmwareOrig))
271 { 270 {
272 m_dp->listProgress->addItem(tr("Could not rename: %1 to %2") 271 m_dp->addItem(tr("Could not rename: %1 to %2")
273 .arg(firmware,firmwareOrig)); 272 .arg(firmware,firmwareOrig));
274 emit done(true); 273 emit done(true);
275 return; 274 return;
@@ -284,7 +283,7 @@ void BootloaderInstaller::gigabeatFinish()
284 //copy the firmware 283 //copy the firmware
285 if(!downloadFile.copy(firmware)) 284 if(!downloadFile.copy(firmware))
286 { 285 {
287 m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") 286 m_dp->addItem(tr("Could not copy: %1 to %2")
288 .arg(m_tempfilename,firmware)); 287 .arg(m_tempfilename,firmware));
289 emit done(true); 288 emit done(true);
290 return; 289 return;
@@ -292,8 +291,8 @@ void BootloaderInstaller::gigabeatFinish()
292 291
293 downloadFile.remove(); 292 downloadFile.remove();
294 293
295 m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); 294 m_dp->addItem(tr("Bootloader install finished successfully."));
296 m_dp->buttonAbort->setText(tr("&Ok")); 295 m_dp->abort();
297 296
298 emit done(false); // success 297 emit done(false); // success
299 298
@@ -307,7 +306,7 @@ void BootloaderInstaller::iaudioPrepare()
307 306
308 QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername; 307 QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername;
309 308
310 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 309 m_dp->addItem(tr("Downloading file %1.%2")
311 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 310 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
312 311
313 // temporary file needs to be opened to get the filename 312 // temporary file needs to be opened to get the filename
@@ -321,9 +320,8 @@ void BootloaderInstaller::iaudioPrepare()
321 getter->getFile(QUrl(url)); 320 getter->getFile(QUrl(url));
322 // connect signals from HttpGet 321 // connect signals from HttpGet
323 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 322 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
324 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
325 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 323 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
326 324 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
327} 325}
328 326
329void BootloaderInstaller::iaudioFinish() 327void BootloaderInstaller::iaudioFinish()
@@ -333,7 +331,7 @@ void BootloaderInstaller::iaudioFinish()
333 //copy the firmware 331 //copy the firmware
334 if(!downloadFile.copy(firmware)) 332 if(!downloadFile.copy(firmware))
335 { 333 {
336 m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") 334 m_dp->addItem(tr("Could not copy: %1 to %2")
337 .arg(m_tempfilename,firmware)); 335 .arg(m_tempfilename,firmware));
338 emit done(true); 336 emit done(true);
339 return; 337 return;
@@ -341,8 +339,8 @@ void BootloaderInstaller::iaudioFinish()
341 339
342 downloadFile.remove(); 340 downloadFile.remove();
343 341
344 m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); 342 m_dp->addItem(tr("Bootloader install finished successfully."));
345 m_dp->buttonAbort->setText(tr("&Ok")); 343 m_dp->abort();
346 344
347 emit done(false); // success 345 emit done(false); // success
348 346
@@ -358,7 +356,7 @@ void BootloaderInstaller::h10Prepare()
358 { 356 {
359 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; 357 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
360 358
361 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 359 m_dp->addItem(tr("Downloading file %1.%2")
362 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 360 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
363 361
364 // temporary file needs to be opened to get the filename 362 // temporary file needs to be opened to get the filename
@@ -372,8 +370,8 @@ void BootloaderInstaller::h10Prepare()
372 getter->getFile(QUrl(url)); 370 getter->getFile(QUrl(url));
373 // connect signals from HttpGet 371 // connect signals from HttpGet
374 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 372 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
375 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
376 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 373 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
374 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
377 } 375 }
378 else // Uninstallation 376 else // Uninstallation
379 { 377 {
@@ -390,7 +388,7 @@ void BootloaderInstaller::h10Prepare()
390 firmwareFI.setFile(firmware); 388 firmwareFI.setFile(firmware);
391 if(!firmwareFI.exists()) //Firmware dosent exists on player 389 if(!firmwareFI.exists()) //Firmware dosent exists on player
392 { 390 {
393 m_dp->listProgress->addItem(tr("Firmware doesn not exist: %1") 391 m_dp->addItem(tr("Firmware doesn not exist: %1")
394 .arg(firmware)); 392 .arg(firmware));
395 emit done(true); 393 emit done(true);
396 return; 394 return;
@@ -400,7 +398,7 @@ void BootloaderInstaller::h10Prepare()
400 QFileInfo firmwareOrigFI(firmwareOrig); 398 QFileInfo firmwareOrigFI(firmwareOrig);
401 if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player 399 if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player
402 { 400 {
403 m_dp->listProgress->addItem(tr("Original Firmware doesn not exist: %1") 401 m_dp->addItem(tr("Original Firmware doesn not exist: %1")
404 .arg(firmwareOrig)); 402 .arg(firmwareOrig));
405 emit done(true); 403 emit done(true);
406 return; 404 return;
@@ -412,7 +410,7 @@ void BootloaderInstaller::h10Prepare()
412 //remove modified firmware 410 //remove modified firmware
413 if(!firmwareFile.remove()) 411 if(!firmwareFile.remove())
414 { 412 {
415 m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1") 413 m_dp->addItem(tr("Could not remove the Firmware at: %1")
416 .arg(firmware)); 414 .arg(firmware));
417 emit done(true); 415 emit done(true);
418 return; 416 return;
@@ -421,7 +419,7 @@ void BootloaderInstaller::h10Prepare()
421 //copy original firmware 419 //copy original firmware
422 if(!firmwareOrigFile.copy(firmware)) 420 if(!firmwareOrigFile.copy(firmware))
423 { 421 {
424 m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2") 422 m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
425 .arg(firmwareOrig,firmware)); 423 .arg(firmwareOrig,firmware));
426 emit done(true); 424 emit done(true);
427 return; 425 return;
@@ -447,7 +445,7 @@ void BootloaderInstaller::h10Finish()
447 firmwareFI.setFile(firmware); 445 firmwareFI.setFile(firmware);
448 if(!firmwareFI.exists()) //Firmware dosent exists on player 446 if(!firmwareFI.exists()) //Firmware dosent exists on player
449 { 447 {
450 m_dp->listProgress->addItem(tr("Firmware does not exist: %1") 448 m_dp->addItem(tr("Firmware does not exist: %1")
451 .arg(firmware)); 449 .arg(firmware));
452 emit done(true); 450 emit done(true);
453 return; 451 return;
@@ -461,7 +459,7 @@ void BootloaderInstaller::h10Finish()
461 QFile firmwareFile(firmware); 459 QFile firmwareFile(firmware);
462 if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original 460 if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original
463 { 461 {
464 m_dp->listProgress->addItem(tr("Could not rename: %1 to %2") 462 m_dp->addItem(tr("Could not rename: %1 to %2")
465 .arg(firmware,firmwareOrig)); 463 .arg(firmware,firmwareOrig));
466 emit done(true); 464 emit done(true);
467 return; 465 return;
@@ -475,7 +473,7 @@ void BootloaderInstaller::h10Finish()
475 //copy the firmware 473 //copy the firmware
476 if(!downloadFile.copy(firmware)) 474 if(!downloadFile.copy(firmware))
477 { 475 {
478 m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") 476 m_dp->addItem(tr("Could not copy: %1 to %2")
479 .arg(m_tempfilename,firmware)); 477 .arg(m_tempfilename,firmware));
480 emit done(true); 478 emit done(true);
481 return; 479 return;
@@ -483,8 +481,8 @@ void BootloaderInstaller::h10Finish()
483 481
484 downloadFile.remove(); 482 downloadFile.remove();
485 483
486 m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); 484 m_dp->addItem(tr("Bootloader install finished successfully."));
487 m_dp->buttonAbort->setText(tr("&Ok")); 485 m_dp->abort();
488 486
489 emit done(false); // success 487 emit done(false); // success
490 488
@@ -503,19 +501,19 @@ bool initIpodpatcher()
503 501
504void BootloaderInstaller::ipodPrepare() 502void BootloaderInstaller::ipodPrepare()
505{ 503{
506 m_dp->listProgress->addItem(tr("Searching for ipods")); 504 m_dp->addItem(tr("Searching for ipods"));
507 struct ipod_t ipod; 505 struct ipod_t ipod;
508 506
509 int n = ipod_scan(&ipod); 507 int n = ipod_scan(&ipod);
510 if (n == 0) 508 if (n == 0)
511 { 509 {
512 m_dp->listProgress->addItem(tr("No Ipods found")); 510 m_dp->addItem(tr("No Ipods found"));
513 emit done(true); 511 emit done(true);
514 return; 512 return;
515 } 513 }
516 if (n > 1) 514 if (n > 1)
517 { 515 {
518 m_dp->listProgress->addItem(tr("Too many Ipods found")); 516 m_dp->addItem(tr("Too many Ipods found"));
519 emit done(true); 517 emit done(true);
520 } 518 }
521 519
@@ -524,7 +522,7 @@ void BootloaderInstaller::ipodPrepare()
524 522
525 QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod"; 523 QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod";
526 524
527 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 525 m_dp->addItem(tr("Downloading file %1.%2")
528 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 526 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
529 527
530 // temporary file needs to be opened to get the filename 528 // temporary file needs to be opened to get the filename
@@ -538,38 +536,37 @@ void BootloaderInstaller::ipodPrepare()
538 getter->getFile(QUrl(url)); 536 getter->getFile(QUrl(url));
539 // connect signals from HttpGet 537 // connect signals from HttpGet
540 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 538 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
541 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
542 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 539 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
543 540 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
544 } 541 }
545 else // Uninstallation 542 else // Uninstallation
546 { 543 {
547 if (ipod_open(&ipod, 0) < 0) 544 if (ipod_open(&ipod, 0) < 0)
548 { 545 {
549 m_dp->listProgress->addItem(tr("could not open ipod")); 546 m_dp->addItem(tr("could not open ipod"));
550 emit done(true); 547 emit done(true);
551 return; 548 return;
552 } 549 }
553 550
554 if (read_partinfo(&ipod,0) < 0) 551 if (read_partinfo(&ipod,0) < 0)
555 { 552 {
556 m_dp->listProgress->addItem(tr("could not read partitiontable")); 553 m_dp->addItem(tr("could not read partitiontable"));
557 emit done(true); 554 emit done(true);
558 return; 555 return;
559 } 556 }
560 557
561 if (ipod.pinfo[0].start==0) 558 if (ipod.pinfo[0].start==0)
562 { 559 {
563 m_dp->listProgress->addItem(tr("No partition 0 on disk")); 560 m_dp->addItem(tr("No partition 0 on disk"));
564 561
565 int i; 562 int i;
566 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; 563 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
567 m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); 564 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
568 for ( i = 0; i < 4; i++ ) 565 for ( i = 0; i < 4; i++ )
569 { 566 {
570 if (ipod.pinfo[i].start != 0) 567 if (ipod.pinfo[i].start != 0)
571 { 568 {
572 m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( 569 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
573 i).arg( 570 i).arg(
574 ipod.pinfo[i].start).arg( 571 ipod.pinfo[i].start).arg(
575 ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( 572 ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg(
@@ -586,13 +583,13 @@ void BootloaderInstaller::ipodPrepare()
586 583
587 if (ipod.nimages <= 0) 584 if (ipod.nimages <= 0)
588 { 585 {
589 m_dp->listProgress->addItem(tr("Failed to read firmware directory")); 586 m_dp->addItem(tr("Failed to read firmware directory"));
590 emit done(true); 587 emit done(true);
591 return; 588 return;
592 } 589 }
593 if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) 590 if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0)
594 { 591 {
595 m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg( 592 m_dp->addItem(tr("Unknown version number in firmware (%1)").arg(
596 ipod.ipod_directory[0].vers)); 593 ipod.ipod_directory[0].vers));
597 emit done(true); 594 emit done(true);
598 return; 595 return;
@@ -600,32 +597,32 @@ void BootloaderInstaller::ipodPrepare()
600 597
601 if (ipod.macpod) 598 if (ipod.macpod)
602 { 599 {
603 m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); 600 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
604 } 601 }
605 602
606 if (ipod_reopen_rw(&ipod) < 0) 603 if (ipod_reopen_rw(&ipod) < 0)
607 { 604 {
608 m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode")); 605 m_dp->addItem(tr("Could not open Ipod in RW mode"));
609 emit done(true); 606 emit done(true);
610 return; 607 return;
611 } 608 }
612 609
613 if (ipod.ipod_directory[0].entryOffset==0) { 610 if (ipod.ipod_directory[0].entryOffset==0) {
614 m_dp->listProgress->addItem(tr("No bootloader detected.")); 611 m_dp->addItem(tr("No bootloader detected."));
615 emit done(true); 612 emit done(true);
616 return; 613 return;
617 } 614 }
618 615
619 if (delete_bootloader(&ipod)==0) 616 if (delete_bootloader(&ipod)==0)
620 { 617 {
621 m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); 618 m_dp->addItem(tr("Successfully removed Bootloader"));
622 emit done(false); 619 emit done(false);
623 ipod_close(&ipod); 620 ipod_close(&ipod);
624 return; 621 return;
625 } 622 }
626 else 623 else
627 { 624 {
628 m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); 625 m_dp->addItem(tr("--delete-bootloader failed."));
629 emit done(true); 626 emit done(true);
630 ipod_close(&ipod); 627 ipod_close(&ipod);
631 return; 628 return;
@@ -640,32 +637,32 @@ void BootloaderInstaller::ipodFinish()
640 637
641 if (ipod_open(&ipod, 0) < 0) 638 if (ipod_open(&ipod, 0) < 0)
642 { 639 {
643 m_dp->listProgress->addItem(tr("could not open ipod")); 640 m_dp->addItem(tr("could not open ipod"));
644 emit done(true); 641 emit done(true);
645 return; 642 return;
646 } 643 }
647 644
648 if (read_partinfo(&ipod,0) < 0) 645 if (read_partinfo(&ipod,0) < 0)
649 { 646 {
650 m_dp->listProgress->addItem(tr("could not read partitiontable")); 647 m_dp->addItem(tr("could not read partitiontable"));
651 emit done(true); 648 emit done(true);
652 return; 649 return;
653 } 650 }
654 651
655 if (ipod.pinfo[0].start==0) 652 if (ipod.pinfo[0].start==0)
656 { 653 {
657 m_dp->listProgress->addItem(tr("No partition 0 on disk")); 654 m_dp->addItem(tr("No partition 0 on disk"));
658 655
659 int i; 656 int i;
660 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size; 657 double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
661 658
662 m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n")); 659 m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
663 660
664 for ( i = 0; i < 4; i++ ) 661 for ( i = 0; i < 4; i++ )
665 { 662 {
666 if (ipod.pinfo[i].start != 0) 663 if (ipod.pinfo[i].start != 0)
667 { 664 {
668 m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg( 665 m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
669 i).arg( 666 i).arg(
670 ipod.pinfo[i].start).arg( 667 ipod.pinfo[i].start).arg(
671 ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg( 668 ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg(
@@ -682,13 +679,13 @@ void BootloaderInstaller::ipodFinish()
682 679
683 if (ipod.nimages <= 0) 680 if (ipod.nimages <= 0)
684 { 681 {
685 m_dp->listProgress->addItem(tr("Failed to read firmware directory")); 682 m_dp->addItem(tr("Failed to read firmware directory"));
686 emit done(true); 683 emit done(true);
687 return; 684 return;
688 } 685 }
689 if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0) 686 if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0)
690 { 687 {
691 m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg( 688 m_dp->addItem(tr("Unknown version number in firmware (%1)").arg(
692 ipod.ipod_directory[0].vers)); 689 ipod.ipod_directory[0].vers));
693 emit done(true); 690 emit done(true);
694 return; 691 return;
@@ -696,26 +693,26 @@ void BootloaderInstaller::ipodFinish()
696 693
697 if (ipod.macpod) 694 if (ipod.macpod)
698 { 695 {
699 m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod")); 696 m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
700 } 697 }
701 698
702 if (ipod_reopen_rw(&ipod) < 0) 699 if (ipod_reopen_rw(&ipod) < 0)
703 { 700 {
704 m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode")); 701 m_dp->addItem(tr("Could not open Ipod in RW mode"));
705 emit done(true); 702 emit done(true);
706 return; 703 return;
707 } 704 }
708 705
709 if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) 706 if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0)
710 { 707 {
711 m_dp->listProgress->addItem(tr("Successfully added Bootloader")); 708 m_dp->addItem(tr("Successfully added Bootloader"));
712 emit done(false); 709 emit done(false);
713 ipod_close(&ipod); 710 ipod_close(&ipod);
714 return; 711 return;
715 } 712 }
716 else 713 else
717 { 714 {
718 m_dp->listProgress->addItem(tr("failed to add Bootloader")); 715 m_dp->addItem(tr("failed to add Bootloader"));
719 ipod_close(&ipod); 716 ipod_close(&ipod);
720 emit done(true); 717 emit done(true);
721 return; 718 return;
@@ -735,19 +732,19 @@ bool initSansaPatcher()
735 732
736void BootloaderInstaller::sansaPrepare() 733void BootloaderInstaller::sansaPrepare()
737{ 734{
738 m_dp->listProgress->addItem(tr("Searching for sansas")); 735 m_dp->addItem(tr("Searching for sansas"));
739 struct sansa_t sansa; 736 struct sansa_t sansa;
740 737
741 int n = sansa_scan(&sansa); 738 int n = sansa_scan(&sansa);
742 if (n == 0) 739 if (n == 0)
743 { 740 {
744 m_dp->listProgress->addItem(tr("No Sansa found")); 741 m_dp->addItem(tr("No Sansa found"));
745 emit done(true); 742 emit done(true);
746 return; 743 return;
747 } 744 }
748 if (n > 1) 745 if (n > 1)
749 { 746 {
750 m_dp->listProgress->addItem(tr("Too many Sansas found")); 747 m_dp->addItem(tr("Too many Sansas found"));
751 emit done(true); 748 emit done(true);
752 } 749 }
753 750
@@ -755,7 +752,7 @@ void BootloaderInstaller::sansaPrepare()
755 { 752 {
756 QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername; 753 QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername;
757 754
758 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 755 m_dp->addItem(tr("Downloading file %1.%2")
759 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 756 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
760 757
761 // temporary file needs to be opened to get the filename 758 // temporary file needs to be opened to get the filename
@@ -769,36 +766,36 @@ void BootloaderInstaller::sansaPrepare()
769 getter->getFile(QUrl(url)); 766 getter->getFile(QUrl(url));
770 // connect signals from HttpGet 767 // connect signals from HttpGet
771 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 768 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
772 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
773 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 769 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
770 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
774 } 771 }
775 else // Uninstallation 772 else // Uninstallation
776 { 773 {
777 774
778 if (sansa_open(&sansa, 0) < 0) 775 if (sansa_open(&sansa, 0) < 0)
779 { 776 {
780 m_dp->listProgress->addItem(tr("could not open Sansa")); 777 m_dp->addItem(tr("could not open Sansa"));
781 emit done(true); 778 emit done(true);
782 return; 779 return;
783 } 780 }
784 781
785 if (sansa_read_partinfo(&sansa,0) < 0) 782 if (sansa_read_partinfo(&sansa,0) < 0)
786 { 783 {
787 m_dp->listProgress->addItem(tr("could not read partitiontable")); 784 m_dp->addItem(tr("could not read partitiontable"));
788 emit done(true); 785 emit done(true);
789 return; 786 return;
790 } 787 }
791 788
792 int i = is_e200(&sansa); 789 int i = is_e200(&sansa);
793 if (i < 0) { 790 if (i < 0) {
794 m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); 791 m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
795 emit done(true); 792 emit done(true);
796 return; 793 return;
797 } 794 }
798 795
799 if (sansa.hasoldbootloader) 796 if (sansa.hasoldbootloader)
800 { 797 {
801 m_dp->listProgress->addItem(tr("********************************************\n" 798 m_dp->addItem(tr("********************************************\n"
802 "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n" 799 "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
803 "You must reinstall the original Sansa firmware before running\n" 800 "You must reinstall the original Sansa firmware before running\n"
804 "sansapatcher for the first time.\n" 801 "sansapatcher for the first time.\n"
@@ -811,21 +808,21 @@ void BootloaderInstaller::sansaPrepare()
811 808
812 if (sansa_reopen_rw(&sansa) < 0) 809 if (sansa_reopen_rw(&sansa) < 0)
813 { 810 {
814 m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode")); 811 m_dp->addItem(tr("Could not open Sansa in RW mode"));
815 emit done(true); 812 emit done(true);
816 return; 813 return;
817 } 814 }
818 815
819 if (sansa_delete_bootloader(&sansa)==0) 816 if (sansa_delete_bootloader(&sansa)==0)
820 { 817 {
821 m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); 818 m_dp->addItem(tr("Successfully removed Bootloader"));
822 emit done(false); 819 emit done(false);
823 sansa_close(&sansa); 820 sansa_close(&sansa);
824 return; 821 return;
825 } 822 }
826 else 823 else
827 { 824 {
828 m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); 825 m_dp->addItem(tr("--delete-bootloader failed."));
829 emit done(true); 826 emit done(true);
830 sansa_close(&sansa); 827 sansa_close(&sansa);
831 return; 828 return;
@@ -840,14 +837,14 @@ void BootloaderInstaller::sansaFinish()
840 837
841 if (sansa_open(&sansa, 0) < 0) 838 if (sansa_open(&sansa, 0) < 0)
842 { 839 {
843 m_dp->listProgress->addItem(tr("could not open Sansa")); 840 m_dp->addItem(tr("could not open Sansa"));
844 emit done(true); 841 emit done(true);
845 return; 842 return;
846 } 843 }
847 844
848 if (sansa_read_partinfo(&sansa,0) < 0) 845 if (sansa_read_partinfo(&sansa,0) < 0)
849 { 846 {
850 m_dp->listProgress->addItem(tr("could not read partitiontable")); 847 m_dp->addItem(tr("could not read partitiontable"));
851 emit done(true); 848 emit done(true);
852 return; 849 return;
853 } 850 }
@@ -856,14 +853,14 @@ void BootloaderInstaller::sansaFinish()
856 int i = is_e200(&sansa); 853 int i = is_e200(&sansa);
857 if (i < 0) { 854 if (i < 0) {
858 855
859 m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); 856 m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
860 emit done(true); 857 emit done(true);
861 return; 858 return;
862 } 859 }
863 860
864 if (sansa.hasoldbootloader) 861 if (sansa.hasoldbootloader)
865 { 862 {
866 m_dp->listProgress->addItem(tr("********************************************\n" 863 m_dp->addItem(tr("********************************************\n"
867 "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n" 864 "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
868 "You must reinstall the original Sansa firmware before running\n" 865 "You must reinstall the original Sansa firmware before running\n"
869 "sansapatcher for the first time.\n" 866 "sansapatcher for the first time.\n"
@@ -875,21 +872,21 @@ void BootloaderInstaller::sansaFinish()
875 872
876 if (sansa_reopen_rw(&sansa) < 0) 873 if (sansa_reopen_rw(&sansa) < 0)
877 { 874 {
878 m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode")); 875 m_dp->addItem(tr("Could not open Sansa in RW mode"));
879 emit done(true); 876 emit done(true);
880 return; 877 return;
881 } 878 }
882 879
883 if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0) 880 if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0)
884 { 881 {
885 m_dp->listProgress->addItem(tr("Successfully added Bootloader")); 882 m_dp->addItem(tr("Successfully added Bootloader"));
886 emit done(false); 883 emit done(false);
887 sansa_close(&sansa); 884 sansa_close(&sansa);
888 return; 885 return;
889 } 886 }
890 else 887 else
891 { 888 {
892 m_dp->listProgress->addItem(tr("failed to add Bootloader")); 889 m_dp->addItem(tr("failed to add Bootloader"));
893 sansa_close(&sansa); 890 sansa_close(&sansa);
894 emit done(true); 891 emit done(true);
895 return; 892 return;
@@ -905,7 +902,7 @@ void BootloaderInstaller::iriverPrepare()
905{ 902{
906 char md5sum_str[32]; 903 char md5sum_str[32];
907 if (!FileMD5(m_origfirmware, md5sum_str)) { 904 if (!FileMD5(m_origfirmware, md5sum_str)) {
908 m_dp->listProgress->addItem(tr("Could not MD5Sum original firmware")); 905 m_dp->addItem(tr("Could not MD5Sum original firmware"));
909 emit done(true); 906 emit done(true);
910 return; 907 return;
911 } 908 }
@@ -935,14 +932,14 @@ void BootloaderInstaller::iriverPrepare()
935 } 932 }
936 if (series == 0) 933 if (series == 0)
937 { 934 {
938 m_dp->listProgress->addItem(tr("Could not detect firmware type")); 935 m_dp->addItem(tr("Could not detect firmware type"));
939 emit done(true); 936 emit done(true);
940 return; 937 return;
941 } 938 }
942 939
943 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername; 940 QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
944 941
945 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 942 m_dp->addItem(tr("Downloading file %1.%2")
946 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); 943 .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
947 944
948 // temporary file needs to be opened to get the filename 945 // temporary file needs to be opened to get the filename
@@ -956,9 +953,8 @@ void BootloaderInstaller::iriverPrepare()
956 getter->getFile(QUrl(url)); 953 getter->getFile(QUrl(url));
957 // connect signals from HttpGet 954 // connect signals from HttpGet
958 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 955 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
959 //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
960 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 956 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
961 957 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
962} 958}
963 959
964void BootloaderInstaller::iriverFinish() 960void BootloaderInstaller::iriverFinish()
@@ -999,7 +995,7 @@ void BootloaderInstaller::iriverFinish()
999 // iriver decode 995 // iriver decode
1000 if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1) 996 if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1)
1001 { 997 {
1002 m_dp->listProgress->addItem(tr("Error in descramble")); 998 m_dp->addItem(tr("Error in descramble"));
1003 firmwareBin.remove(); 999 firmwareBin.remove();
1004 newBin.remove(); 1000 newBin.remove();
1005 newHex.remove(); 1001 newHex.remove();
@@ -1009,7 +1005,7 @@ void BootloaderInstaller::iriverFinish()
1009 // mkboot 1005 // mkboot
1010 if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp)) 1006 if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp))
1011 { 1007 {
1012 m_dp->listProgress->addItem(tr("Error in patching")); 1008 m_dp->addItem(tr("Error in patching"));
1013 firmwareBin.remove(); 1009 firmwareBin.remove();
1014 newBin.remove(); 1010 newBin.remove();
1015 newHex.remove(); 1011 newHex.remove();
@@ -1019,7 +1015,7 @@ void BootloaderInstaller::iriverFinish()
1019 // iriver_encode 1015 // iriver_encode
1020 if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1) 1016 if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1)
1021 { 1017 {
1022 m_dp->listProgress->addItem(tr("Error in scramble")); 1018 m_dp->addItem(tr("Error in scramble"));
1023 firmwareBin.remove(); 1019 firmwareBin.remove();
1024 newBin.remove(); 1020 newBin.remove();
1025 newHex.remove(); 1021 newHex.remove();
@@ -1030,7 +1026,7 @@ void BootloaderInstaller::iriverFinish()
1030 /* now md5sum it */ 1026 /* now md5sum it */
1031 if (!FileMD5(newHexName, md5sum_str)) 1027 if (!FileMD5(newHexName, md5sum_str))
1032 { 1028 {
1033 m_dp->listProgress->addItem(tr("Error in checksumming")); 1029 m_dp->addItem(tr("Error in checksumming"));
1034 firmwareBin.remove(); 1030 firmwareBin.remove();
1035 newBin.remove(); 1031 newBin.remove();
1036 newHex.remove(); 1032 newHex.remove();
@@ -1054,7 +1050,7 @@ void BootloaderInstaller::iriverFinish()
1054 // copy file 1050 // copy file
1055 if(!newHex.copy(dest)) 1051 if(!newHex.copy(dest))
1056 { 1052 {
1057 m_dp->listProgress->addItem(tr("Could not copy: %1 to %2") 1053 m_dp->addItem(tr("Could not copy: %1 to %2")
1058 .arg(newHexName,dest)); 1054 .arg(newHexName,dest));
1059 emit done(true); 1055 emit done(true);
1060 return; 1056 return;
@@ -1063,8 +1059,8 @@ void BootloaderInstaller::iriverFinish()
1063 downloadFile.remove(); 1059 downloadFile.remove();
1064 newHex.remove(); 1060 newHex.remove();
1065 1061
1066 m_dp->listProgress->addItem(tr("Bootloader install finished successfully.")); 1062 m_dp->addItem(tr("Bootloader install finished successfully."));
1067 m_dp->buttonAbort->setText(tr("&Ok")); 1063 m_dp->abort();
1068 1064
1069 emit done(false); // success 1065 emit done(false); // success
1070 1066
diff --git a/rbutil/rbutilqt/installbootloader.h b/rbutil/rbutilqt/installbootloader.h
index f8dfd43c3f..5a3c02b117 100644
--- a/rbutil/rbutilqt/installbootloader.h
+++ b/rbutil/rbutilqt/installbootloader.h
@@ -22,7 +22,7 @@
22 22
23#include <QtGui> 23#include <QtGui>
24 24
25#include "ui_installprogressfrm.h" 25#include "progressloggerinterface.h"
26#include "httpget.h" 26#include "httpget.h"
27#include "irivertools/irivertools.h" 27#include "irivertools/irivertools.h"
28 28
@@ -43,8 +43,8 @@ public:
43 BootloaderInstaller(QObject* parent); 43 BootloaderInstaller(QObject* parent);
44 ~BootloaderInstaller() {} 44 ~BootloaderInstaller() {}
45 45
46 void install(Ui::InstallProgressFrm* dp); 46 void install(ProgressloggerInterface* dp);
47 void uninstall(Ui::InstallProgressFrm* dp); 47 void uninstall(ProgressloggerInterface* dp);
48 48
49 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;} 49 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
50 void setProxy(QUrl proxy) {m_proxy= proxy;} 50 void setProxy(QUrl proxy) {m_proxy= proxy;}
@@ -101,7 +101,7 @@ private:
101 HttpGet *getter; 101 HttpGet *getter;
102 QTemporaryFile downloadFile; 102 QTemporaryFile downloadFile;
103 103
104 Ui::InstallProgressFrm* m_dp; 104 ProgressloggerInterface* m_dp;
105 105
106}; 106};
107#endif 107#endif
diff --git a/rbutil/rbutilqt/installzip.cpp b/rbutil/rbutilqt/installzip.cpp
index d4072f852a..b947553f33 100644
--- a/rbutil/rbutilqt/installzip.cpp
+++ b/rbutil/rbutilqt/installzip.cpp
@@ -28,11 +28,11 @@ ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
28} 28}
29 29
30 30
31void ZipInstaller::install(Ui::InstallProgressFrm* dp) 31void ZipInstaller::install(ProgressloggerInterface* dp)
32{ 32{
33 m_dp = dp; 33 m_dp = dp;
34 34
35 m_dp->listProgress->addItem(tr("Downloading file %1.%2") 35 m_dp->addItem(tr("Downloading file %1.%2")
36 .arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix())); 36 .arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix()));
37 37
38 // temporary file needs to be opened to get the filename 38 // temporary file needs to be opened to get the filename
@@ -48,7 +48,7 @@ void ZipInstaller::install(Ui::InstallProgressFrm* dp)
48 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); 48 connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
49 connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); 49 connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
50 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); 50 connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
51 connect(m_dp->buttonAbort, SIGNAL(clicked()), getter, SLOT(abort())); 51 connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
52} 52}
53 53
54void ZipInstaller::downloadRequestFinished(int id, bool error) 54void ZipInstaller::downloadRequestFinished(int id, bool error)
@@ -65,53 +65,53 @@ void ZipInstaller::downloadDone(bool error)
65 65
66 // update progress bar 66 // update progress bar
67 67
68 int max = m_dp->progressBar->maximum(); 68 int max = m_dp->getProgressMax();
69 if(max == 0) { 69 if(max == 0) {
70 max = 100; 70 max = 100;
71 m_dp->progressBar->setMaximum(max); 71 m_dp->setProgressMax(max);
72 } 72 }
73 m_dp->progressBar->setValue(max); 73 m_dp->setProgressValue(max);
74 if(getter->httpResponse() != 200) { 74 if(getter->httpResponse() != 200) {
75 m_dp->listProgress->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse())); 75 m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
76 m_dp->buttonAbort->setText(tr("&Ok")); 76 m_dp->abort();
77 emit done(true); 77 emit done(true);
78 return; 78 return;
79 } 79 }
80 if(error) { 80 if(error) {
81 m_dp->listProgress->addItem(tr("Download error: %1").arg(getter->errorString())); 81 m_dp->addItem(tr("Download error: %1").arg(getter->errorString()));
82 m_dp->buttonAbort->setText(tr("&Ok")); 82 m_dp->abort();
83 emit done(true); 83 emit done(true);
84 return; 84 return;
85 } 85 }
86 else m_dp->listProgress->addItem(tr("Download finished.")); 86 else m_dp->addItem(tr("Download finished."));
87 87
88 // unzip downloaded file 88 // unzip downloaded file
89 qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint; 89 qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint;
90 90
91 m_dp->listProgress->addItem(tr("Extracting file.")); 91 m_dp->addItem(tr("Extracting file."));
92 92
93 qDebug() << "file to unzip: " << m_file; 93 qDebug() << "file to unzip: " << m_file;
94 UnZip::ErrorCode ec; 94 UnZip::ErrorCode ec;
95 UnZip uz; 95 UnZip uz;
96 ec = uz.openArchive(m_file); 96 ec = uz.openArchive(m_file);
97 if(ec != UnZip::Ok) { 97 if(ec != UnZip::Ok) {
98 m_dp->listProgress->addItem(tr("Opening archive failed: %1.") 98 m_dp->addItem(tr("Opening archive failed: %1.")
99 .arg(uz.formatError(ec))); 99 .arg(uz.formatError(ec)));
100 m_dp->buttonAbort->setText(tr("&Ok")); 100 m_dp->abort();
101 emit done(false); 101 emit done(false);
102 return; 102 return;
103 } 103 }
104 104
105 ec = uz.extractAll(m_mountpoint); 105 ec = uz.extractAll(m_mountpoint);
106 if(ec != UnZip::Ok) { 106 if(ec != UnZip::Ok) {
107 m_dp->listProgress->addItem(tr("Extracting failed: %1.") 107 m_dp->addItem(tr("Extracting failed: %1.")
108 .arg(uz.formatError(ec))); 108 .arg(uz.formatError(ec)));
109 m_dp->buttonAbort->setText(tr("&Ok")); 109 m_dp->abort();
110 emit done(false); 110 emit done(false);
111 return; 111 return;
112 } 112 }
113 113
114 m_dp->listProgress->addItem(tr("creating installation log")); 114 m_dp->addItem(tr("creating installation log"));
115 115
116 QStringList zipContents = uz.fileList(); 116 QStringList zipContents = uz.fileList();
117 117
@@ -127,16 +127,15 @@ void ZipInstaller::downloadDone(bool error)
127 // remove temporary file 127 // remove temporary file
128 downloadFile.remove(); 128 downloadFile.remove();
129 129
130 m_dp->listProgress->addItem(tr("Extraction finished successfully.")); 130 m_dp->addItem(tr("Extraction finished successfully."));
131 m_dp->buttonAbort->setText(tr("&Ok")); 131 m_dp->abort();
132
133 emit done(false); 132 emit done(false);
134} 133}
135 134
136void ZipInstaller::updateDataReadProgress(int read, int total) 135void ZipInstaller::updateDataReadProgress(int read, int total)
137{ 136{
138 m_dp->progressBar->setMaximum(total); 137 m_dp->setProgressMax(total);
139 m_dp->progressBar->setValue(read); 138 m_dp->setProgressValue(read);
140 qDebug() << "progress:" << read << "/" << total; 139 qDebug() << "progress:" << read << "/" << total;
141 140
142} 141}
diff --git a/rbutil/rbutilqt/installzip.h b/rbutil/rbutilqt/installzip.h
index e3f3b5ad35..f70ec70ccf 100644
--- a/rbutil/rbutilqt/installzip.h
+++ b/rbutil/rbutilqt/installzip.h
@@ -26,7 +26,7 @@
26#include <QtGui> 26#include <QtGui>
27#include <QtNetwork> 27#include <QtNetwork>
28 28
29#include "ui_installprogressfrm.h" 29#include "progressloggerinterface.h"
30#include "httpget.h" 30#include "httpget.h"
31 31
32class ZipInstaller : public QObject 32class ZipInstaller : public QObject
@@ -35,7 +35,7 @@ class ZipInstaller : public QObject
35public: 35public:
36 ZipInstaller(QObject* parent) ; 36 ZipInstaller(QObject* parent) ;
37 ~ZipInstaller(){} 37 ~ZipInstaller(){}
38 void install(Ui::InstallProgressFrm* dp); 38 void install(ProgressloggerInterface* dp);
39 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;} 39 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
40 void setFilename(QString filename){m_file = filename;} 40 void setFilename(QString filename){m_file = filename;}
41 void setUrl(QString url){m_url = url;} 41 void setUrl(QString url){m_url = url;}
@@ -57,7 +57,7 @@ private:
57 HttpGet *getter; 57 HttpGet *getter;
58 QTemporaryFile downloadFile; 58 QTemporaryFile downloadFile;
59 59
60 Ui::InstallProgressFrm* m_dp; 60 ProgressloggerInterface* m_dp;
61}; 61};
62 62
63 63
diff --git a/rbutil/rbutilqt/installzipwindow.cpp b/rbutil/rbutilqt/installzipwindow.cpp
index 551d1144c7..cd85305eba 100644
--- a/rbutil/rbutilqt/installzipwindow.cpp
+++ b/rbutil/rbutilqt/installzipwindow.cpp
@@ -1,128 +1,126 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installzipwindow.cpp 14027 2007-07-27 17:42:49Z domonoky $ 10 * $Id: installzipwindow.cpp 14027 2007-07-27 17:42:49Z domonoky $
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.
14 * 14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "installzipwindow.h" 20#include "installzipwindow.h"
21#include "ui_installprogressfrm.h" 21//#include "ui_installprogressfrm.h"
22 22
23 23
24InstallZipWindow::InstallZipWindow(QWidget *parent) : QDialog(parent) 24InstallZipWindow::InstallZipWindow(QWidget *parent) : QDialog(parent)
25{ 25{
26 ui.setupUi(this); 26 ui.setupUi(this);
27 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder())); 27 connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
28} 28}
29 29
30void InstallZipWindow::setProxy(QUrl proxy_url) 30void InstallZipWindow::setProxy(QUrl proxy_url)
31{ 31{
32 proxy = proxy_url; 32 proxy = proxy_url;
33 qDebug() << "Install::setProxy" << proxy; 33 qDebug() << "Install::setProxy" << proxy;
34} 34}
35 35
36void InstallZipWindow::setMountPoint(QString mount) 36void InstallZipWindow::setMountPoint(QString mount)
37{ 37{
38 QFileInfo m(mount); 38 QFileInfo m(mount);
39 if(m.isDir()) { 39 if(m.isDir()) {
40 ui.lineMountPoint->clear(); 40 ui.lineMountPoint->clear();
41 ui.lineMountPoint->insert(mount); 41 ui.lineMountPoint->insert(mount);
42 } 42 }
43} 43}
44 44
45void InstallZipWindow::setUrl(QString path) 45void InstallZipWindow::setUrl(QString path)
46{ 46{
47 url = path; 47 url = path;
48} 48}
49 49
50void InstallZipWindow::browseFolder() 50void InstallZipWindow::browseFolder()
51{ 51{
52 QFileDialog browser(this); 52 QFileDialog browser(this);
53 if(QFileInfo(ui.lineMountPoint->text()).isDir()) 53 if(QFileInfo(ui.lineMountPoint->text()).isDir())
54 browser.setDirectory(ui.lineMountPoint->text()); 54 browser.setDirectory(ui.lineMountPoint->text());
55 else 55 else
56 browser.setDirectory("/media"); 56 browser.setDirectory("/media");
57 browser.setReadOnly(true); 57 browser.setReadOnly(true);
58 browser.setFileMode(QFileDialog::DirectoryOnly); 58 browser.setFileMode(QFileDialog::DirectoryOnly);
59 browser.setAcceptMode(QFileDialog::AcceptOpen); 59 browser.setAcceptMode(QFileDialog::AcceptOpen);
60 if(browser.exec()) { 60 if(browser.exec()) {
61 qDebug() << browser.directory(); 61 qDebug() << browser.directory();
62 QStringList files = browser.selectedFiles(); 62 QStringList files = browser.selectedFiles();
63 setMountPoint(files.at(0)); 63 setMountPoint(files.at(0));
64 } 64 }
65} 65}
66 66
67void InstallZipWindow::accept() 67void InstallZipWindow::accept()
68{ 68{
69 downloadProgress = new QDialog(this); 69 // create logger
70 dp.setupUi(downloadProgress); 70 logger = new ProgressLoggerGui(this);
71 71 logger->show();
72 // show dialog with error if mount point is wrong 72
73 if(QFileInfo(ui.lineMountPoint->text()).isDir()) { 73 // show dialog with error if mount point is wrong
74 mountPoint = ui.lineMountPoint->text(); 74 if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
75 userSettings->setValue("defaults/mountpoint", mountPoint); 75 mountPoint = ui.lineMountPoint->text();
76 } 76 userSettings->setValue("defaults/mountpoint", mountPoint);
77 else { 77 }
78 dp.listProgress->addItem(tr("Mount point is wrong!")); 78 else {
79 dp.buttonAbort->setText(tr("&Ok")); 79 logger->addItem(tr("Mount point is wrong!"));
80 downloadProgress->show(); 80 logger->abort();
81 return; 81 return;
82 } 82 }
83 83
84 userSettings->sync(); 84 userSettings->sync();
85 85
86 installer = new ZipInstaller(this); 86 // create Zip installer
87 87 installer = new ZipInstaller(this);
88 QString fileName = url.section('/', -1); 88
89 89 QString fileName = url.section('/', -1);
90 installer->setFilename(fileName); 90 installer->setFilename(fileName);
91 installer->setUrl(url); 91 installer->setUrl(url);
92 installer->setProxy(proxy); 92 installer->setProxy(proxy);
93 installer->setLogSection(logsection); 93 installer->setLogSection(logsection);
94 installer->setMountPoint(mountPoint); 94 installer->setMountPoint(mountPoint);
95 installer->install(&dp); 95 installer->install(logger);
96 96
97 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); 97 connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
98 98
99 downloadProgress->show(); 99
100 100}
101} 101
102 102// we are done with Zip installing
103 103void InstallZipWindow::done(bool error)
104void InstallZipWindow::done(bool error) 104{
105{ 105 qDebug() << "Install::done, error:" << error;
106 qDebug() << "Install::done, error:" << error; 106
107 107 if(error) // if there was an error
108 if(error) 108 {
109 { 109 logger->abort();
110 // connect close button now as it's needed if we break upon an error 110 return;
111 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close())); 111 }
112 return; 112
113 } 113 // no error, close the window, when the logger is closed
114 114 connect(logger,SIGNAL(closed()),this,SLOT(close()));
115 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close())); 115}
116 connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close())); 116
117} 117void InstallZipWindow::setDeviceSettings(QSettings *dev)
118 118{
119void InstallZipWindow::setDeviceSettings(QSettings *dev) 119 devices = dev;
120{ 120 qDebug() << "Install::setDeviceSettings:" << devices;
121 devices = dev; 121}
122 qDebug() << "Install::setDeviceSettings:" << devices; 122
123} 123void InstallZipWindow::setUserSettings(QSettings *user)
124 124{
125void InstallZipWindow::setUserSettings(QSettings *user) 125 userSettings = user;
126{ 126}
127 userSettings = user;
128}
diff --git a/rbutil/rbutilqt/installzipwindow.h b/rbutil/rbutilqt/installzipwindow.h
index 7208ff9ffb..1eb96b745f 100644
--- a/rbutil/rbutilqt/installzipwindow.h
+++ b/rbutil/rbutilqt/installzipwindow.h
@@ -1,68 +1,66 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installzipwindow.h 14027 2007-07-27 17:42:49Z domonoky $ 10 * $Id: installzipwindow.h 14027 2007-07-27 17:42:49Z domonoky $
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.
14 * 14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#ifndef INSTALLZIPWINDOW_H 20#ifndef INSTALLZIPWINDOW_H
21#define INSTALLZIPWINDOW_H 21#define INSTALLZIPWINDOW_H
22 22
23#include <QtGui> 23#include <QtGui>
24 24
25#include <QSettings> 25#include <QSettings>
26 26
27#include "ui_installzipfrm.h" 27#include "ui_installzipfrm.h"
28#include "ui_installprogressfrm.h" 28#include "installzip.h"
29#include "installzip.h" 29#include "progressloggergui.h"
30 30
31 31class InstallZipWindow : public QDialog
32class InstallZipWindow : public QDialog 32{
33{ 33 Q_OBJECT
34 Q_OBJECT 34 public:
35 public: 35 InstallZipWindow(QWidget *parent = 0);
36 InstallZipWindow(QWidget *parent = 0); 36 void setProxy(QUrl);
37 void setProxy(QUrl); 37 void setMountPoint(QString);
38 void setMountPoint(QString); 38 void setUrl(QString);
39 void setUrl(QString); 39 void setLogSection(QString name){logsection = name; }
40 void setLogSection(QString name){logsection = name; } 40 void setUserSettings(QSettings*);
41 void setUserSettings(QSettings*); 41 void setDeviceSettings(QSettings*);
42 void setDeviceSettings(QSettings*); 42
43 43 public slots:
44 public slots: 44 void accept(void);
45 void accept(void); 45
46 46 private:
47 private: 47 Ui::InstallZipFrm ui;
48 Ui::InstallZipFrm ui; 48 QUrl proxy;
49 Ui::InstallProgressFrm dp; 49 QSettings *devices;
50 QUrl proxy; 50 QSettings *userSettings;
51 QSettings *devices; 51 ProgressLoggerGui* logger;
52 QSettings *userSettings; 52 QString file;
53 QDialog *downloadProgress; 53 QString fileName;
54 QString file; 54 QString mountPoint;
55 QString fileName; 55 QString url;
56 QString mountPoint; 56 QString logsection;
57 QString url; 57 ZipInstaller* installer;
58 QString logsection; 58
59 ZipInstaller* installer; 59 private slots:
60 60 void browseFolder(void);
61 private slots: 61 void done(bool);
62 void browseFolder(void); 62
63 void done(bool); 63};
64 64
65}; 65
66 66#endif
67
68#endif
diff --git a/rbutil/rbutilqt/irivertools/irivertools.cpp b/rbutil/rbutilqt/irivertools/irivertools.cpp
index f2cc59a8c2..ee91193dc4 100644
--- a/rbutil/rbutilqt/irivertools/irivertools.cpp
+++ b/rbutil/rbutilqt/irivertools/irivertools.cpp
@@ -47,7 +47,7 @@ const unsigned char header[][16] = {
47/* begin mkboot.c excerpt */ 47/* begin mkboot.c excerpt */
48unsigned char image[0x400000 + 0x220 + 0x400000/0x200]; 48unsigned char image[0x400000 + 0x220 + 0x400000/0x200];
49 49
50bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::InstallProgressFrm* dp) 50bool mkboot(QString infile, QString outfile,QString bootloader,int origin,ProgressloggerInterface* dp)
51{ 51{
52 int i; 52 int i;
53 int len,bllen; 53 int len,bllen;
@@ -59,12 +59,12 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
59 QFile f(infile); 59 QFile f(infile);
60 if(!f.open(QIODevice::ReadOnly)) 60 if(!f.open(QIODevice::ReadOnly))
61 { 61 {
62 dp->listProgress->addItem("Could not open: %1" + infile); 62 dp->addItem("Could not open: %1" + infile);
63 return false; 63 return false;
64 } 64 }
65 i = f.read((char*)image,16); 65 i = f.read((char*)image,16);
66 if(i < 16) { 66 if(i < 16) {
67 dp->listProgress->addItem("reading header failed"); 67 dp->addItem("reading header failed");
68 return false; 68 return false;
69 } 69 }
70 70
@@ -77,7 +77,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
77 len = binary_length+0x200-16; 77 len = binary_length+0x200-16;
78 i = f.read((char*)image+16, len); 78 i = f.read((char*)image+16, len);
79 if(i < len) { 79 if(i < len) {
80 dp->listProgress->addItem("reading firmware failed"); 80 dp->addItem("reading firmware failed");
81 return false; 81 return false;
82 } 82 }
83 83
@@ -86,7 +86,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
86 f.setFileName(bootloader); 86 f.setFileName(bootloader);
87 if(!f.open(QIODevice::ReadOnly)) 87 if(!f.open(QIODevice::ReadOnly))
88 { 88 {
89 dp->listProgress->addItem("Could not open: %1" + bootloader); 89 dp->addItem("Could not open: %1" + bootloader);
90 return false; 90 return false;
91 } 91 }
92 92
@@ -94,7 +94,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
94 94
95 i = f.read((char*)image+0x220 + origin, bllen); 95 i = f.read((char*)image+0x220 + origin, bllen);
96 if(i < bllen) { 96 if(i < bllen) {
97 dp->listProgress->addItem("reading bootloader failed"); 97 dp->addItem("reading bootloader failed");
98 return false; 98 return false;
99 } 99 }
100 100
@@ -102,7 +102,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
102 f.setFileName(outfile); 102 f.setFileName(outfile);
103 if(!f.open(QIODevice::WriteOnly)) 103 if(!f.open(QIODevice::WriteOnly))
104 { 104 {
105 dp->listProgress->addItem("Could not open: %1" + outfile); 105 dp->addItem("Could not open: %1" + outfile);
106 return false; 106 return false;
107 } 107 }
108 108
@@ -154,7 +154,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
154 154
155 i = f.write((char*)image,total_length); 155 i = f.write((char*)image,total_length);
156 if(i < total_length) { 156 if(i < total_length) {
157 dp->listProgress->addItem("writing bootloader failed"); 157 dp->addItem("writing bootloader failed");
158 return false; 158 return false;
159 } 159 }
160 160
@@ -208,7 +208,7 @@ static void modifyheader( unsigned char * data )
208}; 208};
209 209
210int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify, 210int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify,
211 enum striptype stripmode,Ui::InstallProgressFrm* dp ) 211 enum striptype stripmode,ProgressloggerInterface* dp )
212{ 212{
213 QFile infile(infile_name); 213 QFile infile(infile_name);
214 QFile outfile(outfile_name); 214 QFile outfile(outfile_name);
@@ -226,18 +226,18 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
226 226
227 if(!infile.open(QIODevice::ReadOnly)) 227 if(!infile.open(QIODevice::ReadOnly))
228 { 228 {
229 dp->listProgress->addItem("Could not open: %1" + infile_name); 229 dp->addItem("Could not open: %1" + infile_name);
230 return -1; 230 return -1;
231 } 231 }
232 if(!outfile.open(QIODevice::WriteOnly)) 232 if(!outfile.open(QIODevice::WriteOnly))
233 { 233 {
234 dp->listProgress->addItem("Could not open: %1" + outfile_name); 234 dp->addItem("Could not open: %1" + outfile_name);
235 return -1; 235 return -1;
236 } 236 }
237 lenread = infile.read( (char*)headerdata, 512); 237 lenread = infile.read( (char*)headerdata, 512);
238 if( lenread != 512 ) 238 if( lenread != 512 )
239 { 239 {
240 dp->listProgress->addItem("This doesn't look like a valid encrypted iHP" 240 dp->addItem("This doesn't look like a valid encrypted iHP"
241 "firmware - reason: header length."); 241 "firmware - reason: header length.");
242 infile.close(); 242 infile.close();
243 outfile.close(); 243 outfile.close();
@@ -247,7 +247,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
247 i = testheader( headerdata ); 247 i = testheader( headerdata );
248 if( i == -1 ) 248 if( i == -1 )
249 { 249 {
250 dp->listProgress->addItem("This firmware is for an unknown model, or is not" 250 dp->addItem("This firmware is for an unknown model, or is not"
251 " a valid encrypted iHP firmware."); 251 " a valid encrypted iHP firmware.");
252 infile.close(); 252 infile.close();
253 outfile.close(); 253 outfile.close();
@@ -270,7 +270,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
270 dwLength2>>9 != dwLength3 || 270 dwLength2>>9 != dwLength3 ||
271 dwLength2+dwLength3+512 != dwLength1 ) 271 dwLength2+dwLength3+512 != dwLength1 )
272 { 272 {
273 dp->listProgress->addItem("This doesn't look like a valid encrypted " 273 dp->addItem("This doesn't look like a valid encrypted "
274 "iHP firmware - reason: file 'length' data."); 274 "iHP firmware - reason: file 'length' data.");
275 infile.close(); 275 infile.close();
276 outfile.close(); 276 outfile.close();
@@ -332,7 +332,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
332 332
333 if( fp != dwLength2 ) 333 if( fp != dwLength2 )
334 { 334 {
335 dp->listProgress->addItem("This doesn't look like a valid encrypted " 335 dp->addItem("This doesn't look like a valid encrypted "
336 "iHP firmware - reason: 'length2' mismatch."); 336 "iHP firmware - reason: 'length2' mismatch.");
337 infile.close(); 337 infile.close();
338 outfile.close(); 338 outfile.close();
@@ -349,7 +349,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
349 outfile.write((char*) blockdata, lenread ); 349 outfile.write((char*) blockdata, lenread );
350 if( memcmp( ppChecksums, blockdata, lenread ) != 0 ) 350 if( memcmp( ppChecksums, blockdata, lenread ) != 0 )
351 { 351 {
352 dp->listProgress->addItem("This doesn't look like a valid encrypted " 352 dp->addItem("This doesn't look like a valid encrypted "
353 "iHP firmware - reason: Checksum mismatch!"); 353 "iHP firmware - reason: Checksum mismatch!");
354 infile.close(); 354 infile.close();
355 outfile.close(); 355 outfile.close();
@@ -360,7 +360,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
360 360
361 if( fp != dwLength3 ) 361 if( fp != dwLength3 )
362 { 362 {
363 dp->listProgress->addItem("This doesn't look like a valid encrypted " 363 dp->addItem("This doesn't look like a valid encrypted "
364 "iHP firmware - reason: 'length3' mismatch."); 364 "iHP firmware - reason: 'length3' mismatch.");
365 infile.close(); 365 infile.close();
366 outfile.close(); 366 outfile.close();
@@ -392,7 +392,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
392 392
393}; 393};
394 394
395int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,Ui::InstallProgressFrm* dp ) 395int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,ProgressloggerInterface* dp )
396{ 396{
397 QFile infile(infile_name); 397 QFile infile(infile_name);
398 QFile outfile(outfile_name); 398 QFile outfile(outfile_name);
@@ -409,19 +409,19 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
409 409
410 if(!infile.open(QIODevice::ReadOnly)) 410 if(!infile.open(QIODevice::ReadOnly))
411 { 411 {
412 dp->listProgress->addItem("Could not open: %1" + infile_name); 412 dp->addItem("Could not open: %1" + infile_name);
413 return -1; 413 return -1;
414 } 414 }
415 if(!outfile.open(QIODevice::WriteOnly)) 415 if(!outfile.open(QIODevice::WriteOnly))
416 { 416 {
417 dp->listProgress->addItem("Could not open: %1" + outfile_name); 417 dp->addItem("Could not open: %1" + outfile_name);
418 return -1; 418 return -1;
419 } 419 }
420 420
421 lenread = infile.read((char*) headerdata, 512 ); 421 lenread = infile.read((char*) headerdata, 512 );
422 if( lenread != 512 ) 422 if( lenread != 512 )
423 { 423 {
424 dp->listProgress->addItem("This doesn't look like a valid decoded " 424 dp->addItem("This doesn't look like a valid decoded "
425 "iHP firmware - reason: header length."); 425 "iHP firmware - reason: header length.");
426 infile.close(); 426 infile.close();
427 outfile.close(); 427 outfile.close();
@@ -435,7 +435,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
435 i = testheader( headerdata ); 435 i = testheader( headerdata );
436 if( i == -1 ) 436 if( i == -1 )
437 { 437 {
438 dp->listProgress->addItem("This firmware is for an unknown model, or is not" 438 dp->addItem("This firmware is for an unknown model, or is not"
439 " a valid decoded iHP firmware."); 439 " a valid decoded iHP firmware.");
440 infile.close(); 440 infile.close();
441 outfile.close(); 441 outfile.close();
@@ -456,7 +456,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
456 dwLength3 > dwLength1 || 456 dwLength3 > dwLength1 ||
457 dwLength2+dwLength3+512 != dwLength1 ) 457 dwLength2+dwLength3+512 != dwLength1 )
458 { 458 {
459 dp->listProgress->addItem("This doesn't look like a valid decoded " 459 dp->addItem("This doesn't look like a valid decoded "
460 "iHP firmware - reason:file 'length' data."); 460 "iHP firmware - reason:file 'length' data.");
461 infile.close(); 461 infile.close();
462 outfile.close(); 462 outfile.close();
@@ -494,7 +494,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
494 494
495 if( fp != dwLength2 ) 495 if( fp != dwLength2 )
496 { 496 {
497 dp->listProgress->addItem("This doesn't look like a valid decoded " 497 dp->addItem("This doesn't look like a valid decoded "
498 "iHP firmware - reason: 'length1' mismatch."); 498 "iHP firmware - reason: 'length1' mismatch.");
499 infile.close(); 499 infile.close();
500 outfile.close(); 500 outfile.close();
@@ -514,7 +514,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
514 514
515 if( fp != dwLength3 ) 515 if( fp != dwLength3 )
516 { 516 {
517 dp->listProgress->addItem("This doesn't look like a valid decoded " 517 dp->addItem("This doesn't look like a valid decoded "
518 "iHP firmware - 'length2' mismatch."); 518 "iHP firmware - 'length2' mismatch.");
519 infile.close(); 519 infile.close();
520 outfile.close(); 520 outfile.close();
diff --git a/rbutil/rbutilqt/irivertools/irivertools.h b/rbutil/rbutilqt/irivertools/irivertools.h
index 54809d7645..dda84b1c75 100644
--- a/rbutil/rbutilqt/irivertools/irivertools.h
+++ b/rbutil/rbutilqt/irivertools/irivertools.h
@@ -25,7 +25,7 @@
25#include <QtGui> 25#include <QtGui>
26 26
27#include "md5sum.h" 27#include "md5sum.h"
28#include "ui_installprogressfrm.h" 28#include "progressloggerinterface.h"
29 29
30#define ESTF_SIZE 32 30#define ESTF_SIZE 32
31 31
@@ -61,9 +61,9 @@ enum striptype
61 61
62int intable(char *md5, struct sumpairs *table, int len); 62int intable(char *md5, struct sumpairs *table, int len);
63 63
64bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::InstallProgressFrm* dp); 64bool mkboot(QString infile, QString outfile,QString bootloader,int origin,ProgressloggerInterface* dp);
65int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify, 65int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify,
66 enum striptype stripmode,Ui::InstallProgressFrm* dp ); 66 enum striptype stripmode,ProgressloggerInterface* dp );
67int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,Ui::InstallProgressFrm* dp); 67int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,ProgressloggerInterface* dp);
68 68
69#endif // IRIVERTOOLS_H_INCLUDED 69#endif // IRIVERTOOLS_H_INCLUDED
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp
new file mode 100644
index 0000000000..4397d3c2f5
--- /dev/null
+++ b/rbutil/rbutilqt/progressloggergui.cpp
@@ -0,0 +1,69 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: progressloggergui.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 "progressloggergui.h"
21
22ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
23{
24 downloadProgress = new QDialog();
25 dp.setupUi(downloadProgress);
26 connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
27}
28
29
30void ProgressLoggerGui::addItem(QString text)
31{
32 dp.listProgress->addItem(text);
33}
34
35void ProgressLoggerGui::setProgressValue(int value)
36{
37 dp.progressBar->setValue(value);
38}
39
40void ProgressLoggerGui::setProgressMax(int max)
41{
42 dp.progressBar->setMaximum(max);
43}
44
45int ProgressLoggerGui::getProgressMax()
46{
47 return dp.progressBar->maximum();
48}
49
50void ProgressLoggerGui::abort()
51{
52 dp.buttonAbort->setText(tr("&Ok"));
53 disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
54 connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
55 connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
56 emit aborted();
57}
58
59void ProgressLoggerGui::close()
60{
61 downloadProgress->close();
62}
63
64void ProgressLoggerGui::show()
65{
66 downloadProgress->show();
67}
68
69
diff --git a/rbutil/rbutilqt/progressloggergui.h b/rbutil/rbutilqt/progressloggergui.h
new file mode 100644
index 0000000000..e0f2d9130a
--- /dev/null
+++ b/rbutil/rbutilqt/progressloggergui.h
@@ -0,0 +1,55 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: progressloggergui.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#ifndef PROGRESSLOGGERGUI_H
20#define PROGRESSLOGGERGUI_H
21
22#include <QtGui>
23
24#include "progressloggerinterface.h"
25#include "ui_installprogressfrm.h"
26
27class ProgressLoggerGui :public ProgressloggerInterface
28{
29 Q_OBJECT
30public:
31 ProgressLoggerGui(QObject * parent);
32
33 virtual void addItem(QString text) ; //adds a string to the list
34
35 virtual void setProgressValue(int value);
36 virtual void setProgressMax(int max);
37 virtual int getProgressMax();
38
39signals:
40 virtual void aborted();
41 virtual void closed();
42
43public slots:
44 virtual void abort();
45 virtual void close();
46 virtual void show();
47
48private:
49 Ui::InstallProgressFrm dp;
50 QDialog *downloadProgress;
51
52};
53
54#endif
55
diff --git a/rbutil/rbutilqt/progressloggerinterface.h b/rbutil/rbutilqt/progressloggerinterface.h
new file mode 100644
index 0000000000..c2075a15f4
--- /dev/null
+++ b/rbutil/rbutilqt/progressloggerinterface.h
@@ -0,0 +1,51 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: progressloggerinterface.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 PROGRESSLOGGERINTERFACE_H
21#define PROGRESSLOGGERINTERFACE_H
22
23#include <QtGui>
24
25class ProgressloggerInterface : public QObject
26{
27 Q_OBJECT
28
29public:
30 ProgressloggerInterface(QObject* parent) : QObject(parent) {}
31 virtual void addItem(QString text) =0 ; //adds a string to the list
32
33 virtual void setProgressValue(int value)=0;
34 virtual void setProgressMax(int max)=0;
35 virtual int getProgressMax()=0;
36
37signals:
38 virtual void aborted()=0;
39
40
41public slots:
42 virtual void abort()=0;
43 virtual void close()=0;
44 virtual void show()=0;
45
46private:
47
48};
49
50#endif
51
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 76757e774a..d5cea652d0 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -9,6 +9,7 @@ SOURCES += rbutilqt.cpp \
9 installbootloader.cpp \ 9 installbootloader.cpp \
10 installbl.cpp \ 10 installbl.cpp \
11 installzipwindow.cpp \ 11 installzipwindow.cpp \
12 progressloggergui.cpp \
12 ../ipodpatcher/ipodpatcher.c \ 13 ../ipodpatcher/ipodpatcher.c \
13 ../sansapatcher/sansapatcher.c \ 14 ../sansapatcher/sansapatcher.c \
14 irivertools/irivertools.cpp \ 15 irivertools/irivertools.cpp \
@@ -30,6 +31,8 @@ HEADERS += rbutilqt.h \
30 installbootloader.h \ 31 installbootloader.h \
31 installbl.h \ 32 installbl.h \
32 installzipwindow.h \ 33 installzipwindow.h \
34 progressloggerinterface.h \
35 progressloggergui.h \
33 ../ipodpatcher/ipodpatcher.h \ 36 ../ipodpatcher/ipodpatcher.h \
34 ../ipodpatcher/ipodio.h \ 37 ../ipodpatcher/ipodio.h \
35 ../ipodpatcher/parttypes.h \ 38 ../ipodpatcher/parttypes.h \
@@ -44,7 +47,7 @@ HEADERS += rbutilqt.h \
44TEMPLATE = app 47TEMPLATE = app
45CONFIG += release \ 48CONFIG += release \
46 warn_on \ 49 warn_on \
47 thread \ 50 thread \
48 qt 51 qt
49TARGET = rbutilqt 52TARGET = rbutilqt
50 53