Commit f76184cb authored by Albert Astals Cid's avatar Albert Astals Cid

Revert e96dabc4

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
parent e96dabc4
......@@ -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
......
......@@ -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;
......
......@@ -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()
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment