[app] Don't keep display on when battery is low
To avoid completely discharging the battery if the reader falls asleep
This commit is contained in:
parent
d99bc12146
commit
34c10653eb
4 changed files with 17 additions and 11 deletions
10
app/app.pro
10
app/app.pro
|
@ -25,10 +25,10 @@ CONFIG(debug, debug|release) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Directories
|
# Directories
|
||||||
FBREADER_DIR = $$_PRO_FILE_PWD_/../fbreader
|
FBREADER_DIR = ../fbreader
|
||||||
FRIBIDI_DIR = $$_PRO_FILE_PWD_/../fribidi
|
FRIBIDI_DIR = ../fribidi
|
||||||
LINEBREAK_DIR = $$_PRO_FILE_PWD_/../linebreak
|
LINEBREAK_DIR = ../linebreak
|
||||||
HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
|
HARBOUR_LIB_DIR = ../harbour-lib
|
||||||
|
|
||||||
HARBOUR_INCLUDE_DIR = $$HARBOUR_LIB_DIR/include
|
HARBOUR_INCLUDE_DIR = $$HARBOUR_LIB_DIR/include
|
||||||
HARBOUR_SRC_DIR = $$HARBOUR_LIB_DIR/src
|
HARBOUR_SRC_DIR = $$HARBOUR_LIB_DIR/src
|
||||||
|
@ -194,6 +194,7 @@ openrepos {
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$HARBOUR_INCLUDE_DIR/HarbourBase45.h \
|
$$HARBOUR_INCLUDE_DIR/HarbourBase45.h \
|
||||||
|
$$HARBOUR_INCLUDE_DIR/HarbourBattery.h \
|
||||||
$$HARBOUR_INCLUDE_DIR/HarbourColorEditorModel.h \
|
$$HARBOUR_INCLUDE_DIR/HarbourColorEditorModel.h \
|
||||||
$$HARBOUR_INCLUDE_DIR/HarbourDisplayBlanking.h \
|
$$HARBOUR_INCLUDE_DIR/HarbourDisplayBlanking.h \
|
||||||
$$HARBOUR_INCLUDE_DIR/HarbourJson.h \
|
$$HARBOUR_INCLUDE_DIR/HarbourJson.h \
|
||||||
|
@ -206,6 +207,7 @@ HEADERS += \
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$HARBOUR_SRC_DIR/HarbourBase45.cpp \
|
$$HARBOUR_SRC_DIR/HarbourBase45.cpp \
|
||||||
|
$$HARBOUR_SRC_DIR/HarbourBattery.cpp \
|
||||||
$$HARBOUR_SRC_DIR/HarbourColorEditorModel.cpp \
|
$$HARBOUR_SRC_DIR/HarbourColorEditorModel.cpp \
|
||||||
$$HARBOUR_SRC_DIR/HarbourDisplayBlanking.cpp \
|
$$HARBOUR_SRC_DIR/HarbourDisplayBlanking.cpp \
|
||||||
$$HARBOUR_SRC_DIR/HarbourJson.cpp \
|
$$HARBOUR_SRC_DIR/HarbourJson.cpp \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2015-2021 Jolla Ltd.
|
Copyright (C) 2015-2021 Jolla Ltd.
|
||||||
Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
|
Copyright (C) 2015-2023 Slava Monich <slava@monich.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:
|
||||||
|
|
||||||
|
@ -52,10 +52,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
property variant currentShelf: mainPage.currentShelf
|
property variant currentShelf: mainPage.currentShelf
|
||||||
|
|
||||||
DisplayBlanking {
|
HarbourDisplayBlanking {
|
||||||
pauseRequested: Qt.application.active &&
|
pauseRequested: Qt.application.active &&
|
||||||
Settings.currentBook &&
|
Settings.currentBook && Settings.keepDisplayOn &&
|
||||||
Settings.keepDisplayOn
|
(HarbourBattery.batteryState === HarbourBattery.BatteryStateCharging ||
|
||||||
|
HarbourBattery.batteryLevel === 0 || // Zero if unknown (not reported by mce)
|
||||||
|
HarbourBattery.batteryLevel >= 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding {
|
Binding {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015-2022 Jolla Ltd.
|
* Copyright (C) 2015-2022 Jolla Ltd.
|
||||||
* Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
|
* Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
|
||||||
*
|
*
|
||||||
* You may use this file under the terms of the BSD license as follows:
|
* You may use this file under the terms of the BSD license as follows:
|
||||||
*
|
*
|
||||||
|
@ -52,6 +52,7 @@
|
||||||
#include "BooksHints.h"
|
#include "BooksHints.h"
|
||||||
#include "BooksUtil.h"
|
#include "BooksUtil.h"
|
||||||
|
|
||||||
|
#include "HarbourBattery.h"
|
||||||
#include "HarbourColorEditorModel.h"
|
#include "HarbourColorEditorModel.h"
|
||||||
#include "HarbourDisplayBlanking.h"
|
#include "HarbourDisplayBlanking.h"
|
||||||
#include "HarbourDebug.h"
|
#include "HarbourDebug.h"
|
||||||
|
@ -96,14 +97,15 @@ Q_DECL_EXPORT int main(int argc, char **argv)
|
||||||
BOOKS_QML_REGISTER_(BooksPageWidget, "PageWidget");
|
BOOKS_QML_REGISTER_(BooksPageWidget, "PageWidget");
|
||||||
BOOKS_QML_REGISTER_(BooksListWatcher, "ListWatcher");
|
BOOKS_QML_REGISTER_(BooksListWatcher, "ListWatcher");
|
||||||
BOOKS_QML_REGISTER_(BooksCoverWidget, "BookCover");
|
BOOKS_QML_REGISTER_(BooksCoverWidget, "BookCover");
|
||||||
BOOKS_QML_REGISTER_(HarbourDisplayBlanking, "DisplayBlanking");
|
|
||||||
|
|
||||||
// But these do (and I think it's a good idea)
|
// But these do (and I think it's a good idea)
|
||||||
BOOKS_QML_REGISTER(HarbourColorEditorModel);
|
BOOKS_QML_REGISTER(HarbourColorEditorModel);
|
||||||
|
BOOKS_QML_REGISTER(HarbourDisplayBlanking);
|
||||||
BOOKS_QML_REGISTER(BooksColorSchemeModel);
|
BOOKS_QML_REGISTER(BooksColorSchemeModel);
|
||||||
BOOKS_QML_REGISTER(BooksImportModel);
|
BOOKS_QML_REGISTER(BooksImportModel);
|
||||||
BOOKS_QML_REGISTER(BooksPathModel);
|
BOOKS_QML_REGISTER(BooksPathModel);
|
||||||
BOOKS_QML_REGISTER(BooksPageStack);
|
BOOKS_QML_REGISTER(BooksPageStack);
|
||||||
|
BOOKS_QML_REGISTER_SINGLETON(HarbourBattery);
|
||||||
BOOKS_QML_REGISTER_SINGLETON(HarbourUtil);
|
BOOKS_QML_REGISTER_SINGLETON(HarbourUtil);
|
||||||
BOOKS_QML_REGISTER_SINGLETON(BooksHints);
|
BOOKS_QML_REGISTER_SINGLETON(BooksHints);
|
||||||
BOOKS_QML_REGISTER_SINGLETON(BooksUtil);
|
BOOKS_QML_REGISTER_SINGLETON(BooksUtil);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 323fc6b6c98f85265e55425c22d617991178cc44
|
Subproject commit 6f745a05d05a236fa8053a4c2f40a807f83141ab
|
Loading…
Reference in a new issue