added exit and notification on 7z lib not found

This commit is contained in:
Luis Ángel San Martín
2013-11-24 12:55:03 +01:00
parent 92331af971
commit 8255637028
12 changed files with 105 additions and 13 deletions

View File

@ -96,7 +96,8 @@ HEADERS += comic_flow.h \
yacreader_main_toolbar.h \
comics_remover.h \
../common/http_worker.h \
yacreader_libraries.h
yacreader_libraries.h \
../common/exit_check.cpp \
SOURCES += comic_flow.cpp \
create_library_dialog.cpp \
@ -138,7 +139,8 @@ SOURCES += comic_flow.cpp \
comics_remover.cpp \
../common/http_worker.cpp \
../common/yacreader_global.cpp \
yacreader_libraries.cpp
yacreader_libraries.cpp \
../common/exit_check.cpp \
include(./server/server.pri)

View File

@ -5,6 +5,9 @@
#include <QDebug>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QApplication>
#include <QLibrary>
#include "data_base_management.h"
#include "qnaturalsorting.h"
#include "db_helper.h"
@ -12,6 +15,8 @@
#include "compressed_archive.h"
#include "comic.h"
#include "yacreader_global.h"
#include "QsLog.h"
#include <algorithm>
@ -61,6 +66,16 @@ void LibraryCreator::run()
{
stopRunning = false;
//check for 7z lib
QLibrary *sevenzLib = new QLibrary("./utils/7z");
if(!sevenzLib->load())
{
QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl;
QApplication::exit(YACReader::SevenZNotFound);
exit();
}
sevenzLib->deleteLater();
if(_mode == CREATOR)
{
QLOG_INFO() << "Starting to create new library ( " << _source << "," << _target << ")";
@ -465,6 +480,9 @@ void LibraryCreator::update(QDir dirS)
}
}
}
bool ThumbnailCreator::crash = false;
ThumbnailCreator::ThumbnailCreator(QString fileSource, QString target, int coverPage)
:_fileSource(fileSource),_target(target),_numPages(0),_coverPage(coverPage)
{
@ -520,7 +538,16 @@ void ThumbnailCreator::create()
else
{
if(crash)
return;
CompressedArchive archive(_fileSource);
if(!archive.toolsLoaded())
{
QLOG_WARN() << "Extracting cover: 7z lib not loaded";
crash = true;
return;
}
if(!archive.isValid())
QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource;
//se filtran para obtener s<>lo los formatos soportados

View File

@ -72,6 +72,7 @@
int _numPages;
QPixmap _cover;
int _coverPage;
static bool crash;
public slots:
void create();

View File

@ -9,6 +9,7 @@
#include <QFileInfo>
#include <QSettings>
#include <QLibrary>
#include <QMessageBox>
#include "yacreader_global.h"
#include "startup.h"
@ -16,6 +17,7 @@
#include "comic_db.h"
#include "db_helper.h"
#include "yacreader_libraries.h"
#include "exit_check.h"
#include "QsLog.h"
#include "QsLogDest.h"
@ -186,12 +188,14 @@ int main( int argc, char ** argv )
int ret = app.exec();
QLOG_INFO() << "YACReaderLibrary closed with exit code :" << ret;
YACReader::exitCheck(ret);
//server shutdown
s->stop();
delete s;
QLOG_INFO() << "YACReaderLibrary closed";
QsLogging::Logger::destroyInstance();
return ret;