[-]
[+]
|
Changed |
_service:tar_git:openrepos-books.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-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">c55bf1a</param>
+ <param name="revision">06ff22f</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.tar.gz/app/harbour-books.desktop
^
|
@@ -15,7 +15,7 @@
X-Nemo-Application-Type=silica-qt5
[X-Sailjail]
-Permissions=Documents;Downloads;RemovableMedia
+Permissions=Documents;Downloads;RemovableMedia;Audio
[X-HarbourBackup]
BackupPathList=.local/share/harbour-books/:Documents/Books/
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.tar.gz/app/qml/Books.js
^
|
@@ -1,6 +1,6 @@
.pragma library
-var version = "1.1.2"
+var version = "1.1.5"
function contentOpacity(brightness) {
return 0.4 + brightness * 0.6
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.tar.gz/app/qml/BooksCoverPage.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 the BSD license as follows:
@@ -38,10 +38,10 @@
id: root
transparent: !_haveBook || grid.count < 6
- property variant book
- property variant shelf
+ property var book
+ property var shelf
- property bool _haveBook: book ? true : false
+ readonly property bool _haveBook: book ? true : false
CoverModel {
id: coverModel
@@ -105,7 +105,7 @@
fill: parent
}
text: book ? book.title : ""
- visible: bookCover.empty
- color: "#FFE898"
+ visible: book && !book.hasCover
+ color: "#ffe898" // Derived from the default cover image
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.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:openrepos-books-1.1.5.tar.gz/app/src/BooksBook.cpp
^
|
@@ -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 the BSD license as follows:
*
@@ -71,9 +71,9 @@
public:
CoverPaintContext();
- void drawImage(int x, int y, const ZLImageData& image);
- void drawImage(int x, int y, const ZLImageData& image, int width, int height, ScalingType type);
- void handleImage(const ZLImageData& image);
+ void drawImage(int, int, const ZLImageData&) Q_DECL_OVERRIDE;
+ void drawImage(int, int, const ZLImageData&, int, int, ScalingType) Q_DECL_OVERRIDE;
+ void handleImage(const ZLImageData&);
bool gotIt() const;
public:
@@ -532,11 +532,15 @@
return iCoverImage.width() > 0 && iCoverImage.height() > 0;
}
-void BooksBook::setCoverImage(QImage aImage)
+void BooksBook::setCoverImage(const QImage aImage)
{
if (iCoverImage != aImage) {
+ const bool hadCover = hasCoverImage();
iCoverImage = aImage;
Q_EMIT coverImageChanged();
+ if (hadCover != hasCoverImage()) {
+ Q_EMIT hasCoverChanged();
+ }
}
}
@@ -568,8 +572,7 @@
HDEBUG(iTitle << iCoverTask->hasImage());
const bool gotCover = iCoverTask->hasImage();
if (gotCover) {
- iCoverImage = iCoverTask->iCoverImage;
- Q_EMIT coverImageChanged();
+ setCoverImage(iCoverTask->iCoverImage);
}
iCoverTask->release(this);
iCoverTask = NULL;
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.tar.gz/app/src/BooksBook.h
^
|
@@ -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 the BSD license as follows:
*
@@ -47,7 +47,9 @@
#include <QImage>
#include <QtQml>
-class BooksBook : public QObject, public BooksItem
+class BooksBook :
+ public QObject,
+ public BooksItem
{
class HashTask;
class CoverTask;
@@ -63,6 +65,7 @@
Q_PROPERTY(BooksBook* book READ book CONSTANT)
Q_PROPERTY(bool accessible READ accessible NOTIFY accessibleChanged)
Q_PROPERTY(bool loadingCover READ loadingCover NOTIFY loadingCoverChanged)
+ Q_PROPERTY(bool hasCover READ hasCoverImage NOTIFY hasCoverChanged)
Q_PROPERTY(bool copyingOut READ copyingOut NOTIFY copyingOutChanged)
Q_PROPERTY(bool fontSizeAdjust READ fontSizeAdjust WRITE setFontSizeAdjust NOTIFY fontSizeAdjustChanged)
@@ -80,7 +83,7 @@
QString authors() const;
QByteArray hash() const;
int fontSizeAdjust() const;
- bool setFontSizeAdjust(int aFontSizeAdjust);
+ bool setFontSizeAdjust(int);
int pageStackPos() const;
BooksPos::List pageStack() const;
void setPageStack(BooksPos::List aStack, int aStackPos);
@@ -92,25 +95,25 @@
bool hasCoverImage() const;
bool requestCoverImage();
void cancelCoverRequest();
- void setCoverImage(QImage aImage);
+ void setCoverImage(const QImage);
QImage coverImage() const;
- void setCopyingOut(bool aValue);
+ void setCopyingOut(bool);
// BooksItem
- virtual BooksItem* retain();
- virtual void release();
- virtual QObject* object();
- virtual BooksShelf* shelf();
- virtual BooksBook* book();
- virtual QString name() const;
- virtual QString fileName() const;
- virtual QString path() const;
- virtual bool accessible() const;
- virtual void deleteFiles();
- virtual BooksItem* copyTo(const BooksStorage& aStorage, QString aRelPath,
- CopyOperation* aObserver);
+ BooksItem* retain() Q_DECL_OVERRIDE;
+ void release() Q_DECL_OVERRIDE;
+ QObject* object() Q_DECL_OVERRIDE;
+ BooksShelf* shelf() Q_DECL_OVERRIDE;
+ BooksBook* book() Q_DECL_OVERRIDE;
+ QString name() const Q_DECL_OVERRIDE;
+ QString fileName() const Q_DECL_OVERRIDE;
+ QString path() const Q_DECL_OVERRIDE;
+ bool accessible() const Q_DECL_OVERRIDE;
+ void deleteFiles() Q_DECL_OVERRIDE;
+ BooksItem* copyTo(const BooksStorage&, QString, CopyOperation*) Q_DECL_OVERRIDE;
Q_SIGNALS:
+ void hasCoverChanged();
void coverImageChanged();
void loadingCoverChanged();
void accessibleChanged();
@@ -128,10 +131,10 @@
private:
void init();
bool coverTaskDone();
- bool makeLink(QString aDestPath);
+ bool makeLink(QString);
void requestSave();
QString cachedImagePath() const;
- static bool isCanceled(CopyOperation* aOperation);
+ static bool isCanceled(CopyOperation*);
private:
QAtomicInt iRef;
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-books-1.1.5.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:openrepos-books-1.1.5.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:openrepos-books-1.1.5.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:openrepos-books-1.1.5.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:openrepos-books-1.1.5.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:openrepos-books-1.1.5.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); }
|