This commit is contained in:
Luis Ángel San Martín
2016-08-22 13:24:43 +02:00
parent aa50f6cdda
commit 264b016d8b
7 changed files with 71 additions and 52 deletions

View File

@ -1,151 +0,0 @@
######################################################################
# 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
QMAKE_MAC_SDK = macosx10.11
#load default build flags
#do a basic dependency check
include(headless_config.pri)
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 server translation #manpage
bin.path = $$BINDIR
isEmpty(DESTDIR) {
bin.files = YACReaderLibraryServer
} else {
bin.files = $$DESTDIR/YACReaderLibraryServer
}
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
}

View File

@ -17,7 +17,10 @@ void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString
QEventLoop eventLoop;
LibraryCreator * libraryCreator = new LibraryCreator();
libraryCreator->createLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
QDir pathDir(path);
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
libraryCreator->createLibrary(cleanPath,QDir::cleanPath(pathDir.absolutePath()+"/.yacreaderlibrary"));
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
@ -33,7 +36,7 @@ void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString
//TODO, at some point some checking is needed for avoiding duplicated libraries
YACReaderLibraries yacreaderLibraries;
yacreaderLibraries.load();
yacreaderLibraries.addLibrary(name, path);
yacreaderLibraries.addLibrary(name, cleanPath);
yacreaderLibraries.save();
}
@ -42,7 +45,10 @@ void ConsoleUILibraryCreator::updateLibrary(const QString & path)
QEventLoop eventLoop;
LibraryCreator * libraryCreator = new LibraryCreator();
libraryCreator->updateLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
QDir pathDir(path);
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
libraryCreator->updateLibrary(cleanPath,QDir::cleanPath(pathDir.absolutePath()+"/.yacreaderlibrary"));
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
@ -58,13 +64,16 @@ void ConsoleUILibraryCreator::updateLibrary(const QString & path)
void ConsoleUILibraryCreator::addExistingLibrary(const QString & name, const QString & path)
{
QDir pathDir(path);
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
//TODO add error handling
YACReaderLibraries yacreaderLibraries;
yacreaderLibraries.load();
yacreaderLibraries.addLibrary(name, path);
yacreaderLibraries.addLibrary(name, cleanPath);
yacreaderLibraries.save();
std::cout << "Library added : " << name.toUtf8().constData() << " at " << path.toUtf8().constData() << std::endl;
std::cout << "Library added : " << name.toUtf8().constData() << " at " << cleanPath.toUtf8().constData() << std::endl;
}
void ConsoleUILibraryCreator::removeLibrary(const QString & name)

View File

@ -132,7 +132,7 @@ int main( int argc, char ** argv )
QDir().mkpath(YACReader::getSettingsPath());
Logger& logger = Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
logger.setLoggingLevel(QsLogging::InfoLevel);
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));

View File

@ -1,71 +0,0 @@
#functions to automatically initialize some of YACReader's build options to
#default values if they're not set on build time
#for a more detailed description, see INSTALL.TXT
#check Qt version
QT_VERSION = $$[QT_VERSION]
QT_VERSION = $$split(QT_VERSION, ".")
QT_VER_MAJ = $$member(QT_VERSION, 0)
QT_VER_MIN = $$member(QT_VERSION, 1)
lessThan(QT_VER_MAJ, 5) {
error(YACReader requires Qt 5 or newer but Qt $$[QT_VERSION] was detected.)
}
lessThan(QT_VER_MIN, 3){
error ("You need at least Qt 5.3 to build YACReader or YACReaderLibrary")
}
!CONFIG(unarr):!CONFIG(7zip) {
unix {
!macx {
CONFIG+=unarr
}
else {
CONFIG+=7zip
}
}
win32 {
CONFIG+=7zip
}
}
unix {
!macx {
packagesExist(QtCore) {
message("Found QtCore")
}
else: {
error("Missing dependency: QtCore")
}
packagesExist(QtGui) {
message("Found QtGui")
}
else: {
error("Missing dependency: QtGui")
}
packagesExist(poppler-qt5) {
message("Found poppler-qt5")
}
else: {
error("Missing dependency: poppler-qt5")
}
packagesExist(QtNetwork) {
message("Found QtNetwork")
}
else: {
error("Missing dependency: QtNetwork")
}
packagesExist(QtSql) {
message("Found QtSql")
}
else: {
error("Missing dependency: QtSql")
}
packagesExist(sqlite3) {
message("Found sqlite3")
}
else: {
error("Missing dependency: sqlite3")
}
}
}