[app] Added dconf option to turn pages by tapping the screen
This commit is contained in:
parent
be2b66f955
commit
278baef519
4 changed files with 38 additions and 4 deletions
|
@ -213,6 +213,16 @@ SilicaFlickable {
|
||||||
}
|
}
|
||||||
onPageClicked: {
|
onPageClicked: {
|
||||||
root.pageClicked(index)
|
root.pageClicked(index)
|
||||||
|
if (Settings.turnPageByTap && mouseY > bookModel.topMargin && mouseY < (pageView.height - bookModel.topMargin)) {
|
||||||
|
if (mouseX < pageView.width/4) {
|
||||||
|
bookView.prevPage()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (mouseX > pageView.width*3/4) {
|
||||||
|
bookView.nextPage()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!Settings.pageDetailsFixed) {
|
if (!Settings.pageDetailsFixed) {
|
||||||
Settings.pageDetails = (Settings.pageDetails + 1) % _visibilityStates.length
|
Settings.pageDetails = (Settings.pageDetails + 1) % _visibilityStates.length
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2015-2017 Jolla Ltd.
|
Copyright (C) 2015-2018 Jolla Ltd.
|
||||||
Contact: Slava Monich <slava.monich@jolla.com>
|
Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
|
||||||
|
|
||||||
You may use this file under the terms of BSD license as follows:
|
You may use this file under the terms of BSD license as follows:
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ Item {
|
||||||
property bool titleVisible
|
property bool titleVisible
|
||||||
property bool pageNumberVisible
|
property bool pageNumberVisible
|
||||||
|
|
||||||
signal pageClicked()
|
signal pageClicked(var mouseX, var mouseY)
|
||||||
signal imagePressed(var url, var rect)
|
signal imagePressed(var url, var rect)
|
||||||
signal footnotePressed(var touchX, var touchY, var text, var url)
|
signal footnotePressed(var touchX, var touchY, var text, var url)
|
||||||
signal browserLinkPressed(var url)
|
signal browserLinkPressed(var url)
|
||||||
|
@ -163,7 +163,7 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (widget.selectionEmpty) {
|
if (widget.selectionEmpty) {
|
||||||
view.pageClicked()
|
view.pageClicked(mouseX, mouseY)
|
||||||
} else {
|
} else {
|
||||||
widget.clearSelection()
|
widget.clearSelection()
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#define KEY_FONT_SIZE "fontSize"
|
#define KEY_FONT_SIZE "fontSize"
|
||||||
#define KEY_PAGE_DETAILS "pageDetails"
|
#define KEY_PAGE_DETAILS "pageDetails"
|
||||||
#define KEY_PAGE_DETAILS_FIXED "pageDetailsFixed"
|
#define KEY_PAGE_DETAILS_FIXED "pageDetailsFixed"
|
||||||
|
#define KEY_TURN_PAGE_BY_TAP "turnPageByTap"
|
||||||
#define KEY_CURRENT_BOOK "currentBook"
|
#define KEY_CURRENT_BOOK "currentBook"
|
||||||
#define KEY_CURRENT_FOLDER "currentFolder"
|
#define KEY_CURRENT_FOLDER "currentFolder"
|
||||||
#define KEY_REMOVABLE_ROOT "removableRoot"
|
#define KEY_REMOVABLE_ROOT "removableRoot"
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
#define DEFAULT_FONT_SIZE 0
|
#define DEFAULT_FONT_SIZE 0
|
||||||
#define DEFAULT_PAGE_DETAILS 0
|
#define DEFAULT_PAGE_DETAILS 0
|
||||||
#define DEFAULT_PAGE_DETAILS_FIXED false
|
#define DEFAULT_PAGE_DETAILS_FIXED false
|
||||||
|
#define DEFAULT_TURN_PAGE_BY_TAP false
|
||||||
#define DEFAULT_CURRENT_BOOK QString()
|
#define DEFAULT_CURRENT_BOOK QString()
|
||||||
#define DEFAULT_CURRENT_FOLDER QString()
|
#define DEFAULT_CURRENT_FOLDER QString()
|
||||||
#define DEFAULT_REMOVABLE_ROOT "Books"
|
#define DEFAULT_REMOVABLE_ROOT "Books"
|
||||||
|
@ -236,6 +238,7 @@ public:
|
||||||
MGConfItem* iFontSizeConf;
|
MGConfItem* iFontSizeConf;
|
||||||
MGConfItem* iPageDetailsConf;
|
MGConfItem* iPageDetailsConf;
|
||||||
MGConfItem* iPageDetailsFixedConf;
|
MGConfItem* iPageDetailsFixedConf;
|
||||||
|
MGConfItem* iTurnPageByTapConf;
|
||||||
MGConfItem* iInvertColorsConf;
|
MGConfItem* iInvertColorsConf;
|
||||||
MGConfItem* iKeepDisplayOnConf;
|
MGConfItem* iKeepDisplayOnConf;
|
||||||
MGConfItem* iVolumeUpActionConf;
|
MGConfItem* iVolumeUpActionConf;
|
||||||
|
@ -258,6 +261,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
|
||||||
iFontSizeConf(new MGConfItem(DCONF_PATH KEY_FONT_SIZE, this)),
|
iFontSizeConf(new MGConfItem(DCONF_PATH KEY_FONT_SIZE, this)),
|
||||||
iPageDetailsConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS, this)),
|
iPageDetailsConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS, this)),
|
||||||
iPageDetailsFixedConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS_FIXED, this)),
|
iPageDetailsFixedConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS_FIXED, this)),
|
||||||
|
iTurnPageByTapConf(new MGConfItem(DCONF_PATH KEY_TURN_PAGE_BY_TAP, this)),
|
||||||
iInvertColorsConf(new MGConfItem(DCONF_PATH KEY_INVERT_COLORS, this)),
|
iInvertColorsConf(new MGConfItem(DCONF_PATH KEY_INVERT_COLORS, this)),
|
||||||
iKeepDisplayOnConf(new MGConfItem(DCONF_PATH KEY_KEEP_DISPLAY_ON, this)),
|
iKeepDisplayOnConf(new MGConfItem(DCONF_PATH KEY_KEEP_DISPLAY_ON, this)),
|
||||||
iVolumeUpActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_UP_ACTION, this)),
|
iVolumeUpActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_UP_ACTION, this)),
|
||||||
|
@ -274,6 +278,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
|
||||||
connect(iCurrentBookPathConf, SIGNAL(valueChanged()), SLOT(onCurrentBookPathChanged()));
|
connect(iCurrentBookPathConf, SIGNAL(valueChanged()), SLOT(onCurrentBookPathChanged()));
|
||||||
connect(iPageDetailsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsChanged()));
|
connect(iPageDetailsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsChanged()));
|
||||||
connect(iPageDetailsFixedConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsFixedChanged()));
|
connect(iPageDetailsFixedConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsFixedChanged()));
|
||||||
|
connect(iTurnPageByTapConf, SIGNAL(valueChanged()), iParent, SIGNAL(turnPageByTapChanged()));
|
||||||
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(invertColorsChanged()));
|
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(invertColorsChanged()));
|
||||||
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageBackgroundColorChanged()));
|
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageBackgroundColorChanged()));
|
||||||
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), iParent, SIGNAL(keepDisplayOnChanged()));
|
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), iParent, SIGNAL(keepDisplayOnChanged()));
|
||||||
|
@ -553,6 +558,20 @@ BooksSettings::setPageDetailsFixed(
|
||||||
iPrivate->iPageDetailsFixedConf->set(aValue);
|
iPrivate->iPageDetailsFixedConf->set(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BooksSettings::turnPageByTap() const
|
||||||
|
{
|
||||||
|
return iPrivate->iTurnPageByTapConf->value(DEFAULT_TURN_PAGE_BY_TAP).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BooksSettings::setTurnPageByTap(
|
||||||
|
bool aValue)
|
||||||
|
{
|
||||||
|
HDEBUG(aValue);
|
||||||
|
iPrivate->iTurnPageByTapConf->set(aValue);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BooksSettings::invertColors() const
|
BooksSettings::invertColors() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@ class BooksSettings : public QObject
|
||||||
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||||
Q_PROPERTY(int pageDetails READ pageDetails WRITE setPageDetails NOTIFY pageDetailsChanged)
|
Q_PROPERTY(int pageDetails READ pageDetails WRITE setPageDetails NOTIFY pageDetailsChanged)
|
||||||
Q_PROPERTY(bool pageDetailsFixed READ pageDetailsFixed WRITE setPageDetailsFixed NOTIFY pageDetailsFixedChanged)
|
Q_PROPERTY(bool pageDetailsFixed READ pageDetailsFixed WRITE setPageDetailsFixed NOTIFY pageDetailsFixedChanged)
|
||||||
|
Q_PROPERTY(bool turnPageByTap READ turnPageByTap WRITE setTurnPageByTap NOTIFY turnPageByTapChanged)
|
||||||
Q_PROPERTY(bool invertColors READ invertColors WRITE setInvertColors NOTIFY invertColorsChanged)
|
Q_PROPERTY(bool invertColors READ invertColors WRITE setInvertColors NOTIFY invertColorsChanged)
|
||||||
Q_PROPERTY(bool keepDisplayOn READ keepDisplayOn WRITE setKeepDisplayOn NOTIFY keepDisplayOnChanged)
|
Q_PROPERTY(bool keepDisplayOn READ keepDisplayOn WRITE setKeepDisplayOn NOTIFY keepDisplayOnChanged)
|
||||||
Q_PROPERTY(int volumeUpAction READ volumeUpAction WRITE setVolumeUpAction NOTIFY volumeUpActionChanged)
|
Q_PROPERTY(int volumeUpAction READ volumeUpAction WRITE setVolumeUpAction NOTIFY volumeUpActionChanged)
|
||||||
|
@ -101,6 +102,9 @@ public:
|
||||||
bool pageDetailsFixed() const;
|
bool pageDetailsFixed() const;
|
||||||
void setPageDetailsFixed(bool aValue);
|
void setPageDetailsFixed(bool aValue);
|
||||||
|
|
||||||
|
bool turnPageByTap() const;
|
||||||
|
void setTurnPageByTap(bool aValue);
|
||||||
|
|
||||||
shared_ptr<ZLTextStyle> textStyle(int aFontSizeAdjust) const;
|
shared_ptr<ZLTextStyle> textStyle(int aFontSizeAdjust) const;
|
||||||
|
|
||||||
bool invertColors() const;
|
bool invertColors() const;
|
||||||
|
@ -135,6 +139,7 @@ Q_SIGNALS:
|
||||||
void textStyleChanged();
|
void textStyleChanged();
|
||||||
void pageDetailsChanged();
|
void pageDetailsChanged();
|
||||||
void pageDetailsFixedChanged();
|
void pageDetailsFixedChanged();
|
||||||
|
void turnPageByTapChanged();
|
||||||
void invertColorsChanged();
|
void invertColorsChanged();
|
||||||
void keepDisplayOnChanged();
|
void keepDisplayOnChanged();
|
||||||
void volumeUpActionChanged();
|
void volumeUpActionChanged();
|
||||||
|
|
Loading…
Reference in a new issue