diff options
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index f9fbd48568..187e369d32 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -465,16 +465,37 @@ bool RbUtilQt::installAuto() | |||
465 | QString myversion = "r" + versmap.value("bleed_rev"); | 465 | QString myversion = "r" + versmap.value("bleed_rev"); |
466 | 466 | ||
467 | //! check if rockbox is already installed | 467 | //! check if rockbox is already installed |
468 | if(QDir(settings->mountpoint() + "/.rockbox").exists()) | 468 | QString rbVersion = installedVersion(settings->mountpoint()); |
469 | if(rbVersion != "") | ||
469 | { | 470 | { |
470 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), | 471 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), |
471 | tr("Rockbox installation detected. Do you want to backup first?"), | 472 | tr("Rockbox installation detected. Do you want to backup first?"), |
472 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) | 473 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
473 | { | 474 | { |
474 | QString backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",settings->mountpoint()); | 475 | logger->addItem(tr("Beginning Backup..."),LOGINFO); |
475 | logger->show(); | 476 | QString backupName = settings->mountpoint() + ".backup/rockbox-backup-"+rbVersion+".zip"; |
477 | |||
478 | //! create dir, if it doesnt exist | ||
479 | QFileInfo backupFile(backupName); | ||
480 | if(!QDir(backupFile.path()).exists()) | ||
481 | { | ||
482 | QDir a; | ||
483 | a.mkpath(backupFile.path()); | ||
484 | } | ||
485 | |||
486 | //! create backup | ||
476 | RbZip backup; | 487 | RbZip backup; |
477 | backup.createZip(backupName,settings->mountpoint() + "/.rockbox",logger); | 488 | connect(&backup,SIGNAL(zipProgress(int,int)),this,SLOT(updateDataReadProgress(int,int))); |
489 | if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok) | ||
490 | { | ||
491 | logger->addItem(tr("Backup successfull"),LOGOK); | ||
492 | } | ||
493 | else | ||
494 | { | ||
495 | logger->addItem(tr("Backup failed!"),LOGERROR); | ||
496 | logger->abort(); | ||
497 | return false; | ||
498 | } | ||
478 | } | 499 | } |
479 | } | 500 | } |
480 | 501 | ||
@@ -493,10 +514,17 @@ bool RbUtilQt::installAuto() | |||
493 | return true; | 514 | return true; |
494 | } | 515 | } |
495 | 516 | ||
517 | void RbUtilQt::updateDataReadProgress(int read, int total) | ||
518 | { | ||
519 | logger->setProgressMax(total); | ||
520 | logger->setProgressValue(read); | ||
521 | //qDebug() << "progress:" << read << "/" << total; | ||
522 | |||
523 | } | ||
524 | |||
496 | void RbUtilQt::install() | 525 | void RbUtilQt::install() |
497 | { | 526 | { |
498 | Install *installWindow = new Install(this); | 527 | Install *installWindow = new Install(settings,this); |
499 | installWindow->setSettings(settings); | ||
500 | 528 | ||
501 | buildInfo.open(); | 529 | buildInfo.open(); |
502 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 530 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |