[app] Added keepDisplayOn option

This commit is contained in:
Slava Monich 2018-05-16 23:55:43 +03:00
parent 57801ed140
commit 3ccc36e335
4 changed files with 36 additions and 7 deletions

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2015-2017 Jolla Ltd.
Contact: Slava Monich <slava.monich@jolla.com>
Copyright (C) 2015-2018 Jolla Ltd.
Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@ -54,6 +54,11 @@ ApplicationWindow {
BooksHints { id: globalHints }
BooksFeedback { id: globalFeedback }
SystemState { id: globalSystemState }
DisplayBlanking {
pauseRequested: Qt.application.active &&
Settings.currentBook &&
Settings.keepDisplayOn
}
initialPage: BooksMainPage { id: mainPage }

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -49,6 +49,7 @@
#define KEY_CURRENT_FOLDER "currentFolder"
#define KEY_REMOVABLE_ROOT "removableRoot"
#define KEY_INVERT_COLORS "invertColors"
#define KEY_KEEP_DISPLAY_ON "keepDisplayOn"
#define KEY_VOLUME_UP_ACTION "volumeUpAction"
#define KEY_VOLUME_DOWN_ACTION "volumeDownAction"
#define KEY_ORIENTATION "orientation"
@ -59,6 +60,7 @@
#define DEFAULT_CURRENT_FOLDER QString()
#define DEFAULT_REMOVABLE_ROOT "Books"
#define DEFAULT_INVERT_COLORS false
#define DEFAULT_KEEP_DISPLAY_ON false
#define DEFAULT_VOLUME_UP_ACTION (BooksSettings::ActionNextPage)
#define DEFAULT_VOLUME_DOWN_ACTION (BooksSettings::ActionPreviousPage)
#define DEFAULT_ORIENTATION (BooksSettings::OrientationAny)
@ -232,6 +234,7 @@ public:
MGConfItem* iFontSizeConf;
MGConfItem* iPageDetailsConf;
MGConfItem* iInvertColorsConf;
MGConfItem* iKeepDisplayOnConf;
MGConfItem* iVolumeUpActionConf;
MGConfItem* iVolumeDownActionConf;
MGConfItem* iCurrentFolderConf;
@ -252,6 +255,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
iFontSizeConf(new MGConfItem(DCONF_PATH KEY_FONT_SIZE, this)),
iPageDetailsConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS, this)),
iInvertColorsConf(new MGConfItem(DCONF_PATH KEY_INVERT_COLORS, this)),
iKeepDisplayOnConf(new MGConfItem(DCONF_PATH KEY_KEEP_DISPLAY_ON, this)),
iVolumeUpActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_UP_ACTION, this)),
iVolumeDownActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_DOWN_ACTION, this)),
iCurrentFolderConf(new MGConfItem(DCONF_PATH KEY_CURRENT_FOLDER, this)),
@ -267,6 +271,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
connect(iPageDetailsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsChanged()));
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(invertColorsChanged()));
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageBackgroundColorChanged()));
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), iParent, SIGNAL(keepDisplayOnChanged()));
connect(iVolumeUpActionConf, SIGNAL(valueChanged()), iParent, SIGNAL(volumeUpActionChanged()));
connect(iVolumeDownActionConf, SIGNAL(valueChanged()), iParent, SIGNAL(volumeDownActionChanged()));
connect(iOrientationConf, SIGNAL(valueChanged()), iParent, SIGNAL(orientationChanged()));
@ -543,6 +548,20 @@ BooksSettings::setInvertColors(
iPrivate->iInvertColorsConf->set(aValue);
}
bool
BooksSettings::keepDisplayOn() const
{
return iPrivate->iKeepDisplayOnConf->value(DEFAULT_KEEP_DISPLAY_ON).toBool();
}
void
BooksSettings::setKeepDisplayOn(
bool aValue)
{
HDEBUG(aValue);
iPrivate->iKeepDisplayOnConf->set(aValue);
}
BooksSettings::Action
BooksSettings::volumeUpAction() const
{

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -49,6 +49,7 @@ class BooksSettings : public QObject
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(int pageDetails READ pageDetails WRITE setPageDetails NOTIFY pageDetailsChanged)
Q_PROPERTY(bool invertColors READ invertColors WRITE setInvertColors NOTIFY invertColorsChanged)
Q_PROPERTY(bool keepDisplayOn READ keepDisplayOn WRITE setKeepDisplayOn NOTIFY keepDisplayOnChanged)
Q_PROPERTY(int volumeUpAction READ volumeUpAction WRITE setVolumeUpAction NOTIFY volumeUpActionChanged)
Q_PROPERTY(int volumeDownAction READ volumeDownAction WRITE setVolumeDownAction NOTIFY volumeDownActionChanged)
Q_PROPERTY(QObject* currentBook READ currentBook WRITE setCurrentBook NOTIFY currentBookChanged)
@ -101,6 +102,9 @@ public:
bool invertColors() const;
void setInvertColors(bool aValue);
bool keepDisplayOn() const;
void setKeepDisplayOn(bool aValue);
Action volumeUpAction() const;
void setVolumeUpAction(int aValue);
@ -127,6 +131,7 @@ Q_SIGNALS:
void textStyleChanged();
void pageDetailsChanged();
void invertColorsChanged();
void keepDisplayOnChanged();
void volumeUpActionChanged();
void volumeDownActionChanged();
void currentBookChanged();

@ -1 +1 @@
Subproject commit c8d907a11a3512672ed906fa2c3b41a65c9a9bd2
Subproject commit b0fda2fea0c7381d74bf848902c48cbbcd3f6a8e