added error managing methods to 7z extraction delegate

This commit is contained in:
Luis Ángel San Martín
2013-08-16 23:11:02 +02:00
parent 9d392416a5
commit 31d1ebb1a8
4 changed files with 28 additions and 37 deletions

View File

@ -242,6 +242,8 @@ QList<QString> FileComic::filter(const QList<QString> & src)
return filtered;
}
//DELEGATE methods
void FileComic::fileExtracted(int index, const QByteArray & rawData)
{
/*QFile f("c:/temp/out2.txt");
@ -257,6 +259,18 @@ void FileComic::fileExtracted(int index, const QByteArray & rawData)
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
}
void FileComic::crcError(int index)
{
emit errorOpening(tr("CRC error"));
}
void FileComic::unknownError(int index)
{
emit errorOpening(tr("Unknown error opening the file"));
}
//--------------------------------------
QList<QVector<quint32> > FileComic::getSections(int & sectionIndex)
{
QVector<quint32> sortedIndexes;
@ -414,38 +428,7 @@ void FileComic::process()
emit imagesLoaded();
moveToThread(QApplication::instance()->thread());
}
//-----------------------------------------------------------------------------
void FileComic::loadSizes()
{
}
//-----------------------------------------------------------------------------
void FileComic::loadImages()
{
}
//-----------------------------------------------------------------------------
void FileComic::openingError(QProcess::ProcessError error)
{
switch(error)
{
case QProcess::FailedToStart:
QMessageBox::critical(NULL,tr("7z not found"),tr("7z wasn't found in your PATH."));
break;
case QProcess::Crashed:
QMessageBox::critical(NULL,tr("7z crashed"),tr("7z crashed."));
break;
case QProcess::ReadError:
QMessageBox::critical(NULL,tr("7z reading"),tr("problem reading from 7z"));
break;
case QProcess::UnknownError:
QMessageBox::critical(NULL,tr("7z problem"),tr("Unknown error 7z"));
break;
default:
//TODO
break;
}
_loaded = false;
emit errorOpening();
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

View File

@ -75,6 +75,7 @@
void openAt(int index);
void numPages(unsigned int numPages);
void errorOpening();
void errorOpening(QString);
void isBookmark(bool);
void bookmarksUpdated();
void isCover();
@ -94,12 +95,10 @@
~FileComic();
void fileExtracted(int index, const QByteArray & rawData);
virtual bool load(const QString & path, int atPage = -1);
void crcError(int index);
void unknownError(int index);
public slots:
void process();
void loadImages();
void loadSizes();
void openingError(QProcess::ProcessError error);
};
class FolderComic : public Comic