From f76184cb556a8c1f0cfd3dfefd2b45090304a092 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 13 Aug 2014 21:07:32 +0200 Subject: [PATCH] Revert e96dabc467e709a55e67a582da5cbab07ac1ae76 Diggory i think there was a misunderstanding in our discussion The patch is unfinished (not goot to commit with a TODO) and needs to be improved (need to find a way to not break ABI, QSize param should be const &) please open a reviewrequest and we can discuss/finalize it there. CCMAIL: diggory.hardy@unibas.ch --- core/generator.h | 12 ++++++------ generators/epub/converter.cpp | 4 +--- generators/epub/epubdocument.cpp | 9 ++------- generators/epub/epubdocument.h | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/core/generator.h b/core/generator.h index e006b9257..9a1d7b26f 100644 --- a/core/generator.h +++ b/core/generator.h @@ -430,12 +430,6 @@ class OKULAR_EXPORT Generator : public QObject */ void setDPI(const QSizeF &dpi); - /** - * Returns DPI, previously set via setDPI() - * @since 0.19 (KDE 4.13) - */ - QSizeF dpi() const; - Q_SIGNALS: /** * This signal should be emitted whenever an error occurred in the generator. @@ -528,6 +522,12 @@ class OKULAR_EXPORT Generator : public QObject */ void updatePageBoundingBox( int page, const NormalizedRect & boundingBox ); + /** + * Returns DPI, previously set via setDPI() + * @since 0.19 (KDE 4.13) + */ + QSizeF dpi() const; + protected Q_SLOTS: /** * Gets the font data for the given font diff --git a/generators/epub/converter.cpp b/generators/epub/converter.cpp index ddacfbe44..392947ea3 100644 --- a/generators/epub/converter.cpp +++ b/generators/epub/converter.cpp @@ -158,7 +158,6 @@ static QPoint calculateXYPosition( QTextDocument *document, int startPosition ) double x = startBoundingRect.x() ; double y = startBoundingRect.y() + startLine.y(); - //TODO: should this 800 be modified as in y = (int)y % 800; return QPoint(x,y); @@ -166,8 +165,7 @@ static QPoint calculateXYPosition( QTextDocument *document, int startPosition ) QTextDocument* Converter::convert( const QString &fileName ) { - EpubDocument *newDocument = - new EpubDocument(fileName, generator()->dpi()); + EpubDocument *newDocument = new EpubDocument(fileName); if (!newDocument->isValid()) { emit error(i18n("Error while opening the EPub document."), -1); delete newDocument; diff --git a/generators/epub/epubdocument.cpp b/generators/epub/epubdocument.cpp index 5efac7ee7..92fafbbfe 100644 --- a/generators/epub/epubdocument.cpp +++ b/generators/epub/epubdocument.cpp @@ -29,17 +29,12 @@ QString resourceUrl(const KUrl &baseUrl, const QString &u) } -EpubDocument::EpubDocument(const QString &fileName, QSizeF dpi) : - QTextDocument(), +EpubDocument::EpubDocument(const QString &fileName) : QTextDocument(), padding(20) { mEpub = epub_open(qPrintable(fileName), 3); - //NOTE: the 600, 800 values may or may not be a good base. Scaling by DPI - // seems to produce reasonable results. - // Assume 96 is the base DPI - QSizeF size(600 * dpi.width() / 96.0f, 800 * dpi.height() / 96.0f); - setPageSize(size); + setPageSize(QSizeF(600, 800)); } bool EpubDocument::isValid() diff --git a/generators/epub/epubdocument.h b/generators/epub/epubdocument.h index 8cb317b8a..f0d55b0ea 100644 --- a/generators/epub/epubdocument.h +++ b/generators/epub/epubdocument.h @@ -22,7 +22,7 @@ namespace Epub { class EpubDocument : public QTextDocument { public: - EpubDocument(const QString &fileName, QSizeF dpi); + EpubDocument(const QString &fileName); bool isValid(); ~EpubDocument(); struct epub *getEpub();