mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
commit
8315e8ec34
@ -1,164 +0,0 @@
|
|||||||
INCLUDEPATH += $$PWD
|
|
||||||
DEPENDPATH += $$PWD
|
|
||||||
INCLUDEPATH += .
|
|
||||||
INCLUDEPATH += $$PWD/../common \
|
|
||||||
$$PWD/../custom_widgets
|
|
||||||
|
|
||||||
CONFIG(legacy_gl_widget) {
|
|
||||||
INCLUDEPATH += ../common/gl_legacy \
|
|
||||||
} else {
|
|
||||||
INCLUDEPATH += ../common/gl \
|
|
||||||
}
|
|
||||||
|
|
||||||
win32 {
|
|
||||||
LIBS += -L$$PWD/../dependencies/poppler/lib -loleaut32 -lole32
|
|
||||||
|
|
||||||
LIBS += -lpoppler-qt5
|
|
||||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
|
||||||
|
|
||||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT
|
|
||||||
!CONFIG(no_opengl) {
|
|
||||||
QMAKE_CXXFLAGS_RELEASE += /GL
|
|
||||||
}
|
|
||||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
|
||||||
CONFIG -= embed_manifest_exe
|
|
||||||
}
|
|
||||||
|
|
||||||
unix:!macx{
|
|
||||||
|
|
||||||
INCLUDEPATH += /usr/include/poppler/qt5
|
|
||||||
LIBS += -L/usr/lib -lpoppler-qt5
|
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
|
||||||
LIBS += -lGLU
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
macx{
|
|
||||||
#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include"
|
|
||||||
#isEqual(QT_MAJOR_VERSION, 5) {
|
|
||||||
#INCLUDEPATH += /usr/local/include/poppler/qt5
|
|
||||||
#LIBS += -L/usr/local/lib -lpoppler-qt5
|
|
||||||
#}
|
|
||||||
#else {
|
|
||||||
#INCLUDEPATH += /usr/local/include/poppler/qt4
|
|
||||||
#LIBS += -L/usr/local/lib -lpoppler-qt4
|
|
||||||
#}
|
|
||||||
CONFIG += objective_c
|
|
||||||
QT += macextras gui-private
|
|
||||||
|
|
||||||
|
|
||||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
|
||||||
|
|
||||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
|
||||||
HEADERS += $$PWD/../common/pdf_comic.h
|
|
||||||
}
|
|
||||||
|
|
||||||
QT += network widgets core
|
|
||||||
!CONFIG(no_opengl) {
|
|
||||||
QT += opengl
|
|
||||||
}
|
|
||||||
|
|
||||||
#CONFIG += release
|
|
||||||
CONFIG -= flat
|
|
||||||
|
|
||||||
QT += multimedia
|
|
||||||
|
|
||||||
# Input
|
|
||||||
HEADERS += $$PWD/../common/comic.h \
|
|
||||||
$$PWD/configuration.h \
|
|
||||||
$$PWD/goto_dialog.h \
|
|
||||||
$$PWD/magnifying_glass.h \
|
|
||||||
$$PWD/main_window_viewer.h \
|
|
||||||
$$PWD/viewer.h \
|
|
||||||
$$PWD/goto_flow.h \
|
|
||||||
$$PWD/options_dialog.h \
|
|
||||||
$$PWD/../common/bookmarks.h \
|
|
||||||
$$PWD/bookmarks_dialog.h \
|
|
||||||
$$PWD/render.h \
|
|
||||||
$$PWD/shortcuts_dialog.h \
|
|
||||||
$$PWD/translator.h \
|
|
||||||
$$PWD/goto_flow_widget.h \
|
|
||||||
$$PWD/page_label_widget.h \
|
|
||||||
$$PWD/goto_flow_toolbar.h \
|
|
||||||
$$PWD/goto_flow_decorationbar.h \
|
|
||||||
$$PWD/width_slider.h \
|
|
||||||
$$PWD/notifications_label_widget.h \
|
|
||||||
$$PWD/../common/pictureflow.h \
|
|
||||||
$$PWD/../common/custom_widgets.h \
|
|
||||||
$$PWD/../common/check_new_version.h \
|
|
||||||
$$PWD/../common/qnaturalsorting.h \
|
|
||||||
$$PWD/../common/yacreader_global.h \
|
|
||||||
$$PWD/../common/onstart_flow_selection_dialog.h \
|
|
||||||
$$PWD/../common/comic_db.h \
|
|
||||||
$$PWD/../common/folder.h \
|
|
||||||
$$PWD/../common/library_item.h \
|
|
||||||
$$PWD/yacreader_local_client.h \
|
|
||||||
$$PWD/../common/http_worker.h \
|
|
||||||
$$PWD/../common/exit_check.h \
|
|
||||||
$$PWD/../common/scroll_management.h
|
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
|
||||||
CONFIG(legacy_gl_widget) {
|
|
||||||
message("using legacy YACReaderFlowGL (QGLWidget) header")
|
|
||||||
HEADERS += ../common/gl_legacy/yacreader_flow_gl.h
|
|
||||||
} else {
|
|
||||||
HEADERS += ../common/gl/yacreader_flow_gl.h
|
|
||||||
}
|
|
||||||
HEADERS += $$PWD/goto_flow_gl.h
|
|
||||||
}
|
|
||||||
|
|
||||||
SOURCES += $$PWD/../common/comic.cpp \
|
|
||||||
$$PWD/configuration.cpp \
|
|
||||||
$$PWD/goto_dialog.cpp \
|
|
||||||
$$PWD/magnifying_glass.cpp \
|
|
||||||
$$PWD/main_window_viewer.cpp \
|
|
||||||
$$PWD/viewer.cpp \
|
|
||||||
$$PWD/goto_flow.cpp \
|
|
||||||
$$PWD/options_dialog.cpp \
|
|
||||||
$$PWD/../common/bookmarks.cpp \
|
|
||||||
$$PWD/bookmarks_dialog.cpp \
|
|
||||||
$$PWD/render.cpp \
|
|
||||||
$$PWD/shortcuts_dialog.cpp \
|
|
||||||
$$PWD/translator.cpp \
|
|
||||||
$$PWD/goto_flow_widget.cpp \
|
|
||||||
$$PWD/page_label_widget.cpp \
|
|
||||||
$$PWD/goto_flow_toolbar.cpp \
|
|
||||||
$$PWD/goto_flow_decorationbar.cpp \
|
|
||||||
$$PWD/width_slider.cpp \
|
|
||||||
$$PWD/notifications_label_widget.cpp \
|
|
||||||
$$PWD/../common/pictureflow.cpp \
|
|
||||||
$$PWD/../common/custom_widgets.cpp \
|
|
||||||
$$PWD/../common/check_new_version.cpp \
|
|
||||||
$$PWD/../common/qnaturalsorting.cpp \
|
|
||||||
$$PWD/../common/onstart_flow_selection_dialog.cpp \
|
|
||||||
$$PWD/../common/comic_db.cpp \
|
|
||||||
$$PWD/../common/folder.cpp \
|
|
||||||
$$PWD/../common/library_item.cpp \
|
|
||||||
$$PWD/yacreader_local_client.cpp \
|
|
||||||
$$PWD/../common/http_worker.cpp \
|
|
||||||
$$PWD/../common/yacreader_global.cpp \
|
|
||||||
$$PWD/../common/exit_check.cpp \
|
|
||||||
$$PWD/../common/scroll_management.cpp
|
|
||||||
|
|
||||||
!CONFIG(no_opengl) {
|
|
||||||
CONFIG(legacy_gl_widget) {
|
|
||||||
message("using legacy YACReaderFlowGL (QGLWidget) source code")
|
|
||||||
SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp
|
|
||||||
} else {
|
|
||||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp
|
|
||||||
}
|
|
||||||
SOURCES += $$PWD/goto_flow_gl.cpp
|
|
||||||
}
|
|
||||||
|
|
||||||
include($$PWD/../custom_widgets/custom_widgets_yacreader.pri)
|
|
||||||
include($$PWD/../compressed_archive/wrapper.pri)
|
|
||||||
include($$PWD/../shortcuts_management/shortcuts_management.pri)
|
|
||||||
|
|
||||||
RESOURCES += $$PWD/yacreader_images.qrc \
|
|
||||||
$$PWD/yacreader_files.qrc
|
|
||||||
|
|
||||||
win32:RESOURCES += $$PWD/yacreader_images_win.qrc
|
|
||||||
unix:!macx:RESOURCES += $$PWD/yacreader_images_win.qrc
|
|
||||||
macx:RESOURCES += $$PWD/yacreader_images_osx.qrc
|
|
@ -174,7 +174,11 @@ SOURCES += ../common/comic.cpp \
|
|||||||
}
|
}
|
||||||
|
|
||||||
include(../custom_widgets/custom_widgets_yacreader.pri)
|
include(../custom_widgets/custom_widgets_yacreader.pri)
|
||||||
|
!CONFIG(unarr){
|
||||||
include(../compressed_archive/wrapper.pri)
|
include(../compressed_archive/wrapper.pri)
|
||||||
|
} else {
|
||||||
|
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||||
|
}
|
||||||
include(../shortcuts_management/shortcuts_management.pri)
|
include(../shortcuts_management/shortcuts_management.pri)
|
||||||
|
|
||||||
RESOURCES += yacreader_images.qrc \
|
RESOURCES += yacreader_images.qrc \
|
||||||
@ -202,7 +206,7 @@ TRANSLATIONS = yacreader_es.ts \
|
|||||||
yacreader_de.ts \
|
yacreader_de.ts \
|
||||||
yacreader_source.ts
|
yacreader_source.ts
|
||||||
|
|
||||||
|
!CONFIG(unarr){
|
||||||
win32 {
|
win32 {
|
||||||
!exists (../compressed_archive/lib7zip) {
|
!exists (../compressed_archive/lib7zip) {
|
||||||
error(You\'ll need 7zip source code to compile YACReader. \
|
error(You\'ll need 7zip source code to compile YACReader. \
|
||||||
@ -219,6 +223,12 @@ exists (../compressed_archive/libp7zip) {
|
|||||||
Please check the compressed_archive folder for further instructions.)
|
Please check the compressed_archive folder for further instructions.)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
exists (../compressed_archive/unarr/unarr-master) {
|
||||||
|
message(Found unarr source-code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
#set install prefix if it's empty
|
#set install prefix if it's empty
|
||||||
|
@ -100,6 +100,7 @@ QImage changeImage( const QImage& image, int value )
|
|||||||
colors[ i ] = qRgb( operation( qRed( colors[ i ] ), value ),
|
colors[ i ] = qRgb( operation( qRed( colors[ i ] ), value ),
|
||||||
operation( qGreen( colors[ i ] ), value ),
|
operation( qGreen( colors[ i ] ), value ),
|
||||||
operation( qBlue( colors[ i ] ), value ));
|
operation( qBlue( colors[ i ] ), value ));
|
||||||
|
im.setColorTable(colors);
|
||||||
}
|
}
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,12 @@ SOURCES += comic_flow.cpp \
|
|||||||
|
|
||||||
include(./server/server.pri)
|
include(./server/server.pri)
|
||||||
include(../custom_widgets/custom_widgets_yacreaderlibrary.pri)
|
include(../custom_widgets/custom_widgets_yacreaderlibrary.pri)
|
||||||
|
!CONFIG(unarr){
|
||||||
include(../compressed_archive/wrapper.pri)
|
include(../compressed_archive/wrapper.pri)
|
||||||
|
} else {
|
||||||
|
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||||
|
}
|
||||||
|
|
||||||
include(./comic_vine/comic_vine.pri)
|
include(./comic_vine/comic_vine.pri)
|
||||||
include(../QsLog/QsLog.pri)
|
include(../QsLog/QsLog.pri)
|
||||||
include(../shortcuts_management/shortcuts_management.pri)
|
include(../shortcuts_management/shortcuts_management.pri)
|
||||||
@ -263,6 +268,7 @@ win32:RESOURCES += qml_win.qrc
|
|||||||
unix:!macx:RESOURCES += qml_win.qrc
|
unix:!macx:RESOURCES += qml_win.qrc
|
||||||
macx:RESOURCES += qml_osx.qrc
|
macx:RESOURCES += qml_osx.qrc
|
||||||
|
|
||||||
|
!CONFIG(unarr){
|
||||||
win32 {
|
win32 {
|
||||||
!exists(../compressed_archive/lib7zip){
|
!exists(../compressed_archive/lib7zip){
|
||||||
error(You\'ll need 7zip source code to compile YACReader. \
|
error(You\'ll need 7zip source code to compile YACReader. \
|
||||||
@ -279,6 +285,11 @@ exists (../compressed_archive/libp7zip) {
|
|||||||
Please check the compressed_archive folder for further instructions.)
|
Please check the compressed_archive folder for further instructions.)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
exists (../compressed_archive/unarr/unarr-master) {
|
||||||
|
message(Found unarr source code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
#set install prefix if it's empty
|
#set install prefix if it's empty
|
||||||
|
@ -65,20 +65,27 @@ void LibraryCreator::updateFolder(const QString &source, const QString &target,
|
|||||||
relativeFolderPath = relativeFolderPath.remove(QDir::cleanPath(source));
|
relativeFolderPath = relativeFolderPath.remove(QDir::cleanPath(source));
|
||||||
|
|
||||||
if(relativeFolderPath.startsWith("/"))
|
if(relativeFolderPath.startsWith("/"))
|
||||||
|
{
|
||||||
relativeFolderPath = relativeFolderPath.remove(0,1);//remove firts '/'
|
relativeFolderPath = relativeFolderPath.remove(0,1);//remove firts '/'
|
||||||
|
}
|
||||||
|
|
||||||
QStringList folders;
|
QStringList folders;
|
||||||
|
|
||||||
if(!relativeFolderPath.isEmpty()) //updating root
|
if(!relativeFolderPath.isEmpty()) //updating root
|
||||||
|
{
|
||||||
folders = relativeFolderPath.split('/');
|
folders = relativeFolderPath.split('/');
|
||||||
|
}
|
||||||
|
|
||||||
QLOG_DEBUG() << "folders found in relative path : " << folders << "-" << relativeFolderPath;
|
QLOG_DEBUG() << "folders found in relative path : " << folders << "-" << relativeFolderPath;
|
||||||
|
|
||||||
QSqlDatabase db = DataBaseManagement::loadDatabase(target);
|
QSqlDatabase db = DataBaseManagement::loadDatabase(target);
|
||||||
|
|
||||||
foreach (QString folderName, folders) {
|
foreach (QString folderName, folders)
|
||||||
|
{
|
||||||
if(folderName.isEmpty())
|
if(folderName.isEmpty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
qulonglong parentId = _currentPathFolders.last().id;
|
qulonglong parentId = _currentPathFolders.last().id;
|
||||||
_currentPathFolders.append(DBHelper::loadFolder(folderName, parentId, db));
|
_currentPathFolders.append(DBHelper::loadFolder(folderName, parentId, db));
|
||||||
QLOG_DEBUG() << "Folder appended : " << _currentPathFolders.last().id << " " << _currentPathFolders.last().name << " with parent" << _currentPathFolders.last().parentId;
|
QLOG_DEBUG() << "Folder appended : " << _currentPathFolders.last().id << " " << _currentPathFolders.last().name << " with parent" << _currentPathFolders.last().parentId;
|
||||||
@ -104,8 +111,10 @@ void LibraryCreator::processLibrary(const QString & source, const QString & targ
|
|||||||
d.removeRecursively();
|
d.removeRecursively();
|
||||||
_mode = CREATOR;
|
_mode = CREATOR;
|
||||||
}
|
}
|
||||||
else //
|
else
|
||||||
|
{ //
|
||||||
_mode = UPDATER;
|
_mode = UPDATER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,6 +129,7 @@ void LibraryCreator::run()
|
|||||||
#else
|
#else
|
||||||
QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z");
|
QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!sevenzLib->load())
|
if(!sevenzLib->load())
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl;
|
QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl;
|
||||||
@ -180,10 +190,15 @@ void LibraryCreator::run()
|
|||||||
}
|
}
|
||||||
QSqlQuery pragma("PRAGMA foreign_keys = ON",_database);
|
QSqlQuery pragma("PRAGMA foreign_keys = ON",_database);
|
||||||
_database.transaction();
|
_database.transaction();
|
||||||
|
|
||||||
if(partialUpdate)
|
if(partialUpdate)
|
||||||
|
{
|
||||||
update(QDir(_sourceFolder));
|
update(QDir(_sourceFolder));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
update(QDir(_source));
|
update(QDir(_source));
|
||||||
|
}
|
||||||
_database.commit();
|
_database.commit();
|
||||||
_database.close();
|
_database.close();
|
||||||
QSqlDatabase::removeDatabase(_target);
|
QSqlDatabase::removeDatabase(_target);
|
||||||
@ -191,10 +206,14 @@ void LibraryCreator::run()
|
|||||||
if(!partialUpdate)
|
if(!partialUpdate)
|
||||||
{
|
{
|
||||||
if(!creation)
|
if(!creation)
|
||||||
|
{
|
||||||
emit(updated());
|
emit(updated());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
emit(created());
|
emit(created());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
QLOG_INFO() << "Update library END";
|
QLOG_INFO() << "Update library END";
|
||||||
}
|
}
|
||||||
//msleep(100);//TODO try to solve the problem with the udpate dialog (ya no se usa más...)
|
//msleep(100);//TODO try to solve the problem with the udpate dialog (ya no se usa más...)
|
||||||
@ -203,7 +222,7 @@ void LibraryCreator::run()
|
|||||||
emit updatedCurrentFolder(folderDestinationModelIndex);
|
emit updatedCurrentFolder(folderDestinationModelIndex);
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
else
|
else //TODO check this part!!
|
||||||
emit finished();
|
emit finished();
|
||||||
creation = false;
|
creation = false;
|
||||||
}
|
}
|
||||||
@ -260,6 +279,7 @@ void LibraryCreator::create(QDir dir)
|
|||||||
#endif
|
#endif
|
||||||
if(fileInfo.isDir())
|
if(fileInfo.isDir())
|
||||||
{
|
{
|
||||||
|
QLOG_INFO() << "Parsing folder" << fileInfo.canonicalPath() ;
|
||||||
//se añade al path actual el folder, aún no se sabe si habrá que añadirlo a la base de datos
|
//se añade al path actual el folder, aún no se sabe si habrá que añadirlo a la base de datos
|
||||||
_currentPathFolders.append(Folder(fileInfo.fileName(),relativePath));
|
_currentPathFolders.append(Folder(fileInfo.fileName(),relativePath));
|
||||||
create(QDir(fileInfo.absoluteFilePath()));
|
create(QDir(fileInfo.absoluteFilePath()));
|
||||||
@ -268,6 +288,7 @@ void LibraryCreator::create(QDir dir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
QLOG_INFO() << "Parsing file" << fileInfo.filePath();
|
||||||
insertComic(relativePath,fileInfo);
|
insertComic(relativePath,fileInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,8 +319,10 @@ void LibraryCreator::insertComic(const QString & relativePath,const QFileInfo &
|
|||||||
tc.create();
|
tc.create();
|
||||||
numPages = tc.getNumPages();
|
numPages = tc.getNumPages();
|
||||||
if (numPages > 0)
|
if (numPages > 0)
|
||||||
|
{
|
||||||
emit(comicAdded(relativePath,_target+"/covers/"+hash+".jpg"));
|
emit(comicAdded(relativePath,_target+"/covers/"+hash+".jpg"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (numPages > 0 || exists)
|
if (numPages > 0 || exists)
|
||||||
{
|
{
|
||||||
@ -595,11 +618,20 @@ void ThumbnailCreator::create()
|
|||||||
//p.save(_target);
|
//p.save(_target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
//poppler only, not mac
|
||||||
|
if (pdfComic->isLocked())
|
||||||
|
{
|
||||||
|
QLOG_WARN() << "Extracting cover: unable to open PDF file " << _fileSource;
|
||||||
|
delete pdfComic;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
_numPages = pdfComic->numPages();
|
_numPages = pdfComic->numPages();
|
||||||
if(_numPages >= _coverPage)
|
if(_numPages >= _coverPage)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
{
|
{ //TODO is this "{" one too much?
|
||||||
QImage p = pdfComic->getPage(_coverPage-1); //TODO check if the page is valid
|
QImage p = pdfComic->getPage(_coverPage-1); //TODO check if the page is valid
|
||||||
#else
|
#else
|
||||||
QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72);
|
QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72);
|
||||||
@ -609,13 +641,17 @@ void ThumbnailCreator::create()
|
|||||||
{
|
{
|
||||||
QImage scaled;
|
QImage scaled;
|
||||||
if(p.width()>p.height()) //landscape??
|
if(p.width()>p.height()) //landscape??
|
||||||
|
{
|
||||||
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
scaled.save(_target,0,75);
|
scaled.save(_target,0,75);
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
}
|
} //TODO is this "{" one too much?
|
||||||
pdfComic->releaseLastPageData();
|
pdfComic->releaseLastPageData();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -633,7 +669,9 @@ void ThumbnailCreator::create()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(crash)
|
if(crash)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CompressedArchive archive(_fileSource);
|
CompressedArchive archive(_fileSource);
|
||||||
if(!archive.toolsLoaded())
|
if(!archive.toolsLoaded())
|
||||||
@ -643,7 +681,9 @@ void ThumbnailCreator::create()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!archive.isValid())
|
if(!archive.isValid())
|
||||||
|
{
|
||||||
QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource;
|
QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource;
|
||||||
|
}
|
||||||
//se filtran para obtener sólo los formatos soportados
|
//se filtran para obtener sólo los formatos soportados
|
||||||
QList<QString> order = archive.getFileNames();
|
QList<QString> order = archive.getFileNames();
|
||||||
QList<QString> fileNames = FileComic::filter(order);
|
QList<QString> fileNames = FileComic::filter(order);
|
||||||
@ -653,12 +693,16 @@ void ThumbnailCreator::create()
|
|||||||
QLOG_WARN() << "Extracting cover: empty comic " << _fileSource;
|
QLOG_WARN() << "Extracting cover: empty comic " << _fileSource;
|
||||||
_cover.load(":/images/notCover.png");
|
_cover.load(":/images/notCover.png");
|
||||||
if(_target!="")
|
if(_target!="")
|
||||||
|
{
|
||||||
_cover.save(_target);
|
_cover.save(_target);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(_coverPage > _numPages)
|
if(_coverPage > _numPages)
|
||||||
|
{
|
||||||
_coverPage = 1;
|
_coverPage = 1;
|
||||||
|
}
|
||||||
qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI);
|
qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI);
|
||||||
int index = order.indexOf(fileNames.at(_coverPage-1));
|
int index = order.indexOf(fileNames.at(_coverPage-1));
|
||||||
|
|
||||||
@ -677,9 +721,13 @@ void ThumbnailCreator::create()
|
|||||||
{
|
{
|
||||||
QImage scaled;
|
QImage scaled;
|
||||||
if(p.width()>p.height()) //landscape??
|
if(p.width()>p.height()) //landscape??
|
||||||
|
{
|
||||||
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
scaled.save(_target,0,75);
|
scaled.save(_target,0,75);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -708,8 +708,11 @@ void PDFComic::process()
|
|||||||
emit errorOpening();
|
emit errorOpening();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (pdfComic->isLocked())
|
||||||
|
{
|
||||||
|
emit errorOpening();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//pdfComic->setRenderHint(Poppler::Document::Antialiasing, true);
|
//pdfComic->setRenderHint(Poppler::Document::Antialiasing, true);
|
||||||
pdfComic->setRenderHint(Poppler::Document::TextAntialiasing, true);
|
pdfComic->setRenderHint(Poppler::Document::TextAntialiasing, true);
|
||||||
|
1
compressed_archive/unarr/README.txt
Normal file
1
compressed_archive/unarr/README.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
To use unarr download https://github.com/zeniko/unarr/archive/master.zip and extract it in this folder. Run qmake with CONFIG+=unarr
|
107
compressed_archive/unarr/compressed_archive.cpp
Normal file
107
compressed_archive/unarr/compressed_archive.cpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
#include "compressed_archive.h"
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
#include "extract_delegate.h"
|
||||||
|
|
||||||
|
extern"C" {
|
||||||
|
#include "unarr.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
|
||||||
|
QObject(parent),valid(false),tools(true),numFiles(0),ar(NULL),stream(NULL)
|
||||||
|
{
|
||||||
|
stream = ar_open_file(filePath.toStdString().c_str());
|
||||||
|
//try to open archive
|
||||||
|
ar = ar_open_rar_archive(stream);
|
||||||
|
if (!ar) ar = ar_open_zip_archive(stream, false);
|
||||||
|
//if (!ar) ar = ar_open_7z_archive(stream);
|
||||||
|
if (!ar) ar = ar_open_tar_archive(stream);
|
||||||
|
if (!ar)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//initial parse
|
||||||
|
while (ar_parse_entry(ar))
|
||||||
|
{
|
||||||
|
numFiles++;
|
||||||
|
fileNames.append(ar_entry_get_name(ar));
|
||||||
|
offsets.append(ar_entry_get_offset(ar));
|
||||||
|
}
|
||||||
|
if (numFiles > 0)
|
||||||
|
{
|
||||||
|
valid = true;
|
||||||
|
tools = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CompressedArchive::~CompressedArchive()
|
||||||
|
{
|
||||||
|
ar_close_archive(ar);
|
||||||
|
ar_close(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> CompressedArchive::getFileNames()
|
||||||
|
{
|
||||||
|
return fileNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CompressedArchive::isValid()
|
||||||
|
{
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CompressedArchive::toolsLoaded()
|
||||||
|
{
|
||||||
|
return tools;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CompressedArchive::getNumFiles()
|
||||||
|
{
|
||||||
|
return numFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)
|
||||||
|
{
|
||||||
|
if (indexes.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QByteArray buffer;
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
while (i < indexes.count())
|
||||||
|
{
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
ar_parse_entry_at(ar, offsets.at(indexes.at(0))); //set ar_entry to start of indexes
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ar_parse_entry(ar);
|
||||||
|
}
|
||||||
|
buffer.resize(ar_entry_get_size(ar));
|
||||||
|
ar_entry_uncompress(ar, buffer.data(), buffer.size());
|
||||||
|
delegate->fileExtracted(indexes.at(i), buffer); //return extracted files :)
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CompressedArchive::getRawDataAtIndex(int index)
|
||||||
|
{
|
||||||
|
QByteArray buffer;
|
||||||
|
if(index >= 0 && index < getNumFiles())
|
||||||
|
{
|
||||||
|
ar_parse_entry_at(ar, offsets.at(index));
|
||||||
|
while (ar_entry_get_size(ar)==0)
|
||||||
|
{
|
||||||
|
ar_parse_entry(ar);
|
||||||
|
}
|
||||||
|
buffer.resize(ar_entry_get_size(ar));
|
||||||
|
ar_entry_uncompress(ar, buffer.data(), buffer.size());
|
||||||
|
//return buffer;
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
37
compressed_archive/unarr/compressed_archive.h
Normal file
37
compressed_archive/unarr/compressed_archive.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#ifndef COMPRESSED_ARCHIVE_H
|
||||||
|
#define COMPRESSED_ARCHIVE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "extract_delegate.h"
|
||||||
|
extern"C" {
|
||||||
|
#include "unarr.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
class CompressedArchive : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CompressedArchive(const QString & filePath, QObject *parent = 0);
|
||||||
|
~CompressedArchive();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
int getNumFiles();
|
||||||
|
void getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate=0);
|
||||||
|
QByteArray getRawDataAtIndex(int index);
|
||||||
|
QList<QString> getFileNames();
|
||||||
|
bool isValid();
|
||||||
|
bool toolsLoaded();
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool tools;
|
||||||
|
bool valid;
|
||||||
|
QList<QString> fileNames;
|
||||||
|
int numFiles;
|
||||||
|
ar_archive *ar;
|
||||||
|
ar_stream *stream;
|
||||||
|
QList<qint64> offsets;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMPRESSED_ARCHIVE_H
|
14
compressed_archive/unarr/extract_delegate.h
Normal file
14
compressed_archive/unarr/extract_delegate.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef EXTRACT_DELEGATE_H
|
||||||
|
#define EXTRACT_DELEGATE_H
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
class ExtractDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void fileExtracted(int index, const QByteArray & rawData) = 0;
|
||||||
|
virtual void crcError(int index) = 0;
|
||||||
|
virtual void unknownError(int index) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //EXTRACT_DELEGATE_H
|
13
compressed_archive/unarr/unarr-wrapper.pri
Normal file
13
compressed_archive/unarr/unarr-wrapper.pri
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
DEPENDPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += $$PWD/extract_delegate.h \
|
||||||
|
$$PWD/compressed_archive.h \
|
||||||
|
|
||||||
|
SOURCES += $$PWD/compressed_archive.cpp \
|
||||||
|
|
||||||
|
#static build (no lib)
|
||||||
|
include(unarr.pro)
|
||||||
|
|
||||||
|
#for system libunarr.so
|
||||||
|
#LIBS+=-lunarr
|
Loading…
x
Reference in New Issue
Block a user