From e1de588e4049bc55e6aee5a96a409782ddc6c679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 12 Dec 2015 12:10:37 +0100 Subject: [PATCH] fixed compilation of YACReaderLibrary and YACReaderLibraryServer, removing all the dependecies on QtWidgets from non gui code --- YACReaderLibrary/YACReaderLibraryServer.pro | 14 ++++------ .../comic_vine/api_key_dialog.cpp | 2 +- .../comic_vine/comic_vine_client.cpp | 1 + YACReaderLibrary/comics_view_transition.cpp | 2 +- YACReaderLibrary/db/comic_model.h | 2 +- YACReaderLibrary/db/data_base_management.cpp | 1 - YACReaderLibrary/db/folder_model.cpp | 2 +- YACReaderLibrary/db/reading_list_item.h | 2 +- YACReaderLibrary/empty_label_widget.h | 2 +- YACReaderLibrary/headless/main.cpp | 25 +++++------------- YACReaderLibrary/library_creator.cpp | 6 ++--- YACReaderLibrary/library_window.h | 2 +- .../lib/bfHttpServer/staticfilecontroller.cpp | 6 ++--- .../lib/bfTemplateEngine/templateloader.cpp | 6 ++--- YACReaderLibrary/server/startup.cpp | 4 +-- YACReaderLibrary/server_config_dialog.cpp | 2 +- common/bookmarks.cpp | 1 - common/check_new_version.cpp | 2 +- common/check_new_version.h | 1 - common/comic.cpp | 26 +++++++++---------- common/http_worker.cpp | 2 +- common/http_worker.h | 1 - common/pictureflow.h | 2 +- custom_widgets/yacreader_sidebar.cpp | 2 +- 24 files changed, 48 insertions(+), 68 deletions(-) diff --git a/YACReaderLibrary/YACReaderLibraryServer.pro b/YACReaderLibrary/YACReaderLibraryServer.pro index d6ff1947..da375155 100644 --- a/YACReaderLibrary/YACReaderLibraryServer.pro +++ b/YACReaderLibrary/YACReaderLibraryServer.pro @@ -67,10 +67,6 @@ HEADERS += library_creator.h \ bundle_creator.h \ db_helper.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/folder.h \ ../common/library_item.h \ @@ -82,8 +78,8 @@ HEADERS += library_creator.h \ comics_remover.h \ ../common/http_worker.h \ yacreader_libraries.h \ - comic_files_manager.h \ -# db/reading_list_model.h + comic_files_manager.h + SOURCES += library_creator.cpp \ .\headless\main.cpp \ @@ -102,8 +98,7 @@ SOURCES += library_creator.cpp \ ../common/http_worker.cpp \ ../common/yacreader_global.cpp \ yacreader_libraries.cpp \ - comic_files_manager.cpp \ - + comic_files_manager.cpp include(./server/server.pri) @@ -114,9 +109,9 @@ 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 \ @@ -130,6 +125,7 @@ TRANSLATIONS = yacreaderlibraryserver_es.ts \ Release:DESTDIR = ../release Debug:DESTDIR = ../debug + unix:!macx { #set install prefix if it's empty isEmpty(PREFIX) { diff --git a/YACReaderLibrary/comic_vine/api_key_dialog.cpp b/YACReaderLibrary/comic_vine/api_key_dialog.cpp index 355ecd0e..0e1b326b 100644 --- a/YACReaderLibrary/comic_vine/api_key_dialog.cpp +++ b/YACReaderLibrary/comic_vine/api_key_dialog.cpp @@ -7,7 +7,7 @@ #include #include -#include "yacreader_global.h" +#include "yacreader_global_gui.h" ApiKeyDialog::ApiKeyDialog(QWidget *parent) : QDialog(parent) diff --git a/YACReaderLibrary/comic_vine/comic_vine_client.cpp b/YACReaderLibrary/comic_vine/comic_vine_client.cpp index cb36d3ca..409ec8c3 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_client.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_client.cpp @@ -1,4 +1,5 @@ #include "comic_vine_client.h" +#include "yacreader_global_gui.h" //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 diff --git a/YACReaderLibrary/comics_view_transition.cpp b/YACReaderLibrary/comics_view_transition.cpp index 6734d479..a41e1070 100644 --- a/YACReaderLibrary/comics_view_transition.cpp +++ b/YACReaderLibrary/comics_view_transition.cpp @@ -8,7 +8,7 @@ #include #include -#include "yacreader_global.h" +#include "yacreader_global_gui.h" ComicsViewTransition::ComicsViewTransition(QWidget *parent) : QWidget(parent),movie(0) diff --git a/YACReaderLibrary/db/comic_model.h b/YACReaderLibrary/db/comic_model.h index bd48038b..ce0de290 100644 --- a/YACReaderLibrary/db/comic_model.h +++ b/YACReaderLibrary/db/comic_model.h @@ -7,7 +7,7 @@ #include #include -#include "yacreader_global.h" +#include "yacreader_global_gui.h" class ComicDB; diff --git a/YACReaderLibrary/db/data_base_management.cpp b/YACReaderLibrary/db/data_base_management.cpp index e8052aee..9f307024 100644 --- a/YACReaderLibrary/db/data_base_management.cpp +++ b/YACReaderLibrary/db/data_base_management.cpp @@ -311,7 +311,6 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database) return success; } -#include void DataBaseManagement::exportComicsInfo(QString source, QString dest) { //QSqlDatabase sourceDB = loadDatabase(source); diff --git a/YACReaderLibrary/db/folder_model.cpp b/YACReaderLibrary/db/folder_model.cpp index 10420299..1df7b199 100644 --- a/YACReaderLibrary/db/folder_model.cpp +++ b/YACReaderLibrary/db/folder_model.cpp @@ -54,7 +54,7 @@ #include "folder.h" #include "db_helper.h" #include "qnaturalsorting.h" -#include "yacreader_global.h" +#include "yacreader_global_gui.h" #include "QsLog.h" #ifdef Q_OS_MAC diff --git a/YACReaderLibrary/db/reading_list_item.h b/YACReaderLibrary/db/reading_list_item.h index e79fea62..6acf898b 100644 --- a/YACReaderLibrary/db/reading_list_item.h +++ b/YACReaderLibrary/db/reading_list_item.h @@ -4,7 +4,7 @@ #include #include -#include "yacreader_global.h" +#include "yacreader_global_gui.h" #include "reading_list_model.h" //TODO add propper constructors, using QList is not safe diff --git a/YACReaderLibrary/empty_label_widget.h b/YACReaderLibrary/empty_label_widget.h index 0e877da6..8dce705c 100644 --- a/YACReaderLibrary/empty_label_widget.h +++ b/YACReaderLibrary/empty_label_widget.h @@ -3,7 +3,7 @@ #include #include "empty_container_info.h" -#include "yacreader_global.h" +#include "yacreader_global_gui.h" class EmptyLabelWidget : public EmptyContainerInfo { diff --git a/YACReaderLibrary/headless/main.cpp b/YACReaderLibrary/headless/main.cpp index 554dcafc..6a94be76 100644 --- a/YACReaderLibrary/headless/main.cpp +++ b/YACReaderLibrary/headless/main.cpp @@ -96,6 +96,8 @@ void logSystemAndConfig() QLOG_INFO() << "7z : found"; else QLOG_ERROR() << "7z : not found"; + + /* #if defined Q_OS_UNIX && !defined Q_OS_MAC if(QFileInfo(QString(BINDIR)+"/qrencode").exists()) #else @@ -104,18 +106,7 @@ void logSystemAndConfig() QLOG_INFO() << "qrencode : found"; else 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() << "--------------------------------------------"; @@ -204,18 +195,14 @@ int main( int argc, char ** argv ) qRegisterMetaType("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 settings->beginGroup("libraryConfig"); s = new Startup(); + s->start(); - if(settings->value(SERVER_ON,true).toBool()) - { - s->start(); - } -#endif - QLOG_INFO() << "YACReaderLibrary attempting to start"; + QLOG_INFO() << "YACReaderLibraryServer attempting to start"; logSystemAndConfig(); diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 8b5662f4..ec12222a 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include "data_base_management.h" @@ -127,13 +127,13 @@ void LibraryCreator::run() #if defined Q_OS_UNIX && !defined Q_OS_MAC QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); #else - QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); + QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath()+"/utils/7z"); #endif if(!sevenzLib->load()) { QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl; - QApplication::exit(YACReader::SevenZNotFound); + QCoreApplication::exit(YACReader::SevenZNotFound); exit(); } sevenzLib->deleteLater(); diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 26b218ac..29ca0232 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -5,7 +5,7 @@ #include #include #include -#include "yacreader_global.h" +#include "yacreader_global_gui.h" #include "yacreader_libraries.h" #include "yacreader_navigation_controller.h" diff --git a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp index b2515e3c..c16a3c28 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp @@ -9,7 +9,7 @@ #include #include "httpsession.h" #include "static.h" -#include +#include StaticFileController::StaticFileController(QSettings* settings, QObject* parent) @@ -29,8 +29,8 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent) QFileInfo configFile(QString(DATADIR)+"/yacreader"); docroot=QFileInfo(QString(DATADIR)+"/yacreader",docroot).absoluteFilePath(); #else - QFileInfo configFile(QApplication::applicationDirPath()); - docroot=QFileInfo(QApplication::applicationDirPath(),docroot).absoluteFilePath(); + QFileInfo configFile(QCoreApplication::applicationDirPath()); + docroot=QFileInfo(QCoreApplication::applicationDirPath(),docroot).absoluteFilePath(); #endif } qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge); diff --git a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp index ea3a2dd8..9ed9cf8f 100644 --- a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp +++ b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent) : QObject(parent) @@ -26,8 +26,8 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent) QFileInfo configFile(QString(DATADIR)+"/yacreader"); templatePath=QFileInfo(QString(DATADIR)+"/yacreader",templatePath).absoluteFilePath(); #else - QFileInfo configFile(QApplication::applicationDirPath()); - templatePath=QFileInfo(QApplication::applicationDirPath(),templatePath).absoluteFilePath(); + QFileInfo configFile(QCoreApplication::applicationDirPath()); + templatePath=QFileInfo(QCoreApplication::applicationDirPath(),templatePath).absoluteFilePath(); #endif } fileNameSuffix=settings->value("suffix",".tpl").toString(); diff --git a/YACReaderLibrary/server/startup.cpp b/YACReaderLibrary/server/startup.cpp index 7166e402..a9927c6e 100644 --- a/YACReaderLibrary/server/startup.cpp +++ b/YACReaderLibrary/server/startup.cpp @@ -13,7 +13,7 @@ #include "yacreader_global.h" #include -#include +#include /** Name of this application */ #define APPNAME "YACReaderLibrary" @@ -26,7 +26,7 @@ void Startup::start() { // Initialize the core application - QCoreApplication* app = QApplication::instance(); + QCoreApplication* app = QCoreApplication::instance(); app->setApplicationName(APPNAME); app->setOrganizationName(ORGANISATION); QString configFileName=YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini"; diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 3e971668..e0fe3bc7 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -11,7 +11,7 @@ #include #include "startup.h" -#include "yacreader_global.h" +#include "yacreader_global_gui.h" #include "qnaturalsorting.h" diff --git a/common/bookmarks.cpp b/common/bookmarks.cpp index d60d8b60..1330c266 100644 --- a/common/bookmarks.cpp +++ b/common/bookmarks.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include "yacreader_global.h" diff --git a/common/check_new_version.cpp b/common/check_new_version.cpp index 6454c980..f1f0eb71 100644 --- a/common/check_new_version.cpp +++ b/common/check_new_version.cpp @@ -1,5 +1,5 @@ #include "check_new_version.h" -#include + #include #include #include diff --git a/common/check_new_version.h b/common/check_new_version.h index 5c5e2fb5..f8e6b146 100644 --- a/common/check_new_version.h +++ b/common/check_new_version.h @@ -4,7 +4,6 @@ #include "http_worker.h" #include "yacreader_global.h" -#include #include #include diff --git a/common/comic.cpp b/common/comic.cpp index 9a148cda..e4a45ee7 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks #include "qnaturalsorting.h" @@ -309,7 +309,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic) else { //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -476,14 +476,14 @@ void FileComic::process() CompressedArchive archive(_path); if(!archive.toolsLoaded()) { - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(tr("7z not found")); return; } if(!archive.isValid()) { - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(tr("Format not supported")); return; } @@ -495,7 +495,7 @@ void FileComic::process() if(_fileNames.size()==0) { //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(); return; } @@ -539,7 +539,7 @@ void FileComic::process() emit imageLoaded(sortedIndex); emit imageLoaded(sortedIndex,_pages[sortedIndex]); }*/ - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit imagesLoaded(); } @@ -598,7 +598,7 @@ void FolderComic::process() { //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")); - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); } else @@ -632,7 +632,7 @@ void FolderComic::process() count++; } } - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit imagesLoaded(); } @@ -675,7 +675,7 @@ bool PDFComic::load(const QString & path, int atPage) } else { - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -698,7 +698,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic) else { //QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path); - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return false; } @@ -722,13 +722,13 @@ void PDFComic::process() { //delete pdfComic; //pdfComic = 0; - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return; } if (pdfComic->isLocked()) { - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit errorOpening(); return; } @@ -764,7 +764,7 @@ void PDFComic::process() renderPage(i); delete pdfComic; - moveToThread(QApplication::instance()->thread()); + moveToThread(QCoreApplication::instance()->thread()); emit imagesLoaded(); } diff --git a/common/http_worker.cpp b/common/http_worker.cpp index eabdcc6c..c64b7c90 100644 --- a/common/http_worker.cpp +++ b/common/http_worker.cpp @@ -1,5 +1,5 @@ #include "http_worker.h" -#include + #include #include #include diff --git a/common/http_worker.h b/common/http_worker.h index 10034717..0cc01136 100644 --- a/common/http_worker.h +++ b/common/http_worker.h @@ -1,7 +1,6 @@ #ifndef __HTTP_WORKER_H #define __HTTP_WORKER_H -#include #include #include #include diff --git a/common/pictureflow.h b/common/pictureflow.h index b746ef70..0ac197d4 100644 --- a/common/pictureflow.h +++ b/common/pictureflow.h @@ -28,7 +28,7 @@ #define PICTUREFLOW_H #include -#include "yacreader_global.h" //FlowType +#include "yacreader_global_gui.h" //FlowType class PictureFlowPrivate; diff --git a/custom_widgets/yacreader_sidebar.cpp b/custom_widgets/yacreader_sidebar.cpp index 2d380e4e..44a796cc 100644 --- a/custom_widgets/yacreader_sidebar.cpp +++ b/custom_widgets/yacreader_sidebar.cpp @@ -8,7 +8,7 @@ #include "yacreader_library_list_widget.h" #include "yacreader_search_line_edit.h" #include "yacreader_titled_toolbar.h" - +#include "yacreader_global_gui.h" YACReaderSideBar::YACReaderSideBar(QWidget *parent) : QWidget(parent)