mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
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:
parent
251db06294
commit
acccee479a
7 changed files with 49 additions and 11 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "install.h"
|
#include "install.h"
|
||||||
#include "ui_installfrm.h"
|
#include "ui_installfrm.h"
|
||||||
|
#include "rbzip.h"
|
||||||
|
|
||||||
Install::Install(QWidget *parent) : QDialog(parent)
|
Install::Install(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
|
|
@ -82,7 +83,22 @@ void Install::accept()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings->sync();
|
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 = new ZipInstaller(this);
|
||||||
installer->setUrl(file);
|
installer->setUrl(file);
|
||||||
installer->setLogSection("Rockbox (Base)");
|
installer->setLogSection("Rockbox (Base)");
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
#include "progressloggergui.h"
|
#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);
|
downloadProgress->setModal(true);
|
||||||
dp.setupUi(downloadProgress);
|
dp.setupUi(downloadProgress);
|
||||||
dp.listProgress->setAlternatingRowColors(true);
|
dp.listProgress->setAlternatingRowColors(true);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class ProgressLoggerGui :public ProgressloggerInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProgressLoggerGui(QObject * parent);
|
ProgressLoggerGui(QWidget * parent);
|
||||||
|
|
||||||
virtual void addItem(const QString &text); //adds a string to the list
|
virtual void addItem(const QString &text); //adds a string to the list
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include "uninstallwindow.h"
|
#include "uninstallwindow.h"
|
||||||
#include "browseof.h"
|
#include "browseof.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "rbzip.h"
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -462,7 +463,22 @@ bool RbUtilQt::installAuto()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString myversion = "r" + versmap.value("bleed_rev");
|
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);
|
ZipInstaller* installer = new ZipInstaller(this);
|
||||||
installer->setUrl(file);
|
installer->setUrl(file);
|
||||||
installer->setLogSection("Rockbox (Base)");
|
installer->setLogSection("Rockbox (Base)");
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ SOURCES += rbutilqt.cpp \
|
||||||
voicefile.cpp \
|
voicefile.cpp \
|
||||||
createvoicewindow.cpp \
|
createvoicewindow.cpp \
|
||||||
rbsettings.cpp \
|
rbsettings.cpp \
|
||||||
rbunzip.cpp
|
rbunzip.cpp \
|
||||||
|
rbzip.cpp
|
||||||
|
|
||||||
HEADERS += rbutilqt.h \
|
HEADERS += rbutilqt.h \
|
||||||
install.h \
|
install.h \
|
||||||
|
|
@ -102,7 +103,8 @@ HEADERS += rbutilqt.h \
|
||||||
voicefile.h \
|
voicefile.h \
|
||||||
createvoicewindow.h \
|
createvoicewindow.h \
|
||||||
rbsettings.h \
|
rbsettings.h \
|
||||||
rbunzip.h
|
rbunzip.h \
|
||||||
|
rbzip.h
|
||||||
|
|
||||||
# Needed by QT on Win
|
# Needed by QT on Win
|
||||||
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools
|
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools
|
||||||
|
|
|
||||||
|
|
@ -441,13 +441,15 @@ Zip::ErrorCode Zip::addDirectory(const QString& path, const QString& root, Compr
|
||||||
if (info.isDir())
|
if (info.isDir())
|
||||||
{
|
{
|
||||||
// Recursion :)
|
// Recursion :)
|
||||||
ec = addDirectory(info.absoluteFilePath(), actualRoot, recursionOptions, level);
|
progress();
|
||||||
|
ec = addDirectory(info.absoluteFilePath(), actualRoot, recursionOptions, level);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
progress();
|
||||||
ec = d->createEntry(info, actualRoot, level);
|
ec = d->createEntry(info, actualRoot, level);
|
||||||
filesAdded = true;
|
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
|
// Non-empty directories don't need it because they have a path component in the filename
|
||||||
if (!filesAdded && !options.testFlag(IgnorePaths))
|
if (!filesAdded && !options.testFlag(IgnorePaths))
|
||||||
ec = d->createEntry(current, actualRoot, level);
|
ec = d->createEntry(current, actualRoot, level);
|
||||||
|
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,9 @@ public:
|
||||||
ErrorCode closeArchive();
|
ErrorCode closeArchive();
|
||||||
|
|
||||||
QString formatError(ErrorCode c) const;
|
QString formatError(ErrorCode c) const;
|
||||||
|
|
||||||
|
virtual void progress() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ZipPrivate* d;
|
ZipPrivate* d;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue