[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,7 +217,9 @@ SilicaFlickable {
} }
onPageClicked: { onPageClicked: {
root.pageClicked(index) root.pageClicked(index)
Settings.pageDetails = (Settings.pageDetails + 1) % _visibilityStates.length if (!Settings.pageDetailsFixed) {
Settings.pageDetails = (Settings.pageDetails + 1) % _visibilityStates.length
}
} }
onImagePressed: { onImagePressed: {
if (currentPage) { if (currentPage) {

View file

@ -45,6 +45,7 @@
#define DCONF_PATH BOOKS_DCONF_ROOT #define DCONF_PATH BOOKS_DCONF_ROOT
#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_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"
@ -56,6 +57,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_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"
@ -233,6 +235,7 @@ public:
BooksSettings* iParent; BooksSettings* iParent;
MGConfItem* iFontSizeConf; MGConfItem* iFontSizeConf;
MGConfItem* iPageDetailsConf; MGConfItem* iPageDetailsConf;
MGConfItem* iPageDetailsFixedConf;
MGConfItem* iInvertColorsConf; MGConfItem* iInvertColorsConf;
MGConfItem* iKeepDisplayOnConf; MGConfItem* iKeepDisplayOnConf;
MGConfItem* iVolumeUpActionConf; MGConfItem* iVolumeUpActionConf;
@ -254,6 +257,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
iParent(aParent), iParent(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)),
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)),
@ -269,6 +273,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
connect(iCurrentFolderConf, SIGNAL(valueChanged()), SLOT(onCurrentFolderChanged())); connect(iCurrentFolderConf, SIGNAL(valueChanged()), SLOT(onCurrentFolderChanged()));
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(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()));
@ -534,6 +539,20 @@ BooksSettings::setPageDetails(
iPrivate->iPageDetailsConf->set(aValue); 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 bool
BooksSettings::invertColors() const BooksSettings::invertColors() const
{ {

View file

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