forked from len0rd/rockbox
rbutilqt: first attempt to Small and Complete Installation, could be improved.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14463 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0aeea5d9a7
commit
388506ec78
9 changed files with 2234 additions and 592 deletions
328
rbutil/rbutilqt/multiinstaller.cpp
Normal file
328
rbutil/rbutilqt/multiinstaller.cpp
Normal file
|
@ -0,0 +1,328 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: multinstaller.cpp 14462 2007-08-26 16:44:23Z 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 "multiinstaller.h"
|
||||
|
||||
#include "installbootloader.h"
|
||||
#include "progressloggergui.h"
|
||||
#include "installzip.h"
|
||||
#include "browseof.h"
|
||||
#include "installthemes.h"
|
||||
|
||||
MultiInstaller::MultiInstaller(QObject* parent): QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MultiInstaller::setUserSettings(QSettings* user)
|
||||
{
|
||||
userSettings = user;
|
||||
}
|
||||
void MultiInstaller::setDeviceSettings(QSettings* dev)
|
||||
{
|
||||
devices = dev;
|
||||
}
|
||||
|
||||
void MultiInstaller::setProxy(QUrl proxy)
|
||||
{
|
||||
m_proxy = proxy;
|
||||
}
|
||||
|
||||
void MultiInstaller::installSmall()
|
||||
{
|
||||
// create logger
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
|
||||
m_plattform = userSettings->value("defaults/platform").toString();
|
||||
m_mountpoint = userSettings->value("defaults/mountpoint").toString();
|
||||
// show dialog with error if mount point is wrong
|
||||
if(!QFileInfo(m_mountpoint).isDir()) {
|
||||
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
// Bootloader
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installBootloader())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
if(m_error) return;
|
||||
logger->undoAbort();
|
||||
|
||||
// Rockbox
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installRockbox())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiInstaller::installComplete()
|
||||
{
|
||||
// create logger
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
|
||||
m_plattform = userSettings->value("defaults/platform").toString();
|
||||
m_mountpoint = userSettings->value("defaults/mountpoint").toString();
|
||||
// show dialog with error if mount point is wrong
|
||||
if(!QFileInfo(m_mountpoint).isDir()) {
|
||||
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
// Bootloader
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installBootloader())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
if(m_error) return;
|
||||
logger->undoAbort();
|
||||
|
||||
// Rockbox
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installRockbox())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
if(m_error) return;
|
||||
logger->undoAbort();
|
||||
|
||||
// Fonts
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installFonts())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
if(m_error) return;
|
||||
logger->undoAbort();
|
||||
|
||||
// Doom
|
||||
m_error = false;
|
||||
installed = false;
|
||||
if(!installDoom())
|
||||
return;
|
||||
else
|
||||
{
|
||||
// wait for boot loader installation finished
|
||||
while(!installed)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
if(m_error) return;
|
||||
|
||||
|
||||
// theme
|
||||
// this is a window
|
||||
// it has its own logger window,so close our.
|
||||
logger->close();
|
||||
installThemes();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MultiInstaller::installdone(bool error)
|
||||
{
|
||||
installed = true;
|
||||
m_error = error;
|
||||
}
|
||||
|
||||
|
||||
void MultiInstaller::setVersionStrings(QMap<QString, QString> ver)
|
||||
{
|
||||
version = ver;
|
||||
// version strings map is as following:
|
||||
// rel_rev release version revision id
|
||||
// rel_date release version release date
|
||||
// same for arch_* and bleed_*
|
||||
|
||||
qDebug() << "Install::setVersionStrings" << version;
|
||||
}
|
||||
|
||||
bool MultiInstaller::installBootloader()
|
||||
{
|
||||
BootloaderInstaller* blinstaller = new BootloaderInstaller(this);
|
||||
blinstaller->setMountPoint(m_mountpoint);
|
||||
blinstaller->setProxy(m_proxy);
|
||||
blinstaller->setDevice(m_plattform);
|
||||
blinstaller->setBootloaderMethod(devices->value(m_plattform + "/bootloadermethod").toString());
|
||||
blinstaller->setBootloaderName(devices->value(m_plattform + "/bootloadername").toString());
|
||||
blinstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
||||
blinstaller->setBootloaderInfoUrl(devices->value("bootloader_info_url").toString());
|
||||
if(!blinstaller->downloadInfo())
|
||||
{
|
||||
logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR);
|
||||
logger->abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(blinstaller->uptodate())
|
||||
{
|
||||
int ret = QMessageBox::question(NULL, tr("Bootloader Installation"),
|
||||
tr("It seem your Bootloader is already uptodate.\n"
|
||||
"Do really want to install it?"),
|
||||
QMessageBox::Ok | QMessageBox::Ignore |
|
||||
QMessageBox::Cancel,
|
||||
QMessageBox::Ignore);
|
||||
if(ret == QMessageBox::Cancel)
|
||||
{
|
||||
logger->addItem(tr("Bootloader installation Canceled!"),LOGERROR);
|
||||
logger->abort();
|
||||
return false;
|
||||
}
|
||||
else if(ret == QMessageBox::Ignore)
|
||||
{
|
||||
// skip to next install step
|
||||
logger->addItem(tr("Skipped Bootloader installation!"),LOGWARNING);
|
||||
installed = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// if fwpatcher , ask for extra file
|
||||
QString offirmware;
|
||||
if(devices->value(m_plattform + "/bootloadermethod").toString() == "fwpatcher")
|
||||
{
|
||||
BrowseOF ofbrowser(NULL);
|
||||
ofbrowser.setFile(userSettings->value("defaults/ofpath").toString());
|
||||
if(ofbrowser.exec() == QDialog::Accepted)
|
||||
{
|
||||
offirmware = ofbrowser.getFile();
|
||||
qDebug() << offirmware;
|
||||
if(!QFileInfo(offirmware).exists())
|
||||
{
|
||||
logger->addItem(tr("Original Firmware Path is wrong!"),LOGERROR);
|
||||
logger->abort();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
userSettings->setValue("defaults/ofpath",offirmware);
|
||||
userSettings->sync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger->addItem(tr("Original Firmware selection Canceled!"),LOGERROR);
|
||||
logger->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
blinstaller->setOrigFirmwarePath(offirmware);
|
||||
|
||||
blinstaller->install(logger);
|
||||
connect(blinstaller,SIGNAL(done(bool)),this,SLOT(installdone(bool)));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiInstaller::installRockbox()
|
||||
{
|
||||
QString file = QString("%1%2/rockbox.zip")
|
||||
.arg(devices->value("bleeding_url").toString(),
|
||||
userSettings->value("defaults/platform").toString());
|
||||
QString myversion = "r" + version.value("bleed_rev");
|
||||
|
||||
ZipInstaller* installer = new ZipInstaller(this);
|
||||
installer->setUrl(file);
|
||||
installer->setProxy(m_proxy);
|
||||
installer->setLogSection("rockboxbase");
|
||||
installer->setLogVersion(myversion);
|
||||
installer->setMountPoint(m_mountpoint);
|
||||
installer->install(logger);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiInstaller::installFonts()
|
||||
{
|
||||
// create zip installer
|
||||
ZipInstaller* installer = new ZipInstaller(this);
|
||||
|
||||
installer->setUrl(devices->value("font_url").toString());
|
||||
installer->setProxy(m_proxy);
|
||||
installer->setLogSection("Fonts");
|
||||
installer->setLogVersion(version.value("arch_date"));
|
||||
installer->setMountPoint(m_mountpoint);
|
||||
installer->install(logger);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiInstaller::installDoom()
|
||||
{
|
||||
// create zip installer
|
||||
ZipInstaller* installer = new ZipInstaller(this);
|
||||
|
||||
installer->setUrl(devices->value("doom_url").toString());
|
||||
installer->setProxy(m_proxy);
|
||||
installer->setLogSection("Game Addons");
|
||||
installer->setLogVersion(version.value("arch_date"));
|
||||
installer->setMountPoint(m_mountpoint);
|
||||
installer->install(logger);
|
||||
|
||||
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiInstaller::installThemes()
|
||||
{
|
||||
ThemesInstallWindow* tw = new ThemesInstallWindow(NULL);
|
||||
tw->setDeviceSettings(devices);
|
||||
tw->setUserSettings(userSettings);
|
||||
tw->setProxy(m_proxy);
|
||||
tw->setModal(true);
|
||||
tw->show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
66
rbutil/rbutilqt/multiinstaller.h
Normal file
66
rbutil/rbutilqt/multiinstaller.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: multiinstaller.h 14462 2007-08-26 16:44:23Z 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 MULTIINSTALLER_H
|
||||
#define MULTIINSTALLER_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "progressloggerinterface.h"
|
||||
|
||||
|
||||
class MultiInstaller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MultiInstaller(QObject* parent);
|
||||
|
||||
void setUserSettings(QSettings*);
|
||||
void setDeviceSettings(QSettings*);
|
||||
void setProxy(QUrl proxy);
|
||||
void setVersionStrings(QMap<QString, QString>);
|
||||
|
||||
void installComplete();
|
||||
void installSmall();
|
||||
|
||||
|
||||
private slots:
|
||||
void installdone(bool error);
|
||||
|
||||
private:
|
||||
bool installBootloader();
|
||||
bool installRockbox();
|
||||
bool installDoom();
|
||||
bool installFonts();
|
||||
bool installThemes();
|
||||
|
||||
ProgressloggerInterface* logger;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
|
||||
QString m_mountpoint,m_plattform;
|
||||
QUrl m_proxy;
|
||||
QMap<QString, QString> version;
|
||||
|
||||
|
||||
volatile bool installed;
|
||||
volatile bool m_error;
|
||||
};
|
||||
#endif
|
|
@ -82,6 +82,13 @@ void ProgressLoggerGui::abort()
|
|||
emit aborted();
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::undoAbort()
|
||||
{
|
||||
dp.buttonAbort->setText(tr("&Abort"));
|
||||
dp.buttonAbort->setIcon(QIcon(QString::fromUtf8(":/icons/icons/process-stop.png")));
|
||||
connect(dp.buttonAbort, SIGNAL(clicked()), this, SLOT(abort()));
|
||||
}
|
||||
|
||||
void ProgressLoggerGui::close()
|
||||
{
|
||||
downloadProgress->close();
|
||||
|
|
|
@ -44,6 +44,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
virtual void abort();
|
||||
virtual void undoAbort();
|
||||
virtual void close();
|
||||
virtual void show();
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
virtual void abort()=0;
|
||||
virtual void undoAbort() =0;
|
||||
virtual void close()=0;
|
||||
virtual void show()=0;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,6 +31,7 @@
|
|||
#include "installthemes.h"
|
||||
#include "uninstallwindow.h"
|
||||
#include "browseof.h"
|
||||
#include "multiinstaller.h"
|
||||
|
||||
#ifdef __linux
|
||||
#include <stdio.h>
|
||||
|
@ -93,10 +94,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
|||
connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
|
||||
connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
|
||||
connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
|
||||
|
||||
// disable unimplemented stuff
|
||||
ui.buttonSmall->setEnabled(false);
|
||||
ui.buttonComplete->setEnabled(false);
|
||||
connect(ui.buttonSmall, SIGNAL(clicked()), this, SLOT(smallInstall()));
|
||||
connect(ui.buttonComplete, SIGNAL(clicked()), this, SLOT(completeInstall()));
|
||||
|
||||
#if !defined(STATIC)
|
||||
ui.actionInstall_Rockbox_Utility_on_player->setEnabled(false);
|
||||
#else
|
||||
|
@ -299,6 +299,65 @@ void RbUtilQt::updateManual()
|
|||
}
|
||||
}
|
||||
|
||||
void RbUtilQt::completeInstall()
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||
tr("Do you really want to make a complete Installation?"),
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
||||
|
||||
MultiInstaller installer(this);
|
||||
installer.setUserSettings(userSettings);
|
||||
installer.setDeviceSettings(devices);
|
||||
installer.setProxy(proxy());
|
||||
|
||||
buildInfo.open();
|
||||
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
||||
buildInfo.close();
|
||||
|
||||
devices->beginGroup(platform);
|
||||
QString released = devices->value("released").toString();
|
||||
devices->endGroup();
|
||||
if(released == "yes") {
|
||||
// only set the keys if needed -- querying will yield an empty string
|
||||
// if not set.
|
||||
versmap.insert("rel_rev", devices->value("last_release").toString());
|
||||
versmap.insert("rel_date", ""); // FIXME: provide the release timestamp
|
||||
}
|
||||
installer.setVersionStrings(versmap);
|
||||
|
||||
installer.installComplete();
|
||||
|
||||
}
|
||||
|
||||
void RbUtilQt::smallInstall()
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||
tr("Do you really want to make a small Installation?"),
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
||||
|
||||
MultiInstaller installer(this);
|
||||
installer.setUserSettings(userSettings);
|
||||
installer.setDeviceSettings(devices);
|
||||
installer.setProxy(proxy());
|
||||
|
||||
buildInfo.open();
|
||||
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
||||
buildInfo.close();
|
||||
|
||||
devices->beginGroup(platform);
|
||||
QString released = devices->value("released").toString();
|
||||
devices->endGroup();
|
||||
if(released == "yes") {
|
||||
// only set the keys if needed -- querying will yield an empty string
|
||||
// if not set.
|
||||
versmap.insert("rel_rev", devices->value("last_release").toString());
|
||||
versmap.insert("rel_date", ""); // FIXME: provide the release timestamp
|
||||
}
|
||||
installer.setVersionStrings(versmap);
|
||||
|
||||
installer.installSmall();
|
||||
|
||||
}
|
||||
|
||||
void RbUtilQt::install()
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "progressloggergui.h"
|
||||
#include "installbootloader.h"
|
||||
|
||||
|
||||
class RbUtilQt : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -61,6 +62,8 @@ class RbUtilQt : public QMainWindow
|
|||
void configDialog(void);
|
||||
void updateDevice(void);
|
||||
void updateSettings(void);
|
||||
void completeInstall(void);
|
||||
void smallInstall(void);
|
||||
void install(void);
|
||||
void installBl(void);
|
||||
void installFonts(void);
|
||||
|
@ -78,6 +81,7 @@ class RbUtilQt : public QMainWindow
|
|||
void installPortable(void);
|
||||
void updateInfo(void);
|
||||
void updateTabs(int);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,8 @@ SOURCES += rbutilqt.cpp \
|
|||
uninstall.cpp \
|
||||
uninstallwindow.cpp \
|
||||
browseof.cpp \
|
||||
preview.cpp
|
||||
preview.cpp \
|
||||
multiinstaller.cpp
|
||||
|
||||
HEADERS += rbutilqt.h \
|
||||
install.h \
|
||||
|
@ -69,7 +70,8 @@ HEADERS += rbutilqt.h \
|
|||
uninstall.h \
|
||||
uninstallwindow.h \
|
||||
browseof.h \
|
||||
preview.h
|
||||
preview.h \
|
||||
multiinstaller.h
|
||||
|
||||
# Needed by QT on Win
|
||||
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue