forked from len0rd/rockbox
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
This commit is contained in:
parent
c414f46971
commit
917e0acd64
16 changed files with 724 additions and 561 deletions
|
@ -19,8 +19,6 @@
|
|||
|
||||
#include "install.h"
|
||||
#include "ui_installfrm.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
|
||||
|
||||
Install::Install(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
|
@ -98,17 +96,17 @@ void Install::browseFolder()
|
|||
|
||||
void Install::accept()
|
||||
{
|
||||
downloadProgress = new QDialog(this);
|
||||
dp.setupUi(downloadProgress);
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
|
||||
// show dialog with error if mount point is wrong
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
|
||||
mountPoint = ui.lineMountPoint->text();
|
||||
userSettings->setValue("defaults/mountpoint", mountPoint);
|
||||
}
|
||||
else {
|
||||
dp.listProgress->addItem(tr("Mount point is wrong!"));
|
||||
dp.buttonAbort->setText(tr("&Ok"));
|
||||
downloadProgress->show();
|
||||
logger->addItem(tr("Mount point is wrong!"));
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,26 +145,25 @@ void Install::accept()
|
|||
installer->setProxy(proxy);
|
||||
installer->setLogSection("rockboxbase");
|
||||
installer->setMountPoint(mountPoint);
|
||||
installer->install(&dp);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
downloadProgress->show();
|
||||
installer->install(logger);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Zip installer has finished
|
||||
void Install::done(bool error)
|
||||
{
|
||||
qDebug() << "Install::done, error:" << error;
|
||||
|
||||
if(error)
|
||||
{
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close()));
|
||||
// no error, close the window, when the logger is closed
|
||||
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <QSettings>
|
||||
|
||||
#include "ui_installfrm.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "installzip.h"
|
||||
#include "progressloggergui.h"
|
||||
|
||||
class Install : public QDialog
|
||||
{
|
||||
|
@ -42,16 +42,14 @@ class Install : public QDialog
|
|||
|
||||
public slots:
|
||||
void accept(void);
|
||||
// void extractBuild(bool);
|
||||
|
||||
private:
|
||||
Ui::InstallFrm ui;
|
||||
Ui::InstallProgressFrm dp;
|
||||
ProgressLoggerGui* logger;
|
||||
QUrl proxy;
|
||||
QString releasever;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
QDialog *downloadProgress;
|
||||
QHttp *download;
|
||||
QFile *target;
|
||||
QString file;
|
||||
|
|
|
@ -1,176 +1,176 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installbl.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "installbl.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
|
||||
|
||||
InstallBl::InstallBl(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
||||
connect(ui.buttonBrowseOF, SIGNAL(clicked()), this, SLOT(browseOF()));
|
||||
|
||||
}
|
||||
|
||||
void InstallBl::setProxy(QUrl proxy_url)
|
||||
{
|
||||
proxy = proxy_url;
|
||||
qDebug() << "Install::setProxy" << proxy;
|
||||
}
|
||||
|
||||
void InstallBl::setMountPoint(QString mount)
|
||||
{
|
||||
QFileInfo m(mount);
|
||||
if(m.isDir()) {
|
||||
ui.lineMountPoint->clear();
|
||||
ui.lineMountPoint->insert(mount);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::setOFPath(QString path)
|
||||
{
|
||||
QFileInfo m(path);
|
||||
if(m.exists()) {
|
||||
ui.lineOriginalFirmware->clear();
|
||||
ui.lineOriginalFirmware->insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::browseFolder()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir())
|
||||
browser.setDirectory(ui.lineMountPoint->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setFileMode(QFileDialog::DirectoryOnly);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setMountPoint(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::browseOF()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
|
||||
browser.setDirectory(ui.lineOriginalFirmware->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setOFPath(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::accept()
|
||||
{
|
||||
downloadProgress = new QDialog(this);
|
||||
dp.setupUi(downloadProgress);
|
||||
// show dialog with error if mount point is wrong
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
|
||||
mountPoint = ui.lineMountPoint->text();
|
||||
userSettings->setValue("defaults/mountpoint", mountPoint);
|
||||
}
|
||||
else {
|
||||
dp.listProgress->addItem(tr("Mount point is wrong!"));
|
||||
dp.buttonAbort->setText(tr("&Ok"));
|
||||
downloadProgress->show();
|
||||
return;
|
||||
}
|
||||
|
||||
if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
|
||||
{
|
||||
m_OrigFirmware = ui.lineOriginalFirmware->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
dp.listProgress->addItem(tr("Original Firmware Path is wrong!"));
|
||||
dp.buttonAbort->setText(tr("&Ok"));
|
||||
downloadProgress->show();
|
||||
return;
|
||||
}
|
||||
userSettings->sync();
|
||||
|
||||
binstaller = new BootloaderInstaller(this);
|
||||
|
||||
binstaller->setMountPoint(mountPoint);
|
||||
binstaller->setProxy(proxy);
|
||||
QString plattform = userSettings->value("defaults/platform").toString();
|
||||
|
||||
binstaller->setDevice(plattform);
|
||||
binstaller->setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
|
||||
binstaller->setBootloaderName(devices->value(plattform + "/bootloadername").toString());
|
||||
binstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
||||
binstaller->setOrigFirmwarePath(m_OrigFirmware);
|
||||
|
||||
binstaller->install(&dp);
|
||||
|
||||
connect(binstaller, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
downloadProgress->show();
|
||||
}
|
||||
|
||||
|
||||
void InstallBl::done(bool error)
|
||||
{
|
||||
qDebug() << "Install::done, error:" << error;
|
||||
|
||||
if(error)
|
||||
{
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
|
||||
return;
|
||||
}
|
||||
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close()));
|
||||
}
|
||||
|
||||
void InstallBl::setDeviceSettings(QSettings *dev)
|
||||
{
|
||||
devices = dev;
|
||||
|
||||
if(userSettings->value("defaults/platform").toString() == "h100" ||
|
||||
userSettings->value("defaults/platform").toString() == "h120" ||
|
||||
userSettings->value("defaults/platform").toString() == "h300")
|
||||
{
|
||||
ui.buttonBrowseOF->show();
|
||||
ui.lineOriginalFirmware->show();
|
||||
ui.label_3->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.buttonBrowseOF->hide();
|
||||
ui.lineOriginalFirmware->hide();
|
||||
ui.label_3->hide();
|
||||
}
|
||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||
}
|
||||
|
||||
void InstallBl::setUserSettings(QSettings *user)
|
||||
{
|
||||
userSettings = user;
|
||||
}
|
||||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installbl.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "installbl.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
|
||||
|
||||
InstallBl::InstallBl(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
||||
connect(ui.buttonBrowseOF, SIGNAL(clicked()), this, SLOT(browseOF()));
|
||||
|
||||
}
|
||||
|
||||
void InstallBl::setProxy(QUrl proxy_url)
|
||||
{
|
||||
proxy = proxy_url;
|
||||
qDebug() << "Install::setProxy" << proxy;
|
||||
}
|
||||
|
||||
void InstallBl::setMountPoint(QString mount)
|
||||
{
|
||||
QFileInfo m(mount);
|
||||
if(m.isDir()) {
|
||||
ui.lineMountPoint->clear();
|
||||
ui.lineMountPoint->insert(mount);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::setOFPath(QString path)
|
||||
{
|
||||
QFileInfo m(path);
|
||||
if(m.exists()) {
|
||||
ui.lineOriginalFirmware->clear();
|
||||
ui.lineOriginalFirmware->insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::browseFolder()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir())
|
||||
browser.setDirectory(ui.lineMountPoint->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setFileMode(QFileDialog::DirectoryOnly);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setMountPoint(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::browseOF()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
|
||||
browser.setDirectory(ui.lineOriginalFirmware->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setOFPath(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallBl::accept()
|
||||
{
|
||||
// create logger
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
|
||||
// show dialog with error if mount point is wrong
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
|
||||
mountPoint = ui.lineMountPoint->text();
|
||||
userSettings->setValue("defaults/mountpoint", mountPoint);
|
||||
}
|
||||
else {
|
||||
logger->addItem(tr("Mount point is wrong!"));
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
if(QFileInfo(ui.lineOriginalFirmware->text()).exists())
|
||||
{
|
||||
m_OrigFirmware = ui.lineOriginalFirmware->text();
|
||||
}
|
||||
else
|
||||
{
|
||||
logger->addItem(tr("Original Firmware Path is wrong!"));
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
userSettings->sync();
|
||||
|
||||
binstaller = new BootloaderInstaller(this);
|
||||
|
||||
binstaller->setMountPoint(mountPoint);
|
||||
binstaller->setProxy(proxy);
|
||||
QString plattform = userSettings->value("defaults/platform").toString();
|
||||
|
||||
binstaller->setDevice(plattform);
|
||||
binstaller->setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
|
||||
binstaller->setBootloaderName(devices->value(plattform + "/bootloadername").toString());
|
||||
binstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
||||
binstaller->setOrigFirmwarePath(m_OrigFirmware);
|
||||
|
||||
binstaller->install(logger);
|
||||
|
||||
connect(binstaller, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void InstallBl::done(bool error)
|
||||
{
|
||||
qDebug() << "Install::done, error:" << error;
|
||||
|
||||
if(error)
|
||||
{
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
// no error, close the window, when the logger is closed
|
||||
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
||||
|
||||
}
|
||||
|
||||
void InstallBl::setDeviceSettings(QSettings *dev)
|
||||
{
|
||||
devices = dev;
|
||||
|
||||
if(userSettings->value("defaults/platform").toString() == "h100" ||
|
||||
userSettings->value("defaults/platform").toString() == "h120" ||
|
||||
userSettings->value("defaults/platform").toString() == "h300")
|
||||
{
|
||||
ui.buttonBrowseOF->show();
|
||||
ui.lineOriginalFirmware->show();
|
||||
ui.label_3->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.buttonBrowseOF->hide();
|
||||
ui.lineOriginalFirmware->hide();
|
||||
ui.label_3->hide();
|
||||
}
|
||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||
}
|
||||
|
||||
void InstallBl::setUserSettings(QSettings *user)
|
||||
{
|
||||
userSettings = user;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QSettings>
|
||||
|
||||
#include "ui_installbootloaderfrm.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "progressloggergui.h"
|
||||
|
||||
#include "installbootloader.h"
|
||||
#include "irivertools/irivertools.h"
|
||||
|
@ -46,11 +46,10 @@ class InstallBl : public QDialog
|
|||
|
||||
private:
|
||||
Ui::InstallBootloaderFrm ui;
|
||||
Ui::InstallProgressFrm dp;
|
||||
ProgressLoggerGui* logger;
|
||||
QUrl proxy;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
QDialog *downloadProgress;
|
||||
QHttp *download;
|
||||
QFile *target;
|
||||
QString file;
|
||||
|
|
|
@ -24,11 +24,11 @@ BootloaderInstaller::BootloaderInstaller(QObject* parent): QObject(parent)
|
|||
|
||||
}
|
||||
|
||||
void BootloaderInstaller::install(Ui::InstallProgressFrm* dp)
|
||||
void BootloaderInstaller::install(ProgressloggerInterface* dp)
|
||||
{
|
||||
m_dp = dp;
|
||||
m_install = true;
|
||||
m_dp->listProgress->addItem(tr("Starting bootloader installation"));
|
||||
m_dp->addItem(tr("Starting bootloader installation"));
|
||||
|
||||
if(m_bootloadermethod == "gigabeatf")
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ void BootloaderInstaller::install(Ui::InstallProgressFrm* dp)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("unsupported install Method"));
|
||||
m_dp->addItem(tr("unsupported install Method"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ void BootloaderInstaller::install(Ui::InstallProgressFrm* dp)
|
|||
emit prepare();
|
||||
}
|
||||
|
||||
void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp)
|
||||
void BootloaderInstaller::uninstall(ProgressloggerInterface* dp)
|
||||
{
|
||||
m_dp = dp;
|
||||
m_install = false;
|
||||
m_dp->listProgress->addItem(tr("Starting bootloader uninstallation"));
|
||||
m_dp->addItem(tr("Starting bootloader uninstallation"));
|
||||
|
||||
if(m_bootloadermethod == "gigabeatf")
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp)
|
|||
}
|
||||
else if(m_bootloadermethod == "iaudio")
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No uninstallation possible"));
|
||||
m_dp->addItem(tr("No uninstallation possible"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
@ -110,13 +110,13 @@ void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp)
|
|||
}
|
||||
else if(m_bootloadermethod == "fwpatcher")
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No uninstallation possible"));
|
||||
m_dp->addItem(tr("No uninstallation possible"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("unsupported install Method"));
|
||||
m_dp->addItem(tr("unsupported install Method"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
@ -138,25 +138,25 @@ void BootloaderInstaller::downloadDone(bool error)
|
|||
|
||||
// update progress bar
|
||||
|
||||
int max = m_dp->progressBar->maximum();
|
||||
int max = m_dp->getProgressMax();
|
||||
if(max == 0) {
|
||||
max = 100;
|
||||
m_dp->progressBar->setMaximum(max);
|
||||
m_dp->setProgressMax(max);
|
||||
}
|
||||
m_dp->progressBar->setValue(max);
|
||||
m_dp->setProgressValue(max);
|
||||
if(getter->httpResponse() != 200) {
|
||||
m_dp->listProgress->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
|
||||
m_dp->abort();
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if(error) {
|
||||
m_dp->listProgress->addItem(tr("Download error: %1").arg(getter->errorString()));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Download error: %1").arg(getter->errorString()));
|
||||
m_dp->abort();
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
else m_dp->listProgress->addItem(tr("Download finished."));
|
||||
else m_dp->addItem(tr("Download finished."));
|
||||
|
||||
emit finish();
|
||||
|
||||
|
@ -164,8 +164,8 @@ void BootloaderInstaller::downloadDone(bool error)
|
|||
|
||||
void BootloaderInstaller::updateDataReadProgress(int read, int total)
|
||||
{
|
||||
m_dp->progressBar->setMaximum(total);
|
||||
m_dp->progressBar->setValue(read);
|
||||
m_dp->setProgressMax(total);
|
||||
m_dp->setProgressValue(read);
|
||||
qDebug() << "progress:" << read << "/" << total;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ void BootloaderInstaller::gigabeatPrepare()
|
|||
{
|
||||
QString url = m_bootloaderUrlBase + "/gigabeat/" + m_bootloadername;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -194,9 +194,8 @@ void BootloaderInstaller::gigabeatPrepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
else //UnInstallation
|
||||
{
|
||||
|
@ -208,7 +207,7 @@ void BootloaderInstaller::gigabeatPrepare()
|
|||
// check if original firmware exists
|
||||
if(!firmwareOrigFI.exists())
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not find the Original Firmware at: %1")
|
||||
m_dp->addItem(tr("Could not find the Original Firmware at: %1")
|
||||
.arg(firmwareOrig));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -220,7 +219,7 @@ void BootloaderInstaller::gigabeatPrepare()
|
|||
//remove modified firmware
|
||||
if(!firmwareFile.remove())
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1")
|
||||
m_dp->addItem(tr("Could not remove the Firmware at: %1")
|
||||
.arg(firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -229,7 +228,7 @@ void BootloaderInstaller::gigabeatPrepare()
|
|||
//copy original firmware
|
||||
if(!firmwareOrigFile.copy(firmware))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
|
||||
.arg(firmwareOrig,firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -244,7 +243,7 @@ void BootloaderInstaller::gigabeatFinish()
|
|||
{
|
||||
// this step is only need for installation, so no code for uninstall here
|
||||
|
||||
m_dp->listProgress->addItem(tr("Finishing bootloader install"));
|
||||
m_dp->addItem(tr("Finishing bootloader install"));
|
||||
|
||||
QString firmware = m_mountpoint + "/GBSYSTEM/FWIMG/" + m_bootloadername;
|
||||
|
||||
|
@ -253,7 +252,7 @@ void BootloaderInstaller::gigabeatFinish()
|
|||
// check if firmware exists
|
||||
if(!firmwareFI.exists())
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not find the Firmware at: %1")
|
||||
m_dp->addItem(tr("Could not find the Firmware at: %1")
|
||||
.arg(firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -269,7 +268,7 @@ void BootloaderInstaller::gigabeatFinish()
|
|||
QFile firmwareFile(firmware);
|
||||
if(!firmwareFile.rename(firmwareOrig))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not rename: %1 to %2")
|
||||
m_dp->addItem(tr("Could not rename: %1 to %2")
|
||||
.arg(firmware,firmwareOrig));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -284,7 +283,7 @@ void BootloaderInstaller::gigabeatFinish()
|
|||
//copy the firmware
|
||||
if(!downloadFile.copy(firmware))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy: %1 to %2")
|
||||
.arg(m_tempfilename,firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -292,8 +291,8 @@ void BootloaderInstaller::gigabeatFinish()
|
|||
|
||||
downloadFile.remove();
|
||||
|
||||
m_dp->listProgress->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->abort();
|
||||
|
||||
emit done(false); // success
|
||||
|
||||
|
@ -307,7 +306,7 @@ void BootloaderInstaller::iaudioPrepare()
|
|||
|
||||
QString url = m_bootloaderUrlBase + "/iaudio/" + m_bootloadername;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -321,9 +320,8 @@ void BootloaderInstaller::iaudioPrepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
|
||||
void BootloaderInstaller::iaudioFinish()
|
||||
|
@ -333,7 +331,7 @@ void BootloaderInstaller::iaudioFinish()
|
|||
//copy the firmware
|
||||
if(!downloadFile.copy(firmware))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy: %1 to %2")
|
||||
.arg(m_tempfilename,firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -341,8 +339,8 @@ void BootloaderInstaller::iaudioFinish()
|
|||
|
||||
downloadFile.remove();
|
||||
|
||||
m_dp->listProgress->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->abort();
|
||||
|
||||
emit done(false); // success
|
||||
|
||||
|
@ -358,7 +356,7 @@ void BootloaderInstaller::h10Prepare()
|
|||
{
|
||||
QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -372,8 +370,8 @@ void BootloaderInstaller::h10Prepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
else // Uninstallation
|
||||
{
|
||||
|
@ -390,7 +388,7 @@ void BootloaderInstaller::h10Prepare()
|
|||
firmwareFI.setFile(firmware);
|
||||
if(!firmwareFI.exists()) //Firmware dosent exists on player
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Firmware doesn not exist: %1")
|
||||
m_dp->addItem(tr("Firmware doesn not exist: %1")
|
||||
.arg(firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -400,7 +398,7 @@ void BootloaderInstaller::h10Prepare()
|
|||
QFileInfo firmwareOrigFI(firmwareOrig);
|
||||
if(!firmwareOrigFI.exists()) //Original Firmware dosent exists on player
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Original Firmware doesn not exist: %1")
|
||||
m_dp->addItem(tr("Original Firmware doesn not exist: %1")
|
||||
.arg(firmwareOrig));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -412,7 +410,7 @@ void BootloaderInstaller::h10Prepare()
|
|||
//remove modified firmware
|
||||
if(!firmwareFile.remove())
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not remove the Firmware at: %1")
|
||||
m_dp->addItem(tr("Could not remove the Firmware at: %1")
|
||||
.arg(firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -421,7 +419,7 @@ void BootloaderInstaller::h10Prepare()
|
|||
//copy original firmware
|
||||
if(!firmwareOrigFile.copy(firmware))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy the Firmware from: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy the Firmware from: %1 to %2")
|
||||
.arg(firmwareOrig,firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -447,7 +445,7 @@ void BootloaderInstaller::h10Finish()
|
|||
firmwareFI.setFile(firmware);
|
||||
if(!firmwareFI.exists()) //Firmware dosent exists on player
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Firmware does not exist: %1")
|
||||
m_dp->addItem(tr("Firmware does not exist: %1")
|
||||
.arg(firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -461,7 +459,7 @@ void BootloaderInstaller::h10Finish()
|
|||
QFile firmwareFile(firmware);
|
||||
if(!firmwareFile.rename(firmwareOrig)) //rename Firmware to Original
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not rename: %1 to %2")
|
||||
m_dp->addItem(tr("Could not rename: %1 to %2")
|
||||
.arg(firmware,firmwareOrig));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -475,7 +473,7 @@ void BootloaderInstaller::h10Finish()
|
|||
//copy the firmware
|
||||
if(!downloadFile.copy(firmware))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy: %1 to %2")
|
||||
.arg(m_tempfilename,firmware));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -483,8 +481,8 @@ void BootloaderInstaller::h10Finish()
|
|||
|
||||
downloadFile.remove();
|
||||
|
||||
m_dp->listProgress->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->abort();
|
||||
|
||||
emit done(false); // success
|
||||
|
||||
|
@ -503,19 +501,19 @@ bool initIpodpatcher()
|
|||
|
||||
void BootloaderInstaller::ipodPrepare()
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Searching for ipods"));
|
||||
m_dp->addItem(tr("Searching for ipods"));
|
||||
struct ipod_t ipod;
|
||||
|
||||
int n = ipod_scan(&ipod);
|
||||
if (n == 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No Ipods found"));
|
||||
m_dp->addItem(tr("No Ipods found"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if (n > 1)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Too many Ipods found"));
|
||||
m_dp->addItem(tr("Too many Ipods found"));
|
||||
emit done(true);
|
||||
}
|
||||
|
||||
|
@ -524,7 +522,7 @@ void BootloaderInstaller::ipodPrepare()
|
|||
|
||||
QString url = m_bootloaderUrlBase + "/ipod/bootloader-" + m_bootloadername + ".ipod";
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -538,38 +536,37 @@ void BootloaderInstaller::ipodPrepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
else // Uninstallation
|
||||
{
|
||||
if (ipod_open(&ipod, 0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not open ipod"));
|
||||
m_dp->addItem(tr("could not open ipod"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (read_partinfo(&ipod,0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not read partitiontable"));
|
||||
m_dp->addItem(tr("could not read partitiontable"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipod.pinfo[0].start==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No partition 0 on disk"));
|
||||
m_dp->addItem(tr("No partition 0 on disk"));
|
||||
|
||||
int i;
|
||||
double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
|
||||
m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
|
||||
m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
|
||||
for ( i = 0; i < 4; i++ )
|
||||
{
|
||||
if (ipod.pinfo[i].start != 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
|
||||
m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
|
||||
i).arg(
|
||||
ipod.pinfo[i].start).arg(
|
||||
ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg(
|
||||
|
@ -586,13 +583,13 @@ void BootloaderInstaller::ipodPrepare()
|
|||
|
||||
if (ipod.nimages <= 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Failed to read firmware directory"));
|
||||
m_dp->addItem(tr("Failed to read firmware directory"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg(
|
||||
m_dp->addItem(tr("Unknown version number in firmware (%1)").arg(
|
||||
ipod.ipod_directory[0].vers));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -600,32 +597,32 @@ void BootloaderInstaller::ipodPrepare()
|
|||
|
||||
if (ipod.macpod)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
|
||||
m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
|
||||
}
|
||||
|
||||
if (ipod_reopen_rw(&ipod) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode"));
|
||||
m_dp->addItem(tr("Could not open Ipod in RW mode"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipod.ipod_directory[0].entryOffset==0) {
|
||||
m_dp->listProgress->addItem(tr("No bootloader detected."));
|
||||
m_dp->addItem(tr("No bootloader detected."));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (delete_bootloader(&ipod)==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Successfully removed Bootloader"));
|
||||
m_dp->addItem(tr("Successfully removed Bootloader"));
|
||||
emit done(false);
|
||||
ipod_close(&ipod);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("--delete-bootloader failed."));
|
||||
m_dp->addItem(tr("--delete-bootloader failed."));
|
||||
emit done(true);
|
||||
ipod_close(&ipod);
|
||||
return;
|
||||
|
@ -640,32 +637,32 @@ void BootloaderInstaller::ipodFinish()
|
|||
|
||||
if (ipod_open(&ipod, 0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not open ipod"));
|
||||
m_dp->addItem(tr("could not open ipod"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (read_partinfo(&ipod,0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not read partitiontable"));
|
||||
m_dp->addItem(tr("could not read partitiontable"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipod.pinfo[0].start==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No partition 0 on disk"));
|
||||
m_dp->addItem(tr("No partition 0 on disk"));
|
||||
|
||||
int i;
|
||||
double sectors_per_MB = (1024.0*1024.0)/ipod.sector_size;
|
||||
|
||||
m_dp->listProgress->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
|
||||
m_dp->addItem(tr("[INFO] Part Start Sector End Sector Size (MB) Type\n"));
|
||||
|
||||
for ( i = 0; i < 4; i++ )
|
||||
{
|
||||
if (ipod.pinfo[i].start != 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
|
||||
m_dp->addItem(tr("[INFO] %1 %2 %3 %4 %5 (%6)").arg(
|
||||
i).arg(
|
||||
ipod.pinfo[i].start).arg(
|
||||
ipod.pinfo[i].start+ipod.pinfo[i].size-1).arg(
|
||||
|
@ -682,13 +679,13 @@ void BootloaderInstaller::ipodFinish()
|
|||
|
||||
if (ipod.nimages <= 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Failed to read firmware directory"));
|
||||
m_dp->addItem(tr("Failed to read firmware directory"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if (getmodel(&ipod,(ipod.ipod_directory[0].vers>>8)) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Unknown version number in firmware (%1)").arg(
|
||||
m_dp->addItem(tr("Unknown version number in firmware (%1)").arg(
|
||||
ipod.ipod_directory[0].vers));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -696,26 +693,26 @@ void BootloaderInstaller::ipodFinish()
|
|||
|
||||
if (ipod.macpod)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
|
||||
m_dp->addItem(tr("Warning this is a MacPod, Rockbox doesnt work on this. Convert it to WinPod"));
|
||||
}
|
||||
|
||||
if (ipod_reopen_rw(&ipod) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not open Ipod in RW mode"));
|
||||
m_dp->addItem(tr("Could not open Ipod in RW mode"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Successfully added Bootloader"));
|
||||
m_dp->addItem(tr("Successfully added Bootloader"));
|
||||
emit done(false);
|
||||
ipod_close(&ipod);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("failed to add Bootloader"));
|
||||
m_dp->addItem(tr("failed to add Bootloader"));
|
||||
ipod_close(&ipod);
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -735,19 +732,19 @@ bool initSansaPatcher()
|
|||
|
||||
void BootloaderInstaller::sansaPrepare()
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Searching for sansas"));
|
||||
m_dp->addItem(tr("Searching for sansas"));
|
||||
struct sansa_t sansa;
|
||||
|
||||
int n = sansa_scan(&sansa);
|
||||
if (n == 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("No Sansa found"));
|
||||
m_dp->addItem(tr("No Sansa found"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if (n > 1)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Too many Sansas found"));
|
||||
m_dp->addItem(tr("Too many Sansas found"));
|
||||
emit done(true);
|
||||
}
|
||||
|
||||
|
@ -755,7 +752,7 @@ void BootloaderInstaller::sansaPrepare()
|
|||
{
|
||||
QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -769,36 +766,36 @@ void BootloaderInstaller::sansaPrepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
else // Uninstallation
|
||||
{
|
||||
|
||||
if (sansa_open(&sansa, 0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not open Sansa"));
|
||||
m_dp->addItem(tr("could not open Sansa"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa_read_partinfo(&sansa,0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not read partitiontable"));
|
||||
m_dp->addItem(tr("could not read partitiontable"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
int i = is_e200(&sansa);
|
||||
if (i < 0) {
|
||||
m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
|
||||
m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa.hasoldbootloader)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("********************************************\n"
|
||||
m_dp->addItem(tr("********************************************\n"
|
||||
"OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
|
||||
"You must reinstall the original Sansa firmware before running\n"
|
||||
"sansapatcher for the first time.\n"
|
||||
|
@ -811,21 +808,21 @@ void BootloaderInstaller::sansaPrepare()
|
|||
|
||||
if (sansa_reopen_rw(&sansa) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode"));
|
||||
m_dp->addItem(tr("Could not open Sansa in RW mode"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa_delete_bootloader(&sansa)==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Successfully removed Bootloader"));
|
||||
m_dp->addItem(tr("Successfully removed Bootloader"));
|
||||
emit done(false);
|
||||
sansa_close(&sansa);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("--delete-bootloader failed."));
|
||||
m_dp->addItem(tr("--delete-bootloader failed."));
|
||||
emit done(true);
|
||||
sansa_close(&sansa);
|
||||
return;
|
||||
|
@ -840,14 +837,14 @@ void BootloaderInstaller::sansaFinish()
|
|||
|
||||
if (sansa_open(&sansa, 0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not open Sansa"));
|
||||
m_dp->addItem(tr("could not open Sansa"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa_read_partinfo(&sansa,0) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("could not read partitiontable"));
|
||||
m_dp->addItem(tr("could not read partitiontable"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
@ -856,14 +853,14 @@ void BootloaderInstaller::sansaFinish()
|
|||
int i = is_e200(&sansa);
|
||||
if (i < 0) {
|
||||
|
||||
m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
|
||||
m_dp->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa.hasoldbootloader)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("********************************************\n"
|
||||
m_dp->addItem(tr("********************************************\n"
|
||||
"OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
|
||||
"You must reinstall the original Sansa firmware before running\n"
|
||||
"sansapatcher for the first time.\n"
|
||||
|
@ -875,21 +872,21 @@ void BootloaderInstaller::sansaFinish()
|
|||
|
||||
if (sansa_reopen_rw(&sansa) < 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode"));
|
||||
m_dp->addItem(tr("Could not open Sansa in RW mode"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Successfully added Bootloader"));
|
||||
m_dp->addItem(tr("Successfully added Bootloader"));
|
||||
emit done(false);
|
||||
sansa_close(&sansa);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("failed to add Bootloader"));
|
||||
m_dp->addItem(tr("failed to add Bootloader"));
|
||||
sansa_close(&sansa);
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -905,7 +902,7 @@ void BootloaderInstaller::iriverPrepare()
|
|||
{
|
||||
char md5sum_str[32];
|
||||
if (!FileMD5(m_origfirmware, md5sum_str)) {
|
||||
m_dp->listProgress->addItem(tr("Could not MD5Sum original firmware"));
|
||||
m_dp->addItem(tr("Could not MD5Sum original firmware"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
@ -935,14 +932,14 @@ void BootloaderInstaller::iriverPrepare()
|
|||
}
|
||||
if (series == 0)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not detect firmware type"));
|
||||
m_dp->addItem(tr("Could not detect firmware type"));
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
QString url = m_bootloaderUrlBase + "/iriver/" + m_bootloadername;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -956,9 +953,8 @@ void BootloaderInstaller::iriverPrepare()
|
|||
getter->getFile(QUrl(url));
|
||||
// connect signals from HttpGet
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
//connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
|
||||
void BootloaderInstaller::iriverFinish()
|
||||
|
@ -999,7 +995,7 @@ void BootloaderInstaller::iriverFinish()
|
|||
// iriver decode
|
||||
if (iriver_decode(m_origfirmware, firmwareBinName, FALSE, STRIP_NONE,m_dp) == -1)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Error in descramble"));
|
||||
m_dp->addItem(tr("Error in descramble"));
|
||||
firmwareBin.remove();
|
||||
newBin.remove();
|
||||
newHex.remove();
|
||||
|
@ -1009,7 +1005,7 @@ void BootloaderInstaller::iriverFinish()
|
|||
// mkboot
|
||||
if (!mkboot(firmwareBinName, newBinName, m_tempfilename, origin,m_dp))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Error in patching"));
|
||||
m_dp->addItem(tr("Error in patching"));
|
||||
firmwareBin.remove();
|
||||
newBin.remove();
|
||||
newHex.remove();
|
||||
|
@ -1019,7 +1015,7 @@ void BootloaderInstaller::iriverFinish()
|
|||
// iriver_encode
|
||||
if (iriver_encode(newBinName, newHexName, FALSE,m_dp) == -1)
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Error in scramble"));
|
||||
m_dp->addItem(tr("Error in scramble"));
|
||||
firmwareBin.remove();
|
||||
newBin.remove();
|
||||
newHex.remove();
|
||||
|
@ -1030,7 +1026,7 @@ void BootloaderInstaller::iriverFinish()
|
|||
/* now md5sum it */
|
||||
if (!FileMD5(newHexName, md5sum_str))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Error in checksumming"));
|
||||
m_dp->addItem(tr("Error in checksumming"));
|
||||
firmwareBin.remove();
|
||||
newBin.remove();
|
||||
newHex.remove();
|
||||
|
@ -1054,7 +1050,7 @@ void BootloaderInstaller::iriverFinish()
|
|||
// copy file
|
||||
if(!newHex.copy(dest))
|
||||
{
|
||||
m_dp->listProgress->addItem(tr("Could not copy: %1 to %2")
|
||||
m_dp->addItem(tr("Could not copy: %1 to %2")
|
||||
.arg(newHexName,dest));
|
||||
emit done(true);
|
||||
return;
|
||||
|
@ -1063,8 +1059,8 @@ void BootloaderInstaller::iriverFinish()
|
|||
downloadFile.remove();
|
||||
newHex.remove();
|
||||
|
||||
m_dp->listProgress->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Bootloader install finished successfully."));
|
||||
m_dp->abort();
|
||||
|
||||
emit done(false); // success
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <QtGui>
|
||||
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "progressloggerinterface.h"
|
||||
#include "httpget.h"
|
||||
#include "irivertools/irivertools.h"
|
||||
|
||||
|
@ -43,8 +43,8 @@ public:
|
|||
BootloaderInstaller(QObject* parent);
|
||||
~BootloaderInstaller() {}
|
||||
|
||||
void install(Ui::InstallProgressFrm* dp);
|
||||
void uninstall(Ui::InstallProgressFrm* dp);
|
||||
void install(ProgressloggerInterface* dp);
|
||||
void uninstall(ProgressloggerInterface* dp);
|
||||
|
||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
||||
|
@ -101,7 +101,7 @@ private:
|
|||
HttpGet *getter;
|
||||
QTemporaryFile downloadFile;
|
||||
|
||||
Ui::InstallProgressFrm* m_dp;
|
||||
ProgressloggerInterface* m_dp;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -28,11 +28,11 @@ ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
|
|||
}
|
||||
|
||||
|
||||
void ZipInstaller::install(Ui::InstallProgressFrm* dp)
|
||||
void ZipInstaller::install(ProgressloggerInterface* dp)
|
||||
{
|
||||
m_dp = dp;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Downloading file %1.%2")
|
||||
m_dp->addItem(tr("Downloading file %1.%2")
|
||||
.arg(QFileInfo(m_url).baseName(), QFileInfo(m_url).completeSuffix()));
|
||||
|
||||
// temporary file needs to be opened to get the filename
|
||||
|
@ -48,7 +48,7 @@ void ZipInstaller::install(Ui::InstallProgressFrm* dp)
|
|||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
connect(m_dp->buttonAbort, SIGNAL(clicked()), getter, SLOT(abort()));
|
||||
connect(m_dp, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
}
|
||||
|
||||
void ZipInstaller::downloadRequestFinished(int id, bool error)
|
||||
|
@ -65,53 +65,53 @@ void ZipInstaller::downloadDone(bool error)
|
|||
|
||||
// update progress bar
|
||||
|
||||
int max = m_dp->progressBar->maximum();
|
||||
int max = m_dp->getProgressMax();
|
||||
if(max == 0) {
|
||||
max = 100;
|
||||
m_dp->progressBar->setMaximum(max);
|
||||
m_dp->setProgressMax(max);
|
||||
}
|
||||
m_dp->progressBar->setValue(max);
|
||||
m_dp->setProgressValue(max);
|
||||
if(getter->httpResponse() != 200) {
|
||||
m_dp->listProgress->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()));
|
||||
m_dp->abort();
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
if(error) {
|
||||
m_dp->listProgress->addItem(tr("Download error: %1").arg(getter->errorString()));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->addItem(tr("Download error: %1").arg(getter->errorString()));
|
||||
m_dp->abort();
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
else m_dp->listProgress->addItem(tr("Download finished."));
|
||||
else m_dp->addItem(tr("Download finished."));
|
||||
|
||||
// unzip downloaded file
|
||||
qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint;
|
||||
|
||||
m_dp->listProgress->addItem(tr("Extracting file."));
|
||||
m_dp->addItem(tr("Extracting file."));
|
||||
|
||||
qDebug() << "file to unzip: " << m_file;
|
||||
UnZip::ErrorCode ec;
|
||||
UnZip uz;
|
||||
ec = uz.openArchive(m_file);
|
||||
if(ec != UnZip::Ok) {
|
||||
m_dp->listProgress->addItem(tr("Opening archive failed: %1.")
|
||||
m_dp->addItem(tr("Opening archive failed: %1.")
|
||||
.arg(uz.formatError(ec)));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->abort();
|
||||
emit done(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ec = uz.extractAll(m_mountpoint);
|
||||
if(ec != UnZip::Ok) {
|
||||
m_dp->listProgress->addItem(tr("Extracting failed: %1.")
|
||||
m_dp->addItem(tr("Extracting failed: %1.")
|
||||
.arg(uz.formatError(ec)));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
m_dp->abort();
|
||||
emit done(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_dp->listProgress->addItem(tr("creating installation log"));
|
||||
m_dp->addItem(tr("creating installation log"));
|
||||
|
||||
QStringList zipContents = uz.fileList();
|
||||
|
||||
|
@ -127,16 +127,15 @@ void ZipInstaller::downloadDone(bool error)
|
|||
// remove temporary file
|
||||
downloadFile.remove();
|
||||
|
||||
m_dp->listProgress->addItem(tr("Extraction finished successfully."));
|
||||
m_dp->buttonAbort->setText(tr("&Ok"));
|
||||
|
||||
m_dp->addItem(tr("Extraction finished successfully."));
|
||||
m_dp->abort();
|
||||
emit done(false);
|
||||
}
|
||||
|
||||
void ZipInstaller::updateDataReadProgress(int read, int total)
|
||||
{
|
||||
m_dp->progressBar->setMaximum(total);
|
||||
m_dp->progressBar->setValue(read);
|
||||
m_dp->setProgressMax(total);
|
||||
m_dp->setProgressValue(read);
|
||||
qDebug() << "progress:" << read << "/" << total;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <QtGui>
|
||||
#include <QtNetwork>
|
||||
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "progressloggerinterface.h"
|
||||
#include "httpget.h"
|
||||
|
||||
class ZipInstaller : public QObject
|
||||
|
@ -35,7 +35,7 @@ class ZipInstaller : public QObject
|
|||
public:
|
||||
ZipInstaller(QObject* parent) ;
|
||||
~ZipInstaller(){}
|
||||
void install(Ui::InstallProgressFrm* dp);
|
||||
void install(ProgressloggerInterface* dp);
|
||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||
void setFilename(QString filename){m_file = filename;}
|
||||
void setUrl(QString url){m_url = url;}
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
HttpGet *getter;
|
||||
QTemporaryFile downloadFile;
|
||||
|
||||
Ui::InstallProgressFrm* m_dp;
|
||||
ProgressloggerInterface* m_dp;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,128 +1,126 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzipwindow.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "installzipwindow.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
|
||||
|
||||
InstallZipWindow::InstallZipWindow(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
||||
}
|
||||
|
||||
void InstallZipWindow::setProxy(QUrl proxy_url)
|
||||
{
|
||||
proxy = proxy_url;
|
||||
qDebug() << "Install::setProxy" << proxy;
|
||||
}
|
||||
|
||||
void InstallZipWindow::setMountPoint(QString mount)
|
||||
{
|
||||
QFileInfo m(mount);
|
||||
if(m.isDir()) {
|
||||
ui.lineMountPoint->clear();
|
||||
ui.lineMountPoint->insert(mount);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallZipWindow::setUrl(QString path)
|
||||
{
|
||||
url = path;
|
||||
}
|
||||
|
||||
void InstallZipWindow::browseFolder()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir())
|
||||
browser.setDirectory(ui.lineMountPoint->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setFileMode(QFileDialog::DirectoryOnly);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setMountPoint(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallZipWindow::accept()
|
||||
{
|
||||
downloadProgress = new QDialog(this);
|
||||
dp.setupUi(downloadProgress);
|
||||
|
||||
// show dialog with error if mount point is wrong
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
|
||||
mountPoint = ui.lineMountPoint->text();
|
||||
userSettings->setValue("defaults/mountpoint", mountPoint);
|
||||
}
|
||||
else {
|
||||
dp.listProgress->addItem(tr("Mount point is wrong!"));
|
||||
dp.buttonAbort->setText(tr("&Ok"));
|
||||
downloadProgress->show();
|
||||
return;
|
||||
}
|
||||
|
||||
userSettings->sync();
|
||||
|
||||
installer = new ZipInstaller(this);
|
||||
|
||||
QString fileName = url.section('/', -1);
|
||||
|
||||
installer->setFilename(fileName);
|
||||
installer->setUrl(url);
|
||||
installer->setProxy(proxy);
|
||||
installer->setLogSection(logsection);
|
||||
installer->setMountPoint(mountPoint);
|
||||
installer->install(&dp);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
downloadProgress->show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void InstallZipWindow::done(bool error)
|
||||
{
|
||||
qDebug() << "Install::done, error:" << error;
|
||||
|
||||
if(error)
|
||||
{
|
||||
// connect close button now as it's needed if we break upon an error
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
|
||||
return;
|
||||
}
|
||||
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()),downloadProgress, SLOT(close()));
|
||||
}
|
||||
|
||||
void InstallZipWindow::setDeviceSettings(QSettings *dev)
|
||||
{
|
||||
devices = dev;
|
||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||
}
|
||||
|
||||
void InstallZipWindow::setUserSettings(QSettings *user)
|
||||
{
|
||||
userSettings = user;
|
||||
}
|
||||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzipwindow.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "installzipwindow.h"
|
||||
//#include "ui_installprogressfrm.h"
|
||||
|
||||
|
||||
InstallZipWindow::InstallZipWindow(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
||||
}
|
||||
|
||||
void InstallZipWindow::setProxy(QUrl proxy_url)
|
||||
{
|
||||
proxy = proxy_url;
|
||||
qDebug() << "Install::setProxy" << proxy;
|
||||
}
|
||||
|
||||
void InstallZipWindow::setMountPoint(QString mount)
|
||||
{
|
||||
QFileInfo m(mount);
|
||||
if(m.isDir()) {
|
||||
ui.lineMountPoint->clear();
|
||||
ui.lineMountPoint->insert(mount);
|
||||
}
|
||||
}
|
||||
|
||||
void InstallZipWindow::setUrl(QString path)
|
||||
{
|
||||
url = path;
|
||||
}
|
||||
|
||||
void InstallZipWindow::browseFolder()
|
||||
{
|
||||
QFileDialog browser(this);
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir())
|
||||
browser.setDirectory(ui.lineMountPoint->text());
|
||||
else
|
||||
browser.setDirectory("/media");
|
||||
browser.setReadOnly(true);
|
||||
browser.setFileMode(QFileDialog::DirectoryOnly);
|
||||
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if(browser.exec()) {
|
||||
qDebug() << browser.directory();
|
||||
QStringList files = browser.selectedFiles();
|
||||
setMountPoint(files.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallZipWindow::accept()
|
||||
{
|
||||
// create logger
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
|
||||
// show dialog with error if mount point is wrong
|
||||
if(QFileInfo(ui.lineMountPoint->text()).isDir()) {
|
||||
mountPoint = ui.lineMountPoint->text();
|
||||
userSettings->setValue("defaults/mountpoint", mountPoint);
|
||||
}
|
||||
else {
|
||||
logger->addItem(tr("Mount point is wrong!"));
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
userSettings->sync();
|
||||
|
||||
// create Zip installer
|
||||
installer = new ZipInstaller(this);
|
||||
|
||||
QString fileName = url.section('/', -1);
|
||||
installer->setFilename(fileName);
|
||||
installer->setUrl(url);
|
||||
installer->setProxy(proxy);
|
||||
installer->setLogSection(logsection);
|
||||
installer->setMountPoint(mountPoint);
|
||||
installer->install(logger);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
// we are done with Zip installing
|
||||
void InstallZipWindow::done(bool error)
|
||||
{
|
||||
qDebug() << "Install::done, error:" << error;
|
||||
|
||||
if(error) // if there was an error
|
||||
{
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
// no error, close the window, when the logger is closed
|
||||
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
||||
}
|
||||
|
||||
void InstallZipWindow::setDeviceSettings(QSettings *dev)
|
||||
{
|
||||
devices = dev;
|
||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||
}
|
||||
|
||||
void InstallZipWindow::setUserSettings(QSettings *user)
|
||||
{
|
||||
userSettings = user;
|
||||
}
|
||||
|
|
|
@ -1,68 +1,66 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzipwindow.h 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef INSTALLZIPWINDOW_H
|
||||
#define INSTALLZIPWINDOW_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "ui_installzipfrm.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "installzip.h"
|
||||
|
||||
|
||||
class InstallZipWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InstallZipWindow(QWidget *parent = 0);
|
||||
void setProxy(QUrl);
|
||||
void setMountPoint(QString);
|
||||
void setUrl(QString);
|
||||
void setLogSection(QString name){logsection = name; }
|
||||
void setUserSettings(QSettings*);
|
||||
void setDeviceSettings(QSettings*);
|
||||
|
||||
public slots:
|
||||
void accept(void);
|
||||
|
||||
private:
|
||||
Ui::InstallZipFrm ui;
|
||||
Ui::InstallProgressFrm dp;
|
||||
QUrl proxy;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
QDialog *downloadProgress;
|
||||
QString file;
|
||||
QString fileName;
|
||||
QString mountPoint;
|
||||
QString url;
|
||||
QString logsection;
|
||||
ZipInstaller* installer;
|
||||
|
||||
private slots:
|
||||
void browseFolder(void);
|
||||
void done(bool);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installzipwindow.h 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef INSTALLZIPWINDOW_H
|
||||
#define INSTALLZIPWINDOW_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "ui_installzipfrm.h"
|
||||
#include "installzip.h"
|
||||
#include "progressloggergui.h"
|
||||
|
||||
class InstallZipWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InstallZipWindow(QWidget *parent = 0);
|
||||
void setProxy(QUrl);
|
||||
void setMountPoint(QString);
|
||||
void setUrl(QString);
|
||||
void setLogSection(QString name){logsection = name; }
|
||||
void setUserSettings(QSettings*);
|
||||
void setDeviceSettings(QSettings*);
|
||||
|
||||
public slots:
|
||||
void accept(void);
|
||||
|
||||
private:
|
||||
Ui::InstallZipFrm ui;
|
||||
QUrl proxy;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
ProgressLoggerGui* logger;
|
||||
QString file;
|
||||
QString fileName;
|
||||
QString mountPoint;
|
||||
QString url;
|
||||
QString logsection;
|
||||
ZipInstaller* installer;
|
||||
|
||||
private slots:
|
||||
void browseFolder(void);
|
||||
void done(bool);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,7 @@ const unsigned char header[][16] = {
|
|||
/* begin mkboot.c excerpt */
|
||||
unsigned char image[0x400000 + 0x220 + 0x400000/0x200];
|
||||
|
||||
bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::InstallProgressFrm* dp)
|
||||
bool mkboot(QString infile, QString outfile,QString bootloader,int origin,ProgressloggerInterface* dp)
|
||||
{
|
||||
int i;
|
||||
int len,bllen;
|
||||
|
@ -59,12 +59,12 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
QFile f(infile);
|
||||
if(!f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + infile);
|
||||
dp->addItem("Could not open: %1" + infile);
|
||||
return false;
|
||||
}
|
||||
i = f.read((char*)image,16);
|
||||
if(i < 16) {
|
||||
dp->listProgress->addItem("reading header failed");
|
||||
dp->addItem("reading header failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
len = binary_length+0x200-16;
|
||||
i = f.read((char*)image+16, len);
|
||||
if(i < len) {
|
||||
dp->listProgress->addItem("reading firmware failed");
|
||||
dp->addItem("reading firmware failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
f.setFileName(bootloader);
|
||||
if(!f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + bootloader);
|
||||
dp->addItem("Could not open: %1" + bootloader);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
|
||||
i = f.read((char*)image+0x220 + origin, bllen);
|
||||
if(i < bllen) {
|
||||
dp->listProgress->addItem("reading bootloader failed");
|
||||
dp->addItem("reading bootloader failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
f.setFileName(outfile);
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + outfile);
|
||||
dp->addItem("Could not open: %1" + outfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::In
|
|||
|
||||
i = f.write((char*)image,total_length);
|
||||
if(i < total_length) {
|
||||
dp->listProgress->addItem("writing bootloader failed");
|
||||
dp->addItem("writing bootloader failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ static void modifyheader( unsigned char * data )
|
|||
};
|
||||
|
||||
int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify,
|
||||
enum striptype stripmode,Ui::InstallProgressFrm* dp )
|
||||
enum striptype stripmode,ProgressloggerInterface* dp )
|
||||
{
|
||||
QFile infile(infile_name);
|
||||
QFile outfile(outfile_name);
|
||||
|
@ -226,18 +226,18 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if(!infile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + infile_name);
|
||||
dp->addItem("Could not open: %1" + infile_name);
|
||||
return -1;
|
||||
}
|
||||
if(!outfile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + outfile_name);
|
||||
dp->addItem("Could not open: %1" + outfile_name);
|
||||
return -1;
|
||||
}
|
||||
lenread = infile.read( (char*)headerdata, 512);
|
||||
if( lenread != 512 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid encrypted iHP"
|
||||
dp->addItem("This doesn't look like a valid encrypted iHP"
|
||||
"firmware - reason: header length.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -247,7 +247,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
i = testheader( headerdata );
|
||||
if( i == -1 )
|
||||
{
|
||||
dp->listProgress->addItem("This firmware is for an unknown model, or is not"
|
||||
dp->addItem("This firmware is for an unknown model, or is not"
|
||||
" a valid encrypted iHP firmware.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -270,7 +270,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
dwLength2>>9 != dwLength3 ||
|
||||
dwLength2+dwLength3+512 != dwLength1 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid encrypted "
|
||||
dp->addItem("This doesn't look like a valid encrypted "
|
||||
"iHP firmware - reason: file 'length' data.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -332,7 +332,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if( fp != dwLength2 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid encrypted "
|
||||
dp->addItem("This doesn't look like a valid encrypted "
|
||||
"iHP firmware - reason: 'length2' mismatch.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -349,7 +349,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
outfile.write((char*) blockdata, lenread );
|
||||
if( memcmp( ppChecksums, blockdata, lenread ) != 0 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid encrypted "
|
||||
dp->addItem("This doesn't look like a valid encrypted "
|
||||
"iHP firmware - reason: Checksum mismatch!");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -360,7 +360,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if( fp != dwLength3 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid encrypted "
|
||||
dp->addItem("This doesn't look like a valid encrypted "
|
||||
"iHP firmware - reason: 'length3' mismatch.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -392,7 +392,7 @@ int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
};
|
||||
|
||||
int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,Ui::InstallProgressFrm* dp )
|
||||
int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,ProgressloggerInterface* dp )
|
||||
{
|
||||
QFile infile(infile_name);
|
||||
QFile outfile(outfile_name);
|
||||
|
@ -409,19 +409,19 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if(!infile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + infile_name);
|
||||
dp->addItem("Could not open: %1" + infile_name);
|
||||
return -1;
|
||||
}
|
||||
if(!outfile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
dp->listProgress->addItem("Could not open: %1" + outfile_name);
|
||||
dp->addItem("Could not open: %1" + outfile_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lenread = infile.read((char*) headerdata, 512 );
|
||||
if( lenread != 512 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid decoded "
|
||||
dp->addItem("This doesn't look like a valid decoded "
|
||||
"iHP firmware - reason: header length.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -435,7 +435,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
i = testheader( headerdata );
|
||||
if( i == -1 )
|
||||
{
|
||||
dp->listProgress->addItem("This firmware is for an unknown model, or is not"
|
||||
dp->addItem("This firmware is for an unknown model, or is not"
|
||||
" a valid decoded iHP firmware.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -456,7 +456,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
dwLength3 > dwLength1 ||
|
||||
dwLength2+dwLength3+512 != dwLength1 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid decoded "
|
||||
dp->addItem("This doesn't look like a valid decoded "
|
||||
"iHP firmware - reason:file 'length' data.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -494,7 +494,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if( fp != dwLength2 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid decoded "
|
||||
dp->addItem("This doesn't look like a valid decoded "
|
||||
"iHP firmware - reason: 'length1' mismatch.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
@ -514,7 +514,7 @@ int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify
|
|||
|
||||
if( fp != dwLength3 )
|
||||
{
|
||||
dp->listProgress->addItem("This doesn't look like a valid decoded "
|
||||
dp->addItem("This doesn't look like a valid decoded "
|
||||
"iHP firmware - 'length2' mismatch.");
|
||||
infile.close();
|
||||
outfile.close();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "md5sum.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
#include "progressloggerinterface.h"
|
||||
|
||||
#define ESTF_SIZE 32
|
||||
|
||||
|
@ -61,9 +61,9 @@ enum striptype
|
|||
|
||||
int intable(char *md5, struct sumpairs *table, int len);
|
||||
|
||||
bool mkboot(QString infile, QString outfile,QString bootloader,int origin,Ui::InstallProgressFrm* dp);
|
||||
bool mkboot(QString infile, QString outfile,QString bootloader,int origin,ProgressloggerInterface* dp);
|
||||
int iriver_decode(QString infile_name, QString outfile_name, unsigned int modify,
|
||||
enum striptype stripmode,Ui::InstallProgressFrm* dp );
|
||||
int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,Ui::InstallProgressFrm* dp);
|
||||
enum striptype stripmode,ProgressloggerInterface* dp );
|
||||
int iriver_encode(QString infile_name, QString outfile_name, unsigned int modify,ProgressloggerInterface* dp);
|
||||
|
||||
#endif // IRIVERTOOLS_H_INCLUDED
|
||||
|
|
69
rbutil/rbutilqt/progressloggergui.cpp
Normal file
69
rbutil/rbutilqt/progressloggergui.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: progressloggergui.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "progressloggergui.h"
|
||||
|
||||
ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
|
||||
{
|
||||
downloadProgress = new QDialog();
|
||||
dp.setupUi(downloadProgress);
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
||||
}
|
||||
|
||||
|
||||
void ProgressLoggerGui::addItem(QString text)
|
||||
{
|
||||
dp.listProgress->addItem(text);
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::setProgressValue(int value)
|
||||
{
|
||||
dp.progressBar->setValue(value);
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::setProgressMax(int max)
|
||||
{
|
||||
dp.progressBar->setMaximum(max);
|
||||
}
|
||||
|
||||
int ProgressLoggerGui::getProgressMax()
|
||||
{
|
||||
return dp.progressBar->maximum();
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::abort()
|
||||
{
|
||||
dp.buttonAbort->setText(tr("&Ok"));
|
||||
disconnect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), downloadProgress, SLOT(close()));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SIGNAL(closed()));
|
||||
emit aborted();
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::close()
|
||||
{
|
||||
downloadProgress->close();
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::show()
|
||||
{
|
||||
downloadProgress->show();
|
||||
}
|
||||
|
||||
|
55
rbutil/rbutilqt/progressloggergui.h
Normal file
55
rbutil/rbutilqt/progressloggergui.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: progressloggergui.h 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef PROGRESSLOGGERGUI_H
|
||||
#define PROGRESSLOGGERGUI_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "progressloggerinterface.h"
|
||||
#include "ui_installprogressfrm.h"
|
||||
|
||||
class ProgressLoggerGui :public ProgressloggerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProgressLoggerGui(QObject * parent);
|
||||
|
||||
virtual void addItem(QString text) ; //adds a string to the list
|
||||
|
||||
virtual void setProgressValue(int value);
|
||||
virtual void setProgressMax(int max);
|
||||
virtual int getProgressMax();
|
||||
|
||||
signals:
|
||||
virtual void aborted();
|
||||
virtual void closed();
|
||||
|
||||
public slots:
|
||||
virtual void abort();
|
||||
virtual void close();
|
||||
virtual void show();
|
||||
|
||||
private:
|
||||
Ui::InstallProgressFrm dp;
|
||||
QDialog *downloadProgress;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
51
rbutil/rbutilqt/progressloggerinterface.h
Normal file
51
rbutil/rbutilqt/progressloggerinterface.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: progressloggerinterface.h 14027 2007-07-27 17:42:49Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PROGRESSLOGGERINTERFACE_H
|
||||
#define PROGRESSLOGGERINTERFACE_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
class ProgressloggerInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProgressloggerInterface(QObject* parent) : QObject(parent) {}
|
||||
virtual void addItem(QString text) =0 ; //adds a string to the list
|
||||
|
||||
virtual void setProgressValue(int value)=0;
|
||||
virtual void setProgressMax(int max)=0;
|
||||
virtual int getProgressMax()=0;
|
||||
|
||||
signals:
|
||||
virtual void aborted()=0;
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void abort()=0;
|
||||
virtual void close()=0;
|
||||
virtual void show()=0;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -9,6 +9,7 @@ SOURCES += rbutilqt.cpp \
|
|||
installbootloader.cpp \
|
||||
installbl.cpp \
|
||||
installzipwindow.cpp \
|
||||
progressloggergui.cpp \
|
||||
../ipodpatcher/ipodpatcher.c \
|
||||
../sansapatcher/sansapatcher.c \
|
||||
irivertools/irivertools.cpp \
|
||||
|
@ -30,6 +31,8 @@ HEADERS += rbutilqt.h \
|
|||
installbootloader.h \
|
||||
installbl.h \
|
||||
installzipwindow.h \
|
||||
progressloggerinterface.h \
|
||||
progressloggergui.h \
|
||||
../ipodpatcher/ipodpatcher.h \
|
||||
../ipodpatcher/ipodio.h \
|
||||
../ipodpatcher/parttypes.h \
|
||||
|
@ -44,7 +47,7 @@ HEADERS += rbutilqt.h \
|
|||
TEMPLATE = app
|
||||
CONFIG += release \
|
||||
warn_on \
|
||||
thread \
|
||||
thread \
|
||||
qt
|
||||
TARGET = rbutilqt
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue