rbutil: improve the backup function.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17463 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2008-05-11 18:22:42 +00:00
parent 9c54187678
commit d24eb9e461
9 changed files with 203 additions and 66 deletions

View file

@ -21,14 +21,12 @@
#include <QtCore>
Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface *dp)
Zip::ErrorCode RbZip::createZip(QString zip,QString dir)
{
m_logger = dp;
Zip::ErrorCode error = Ok;
m_curEntry = 1;
int numEntrys=0;
m_numEntrys=0;
m_logger->addItem(tr("Creating Backup: %1").arg(zip),LOGINFO);
QCoreApplication::processEvents();
// get number of entrys in dir
@ -36,10 +34,10 @@ Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface
while (it.hasNext())
{
it.next();
numEntrys++;
m_numEntrys++;
QCoreApplication::processEvents();
}
m_logger->setProgressMax(numEntrys);
//! create zip
error = Zip::createArchive(zip);
@ -54,13 +52,13 @@ Zip::ErrorCode RbZip::createZip(QString zip,QString dir,ProgressloggerInterface
//! close zip
error = Zip::closeArchive();
return error;
return error;
}
void RbZip::progress()
{
m_curEntry++;
m_logger->setProgressValue(m_curEntry);
emit zipProgress(m_curEntry,m_numEntrys);
QCoreApplication::processEvents(); // update UI
}