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 \
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) {

View File

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

View File

@ -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

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -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>("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();

View File

@ -5,7 +5,7 @@
#include <QDebug>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QApplication>
#include <QCoreApplication>
#include <QLibrary>
#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();

View File

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

View File

@ -9,7 +9,7 @@
#include <QDateTime>
#include "httpsession.h"
#include "static.h"
#include <QApplication>
#include <QCoreApplication>
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);

View File

@ -9,7 +9,7 @@
#include <QStringList>
#include <QDir>
#include <QSet>
#include <QApplication>
#include <QCoreApplication>
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();

View File

@ -13,7 +13,7 @@
#include "yacreader_global.h"
#include <QDir>
#include <QApplication>
#include <QCoreApplication>
/** 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";

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
#include <algorithm>
#include <QDir>
#include <QFileInfoList>
#include <QApplication>
#include <QCoreApplication>
#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();
}

View File

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

View File

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

View File

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

View File

@ -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)