[-]
[+]
|
Changed |
_service:tar_git:harbour-books.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-books.git</param>
<param name="branch">master</param>
- <param name="revision">327ba01</param>
+ <param name="revision">74b666e</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/qml/Books.js
^
|
@@ -1,6 +1,6 @@
.pragma library
-var version = "1.1.3"
+var version = "1.1.4"
function contentOpacity(brightness) {
return 0.4 + brightness * 0.6
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/qml/BooksPageView.qml
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2015-2021 Jolla Ltd.
- Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2015-2022 Jolla Ltd.
+ Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -40,7 +40,7 @@
Rectangle {
id: view
- color: Settings.pageBackgroundColor
+ color: widget.backgroundColor
property alias page: widget.page
property alias bookPos: widget.bookPos
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/src/BooksColorScheme.cpp
^
|
@@ -61,20 +61,21 @@
static const Colors DEFAULT_COLORS;
static const QString DEFAULT_SCHEME_ID;
- Private(const Colors*);
+ Private(const Colors*, bool);
~Private();
void updateSchemeId();
- static QString generateSchemeId(const Colors*);
- static QString defaultSchemeId() { return generateSchemeId(&DEFAULT_COLORS); }
+ static QString generateSchemeId(const Colors*, bool);
+ static QString defaultSchemeId() { return generateSchemeId(&DEFAULT_COLORS, false); }
static void parseRgb(QRgb*, const QString&);
static uint rgb(QRgb);
public:
QAtomicInt iRef;
- Colors iColors;
QString iSchemeId;
+ Colors iColors;
+ bool iInverted;
};
const BooksColorScheme::Private::Colors BooksColorScheme::Private::DEFAULT_COLORS = {
@@ -86,9 +87,11 @@
(BooksColorScheme::Private::defaultSchemeId());
BooksColorScheme::Private::Private(
- const Colors* aColors) :
+ const Colors* aColors,
+ bool aInverted) :
iRef(1),
- iColors(*aColors)
+ iColors(*aColors),
+ iInverted(aInverted)
{
// Note: leaving iSchemeId empty. Caller must do updateSchemeId()
}
@@ -99,13 +102,15 @@
QString
BooksColorScheme::Private::generateSchemeId(
- const Colors* aColors)
+ const Colors* aColors,
+ bool aInverted)
{
QCryptographicHash md5(QCryptographicHash::Md5);
#define HASH_COLOR(colorName,ColorName,key,default) \
md5.addData((const char*)&aColors->MEMBER_VAR(ColorName), sizeof(aColors->MEMBER_VAR(ColorName)));
BOOKS_COLORS(HASH_COLOR)
#undef HASH_COLOR
+ md5.addData((const char*)&aInverted, sizeof(aInverted));
return QString(QLatin1String(md5.result().toHex()));
}
@@ -128,7 +133,7 @@
void
BooksColorScheme::Private::updateSchemeId()
{
- iSchemeId = generateSchemeId(&iColors);
+ iSchemeId = generateSchemeId(&iColors, iInverted);
}
void
@@ -201,7 +206,7 @@
#undef PARSE_KEY
if (!colors.isDefault()) {
- (iPrivate = new Private(&colors))->updateSchemeId();
+ (iPrivate = new Private(&colors, false))->updateSchemeId();
}
}
@@ -221,6 +226,12 @@
}
}
+bool
+BooksColorScheme::isInverted() const
+{
+ return iPrivate && iPrivate->iInverted;
+}
+
const QString
BooksColorScheme::schemeId() const
{
@@ -295,11 +306,11 @@
if (iPrivate) { \
Private::Colors colors(iPrivate->iColors); \
colors.MEMBER_VAR(ColorName) = aColor; \
- if (!colors.isDefault()) { \
- (scheme.iPrivate = new Private(&colors))->updateSchemeId(); \
+ if (isInverted() || !colors.isDefault()) { \
+ (scheme.iPrivate = new Private(&colors, isInverted()))->updateSchemeId(); \
} \
} else { \
- scheme.iPrivate = new Private(&Private::DEFAULT_COLORS); \
+ scheme.iPrivate = new Private(&Private::DEFAULT_COLORS, isInverted()); \
scheme.iPrivate->iColors.MEMBER_VAR(ColorName) = aColor; \
scheme.iPrivate->updateSchemeId(); \
} \
@@ -315,8 +326,8 @@
BooksColorScheme scheme;
Private::Colors colors = iPrivate ? iPrivate->iColors : Private::DEFAULT_COLORS;
colors.invert();
- if (!colors.isDefault()) {
- (scheme.iPrivate = new Private(&colors))->updateSchemeId();
+ if (!isInverted() || !colors.isDefault()) {
+ (scheme.iPrivate = new Private(&colors, !isInverted()))->updateSchemeId();
}
return scheme;
}
@@ -329,8 +340,8 @@
Private::Colors colors = iPrivate ? iPrivate->iColors : Private::DEFAULT_COLORS;
colors.invert();
colors.iSelectionBackground = aColor;
- if (!colors.isDefault()) {
- (scheme.iPrivate = new Private(&colors))->updateSchemeId();
+ if (!isInverted() || !colors.isDefault()) {
+ (scheme.iPrivate = new Private(&colors, !isInverted()))->updateSchemeId();
}
return scheme;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/src/BooksColorScheme.h
^
|
@@ -62,6 +62,7 @@
bool operator != (const BooksColorScheme&) const;
bool equals(const BooksColorScheme&) const;
+ bool isInverted() const;
const QString schemeId() const;
const QString toString() const;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/src/BooksPageWidget.cpp
^
|
@@ -48,7 +48,6 @@
#include <QPainter>
static const QString IMAGE_URL("image://%1/%2");
-static const int REPAINT_DELAY_MSEC = 250;
// ==========================================================================
// BooksPageWidget::Data
@@ -534,6 +533,7 @@
iSettings(BooksSettings::sharedInstance()),
iTaskQueue(BooksTaskQueue::defaultQueue()),
iTextStyle(BooksTextStyle::defaults()),
+ iBackgroundColor(iSettings->pageBackgroundColor()),
iModel(NULL),
iResetTask(NULL),
iRenderTask(NULL),
@@ -647,7 +647,7 @@
{
HDEBUG(iPage);
HASSERT(sender() == iSettings);
- scheduleRepaintDelayUpdate();
+ scheduleRepaint();
}
void
@@ -825,22 +825,6 @@
}
void
-BooksPageWidget::scheduleRepaintDelayUpdate()
-{
- BooksLoadingSignalBlocker block(this);
- cancelRepaint();
- if (width() > 0 && height() > 0) {
- if (!iData.isNull() && !iData->iView.isNull()) {
- (iRenderTask = new RenderTask(iTaskQueue->pool(), thread(),
- iData, iSettings->colorScheme()))->submit(this,
- SLOT(onRenderTaskDoneDelayUpdate()));
- } else if (!iDelayUpdateTimer.isActive()) {
- iDelayUpdateTimer.start(REPAINT_DELAY_MSEC, this);
- }
- }
-}
-
-void
BooksPageWidget::updateNow()
{
iDelayUpdateTimer.stop();
@@ -862,10 +846,16 @@
void
BooksPageWidget::renderTaskDone()
{
- HASSERT(sender() == iRenderTask);
- iImage = iRenderTask->iImage;
- iRenderTask->release(this);
+ RenderTask* task = iRenderTask;
+ HASSERT(sender() == task);
iRenderTask = NULL;
+ iImage = task->iImage;
+ const QColor bg(task->iColors.background());
+ if (iBackgroundColor != bg) {
+ iBackgroundColor = bg;
+ Q_EMIT backgroundColorChanged();
+ }
+ task->release(this);
}
void
@@ -877,16 +867,6 @@
}
void
-BooksPageWidget::onRenderTaskDoneDelayUpdate()
-{
- BooksLoadingSignalBlocker block(this);
- renderTaskDone();
- if (!iDelayUpdateTimer.isActive()) {
- iDelayUpdateTimer.start(REPAINT_DELAY_MSEC, this);
- }
-}
-
-void
BooksPageWidget::timerEvent(
QTimerEvent* aEvent)
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/src/BooksPageWidget.h
^
|
@@ -46,6 +46,7 @@
#include <QQuickPaintedItem>
#include <QBasicTimer>
+#include <QColor>
#include <QList>
class BooksPageWidget: public QQuickPaintedItem, private BooksLoadingProperty
@@ -61,6 +62,7 @@
Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
Q_PROPERTY(int topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
Q_PROPERTY(int bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(BooksBookModel* model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(BooksPos bookPos READ bookPos WRITE setBookPos NOTIFY bookPosChanged)
@@ -83,6 +85,8 @@
int page() const;
void setPage(int);
+ QColor backgroundColor() const;
+
BooksBookModel* model() const;
void setModel(BooksBookModel*);
@@ -119,6 +123,7 @@
void rightMarginChanged();
void topMarginChanged();
void bottomMarginChanged();
+ void backgroundColorChanged();
void browserLinkPressed(QString url);
void imagePressed(QString imageId, QRect rect);
void activeTouch(int touchX, int touchY);
@@ -134,7 +139,6 @@
void onColorsChanged();
void onResetTaskDone();
void onRenderTaskDone();
- void onRenderTaskDoneDelayUpdate();
void onClearSelectionTaskDone();
void onStartSelectionTaskDone();
void onExtendSelectionTaskDone();
@@ -151,7 +155,6 @@
void resetView();
void releaseExtendSelectionTasks();
void scheduleRepaint();
- void scheduleRepaintDelayUpdate();
void cancelRepaint();
void renderTaskDone();
void updateNow();
@@ -169,6 +172,7 @@
shared_ptr<BooksTaskQueue> iTaskQueue;
shared_ptr<ZLTextStyle> iTextStyle;
BooksPos iBookPos;
+ QColor iBackgroundColor;
QBasicTimer iResizeTimer;
QBasicTimer iDelayUpdateTimer;
BooksBookModel* iModel;
@@ -203,6 +207,8 @@
{ return iPage; }
inline const BooksPos& BooksPageWidget::bookPos() const
{ return iBookPos; }
+inline QColor BooksPageWidget::backgroundColor() const
+ { return iBackgroundColor; }
inline BooksBookModel* BooksPageWidget::model() const
{ return iModel; }
inline int BooksPageWidget::leftMargin() const
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/app/src/BooksPaintContext.cpp
^
|
@@ -291,6 +291,10 @@
} else {
argb = ZLColor::rgbValue(rgb);
}
+ if (aColors.isInverted()) {
+ argb = ((~(argb & ZLColor::RGB_MASK)) & ZLColor::RGB_MASK) |
+ (argb & ZLColor::ALPHA_MASK);
+ }
}
}
} else if (aStyle == INTERNAL_HYPERLINK) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-books-1.1.4.tar.gz/fbreader/fbreader/zlibrary/core/src/util/ZLColor.h
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
- * Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
unsigned char Blue;
static const unsigned long ALPHA_MASK = 0xff000000;
+ static const unsigned long RGB_MASK = 0x00ffffff;
ZLColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
ZLColor(unsigned char r, unsigned char g, unsigned char b);
@@ -37,7 +38,7 @@
unsigned long intValue();
static unsigned long rgbValue(unsigned long rgb, unsigned char a = 0xff);
- bool equals(const ZLColor color) const;
+ bool equals(const ZLColor& color) const;
bool operator == (const ZLColor &color) const;
bool operator != (const ZLColor &color) const;
};
@@ -48,7 +49,7 @@
inline void ZLColor::setIntValue(unsigned long argb) { Alpha = (unsigned char)(argb >> 24); Red = (unsigned char)(argb >> 16); Green = (unsigned char)(argb >> 8); Blue = (unsigned char)argb; }
inline unsigned long ZLColor::intValue() { return (((unsigned long)Alpha) << 24) | (((unsigned long)Red) << 16) | (((unsigned long)Green) << 8) | (unsigned long)Blue; }
inline unsigned long ZLColor::rgbValue(unsigned long rgb, unsigned char a) { return (((unsigned long)a) << 24) | rgb; }
-inline bool ZLColor::equals(const ZLColor color) const { return (Red == color.Red) && (Green == color.Green) && (Blue == color.Blue) && (Alpha == color.Alpha); }
+inline bool ZLColor::equals(const ZLColor& color) const { return (Red == color.Red) && (Green == color.Green) && (Blue == color.Blue) && (Alpha == color.Alpha); }
inline bool ZLColor::operator == (const ZLColor &color) const { return equals(color); }
inline bool ZLColor::operator != (const ZLColor &color) const { return !equals(color); }
|