fixed compilation of YACReaderLibrary and YACReaderLibraryServer, removing all the dependecies on QtWidgets from non gui code

This commit is contained in:
Luis Ángel San Martín 2015-12-12 12:10:37 +01:00
parent c1e14aea1f
commit e1de588e40
24 changed files with 48 additions and 68 deletions

View File

@ -67,10 +67,6 @@ HEADERS += library_creator.h \
bundle_creator.h \ bundle_creator.h \
db_helper.h \ db_helper.h \
./db/data_base_management.h \ ./db/data_base_management.h \
# ./db/folder_item.h \
# ./db/folder_model.h \
# ./db/comic_model.h \
# ./db/comic_item.h \
../common/comic_db.h \ ../common/comic_db.h \
../common/folder.h \ ../common/folder.h \
../common/library_item.h \ ../common/library_item.h \
@ -82,8 +78,8 @@ HEADERS += library_creator.h \
comics_remover.h \ comics_remover.h \
../common/http_worker.h \ ../common/http_worker.h \
yacreader_libraries.h \ yacreader_libraries.h \
comic_files_manager.h \ comic_files_manager.h
# db/reading_list_model.h
SOURCES += library_creator.cpp \ SOURCES += library_creator.cpp \
.\headless\main.cpp \ .\headless\main.cpp \
@ -102,8 +98,7 @@ SOURCES += library_creator.cpp \
../common/http_worker.cpp \ ../common/http_worker.cpp \
../common/yacreader_global.cpp \ ../common/yacreader_global.cpp \
yacreader_libraries.cpp \ yacreader_libraries.cpp \
comic_files_manager.cpp \ comic_files_manager.cpp
include(./server/server.pri) include(./server/server.pri)
@ -114,9 +109,9 @@ include(../compressed_archive/unarr/unarr-wrapper.pri)
} else { } else {
error(No compression backend specified. Did you mess with the build system?) error(No compression backend specified. Did you mess with the build system?)
} }
include(../QsLog/QsLog.pri) include(../QsLog/QsLog.pri)
TRANSLATIONS = yacreaderlibraryserver_es.ts \ TRANSLATIONS = yacreaderlibraryserver_es.ts \
yacreaderlibraryserver_ru.ts \ yacreaderlibraryserver_ru.ts \
yacreaderlibraryserver_pt.ts \ yacreaderlibraryserver_pt.ts \
@ -130,6 +125,7 @@ TRANSLATIONS = yacreaderlibraryserver_es.ts \
Release:DESTDIR = ../release Release:DESTDIR = ../release
Debug:DESTDIR = ../debug Debug:DESTDIR = ../debug
unix:!macx { unix:!macx {
#set install prefix if it's empty #set install prefix if it's empty
isEmpty(PREFIX) { isEmpty(PREFIX) {

View File

@ -7,7 +7,7 @@
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include "yacreader_global.h" #include "yacreader_global_gui.h"
ApiKeyDialog::ApiKeyDialog(QWidget *parent) : ApiKeyDialog::ApiKeyDialog(QWidget *parent) :
QDialog(parent) QDialog(parent)

View File

@ -1,4 +1,5 @@
#include "comic_vine_client.h" #include "comic_vine_client.h"
#include "yacreader_global_gui.h"
//this is the API key used by YACReader to access Comic Vine //this is the API key used by YACReader to access Comic Vine
//please, do not use it in your own software, get one for free at Comic Vine //please, do not use it in your own software, get one for free at Comic Vine

View File

@ -8,7 +8,7 @@
#include <QSizePolicy> #include <QSizePolicy>
#include <QPainter> #include <QPainter>
#include "yacreader_global.h" #include "yacreader_global_gui.h"
ComicsViewTransition::ComicsViewTransition(QWidget *parent) : ComicsViewTransition::ComicsViewTransition(QWidget *parent) :
QWidget(parent),movie(0) QWidget(parent),movie(0)

View File

@ -7,7 +7,7 @@
#include <QSqlQuery> #include <QSqlQuery>
#include <QSqlDatabase> #include <QSqlDatabase>
#include "yacreader_global.h" #include "yacreader_global_gui.h"
class ComicDB; class ComicDB;

View File

@ -311,7 +311,6 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
return success; return success;
} }
#include <qmessagebox.h>
void DataBaseManagement::exportComicsInfo(QString source, QString dest) void DataBaseManagement::exportComicsInfo(QString source, QString dest)
{ {
//QSqlDatabase sourceDB = loadDatabase(source); //QSqlDatabase sourceDB = loadDatabase(source);

View File

@ -54,7 +54,7 @@
#include "folder.h" #include "folder.h"
#include "db_helper.h" #include "db_helper.h"
#include "qnaturalsorting.h" #include "qnaturalsorting.h"
#include "yacreader_global.h" #include "yacreader_global_gui.h"
#include "QsLog.h" #include "QsLog.h"
#ifdef Q_OS_MAC #ifdef Q_OS_MAC

View File

@ -4,7 +4,7 @@
#include <QIcon> #include <QIcon>
#include <QVariant> #include <QVariant>
#include "yacreader_global.h" #include "yacreader_global_gui.h"
#include "reading_list_model.h" #include "reading_list_model.h"
//TODO add propper constructors, using QList<QVariant> is not safe //TODO add propper constructors, using QList<QVariant> is not safe

View File

@ -3,7 +3,7 @@
#include <QtWidgets> #include <QtWidgets>
#include "empty_container_info.h" #include "empty_container_info.h"
#include "yacreader_global.h" #include "yacreader_global_gui.h"
class EmptyLabelWidget : public EmptyContainerInfo class EmptyLabelWidget : public EmptyContainerInfo
{ {

View File

@ -96,6 +96,8 @@ void logSystemAndConfig()
QLOG_INFO() << "7z : found"; QLOG_INFO() << "7z : found";
else else
QLOG_ERROR() << "7z : not found"; QLOG_ERROR() << "7z : not found";
/*
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MAC
if(QFileInfo(QString(BINDIR)+"/qrencode").exists()) if(QFileInfo(QString(BINDIR)+"/qrencode").exists())
#else #else
@ -104,18 +106,7 @@ void logSystemAndConfig()
QLOG_INFO() << "qrencode : found"; QLOG_INFO() << "qrencode : found";
else else
QLOG_INFO() << "qrencode : not found"; QLOG_INFO() << "qrencode : not found";
*/
QSettings settings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
settings.beginGroup("libraryConfig");
if(settings.value(SERVER_ON,true).toBool())
QLOG_INFO() << "server : enabled";
else
QLOG_INFO() << "server : disabled";
if(settings.value(USE_OPEN_GL).toBool())
QLOG_INFO() << "OpenGL : enabled" << " - " << (settings.value(V_SYNC).toBool()?"VSync on":"VSync off");
else
QLOG_INFO() << "OpenGL : disabled";
QLOG_INFO() << "Libraries: " << DBHelper::getLibraries().getLibraries(); QLOG_INFO() << "Libraries: " << DBHelper::getLibraries().getLibraries();
QLOG_INFO() << "--------------------------------------------"; QLOG_INFO() << "--------------------------------------------";
@ -204,18 +195,14 @@ int main( int argc, char ** argv )
qRegisterMetaType<ComicDB>("ComicDB"); qRegisterMetaType<ComicDB>("ComicDB");
#ifdef SERVER_RELEASE
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()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creaci�n del fichero de config con el servidor
settings->beginGroup("libraryConfig"); settings->beginGroup("libraryConfig");
s = new Startup(); s = new Startup();
if(settings->value(SERVER_ON,true).toBool())
{
s->start(); s->start();
}
#endif QLOG_INFO() << "YACReaderLibraryServer attempting to start";
QLOG_INFO() << "YACReaderLibrary attempting to start";
logSystemAndConfig(); logSystemAndConfig();

View File

@ -5,7 +5,7 @@
#include <QDebug> #include <QDebug>
#include <QSqlQuery> #include <QSqlQuery>
#include <QSqlRecord> #include <QSqlRecord>
#include <QApplication> #include <QCoreApplication>
#include <QLibrary> #include <QLibrary>
#include "data_base_management.h" #include "data_base_management.h"
@ -127,13 +127,13 @@ void LibraryCreator::run()
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MAC
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so");
#else #else
QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); QLibrary *sevenzLib = new QLibrary(QCoreApplication::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;
QApplication::exit(YACReader::SevenZNotFound); QCoreApplication::exit(YACReader::SevenZNotFound);
exit(); exit();
} }
sevenzLib->deleteLater(); sevenzLib->deleteLater();

View File

@ -5,7 +5,7 @@
#include <QMap> #include <QMap>
#include <QModelIndex> #include <QModelIndex>
#include <QFileInfo> #include <QFileInfo>
#include "yacreader_global.h" #include "yacreader_global_gui.h"
#include "yacreader_libraries.h" #include "yacreader_libraries.h"
#include "yacreader_navigation_controller.h" #include "yacreader_navigation_controller.h"

View File

@ -9,7 +9,7 @@
#include <QDateTime> #include <QDateTime>
#include "httpsession.h" #include "httpsession.h"
#include "static.h" #include "static.h"
#include <QApplication> #include <QCoreApplication>
StaticFileController::StaticFileController(QSettings* settings, QObject* parent) StaticFileController::StaticFileController(QSettings* settings, QObject* parent)
@ -29,8 +29,8 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent)
QFileInfo configFile(QString(DATADIR)+"/yacreader"); QFileInfo configFile(QString(DATADIR)+"/yacreader");
docroot=QFileInfo(QString(DATADIR)+"/yacreader",docroot).absoluteFilePath(); docroot=QFileInfo(QString(DATADIR)+"/yacreader",docroot).absoluteFilePath();
#else #else
QFileInfo configFile(QApplication::applicationDirPath()); QFileInfo configFile(QCoreApplication::applicationDirPath());
docroot=QFileInfo(QApplication::applicationDirPath(),docroot).absoluteFilePath(); docroot=QFileInfo(QCoreApplication::applicationDirPath(),docroot).absoluteFilePath();
#endif #endif
} }
qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge); qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge);

