From d5a35de96ca32f58a4181fa05d0da0f1d4a5f217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Tue, 8 Oct 2013 23:00:16 +0200 Subject: [PATCH] Fixed YACReaderLibrary compilation under Qt5 (untested at runtime) TODO fix YACReader compilation under Qt5 update poppler update server --- YACReaderLibrary/YACReaderLibrary.pro | 14 ++++++++++---- YACReaderLibrary/library_window.cpp | 7 ++++++- YACReaderLibrary/properties_dialog.cpp | 5 +++++ .../server/lib/bfHttpServer/httpresponse.cpp | 2 +- .../server/lib/bfHttpServer/httpsession.cpp | 4 ++-- YACReaderLibrary/server/lib/bfLogging/logger.cpp | 14 ++++++++++++-- .../server/lib/bfTemplateEngine/templateloader.cpp | 2 +- common/check_new_version.h | 2 -- common/comic.cpp | 4 +++- common/http_worker.h | 2 -- custom_widgets/yacreader_table_view.cpp | 14 +++++++++++++- 11 files changed, 53 insertions(+), 17 deletions(-) diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 339441c5..9586e2e0 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -13,7 +13,7 @@ INCLUDEPATH += ../common \ ./comic_vine \ ./comic_vine/model -DEFINES += SERVER_RELEASE +DEFINES += SERVER_RELEASE NOMINMAX win32 { INCLUDEPATH += ../dependencies/poppler/include @@ -143,6 +143,12 @@ TRANSLATIONS = yacreaderlibrary_es.ts \ yacreaderlibrary_fr.ts \ yacreaderlibrary_nl.ts \ yacreaderlibrary_source.ts - -Release:DESTDIR = ../release -Debug:DESTDIR = ../debug +contains(QT_MINOR_VERSION, 5) { + Release:DESTDIR = ../release5 + Debug:DESTDIR = ../debug5 +} +!contains(QT_MINOR_VERSION, 5) +{ + Release:DESTDIR = ../release + Debug:DESTDIR = ../debug +} diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index ffc72696..3d5f1640 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -939,7 +940,11 @@ void LibraryWindow::loadCovers(const QModelIndex & mi) comicView->setModel(dmCV); comicView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); +#if QT_VERSION >= 0x050100 + comicView->horizontalHeader()->setSectionsMovable(true); +#else comicView->horizontalHeader()->setMovable(true); +#endif //TODO parametrizar la configuración de las columnas for(int i = 0;ihorizontalHeader()->count();i++) comicView->horizontalHeader()->hideSection(i); @@ -1730,4 +1735,4 @@ void LibraryWindow::updateComicsView(quint64 libraryId, const ComicDB & comic) dmCV->reload(comic); comicFlow->setMarks(dmCV->getReadList()); } -} \ No newline at end of file +} diff --git a/YACReaderLibrary/properties_dialog.cpp b/YACReaderLibrary/properties_dialog.cpp index d6e64aef..98016d1a 100644 --- a/YACReaderLibrary/properties_dialog.cpp +++ b/YACReaderLibrary/properties_dialog.cpp @@ -16,6 +16,11 @@ #include #include #include +#include +#include +#include +#include +#include PropertiesDialog::PropertiesDialog(QWidget * parent) :QDialog(parent) diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp index 434afc1e..2d67cf94 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp @@ -112,7 +112,7 @@ void HttpResponse::write(QByteArray data, bool lastPart) { void HttpResponse::writeText(QString text, bool lastPart) { - write(text.toAscii(),lastPart); + write(text.toLatin1(),lastPart); } bool HttpResponse::hasSentLastPart() const { diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp index 499e6eb4..10e30596 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpsession.cpp @@ -13,7 +13,7 @@ HttpSession::HttpSession(bool canStore) { dataPtr=new HttpSessionData(); dataPtr->refCount=1; dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch(); - dataPtr->id=QUuid::createUuid().toString().toAscii(); + dataPtr->id=QUuid::createUuid().toString().toLatin1(); dataPtr->yacreaderSessionData.comic = 0; dataPtr->yacreaderSessionData.comicId = 0; #ifdef SUPERVERBOSE @@ -306,4 +306,4 @@ int HttpSession::topPage() if(dataPtr) return dataPtr->yacreaderSessionData.navigationPath.top(); return 0; -} \ No newline at end of file +} diff --git a/YACReaderLibrary/server/lib/bfLogging/logger.cpp b/YACReaderLibrary/server/lib/bfLogging/logger.cpp index cf559471..7f304c54 100644 --- a/YACReaderLibrary/server/lib/bfLogging/logger.cpp +++ b/YACReaderLibrary/server/lib/bfLogging/logger.cpp @@ -9,6 +9,7 @@ #include #include #include +#include Logger* Logger::defaultLogger=0; @@ -72,7 +73,12 @@ void Logger::msgHandler(const QtMsgType type, const char* message) { Logger::~Logger() { if (defaultLogger==this) { - qInstallMsgHandler(0); +#if QT_VERSION >= 0x050100 + qInstallMessageHandler(0); +#else + qInstallMsgHandler(0); +#endif + defaultLogger=0; } } @@ -86,7 +92,11 @@ void Logger::write(const LogMessage* logMessage) { void Logger::installMsgHandler() { defaultLogger=this; - qInstallMsgHandler(msgHandler); +#if QT_VERSION >= 0x050100 + //qInstallMessageHandler(msgHandler); TODO Qt5 +#else + qInstallMsgHandler(msgHandler); +#endif } diff --git a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp index 121b00de..4ba3611e 100644 --- a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp +++ b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp @@ -30,7 +30,7 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent) textCodec=QTextCodec::codecForLocale(); } else { - textCodec=QTextCodec::codecForName(encoding.toAscii()); + textCodec=QTextCodec::codecForName(encoding.toLatin1()); } qDebug("TemplateLoader: path=%s, codec=%s",qPrintable(templatePath),textCodec->name().data()); } diff --git a/common/check_new_version.h b/common/check_new_version.h index c8cb7f54..5c5e2fb5 100644 --- a/common/check_new_version.h +++ b/common/check_new_version.h @@ -5,8 +5,6 @@ #include "yacreader_global.h" #include -#include -#include #include #include diff --git a/common/comic.cpp b/common/comic.cpp index 6b2d6471..0cc4de32 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -6,6 +6,8 @@ #include #include #include +#include + #include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks #include "qnaturalsorting.h" #include "compressed_archive.h" @@ -698,4 +700,4 @@ Comic * FactoryComic::newComic(const QString & path) else return NULL; -} \ No newline at end of file +} diff --git a/common/http_worker.h b/common/http_worker.h index 4ccc3785..c56a6ebc 100644 --- a/common/http_worker.h +++ b/common/http_worker.h @@ -2,8 +2,6 @@ #define __HTTP_WORKER_H #include -#include -#include #include #include #include diff --git a/custom_widgets/yacreader_table_view.cpp b/custom_widgets/yacreader_table_view.cpp index 05e6b832..b38ff5a6 100644 --- a/custom_widgets/yacreader_table_view.cpp +++ b/custom_widgets/yacreader_table_view.cpp @@ -31,15 +31,27 @@ YACReaderTableView::YACReaderTableView(QWidget *parent) : setContextMenuPolicy(Qt::ActionsContextMenu); setShowGrid(false); - +#if QT_VERSION >= 0x050100 + verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); +#else verticalHeader()->setResizeMode(QHeaderView::Fixed); +#endif //comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); horizontalHeader()->setStretchLastSection(true); +#if QT_VERSION >= 0x050100 + horizontalHeader()->setSectionsClickable(false); +#else horizontalHeader()->setClickable(false); +#endif //comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); verticalHeader()->setDefaultSectionSize(24); +#if QT_VERSION >= 0x050100 + verticalHeader()->setSectionsClickable(false); //TODO comportamiento anómalo +#else verticalHeader()->setClickable(false); //TODO comportamiento anómalo +#endif + setCornerButtonEnabled(false); setSelectionBehavior(QAbstractItemView::SelectRows);