[app] Allow to fix page layout

Some users are annoyed by page layout changing after accident tap
This commit is contained in:
Slava Monich 2018-07-23 00:52:14 +03:00
parent fbb16be906
commit 73f4e53933
3 changed files with 27 additions and 1 deletions

View file

@ -217,8 +217,10 @@ SilicaFlickable {
}
onPageClicked: {
root.pageClicked(index)
if (!Settings.pageDetailsFixed) {
Settings.pageDetails = (Settings.pageDetails + 1) % _visibilityStates.length
}
}
onImagePressed: {
if (currentPage) {
if (!imageView) {

View file

@ -45,6 +45,7 @@
#define DCONF_PATH BOOKS_DCONF_ROOT
#define KEY_FONT_SIZE "fontSize"
#define KEY_PAGE_DETAILS "pageDetails"
#define KEY_PAGE_DETAILS_FIXED "pageDetailsFixed"
#define KEY_CURRENT_BOOK "currentBook"
#define KEY_CURRENT_FOLDER "currentFolder"
#define KEY_REMOVABLE_ROOT "removableRoot"
@ -56,6 +57,7 @@
#define DEFAULT_FONT_SIZE 0
#define DEFAULT_PAGE_DETAILS 0
#define DEFAULT_PAGE_DETAILS_FIXED false
#define DEFAULT_CURRENT_BOOK QString()
#define DEFAULT_CURRENT_FOLDER QString()
#define DEFAULT_REMOVABLE_ROOT "Books"
@ -233,6 +235,7 @@ public:
BooksSettings* iParent;
MGConfItem* iFontSizeConf;
MGConfItem* iPageDetailsConf;
MGConfItem* iPageDetailsFixedConf;
MGConfItem* iInvertColorsConf;
MGConfItem* iKeepDisplayOnConf;
MGConfItem* iVolumeUpActionConf;
@ -254,6 +257,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
iParent(aParent),
iFontSizeConf(new MGConfItem(DCONF_PATH KEY_FONT_SIZE, this)),
iPageDetailsConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS, this)),
iPageDetailsFixedConf(new MGConfItem(DCONF_PATH KEY_PAGE_DETAILS_FIXED, 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)),
@ -269,6 +273,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
connect(iCurrentFolderConf, SIGNAL(valueChanged()), SLOT(onCurrentFolderChanged()));
connect(iCurrentBookPathConf, SIGNAL(valueChanged()), SLOT(onCurrentBookPathChanged()));
connect(iPageDetailsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsChanged()));
connect(iPageDetailsFixedConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageDetailsFixedChanged()));
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(invertColorsChanged()));
connect(iInvertColorsConf, SIGNAL(valueChanged()), iParent, SIGNAL(pageBackgroundColorChanged()));
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), iParent, SIGNAL(keepDisplayOnChanged()));
@ -534,6 +539,20 @@ BooksSettings::setPageDetails(
iPrivate->iPageDetailsConf->set(aValue);
}
bool
BooksSettings::pageDetailsFixed() const
{
return iPrivate->iPageDetailsFixedConf->value(DEFAULT_PAGE_DETAILS_FIXED).toBool();
}
void
BooksSettings::setPageDetailsFixed(
bool aValue)
{
HDEBUG(aValue);
iPrivate->iPageDetailsFixedConf->set(aValue);
}
bool
BooksSettings::invertColors() const
{

View file

@ -48,6 +48,7 @@ class BooksSettings : public QObject
Q_ENUMS(Action)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(int pageDetails READ pageDetails WRITE setPageDetails NOTIFY pageDetailsChanged)
Q_PROPERTY(bool pageDetailsFixed READ pageDetailsFixed WRITE setPageDetailsFixed NOTIFY pageDetailsFixedChanged)
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)
@ -97,6 +98,9 @@ public:
int pageDetails() const;
void setPageDetails(int aValue);
bool pageDetailsFixed() const;
void setPageDetailsFixed(bool aValue);
shared_ptr<ZLTextStyle> textStyle(int aFontSizeAdjust) const;
bool invertColors() const;
@ -130,6 +134,7 @@ Q_SIGNALS:
void fontSizeChanged();
void textStyleChanged();
void pageDetailsChanged();
void pageDetailsFixedChanged();
void invertColorsChanged();
void keepDisplayOnChanged();
void volumeUpActionChanged();