mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Merged luisangelsm/yacreader/headless_server into headless_server
This commit is contained in:
parent
6b5e4c5ec8
commit
65f2068dd6
@ -1,159 +1,164 @@
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = YACReaderLibraryServer
|
||||
CONFIG += console
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
|
||||
|
||||
#load default build flags
|
||||
#TODO include (../config.pri)
|
||||
!CONFIG(unarr):!CONFIG(7zip) {
|
||||
unix {
|
||||
!macx {
|
||||
CONFIG+=unarr
|
||||
}
|
||||
else {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
|
||||
}
|
||||
win32 {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
|
||||
LIBS += -lpoppler-qt5
|
||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
|
||||
macx{
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
||||
HEADERS += $$PWD/../common/pdf_comic.h
|
||||
CONFIG += objective_c
|
||||
}
|
||||
|
||||
unix{
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += core sql network script
|
||||
|
||||
# Input
|
||||
HEADERS += library_creator.h \
|
||||
package_manager.h \
|
||||
bundle_creator.h \
|
||||
db_helper.h \
|
||||
./db/data_base_management.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
../common/comic.h \
|
||||
../common/bookmarks.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
yacreader_local_server.h \
|
||||
comics_remover.h \
|
||||
../common/http_worker.h \
|
||||
yacreader_libraries.h \
|
||||
comic_files_manager.h
|
||||
|
||||
|
||||
SOURCES += library_creator.cpp \
|
||||
.\headless\main.cpp \
|
||||
package_manager.cpp \
|
||||
bundle_creator.cpp \
|
||||
db_helper.cpp \
|
||||
./db/data_base_management.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
../common/comic.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
comic_files_manager.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr) {
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
|
||||
TRANSLATIONS = yacreaderlibraryserver_es.ts \
|
||||
yacreaderlibraryserver_ru.ts \
|
||||
yacreaderlibraryserver_pt.ts \
|
||||
yacreaderlibraryserver_fr.ts \
|
||||
yacreaderlibraryserver_nl.ts \
|
||||
yacreaderlibraryserver_tr.ts \
|
||||
yacreaderlibraryserver_de.ts \
|
||||
yacreaderlibraryserver_source.ts
|
||||
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
INSTALLS += bin icon desktop server translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReaderLibrary
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReaderLibrary
|
||||
}
|
||||
|
||||
server.path = $$DATADIR/yacreader
|
||||
server.files = ../release/server
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreaderlibrary_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReaderLibrary.1
|
||||
}
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = YACReaderLibraryServer
|
||||
CONFIG += console
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY QT_NO_DEBUG_OUTPUT
|
||||
|
||||
#load default build flags
|
||||
#TODO include (../config.pri)
|
||||
!CONFIG(unarr):!CONFIG(7zip) {
|
||||
unix {
|
||||
!macx {
|
||||
CONFIG+=unarr
|
||||
}
|
||||
else {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
|
||||
}
|
||||
win32 {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
|
||||
LIBS += -lpoppler-qt5
|
||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
|
||||
macx{
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
||||
HEADERS += $$PWD/../common/pdf_comic.h
|
||||
CONFIG += objective_c
|
||||
}
|
||||
|
||||
unix{
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += core sql network script
|
||||
|
||||
# Input
|
||||
HEADERS += library_creator.h \
|
||||
package_manager.h \
|
||||
bundle_creator.h \
|
||||
db_helper.h \
|
||||
./db/data_base_management.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
../common/comic.h \
|
||||
../common/bookmarks.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
yacreader_local_server.h \
|
||||
comics_remover.h \
|
||||
../common/http_worker.h \
|
||||
yacreader_libraries.h \
|
||||
comic_files_manager.h \
|
||||
headless/console_ui_library_creator.h
|
||||
|
||||
|
||||
SOURCES += library_creator.cpp \
|
||||
.\headless\main.cpp \
|
||||
package_manager.cpp \
|
||||
bundle_creator.cpp \
|
||||
db_helper.cpp \
|
||||
./db/data_base_management.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
../common/comic.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
comic_files_manager.cpp \
|
||||
headless/console_ui_library_creator.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr) {
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
|
||||
TRANSLATIONS = yacreaderlibraryserver_es.ts \
|
||||
yacreaderlibraryserver_ru.ts \
|
||||
yacreaderlibraryserver_pt.ts \
|
||||
yacreaderlibraryserver_fr.ts \
|
||||
yacreaderlibraryserver_nl.ts \
|
||||
yacreaderlibraryserver_tr.ts \
|
||||
yacreaderlibraryserver_de.ts \
|
||||
yacreaderlibraryserver_source.ts
|
||||
|
||||
|
||||
RESOURCES += headless/images.qrc
|
||||
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
INSTALLS += bin icon desktop server translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReaderLibrary
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReaderLibrary
|
||||
}
|
||||
|
||||
server.path = $$DATADIR/yacreader
|
||||
server.files = ../release/server
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreaderlibrary_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReaderLibrary.1
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "library_creator.h"
|
||||
#include "check_new_version.h"
|
||||
|
||||
|
||||
static QString fields = "title ,"
|
||||
|
||||
"coverPage,"
|
||||
|
81
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
81
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "console_ui_library_creator.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "library_creator.h"
|
||||
#include "yacreader_libraries.h"
|
||||
|
||||
|
||||
ConsoleUILibraryCreator::ConsoleUILibraryCreator(QObject *parent) :
|
||||
QObject(parent), numComicsProcessed(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString & path)
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->createLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &ConsoleUILibraryCreator::manageCreatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
|
||||
//TODO, at some point some checking is needed for avoiding duplicated libraries
|
||||
YACReaderLibraries yacreaderLibraries;
|
||||
yacreaderLibraries.load();
|
||||
yacreaderLibraries.addLibrary(name, path);
|
||||
yacreaderLibraries.save();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::updateLibrary(const QString & path)
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->updateLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedOpeningDB, this, &ConsoleUILibraryCreator::manageUpdatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::newComic(const QString & /*relativeComicPath*/, const QString & /*coverPath*/)
|
||||
{
|
||||
numComicsProcessed++;
|
||||
std::cout << ".";
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageCreatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error creating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageUpdatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error updating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::done()
|
||||
{
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
if(numComicsProcessed > 0)
|
||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||
}
|
27
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
27
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
#define CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
class ConsoleUILibraryCreator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleUILibraryCreator(QObject *parent = 0);
|
||||
void createLibrary(const QString & name, const QString & path);
|
||||
void updateLibrary(const QString & path);
|
||||
|
||||
private:
|
||||
uint numComicsProcessed;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
||||
void manageCreatingError(const QString & error);
|
||||
void manageUpdatingError(const QString & error);
|
||||
void done();
|
||||
};
|
||||
|
||||
#endif // CONSOLE_UI_LIBRARY_CREATOR_H
|
6
YACReaderLibrary/headless/images.qrc
Normal file
6
YACReaderLibrary/headless/images.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>../../images/f_overlayed.png</file>
|
||||
<file>../../images/f_overlayed_retina.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -7,9 +7,13 @@
|
||||
#include "yacreader_libraries.h"
|
||||
#include "yacreader_local_server.h"
|
||||
|
||||
#include "console_ui_library_creator.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
#include "QsLogDest.h"
|
||||
|
||||
|
||||
|
||||
using namespace QsLogging;
|
||||
|
||||
void logSystemAndConfig()
|
||||
@ -100,45 +104,98 @@ void logSystemAndConfig()
|
||||
QLOG_INFO() << "--------------------------------------------";
|
||||
}
|
||||
|
||||
QCoreApplication* createApplication(int &argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
if (!qstrcmp(argv[i], "--no-gui"))
|
||||
return new QCoreApplication(argc, argv);
|
||||
return new QCoreApplication(argc, argv);
|
||||
}
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
|
||||
QCoreApplication *app = new QCoreApplication(argc, argv);
|
||||
|
||||
app->setApplicationName("YACReaderLibraryServer");
|
||||
app->setOrganizationName("YACReader");
|
||||
//simple command line parser
|
||||
//will be replaced by QCommandLineParser in the future
|
||||
//TODO: support for file and directory arguments
|
||||
if (argc > 1)
|
||||
app->setApplicationVersion(VERSION);
|
||||
|
||||
QTextStream qout(stdout);
|
||||
|
||||
//general help
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::tr("\nYACReaderLibraryServer is the headless (no gui) version of YACReaderLibrary"));
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, list-libraries]");
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
const QString command = args.isEmpty() ? QString() : args.first();
|
||||
|
||||
if(command == "start")
|
||||
{
|
||||
QTextStream parser(stdout);
|
||||
QStringList optlist = QCoreApplication::arguments().filter(QRegExp ("^-{1,2}"));
|
||||
if (optlist.contains("--version") || optlist.contains("-v"))
|
||||
|
||||
}
|
||||
else if(command == "create-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("create-library", "Creates a library named \"name\" in the specified destination <path>");
|
||||
parser.addPositionalArgument("name", "Library name", "\"name\"");
|
||||
parser.addPositionalArgument("path", "Path to the folder where the library will be created", "<path>");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 3)
|
||||
{
|
||||
parser << app->applicationName() << " " << QString(VERSION) << endl << "Copyright 2014 by Luis Angel San Martin Rodriguez" << endl;
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
if (optlist.contains("--help") || optlist.contains("-h"))
|
||||
|
||||
const QStringList createArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->createLibrary(createArgs.at(1), createArgs.at(2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "update-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("update-library", "Updates an existing library at <path>");
|
||||
parser.addPositionalArgument("path", "Path to the library to be updated", "<path>");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 2)
|
||||
{
|
||||
parser << endl << "Usage:" << "\tYACReaderLibrary [Option]" << endl << endl;
|
||||
parser << "Options:" << endl;
|
||||
parser << " none\t\t\tStart YACReaderLibrary" << endl;
|
||||
parser << " -h, --help\t\tDisplay help text and exit." << endl;
|
||||
parser << " -v, --version\t\tDisplay version information and exit." << endl;
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
if (optlist.contains("--no-gui"))
|
||||
{
|
||||
parser << "You're running YACReaderLibrary in non-gui mode. Press Ctrl+C to exit." << endl;
|
||||
}
|
||||
|
||||
const QStringList updateArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->updateLibrary(updateArgs.at(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "list-libraries")
|
||||
{
|
||||
YACReaderLibraries libraries = DBHelper::getLibraries();
|
||||
for(QString libraryName : libraries.getNames())
|
||||
qout << libraryName << " : " << libraries.getPath(libraryName) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else //error
|
||||
{
|
||||
parser.showHelp();
|
||||
}
|
||||
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log";
|
||||
@ -169,12 +226,10 @@ int main( int argc, char ** argv )
|
||||
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
#endif
|
||||
app->installTranslator(&viewerTranslator);
|
||||
app->setApplicationName("YACReaderLibrary");
|
||||
|
||||
qRegisterMetaType<ComicDB>("ComicDB");
|
||||
|
||||
|
||||
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creaci�n del fichero de config con el servidor
|
||||
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
//server
|
||||
|
@ -636,7 +636,7 @@ void ThumbnailCreator::create()
|
||||
#else
|
||||
QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72);
|
||||
#endif
|
||||
_cover = QPixmap::fromImage(p);
|
||||
_cover = p;
|
||||
if(_target!="")
|
||||
{
|
||||
QImage scaled;
|
||||
|
@ -78,14 +78,14 @@
|
||||
QString _target;
|
||||
QString _currentName;
|
||||
int _numPages;
|
||||
QPixmap _cover;
|
||||
QImage _cover;
|
||||
int _coverPage;
|
||||
static bool crash;
|
||||
|
||||
public slots:
|
||||
void create();
|
||||
int getNumPages(){return _numPages;};
|
||||
QPixmap getCover(){return _cover;};
|
||||
int getNumPages(){return _numPages;}
|
||||
QPixmap getCover(){return QPixmap::fromImage(_cover);}
|
||||
signals:
|
||||
void openingError(QProcess::ProcessError error);
|
||||
|
||||
|
@ -155,31 +155,9 @@ int main( int argc, char ** argv )
|
||||
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
app.setOrganizationName("YACReader");
|
||||
app.setApplicationName(VERSION);
|
||||
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
//simple command line parser
|
||||
//will be replaced by QCommandLineParser in the future
|
||||
//TODO: --headless, --server=[on|off], support for file and directory arguments
|
||||
if (argc > 1)
|
||||
{
|
||||
QTextStream parser(stdout);
|
||||
QStringList optlist = QCoreApplication::arguments().filter(QRegExp ("^-{1,2}"));
|
||||
if (optlist.contains("--version") || optlist.contains("-v"))
|
||||
{
|
||||
parser << app.applicationName() << " " << QString(VERSION) << endl << "Copyright 2014 by Luis Angel San Martin Rodriguez" << endl;
|
||||
return 0;
|
||||
}
|
||||
if (optlist.contains("--help") || optlist.contains("-h"))
|
||||
{
|
||||
parser << endl << "Usage:" << "\tYACReaderLibrary [Option]" << endl << endl;
|
||||
parser << "Options:" << endl;
|
||||
parser << " none\t\t\tStart YACReaderLibrary" << endl;
|
||||
parser << " -h, --help\t\tDisplay help text and exit." << endl;
|
||||
parser << " -v, --version\t\tDisplay version information and exit." << endl;
|
||||
return 0;
|
||||
}
|
||||
parser << "Unsupported command line options. See YACReaderLibrary --help for further information." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log";
|
||||
QDir().mkpath(YACReader::getSettingsPath());
|
||||
@ -209,7 +187,6 @@ int main( int argc, char ** argv )
|
||||
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
#endif
|
||||
app.installTranslator(&viewerTranslator);
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
|
||||
qRegisterMetaType<ComicDB>("ComicDB");
|
||||
|
||||
|
@ -27,8 +27,7 @@
|
||||
void Startup::start() {
|
||||
// Initialize the core application
|
||||
QCoreApplication* app = QCoreApplication::instance();
|
||||
app->setApplicationName(APPNAME);
|
||||
app->setOrganizationName(ORGANISATION);
|
||||
|
||||
QString configFileName=YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini";
|
||||
|
||||
// Configure logging into files
|
||||
|
@ -102,7 +102,7 @@ void YACReaderLibraries::addLibrary(const QString &name, const QString &path)
|
||||
|
||||
void YACReaderLibraries::load()
|
||||
{
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||
QSettings settings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
|
||||
if(settings.value(LIBRARIES).isValid())
|
||||
{
|
||||
@ -136,7 +136,7 @@ void YACReaderLibraries::load()
|
||||
|
||||
bool YACReaderLibraries::save()
|
||||
{
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||
QSettings settings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
|
||||
QByteArray data;
|
||||
QDataStream out(&data, QIODevice::WriteOnly);
|
||||
|
@ -127,10 +127,10 @@ void YACReaderClientConnectionWorker::run()
|
||||
tries = 0;
|
||||
QByteArray data;
|
||||
int dataRead = 0;
|
||||
while(data.size() < totalSize && tries < 200)
|
||||
while((quint32)data.size() < totalSize && tries < 200)
|
||||
{
|
||||
data.append(clientConnection->readAll());
|
||||
if(data.length() < totalSize)
|
||||
if((quint32)data.length() < totalSize)
|
||||
clientConnection->waitForReadyRead(100);
|
||||
if(dataRead == data.length()) //no bytes were read
|
||||
tries++;
|
||||
|
@ -73,12 +73,12 @@ struct SevenZipInterface {
|
||||
|
||||
//SevenZipInterface * szInterface;
|
||||
|
||||
const char rar[7]={static_cast<char>(0x52), static_cast<char>(0x61), static_cast<char>(0x72), static_cast<char>(0x21), static_cast<char>(0x1A), static_cast<char>(0x07), static_cast<char>(0x00)};
|
||||
const char rar5[8]={static_cast<char>(0x52), static_cast<char>(0x61), static_cast<char>(0x72), static_cast<char>(0x21), static_cast<char>(0x1A), static_cast<char>(0x07), static_cast<char>(0x01), static_cast<char>(0x00)};
|
||||
const char zip[2]={static_cast<char>(0x50), static_cast<char>(0x4B)};
|
||||
const char sevenz[6]={static_cast<char>(0x37), static_cast<char>(0x7A), static_cast<char>(0xBC), static_cast<char>(0xAF), static_cast<char>(0x27), static_cast<char>(0x1C)};
|
||||
const char tar[6]="ustar";
|
||||
const char arj[2]={static_cast<char>(0x60), static_cast<char>(0xEA)};
|
||||
const unsigned char rar[7]={static_cast<unsigned char>(0x52), static_cast<unsigned char>(0x61), static_cast<unsigned char>(0x72), static_cast<unsigned char>(0x21), static_cast<unsigned char>(0x1A), static_cast<unsigned char>(0x07), static_cast<unsigned char>(0x00)};
|
||||
const unsigned char rar5[8]={static_cast<unsigned char>(0x52), static_cast<unsigned char>(0x61), static_cast<unsigned char>(0x72), static_cast<unsigned char>(0x21), static_cast<unsigned char>(0x1A), static_cast<unsigned char>(0x07), static_cast<unsigned char>(0x01), static_cast<unsigned char>(0x00)};
|
||||
const unsigned char zip[2]={static_cast<unsigned char>(0x50), static_cast<unsigned char>(0x4B)};
|
||||
const unsigned char sevenz[6]={static_cast<unsigned char>(0x37), static_cast<unsigned char>(0x7A), static_cast<unsigned char>(0xBC), static_cast<unsigned char>(0xAF), static_cast<unsigned char>(0x27), static_cast<unsigned char>(0x1C)};
|
||||
const unsigned char tar[6]="ustar";
|
||||
const unsigned char arj[2]={static_cast<unsigned char>(0x60), static_cast<unsigned char>(0xEA)};
|
||||
|
||||
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
|
||||
QObject(parent),sevenzLib(0),valid(false),tools(false)
|
||||
@ -404,7 +404,7 @@ QVector<quint32> CompressedArchive::translateIndexes(const QVector<quint32> & in
|
||||
|
||||
foreach(quint32 i, indexes)
|
||||
{
|
||||
if(i < offsets.length())
|
||||
if(i < (quint32)offsets.length())
|
||||
translatedIndexes.append(offsets.at(i));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user