rbutil: Detect if Rockbox is already installed, and allow Backup bevor installing a new build.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17440 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2008-05-10 17:53:15 +00:00
parent 251db06294
commit acccee479a
7 changed files with 49 additions and 11 deletions

View file

@ -19,6 +19,7 @@
#include "install.h"
#include "ui_installfrm.h"
#include "rbzip.h"
Install::Install(QWidget *parent) : QDialog(parent)
{
@ -82,7 +83,22 @@ void Install::accept()
return;
}
settings->sync();
//! check if rockbox is already installed
if(QDir(settings->mountpoint() + "/.rockbox").exists())
{
if(QMessageBox::question(this, tr("Installed Rockbox detected"),
tr("Rockbox installation detected. Do you want to backup first?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
QString backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",settings->mountpoint());
logger->show();
RbZip backup;
backup.createZip(backupName,settings->mountpoint() + "/.rockbox",logger);
}
}
//! install build
installer = new ZipInstaller(this);
installer->setUrl(file);
installer->setLogSection("Rockbox (Base)");

View file

@ -19,9 +19,9 @@
#include "progressloggergui.h"
ProgressLoggerGui::ProgressLoggerGui(QObject* parent): ProgressloggerInterface(parent)
ProgressLoggerGui::ProgressLoggerGui(QWidget* parent): ProgressloggerInterface(parent)
{
downloadProgress = new QDialog();
downloadProgress = new QDialog(parent);
downloadProgress->setModal(true);
dp.setupUi(downloadProgress);
dp.listProgress->setAlternatingRowColors(true);

View file

@ -28,7 +28,7 @@ class ProgressLoggerGui :public ProgressloggerInterface
{
Q_OBJECT
public:
ProgressLoggerGui(QObject * parent);
ProgressLoggerGui(QWidget * parent);
virtual void addItem(const QString &text); //adds a string to the list

View file

@ -33,6 +33,7 @@
#include "uninstallwindow.h"
#include "browseof.h"
#include "utils.h"
#include "rbzip.h"
#if defined(Q_OS_LINUX)
#include <stdio.h>
@ -462,7 +463,22 @@ bool RbUtilQt::installAuto()
}
QString myversion = "r" + versmap.value("bleed_rev");
//! check if rockbox is already installed
if(QDir(settings->mountpoint() + "/.rockbox").exists())
{
if(QMessageBox::question(this, tr("Installed Rockbox detected"),
tr("Rockbox installation detected. Do you want to backup first?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
QString backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",settings->mountpoint());
logger->show();
RbZip backup;
backup.createZip(backupName,settings->mountpoint() + "/.rockbox",logger);
}
}
//! install current build
ZipInstaller* installer = new ZipInstaller(this);
installer->setUrl(file);
installer->setLogSection("Rockbox (Base)");

View file

@ -56,7 +56,8 @@ SOURCES += rbutilqt.cpp \
voicefile.cpp \
createvoicewindow.cpp \
rbsettings.cpp \
rbunzip.cpp
rbunzip.cpp \
rbzip.cpp
HEADERS += rbutilqt.h \
install.h \
@ -102,7 +103,8 @@ HEADERS += rbutilqt.h \
voicefile.h \
createvoicewindow.h \
rbsettings.h \
rbunzip.h
rbunzip.h \
rbzip.h
# Needed by QT on Win
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools

View file

@ -441,13 +441,15 @@ Zip::ErrorCode Zip::addDirectory(const QString& path, const QString& root, Compr
if (info.isDir())
{
// Recursion :)
ec = addDirectory(info.absoluteFilePath(), actualRoot, recursionOptions, level);
progress();
ec = addDirectory(info.absoluteFilePath(), actualRoot, recursionOptions, level);
}
else
{
progress();
ec = d->createEntry(info, actualRoot, level);
filesAdded = true;
}
}
}
@ -455,7 +457,7 @@ Zip::ErrorCode Zip::addDirectory(const QString& path, const QString& root, Compr
// Non-empty directories don't need it because they have a path component in the filename
if (!filesAdded && !options.testFlag(IgnorePaths))
ec = d->createEntry(current, actualRoot, level);
return ec;
}

View file

@ -103,7 +103,9 @@ public:
ErrorCode closeArchive();
QString formatError(ErrorCode c) const;
virtual void progress() {}
private:
ZipPrivate* d;
};