reintroduced epub support
This commit is contained in:
49 files changed
+5048
-205
No files matched your search
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
#include <QQuickPaintedItem>
|
||||
#include <QVariant>
|
||||
|
||||
#include "layout/ChunkLayoutEngine.h"
|
||||
|
||||
class BookImageResolver;
|
||||
|
||||
class KnuthPlassItem : public QQuickPaintedItem {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariant layout READ layout WRITE setLayout NOTIFY layoutChanged)
|
||||
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY colorsChanged)
|
||||
Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor NOTIFY colorsChanged)
|
||||
Q_PROPERTY(QColor dimColor READ dimColor WRITE setDimColor NOTIFY colorsChanged)
|
||||
Q_PROPERTY(qreal horizontalMargin READ horizontalMargin WRITE setHorizontalMargin NOTIFY horizontalMarginChanged)
|
||||
|
||||
public:
|
||||
explicit KnuthPlassItem(QQuickItem *parent = nullptr);
|
||||
|
||||
QVariant layout() const { return m_layoutVariant; }
|
||||
void setLayout(const QVariant &val);
|
||||
|
||||
QColor textColor() const { return m_textColor; }
|
||||
void setTextColor(const QColor &c);
|
||||
|
||||
QColor linkColor() const { return m_linkColor; }
|
||||
void setLinkColor(const QColor &c);
|
||||
|
||||
QColor dimColor() const { return m_dimColor; }
|
||||
void setDimColor(const QColor &c);
|
||||
|
||||
qreal horizontalMargin() const { return m_horizontalMargin; }
|
||||
void setHorizontalMargin(qreal m);
|
||||
|
||||
void paint(QPainter *painter) override;
|
||||
|
||||
static void setImageResolver(BookImageResolver *resolver);
|
||||
|
||||
protected:
|
||||
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
|
||||
|
||||
signals:
|
||||
void layoutChanged();
|
||||
void colorsChanged();
|
||||
void horizontalMarginChanged();
|
||||
|
||||
private:
|
||||
QVariant m_layoutVariant;
|
||||
ChunkLayout m_layout;
|
||||
|
||||
QColor m_textColor = QColor(196, 200, 216); // Theme.readingText default
|
||||
QColor m_linkColor = QColor(87, 133, 193); // Theme.buttonAccent default
|
||||
QColor m_dimColor = QColor(113, 115, 140); // Theme.dimText default
|
||||
qreal m_horizontalMargin = 0;
|
||||
|
||||
static BookImageResolver *s_imageResolver;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user