View File

@ -9,7 +9,7 @@
#include <QStringList> #include <QStringList>
#include <QDir> #include <QDir>
#include <QSet> #include <QSet>
#include <QApplication> #include <QCoreApplication>
TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent) TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent)
: QObject(parent) : QObject(parent)
@ -26,8 +26,8 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent)
QFileInfo configFile(QString(DATADIR)+"/yacreader"); QFileInfo configFile(QString(DATADIR)+"/yacreader");
templatePath=QFileInfo(QString(DATADIR)+"/yacreader",templatePath).absoluteFilePath(); templatePath=QFileInfo(QString(DATADIR)+"/yacreader",templatePath).absoluteFilePath();
#else #else
QFileInfo configFile(QApplication::applicationDirPath()); QFileInfo configFile(QCoreApplication::applicationDirPath());
templatePath=QFileInfo(QApplication::applicationDirPath(),templatePath).absoluteFilePath(); templatePath=QFileInfo(QCoreApplication::applicationDirPath(),templatePath).absoluteFilePath();
#endif #endif
} }
fileNameSuffix=settings->value("suffix",".tpl").toString(); fileNameSuffix=settings->value("suffix",".tpl").toString();

View File

@ -13,7 +13,7 @@
#include "yacreader_global.h" #include "yacreader_global.h"
#include <QDir> #include <QDir>
#include <QApplication> #include <QCoreApplication>
/** Name of this application */ /** Name of this application */
#define APPNAME "YACReaderLibrary" #define APPNAME "YACReaderLibrary"
@ -26,7 +26,7 @@
void Startup::start() { void Startup::start() {
// Initialize the core application // Initialize the core application
QCoreApplication* app = QApplication::instance(); QCoreApplication* app = QCoreApplication::instance();
app->setApplicationName(APPNAME); app->setApplicationName(APPNAME);
app->setOrganizationName(ORGANISATION); app->setOrganizationName(ORGANISATION);
QString configFileName=YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini"; QString configFileName=YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini";

View File

@ -11,7 +11,7 @@
#include <QBitmap> #include <QBitmap>
#include "startup.h" #include "startup.h"
#include "yacreader_global.h" #include "yacreader_global_gui.h"
#include "qnaturalsorting.h" #include "qnaturalsorting.h"

View File

@ -4,7 +4,6 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox>
#include <QList> #include <QList>
#include "yacreader_global.h" #include "yacreader_global.h"

View File

@ -1,5 +1,5 @@
#include "check_new_version.h" #include "check_new_version.h"
#include <QMessageBox>
#include <QUrl> #include <QUrl>
#include <QtGlobal> #include <QtGlobal>
#include <QStringList> #include <QStringList>

View File

@ -4,7 +4,6 @@
#include "http_worker.h" #include "http_worker.h"
#include "yacreader_global.h" #include "yacreader_global.h"
#include <QWidget>
#include <QByteArray> #include <QByteArray>
#include <QThread> #include <QThread>

View File

@ -6,7 +6,7 @@
#include <algorithm> #include <algorithm>
#include <QDir> #include <QDir>
#include <QFileInfoList> #include <QFileInfoList>
#include <QApplication> #include <QCoreApplication>
#include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks #include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks
#include "qnaturalsorting.h" #include "qnaturalsorting.h"
@ -309,7 +309,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
else else
{ {
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -476,14 +476,14 @@ void FileComic::process()
CompressedArchive archive(_path); CompressedArchive archive(_path);
if(!archive.toolsLoaded()) if(!archive.toolsLoaded())
{ {
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(tr("7z not found")); emit errorOpening(tr("7z not found"));
return; return;
} }
if(!archive.isValid()) if(!archive.isValid())
{ {
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(tr("Format not supported")); emit errorOpening(tr("Format not supported"));
return; return;
} }
@ -495,7 +495,7 @@ void FileComic::process()
if(_fileNames.size()==0) if(_fileNames.size()==0)
{ {
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file")); //QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
@ -539,7 +539,7 @@ void FileComic::process()
emit imageLoaded(sortedIndex); emit imageLoaded(sortedIndex);
emit imageLoaded(sortedIndex,_pages[sortedIndex]); emit imageLoaded(sortedIndex,_pages[sortedIndex]);
}*/ }*/
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }
@ -598,7 +598,7 @@ void FolderComic::process()
{ {
//TODO emitir este mensaje en otro sitio //TODO emitir este mensaje en otro sitio
//QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder")); //QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
} }
else else
@ -632,7 +632,7 @@ void FolderComic::process()
count++; count++;
} }
} }
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }
@ -675,7 +675,7 @@ bool PDFComic::load(const QString & path, int atPage)
} }
else else
{ {
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -698,7 +698,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic)
else else
{ {
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return false; return false;
} }
@ -722,13 +722,13 @@ void PDFComic::process()
{ {
//delete pdfComic; //delete pdfComic;
//pdfComic = 0; //pdfComic = 0;
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
if (pdfComic->isLocked()) if (pdfComic->isLocked())
{ {
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(); emit errorOpening();
return; return;
} }
@ -764,7 +764,7 @@ void PDFComic::process()
renderPage(i); renderPage(i);
delete pdfComic; delete pdfComic;
moveToThread(QApplication::instance()->thread()); moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded(); emit imagesLoaded();
} }

View File

@ -1,5 +1,5 @@
#include "http_worker.h" #include "http_worker.h"
#include <QMessageBox>
#include <QUrl> #include <QUrl>
#include <QtGlobal> #include <QtGlobal>
#include <QStringList> #include <QStringList>

View File

@ -1,7 +1,6 @@
#ifndef __HTTP_WORKER_H #ifndef __HTTP_WORKER_H
#define __HTTP_WORKER_H #define __HTTP_WORKER_H
#include <QWidget>
#include <QByteArray> #include <QByteArray>
#include <QThread> #include <QThread>
#include <QUrl> #include <QUrl>

View File

@ -28,7 +28,7 @@
#define PICTUREFLOW_H #define PICTUREFLOW_H
#include <qwidget.h> #include <qwidget.h>
#include "yacreader_global.h" //FlowType #include "yacreader_global_gui.h" //FlowType
class PictureFlowPrivate; class PictureFlowPrivate;

View File

@ -8,7 +8,7 @@
#include "yacreader_library_list_widget.h" #include "yacreader_library_list_widget.h"
#include "yacreader_search_line_edit.h" #include "yacreader_search_line_edit.h"
#include "yacreader_titled_toolbar.h" #include "yacreader_titled_toolbar.h"
#include "yacreader_global_gui.h"
YACReaderSideBar::YACReaderSideBar(QWidget *parent) : YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
QWidget(parent) QWidget(parent)