added errors check to Comic

This commit is contained in:
Luis Ángel San Martín 2013-12-15 19:57:33 +01:00
parent 91f89b161d
commit ed729385f8
4 changed files with 39 additions and 7 deletions

View File

@ -122,7 +122,7 @@ void MainWindowViewer::setupUI()
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
viewer = new Viewer(this); viewer = new Viewer(this);
connect(viewer,SIGNAL(reset()),this,SLOT(disableActions())); connect(viewer,SIGNAL(reset()),this,SLOT(processReset()));
//detected end of comic //detected end of comic
connect(viewer,SIGNAL(openNextComic()),this,SLOT(openNextComic())); connect(viewer,SIGNAL(openNextComic()),this,SLOT(openNextComic()));
//detected start of comic //detected start of comic
@ -890,6 +890,26 @@ void MainWindowViewer::checkNewVersion()
conf.setLastVersionCheck(current); conf.setLastVersionCheck(current);
} }
} }
void MainWindowViewer::processReset()
{
if(isClient)
{
if(siblingComics.count()>1)
{
bool openNextB = openNextComicAction->isEnabled();
bool openPrevB = openPreviousComicAction->isEnabled();
disableActions();
openNextComicAction->setEnabled(openNextB);
openPreviousComicAction->setEnabled(openPrevB);
}
else
disableActions();
}
else
disableActions();
}
void MainWindowViewer::changeFit() void MainWindowViewer::changeFit()
{ {
Configuration & conf = Configuration::getConfiguration(); Configuration & conf = Configuration::getConfiguration();

View File

@ -50,6 +50,7 @@ class YACReaderSliderAction;
void fitToWidth(); void fitToWidth();
void fitToHeight(); void fitToHeight();
void checkNewVersion(); void checkNewVersion();
void processReset();
/*void viewComic(); /*void viewComic();
void prev(); void prev();
void next(); void next();

View File

@ -213,12 +213,14 @@ void Viewer::open(QString pathFile, const ComicDB & comic)
void Viewer::showMessageErrorOpening() void Viewer::showMessageErrorOpening()
{ {
QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")); QMessageBox::critical(this,tr("Not found"),tr("Comic not found"));
resetContent();
} }
void Viewer::showMessageErrorOpening(QString message) void Viewer::showMessageErrorOpening(QString message)
{ {
QMessageBox::critical(NULL,tr("Error opening"),message); QMessageBox::critical(this,tr("Error opening comic"),message);
resetContent();
} }
void Viewer::next() void Viewer::next()

View File

@ -414,7 +414,16 @@ void FileComic::process()
{ {
CompressedArchive archive(_path); CompressedArchive archive(_path);
if(!archive.toolsLoaded()) if(!archive.toolsLoaded())
{
emit errorOpening(tr("7z not found"));
return; return;
}
if(!archive.isValid())
{
emit errorOpening(tr("Format not supported"));
return;
}
//se filtran para obtener sólo los formatos soportados //se filtran para obtener sólo los formatos soportados
_order = archive.getFileNames(); _order = archive.getFileNames();
_fileNames = filter(_order); _fileNames = filter(_order);