diff --git a/harbour-batterybuddy.pro b/harbour-batterybuddy.pro index 61b65e6..b74f5af 100644 --- a/harbour-batterybuddy.pro +++ b/harbour-batterybuddy.pro @@ -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 diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index e639485..1478c2d 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -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 { diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index 5e575cd..e045582 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -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) diff --git a/rpm/harbour-batterybuddy.changes b/rpm/harbour-batterybuddy.changes index cb53a26..363d63c 100644 --- a/rpm/harbour-batterybuddy.changes +++ b/rpm/harbour-batterybuddy.changes @@ -12,7 +12,12 @@ # * date Author's Name version-release # - Summary of changes -* Sun Jan 6 2019 Matti Viljanen 1.0-1 +* Tue Jan 8 2019 Matti Viljanen (direc85) 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) 1.0-1 - Initial release - Implement battery level monitoring - Implement audible alerts and notifications diff --git a/rpm/harbour-batterybuddy.spec b/rpm/harbour-batterybuddy.spec index 8467804..67906af 100644 --- a/rpm/harbour-batterybuddy.spec +++ b/rpm/harbour-batterybuddy.spec @@ -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 diff --git a/rpm/harbour-batterybuddy.yaml b/rpm/harbour-batterybuddy.yaml index f3ff89b..225a437 100644 --- a/rpm/harbour-batterybuddy.yaml +++ b/rpm/harbour-batterybuddy.yaml @@ -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 diff --git a/src/battery.cpp b/src/battery.cpp index dd8a3bd..6605ae8 100644 --- a/src/battery.cpp +++ b/src/battery.cpp @@ -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") diff --git a/src/battery.h b/src/battery.h index 3aff4b9..92b3e56 100644 --- a/src/battery.h +++ b/src/battery.h @@ -21,7 +21,6 @@ #include #include #include -#include class Battery : public QObject { diff --git a/src/settings.cpp b/src/settings.cpp index 4d0fe16..c4ca496 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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(); } } diff --git a/src/settings.h b/src/settings.h index 95c25d8..0717fa9 100644 --- a/src/settings.h +++ b/src/settings.h @@ -20,7 +20,6 @@ #include #include -#include class Settings : public QObject { diff --git a/translations/harbour-batterybuddy-fi.ts b/translations/harbour-batterybuddy-fi.ts index dbeba02..388620f 100644 --- a/translations/harbour-batterybuddy-fi.ts +++ b/translations/harbour-batterybuddy-fi.ts @@ -20,6 +20,29 @@ Tekijä + + Battery + + discharging + Charger not plugged in, battery discharging + purkautuu + + + charging + Charger plugged in and battery charging + latautuu + + + unknown + Battery not detected, or faulty, or something + tuntematon + + + idle + Charger plugged in, not using nor charging battery + vapaa + + CoverPage @@ -136,18 +159,6 @@ Battery status Akun tila - - charging - latauksessa - - - discharging - purkautuu - - - Charge level - Varaustaso - Alert levels Hälytysrajat @@ -207,5 +218,25 @@ Charged Täysi + + yes + kyllä + + + no + ei + + + Charge: + Varaus: + + + Charging: + Lataus: + + + State: + Tila: + diff --git a/translations/harbour-batterybuddy.ts b/translations/harbour-batterybuddy.ts index 10fdd81..ec9cf2e 100644 --- a/translations/harbour-batterybuddy.ts +++ b/translations/harbour-batterybuddy.ts @@ -20,6 +20,29 @@ + + Battery + + discharging + Charger not plugged in, battery discharging + + + + charging + Charger plugged in and battery charging + + + + unknown + Battery not detected, or faulty, or something + + + + idle + Charger plugged in, not using nor charging battery + + + CoverPage @@ -136,18 +159,6 @@ Battery status - - charging - - - - discharging - - - - Charge level - - Alert levels @@ -207,5 +218,25 @@ Charged + + yes + + + + no + + + + Charge: + + + + Charging: + + + + State: + +