Version bump to 1.1, update translations, minor cleanup, remove QDebug

This commit is contained in:
Matti Viljanen 2019-01-08 21:15:36 +02:00
parent 1b3920ef03
commit 8eafae5808
No known key found for this signature in database
GPG key ID: CF32A1495158F888
12 changed files with 105 additions and 58 deletions

View file

@ -12,7 +12,7 @@
# The name of your application
TARGET = harbour-batterybuddy
CONFIG += sailfishapp
CONFIG += sailfishapp sailfishapp_i18n
HEADERS += \
src/battery.h \
@ -33,6 +33,10 @@ DISTFILES += qml/harbour-batterybuddy.qml \
qml/pages/InfoPage.qml \
rpm/harbour-batterybuddy.changes
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
TRANSLATIONS += translations/*.ts
# Begin: include sound files
#OTHER_FILES += sounds/upperLimit.ogg \
@ -46,15 +50,3 @@ DISTFILES += qml/harbour-batterybuddy.qml \
#INSTALLS += sounds
# End: include sound files
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
# to disable building translations every time, comment out the
# following CONFIG line
CONFIG += sailfishapp_i18n
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/*.ts

View file

@ -24,7 +24,7 @@ Page {
PageHeader {
id: header
title: qsTr("Battery Buddy") +" v1.0"
title: qsTr("Battery Buddy") +" v1.1"
}
Column {
@ -36,7 +36,6 @@ Page {
x: Theme.paddingLarge
text: qsTr("Author")
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
@ -45,14 +44,12 @@ Page {
wrapMode: Text.Wrap
text: "Matti Viljanen"
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeMedium
}
Label {
x: Theme.paddingLarge
text: qsTr("License")
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
}
Label {
@ -61,7 +58,6 @@ Page {
wrapMode: Text.Wrap
text: "GNU General Public Licence 3.0"
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeMedium
}
Button {

View file

@ -107,9 +107,9 @@ Page {
color: Theme.highlightColor
}
DetailItem {
label: qsTr("Charge level:")+"\n"
label: qsTr("Charge:")+"\n"
+qsTr("Charging:")+"\n"
+qsTr("Battery state:")
+qsTr("State:")
value: battery.charge+"%\n"
+(battery.charging ? qsTr("yes") : qsTr("no"))+"\n"
+qsTr(battery.state)

View file

@ -12,7 +12,12 @@
# * date Author's Name <author's email> version-release
# - Summary of changes
* Sun Jan 6 2019 Matti Viljanen <matti.viljanen@kapsi.fi> 1.0-1
* Tue Jan 8 2019 Matti Viljanen (direc85) <matti.viljanen@kapsi.fi> 1.1-1
- Slider values are now saved
- Show battery state
- Alert when battery is charged to 100%, but not charging
* Sun Jan 6 2019 Matti Viljanen (direc85) <matti.viljanen@kapsi.fi> 1.0-1
- Initial release
- Implement battery level monitoring
- Implement audible alerts and notifications

View file

@ -14,7 +14,7 @@ Name: harbour-batterybuddy
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Battery Buddy
# Checklist: .spec .yaml .changes AboutPage.qml
Version: 1.0
Version: 1.1
Release: 1
Group: Qt/Qt
License: LICENSE

View file

@ -1,6 +1,6 @@
Name: harbour-batterybuddy
Summary: Battery Buddy
Version: 1.0
Version: 1.1
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS

View file

@ -23,7 +23,7 @@ Battery::Battery(QObject* parent) : QObject(parent)
chargeFile = new QFile("/run/state/namespaces/Battery/ChargePercentage");
// Number: 0 or 1
chargingFile = new QFile("/run/state/namespaces/Battery/IsCharging");
// String: charging, discharging, idle, unknown (others?)
// String: charging, discharging, (empty), unknown (others?)
stateFile = new QFile("/run/state/namespaces/Battery/ChargingState");
// TODO
@ -39,7 +39,6 @@ void Battery::updateData()
{
if(chargeFile->open(QIODevice::ReadOnly)) {
nextCharge = chargeFile->readAll().toInt();
qDebug() << "Charge:" << nextCharge;
if(nextCharge != charge) {
charge = nextCharge;
emit chargeChanged();
@ -48,7 +47,6 @@ void Battery::updateData()
}
if(chargingFile->open(QIODevice::ReadOnly)) {
nextCharging = (chargingFile->readAll().toInt() == 0 ? false : true);
qDebug() << "Charging:" << nextCharge;
if(nextCharging != charging) {
charging = nextCharging;
emit chargingChanged();
@ -57,13 +55,12 @@ void Battery::updateData()
}
if(stateFile->open(QIODevice::ReadOnly)) {
nextStatus = (QString(stateFile->readAll()));
qDebug() << "Status:" << nextStatus;
if(nextStatus != state) {
state = nextStatus;
// Update translated text accordingly
if(state == "idle")
stateTr = tr("idle", "Battery in charger, not using nor charging battery");
if(state == "")
stateTr = tr("idle", "Charger plugged in, not using nor charging battery");
else if(state == "discharging")
stateTr = tr("discharging", "Charger not plugged in, battery discharging");
else if(state == "charging")

View file

@ -21,7 +21,6 @@
#include <QObject>
#include <QString>
#include <QFile>
#include <QDebug>
class Battery : public QObject
{

View file

@ -19,13 +19,11 @@
Settings::Settings(QObject *parent) : QObject(parent)
{
qDebug() << "Loading settings from" << mySettings.fileName();
int tempValue;
if(mySettings.contains("lowerLimit")) {
tempValue = mySettings.value("lowerLimit").toInt();
if(tempValue >= 10 && tempValue <= 50) {
lowerLimit = tempValue;
qDebug() << "Lower limit:" << lowerLimit;
emit lowerLimitChanged();
}
}
@ -33,7 +31,6 @@ Settings::Settings(QObject *parent) : QObject(parent)
tempValue = mySettings.value("upperLimit").toInt();
if(tempValue >= 60 && tempValue <= 100) {
upperLimit = tempValue;
qDebug() << "Upper limit:" << upperLimit;
emit upperLimitChanged();
}
}

View file

@ -20,7 +20,6 @@
#include <QObject>
#include <QSettings>
#include <QDebug>
class Settings : public QObject
{

View file

@ -20,6 +20,29 @@
<translation>Tekijä</translation>
</message>
</context>
<context>
<name>Battery</name>
<message>
<source>discharging</source>
<comment>Charger not plugged in, battery discharging</comment>
<translation>purkautuu</translation>
</message>
<message>
<source>charging</source>
<comment>Charger plugged in and battery charging</comment>
<translation>latautuu</translation>
</message>
<message>
<source>unknown</source>
<comment>Battery not detected, or faulty, or something</comment>
<translation>tuntematon</translation>
</message>
<message>
<source>idle</source>
<comment>Charger plugged in, not using nor charging battery</comment>
<translation>vapaa</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
@ -136,18 +159,6 @@
<source>Battery status</source>
<translation>Akun tila</translation>
</message>
<message>
<source>charging</source>
<translation>latauksessa</translation>
</message>
<message>
<source>discharging</source>
<translation>purkautuu</translation>
</message>
<message>
<source>Charge level</source>
<translation>Varaustaso</translation>
</message>
<message>
<source>Alert levels</source>
<translation>Hälytysrajat</translation>
@ -207,5 +218,25 @@
<source>Charged</source>
<translation>Täysi</translation>
</message>
<message>
<source>yes</source>
<translation>kyllä</translation>
</message>
<message>
<source>no</source>
<translation>ei</translation>
</message>
<message>
<source>Charge:</source>
<translation>Varaus:</translation>
</message>
<message>
<source>Charging:</source>
<translation>Lataus:</translation>
</message>
<message>
<source>State:</source>
<translation>Tila:</translation>
</message>
</context>
</TS>

View file

@ -20,6 +20,29 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Battery</name>
<message>
<source>discharging</source>
<comment>Charger not plugged in, battery discharging</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>charging</source>
<comment>Charger plugged in and battery charging</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>unknown</source>
<comment>Battery not detected, or faulty, or something</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>idle</source>
<comment>Charger plugged in, not using nor charging battery</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
@ -136,18 +159,6 @@
<source>Battery status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>charging</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>discharging</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Charge level</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alert levels</source>
<translation type="unfinished"></translation>
@ -207,5 +218,25 @@
<source>Charged</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>no</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Charge:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Charging:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>State:</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>