summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/install.cpp18
-rw-r--r--rbutil/rbutilqt/progressloggergui.cpp4
-rw-r--r--rbutil/rbutilqt/progressloggergui.h2
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp18
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro6
-rw-r--r--rbutil/rbutilqt/zip/zip.cpp8
-rw-r--r--rbutil/rbutilqt/zip/zip.h4
7 files changed, 49 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index 45004cb2b0..4461a6a633 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -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)");
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp
index b66ec89a25..15ddc18663 100644
--- a/rbutil/rbutilqt/progressloggergui.cpp
+++ b/rbutil/rbutilqt/progressloggergui.cpp
@@ -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);
diff --git a/rbutil/rbutilqt/progressloggergui.h b/rbutil/rbutilqt/progressloggergui.h
index 6086330ebb..785e309bd0 100644
--- a/rbutil/rbutilqt/progressloggergui.h
+++ b/rbutil/rbutilqt/progressloggergui.h
@@ -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
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 564d9d8352..f9fbd48568 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -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)");
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 1485f4d8a9..ba04159d58 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -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
diff --git a/rbutil/rbutilqt/zip/zip.cpp b/rbutil/rbutilqt/zip/zip.cpp
index bb02147da3..ac1eaaea0b 100644
--- a/rbutil/rbutilqt/zip/zip.cpp
+++ b/rbutil/rbutilqt/zip/zip.cpp
@@ -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;
}
diff --git a/rbutil/rbutilqt/zip/zip.h b/rbutil/rbutilqt/zip/zip.h
index 03c4d8af0b..44fdd08b5f 100644
--- a/rbutil/rbutilqt/zip/zip.h
+++ b/rbutil/rbutilqt/zip/zip.h
@@ -103,7 +103,9 @@ public:
ErrorCode closeArchive();
QString formatError(ErrorCode c) const;
-
+
+ virtual void progress() {}
+
private:
ZipPrivate* d;
};