CRC message error added.

This commit is contained in:
Luis Ángel San Martín 2013-08-17 19:19:16 +02:00
parent 08581319da
commit 2dd51a0df7
5 changed files with 30 additions and 2 deletions

View File

@ -264,12 +264,14 @@ void FileComic::fileExtracted(int index, const QByteArray & rawData)
void FileComic::crcError(int index) void FileComic::crcError(int index)
{ {
emit errorOpening(tr("CRC error")); emit errorOpening(tr("CRC error: some of the pages will not be displayed correctly"));
} }
//TODO: comprobar que si se produce uno de estos errores, la carga del cómic es irrecuperable
void FileComic::unknownError(int index) void FileComic::unknownError(int index)
{ {
emit errorOpening(tr("Unknown error opening the file")); //emit errorOpening(tr("Unknown error opening the file"));
//emit errorOpening();
} }
//-------------------------------------- //--------------------------------------

View File

@ -606,6 +606,7 @@ void Render::load(const QString & path, int atPage)
previousIndex = currentIndex = 0; previousIndex = currentIndex = 0;
connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening())); connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening()));
connect(comic,SIGNAL(errorOpening(QString)),this,SIGNAL(errorOpening(QString)));
connect(comic,SIGNAL(errorOpening()),this,SLOT(reset())); connect(comic,SIGNAL(errorOpening()),this,SLOT(reset()));
connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int))); connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int)));
connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int))); connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int)));

View File

@ -165,6 +165,7 @@ signals:
void pageChanged(int index); void pageChanged(int index);
void numPages(unsigned int numPages); void numPages(unsigned int numPages);
void errorOpening(); void errorOpening();
void errorOpening(QString);
void currentPageIsBookmark(bool); void currentPageIsBookmark(bool);
void isLast(); void isLast();
void isCover(); void isCover();

View File

@ -157,6 +157,7 @@ void Viewer::createConnections()
//render //render
connect(render,SIGNAL(errorOpening()),this,SLOT(resetContent())); connect(render,SIGNAL(errorOpening()),this,SLOT(resetContent()));
connect(render,SIGNAL(errorOpening()),this,SLOT(showMessageErrorOpening())); connect(render,SIGNAL(errorOpening()),this,SLOT(showMessageErrorOpening()));
connect(render,SIGNAL(errorOpening(QString)),this,SLOT(showMessageErrorOpening(QString)));
connect(render,SIGNAL(numPages(unsigned int)),goToFlow,SLOT(setNumSlides(unsigned int))); connect(render,SIGNAL(numPages(unsigned int)),goToFlow,SLOT(setNumSlides(unsigned int)));
connect(render,SIGNAL(numPages(unsigned int)),goToDialog,SLOT(setNumPages(unsigned int))); connect(render,SIGNAL(numPages(unsigned int)),goToDialog,SLOT(setNumPages(unsigned int)));
//connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation())); //connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation()));
@ -203,6 +204,11 @@ void Viewer::showMessageErrorOpening()
QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")); QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found"));
} }
void Viewer::showMessageErrorOpening(QString message)
{
QMessageBox::critical(NULL,tr("Error opening"),message);
}
void Viewer::next() void Viewer::next()
{ {
direction = 1; direction = 1;
@ -238,6 +244,11 @@ void Viewer::updatePage()
//TODO -> update bookmark action //TODO -> update bookmark action
setFocus(Qt::ShortcutFocusReason); setFocus(Qt::ShortcutFocusReason);
delete previousPage; delete previousPage;
//TODO: fix loading...please wait!
if(currentPage->isNull())
setPageUnavailableMessage();
if(restoreMagnifyingGlass) if(restoreMagnifyingGlass)
{ {
restoreMagnifyingGlass = false; restoreMagnifyingGlass = false;
@ -669,6 +680,17 @@ void Viewer::setLoadingMessage()
configureContent(tr("Loading...please wait!")); configureContent(tr("Loading...please wait!"));
} }
void Viewer::setPageUnavailableMessage()
{
if(magnifyingGlassShowed)
{
hideMagnifyingGlass();
restoreMagnifyingGlass = true;
}
emit(pageAvailable(false));
configureContent(tr("Page not available!"));
}
void Viewer::configureContent(QString msg) void Viewer::configureContent(QString msg)
{ {
content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

View File

@ -64,6 +64,7 @@ class NotificationsLabelWidget;
void doublePageSwitch(); void doublePageSwitch();
void resetContent(); void resetContent();
void setLoadingMessage(); void setLoadingMessage();
void setPageUnavailableMessage();
void configureContent(QString msg); void configureContent(QString msg);
void hideCursor(); void hideCursor();
void showCursor(); void showCursor();
@ -77,6 +78,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
void updateFitToWidthRatio(float ratio); void updateFitToWidthRatio(float ratio);
void updateConfig(QSettings * settings); void updateConfig(QSettings * settings);
void showMessageErrorOpening(); void showMessageErrorOpening();
void showMessageErrorOpening(QString);
void setBookmarks(); void setBookmarks();
void updateImageOptions(); void updateImageOptions();
void showIsCoverMessage(); void showIsCoverMessage();