From f63db9fdb125023d44fc581b2406515d70d3e48e Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Wed, 29 Jan 2014 09:28:29 +0000 Subject: [PATCH 01/11] Edited licence year --- LICENCE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENCE b/LICENCE index a17f27a..1472528 100644 --- a/LICENCE +++ b/LICENCE @@ -1,4 +1,4 @@ -Copyright © 2013 Mikko Ahlroth +Copyright © 2013–2014 Mikko Ahlroth Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 0c463f24bf88803fb06b7eb872c0e4a6d0fd0007 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Sat, 1 Feb 2014 20:22:34 +0200 Subject: [PATCH 02/11] Get uptime from sys/sysinfo.h instead of parsing uptime output. Fixes #2 --- harbour-sailtime.pro | 8 +++- qml/harbour-sailtime.qml | 37 ++++++---------- qml/pages/AboutPage.qml | 2 +- rpm/harbour-sailtime.spec | 2 +- rpm/harbour-sailtime.yaml | 2 +- src/harbour-sailtime.cpp | 9 +++- src/sysinfoc.cpp | 90 +++++++++++++++++++++++++++++++++++++++ src/sysinfoc.h | 70 ++++++++++++++++++++++++++++++ src/sysload.cpp | 24 +++++++++++ src/sysload.h | 33 ++++++++++++++ src/uptimechecker.cpp | 10 ++--- src/uptimechecker.h | 6 +-- 12 files changed, 253 insertions(+), 40 deletions(-) create mode 100644 src/sysinfoc.cpp create mode 100644 src/sysinfoc.h create mode 100644 src/sysload.cpp create mode 100644 src/sysload.h diff --git a/harbour-sailtime.pro b/harbour-sailtime.pro index 1b927b2..90b5379 100644 --- a/harbour-sailtime.pro +++ b/harbour-sailtime.pro @@ -10,10 +10,14 @@ TARGET = harbour-sailtime CONFIG += sailfishapp -HEADERS += src/uptimechecker.h +HEADERS += src/uptimechecker.h \ + src/sysinfoc.h \ + src/sysload.h SOURCES += src/harbour-sailtime.cpp \ - src/uptimechecker.cpp + src/uptimechecker.cpp \ + src/sysinfoc.cpp \ + src/sysload.cpp OTHER_FILES += qml/harbour-sailtime.qml \ qml/cover/CoverPage.qml \ diff --git a/qml/harbour-sailtime.qml b/qml/harbour-sailtime.qml index 5b5a943..3209c55 100644 --- a/qml/harbour-sailtime.qml +++ b/qml/harbour-sailtime.qml @@ -6,7 +6,9 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 -import harbour.sailtime.UptimeChecker 1.0 +import harbour.sailtime.UptimeChecker 2.0 +import harbour.sailtime.SysinfoC 1.0 +import harbour.sailtime.Sysload 1.0 import "cover" import "pages" @@ -61,36 +63,21 @@ ApplicationWindow } function updateDisplay() { - var uptime_str = checker.fetchUptime(); - uptime_str = uptime_str.replace(/^\s+|\s+$/g, ''); + var sysinfo = checker.fetchUptime(); + var uptime_s = sysinfo.uptime; - var uptime_re = /\d+:\d\d:\d\d up\s+(?:(\d+) days?,\s+)?(?:(?:(\d+):(\d+))|(?:(\d?\d) min)),\s+(\d+) users?,\s+load average: (\d+).(\d\d), (\d+).(\d\d), (\d+).(\d\d)/; - var match = uptime_str.match(uptime_re) - //console.log(uptime_str) - - var days = match[1] - if (days === undefined) { - days = 0 - } - - var hours = match[2] - if (hours === undefined) { - hours = 0 - } - - var minutes = match[3] - if (minutes === undefined) { - minutes = match[4] - } + var days = Math.floor(uptime_s / 84600); + var hours = Math.floor(uptime_s / 3600 % 24); + var minutes = Math.floor(uptime_s / 60 % 60); + var seconds = Math.floor(uptime_s % 60); var uptime = { "days": days, "hours": hours, "minutes": minutes, - "users": match[5], - "load1": parseInt(match[6]) + match[7] / 100, - "load5": parseInt(match[8]) + match[9] / 100, - "load15": parseInt(match[10]) + match[11] / 100, + "load1": sysinfo.loads.avg_1, + "load5": sysinfo.loads.avg_5, + "load15": sysinfo.loads.avg_15, } firstpage.updatePage(uptime); diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index e9d318a..977dd49 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -29,7 +29,7 @@ Page { Label { anchors.horizontalCenter: parent.horizontalCenter - text: "SailTime 1.0.2" + text: "SailTime 1.1.0" color: Theme.highlightColor font.pixelSize: Theme.fontSizeLarge } diff --git a/rpm/harbour-sailtime.spec b/rpm/harbour-sailtime.spec index f225fad..8b9136b 100644 --- a/rpm/harbour-sailtime.spec +++ b/rpm/harbour-sailtime.spec @@ -13,7 +13,7 @@ Name: harbour-sailtime %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: SailTime -Version: 1.0.2 +Version: 1.1.0 Release: 1 Group: Qt/Qt License: MIT Expat licence diff --git a/rpm/harbour-sailtime.yaml b/rpm/harbour-sailtime.yaml index 3371290..41c6066 100644 --- a/rpm/harbour-sailtime.yaml +++ b/rpm/harbour-sailtime.yaml @@ -1,6 +1,6 @@ Name: harbour-sailtime Summary: SailTime -Version: 1.0.2 +Version: 1.1.0 Release: 1 Group: Qt/Qt URL: http://example.org/ diff --git a/src/harbour-sailtime.cpp b/src/harbour-sailtime.cpp index 30574af..b1d88ee 100644 --- a/src/harbour-sailtime.cpp +++ b/src/harbour-sailtime.cpp @@ -5,10 +5,13 @@ */ #include +#include #include #include "uptimechecker.h" +#include "sysinfoc.h" +#include "sysload.h" int main(int argc, char *argv[]) @@ -22,7 +25,11 @@ int main(int argc, char *argv[]) // // To display the view, call "show()" (will show fullscreen on device). - qmlRegisterType("harbour.sailtime.UptimeChecker", 1, 0, "UptimeChecker"); + // Register needed metatypes + qmlRegisterType("harbour.sailtime.UptimeChecker", 2, 0, "UptimeChecker"); + qmlRegisterUncreatableType("harbour.sailtime.SysinfoC", 1, 0, "SysinfoC", "Cannot create sysinfo"); + qmlRegisterUncreatableType("harbour.sailtime.Sysload", 1, 0, "Sysload", "Cannot create sysload"); + return SailfishApp::main(argc, argv); } diff --git a/src/sysinfoc.cpp b/src/sysinfoc.cpp new file mode 100644 index 0000000..22617f3 --- /dev/null +++ b/src/sysinfoc.cpp @@ -0,0 +1,90 @@ +#include "sysinfoc.h" +#include + +SysinfoC::SysinfoC(const struct sysinfo* info, QObject* parent) : + QObject(parent), + uptime(info->uptime), + totalram(info->totalram), + freeram(info->freeram), + sharedram(info->sharedram), + bufferram(info->bufferram), + totalswap(info->totalswap), + freeswap(info->freeswap), + procs(info->procs), + totalhigh(info->totalhigh), + freehigh(info->freehigh), + mem_unit(info->mem_unit) +{ + float in_loads[3] = {0.0, 0.0, 0.0}; + in_loads[0] = load2Float(info->loads[0]); + in_loads[1] = load2Float(info->loads[1]); + in_loads[2] = load2Float(info->loads[2]); + + this->loads = new Sysload(in_loads, this); +} + +float SysinfoC::load2Float(unsigned long load) +{ + // As per http://stackoverflow.com/a/4993273 + return load / ((float) (1 << SI_LOAD_SHIFT)); +} + +long SysinfoC::getUptime() const +{ + return uptime; +} + +Sysload* SysinfoC::getLoads() const +{ + return loads; +} + +unsigned long SysinfoC::getTotalram() const +{ + return totalram; +} + +unsigned long SysinfoC::getFreeram() const +{ + return freeram; +} + +unsigned long SysinfoC::getSharedram() const +{ + return sharedram; +} + +unsigned long SysinfoC::getBufferram() const +{ + return bufferram; +} + +unsigned long SysinfoC::getTotalswap() const +{ + return totalswap; +} + +unsigned long SysinfoC::getFreeswap() const +{ + return freeswap; +} + +unsigned short SysinfoC::getProcs() const +{ + return procs; +} + +unsigned long SysinfoC::getTotalhigh() const +{ + return totalhigh; +} + +unsigned long SysinfoC::getFreehigh() const +{ + return freehigh; +} + +unsigned int SysinfoC::getMemunit() const +{ + return mem_unit; +} diff --git a/src/sysinfoc.h b/src/sysinfoc.h new file mode 100644 index 0000000..c01ef0b --- /dev/null +++ b/src/sysinfoc.h @@ -0,0 +1,70 @@ +#ifndef SYSINFO_H +#define SYSINFO_H + +#include +#include + +#include "sysload.h" + +/* + * This class exists because we cannot pass plain structs onto the QML side, + * we need to inherit from QObject. + */ +class SysinfoC : public QObject +{ + Q_OBJECT +public: + explicit SysinfoC(const struct sysinfo* info, QObject* parent = 0); + + /* + * Loads are reported as unsigned longs in the sysinfo struct, this function + * will convert them to floats which are usually used for displaying loads. + */ + static float load2Float(unsigned long load); + + Q_PROPERTY(long uptime READ getUptime) + Q_PROPERTY(Sysload* loads READ getLoads) + Q_PROPERTY(unsigned long totalram READ getTotalram) + Q_PROPERTY(unsigned long freeram READ getFreeram) + Q_PROPERTY(unsigned long sharedram READ getSharedram) + Q_PROPERTY(unsigned long bufferram READ getBufferram) + Q_PROPERTY(unsigned long totalswap READ getTotalswap) + Q_PROPERTY(unsigned long freeswap READ getFreeswap) + Q_PROPERTY(unsigned short procs READ getProcs) + Q_PROPERTY(unsigned long totalhigh READ getTotalhigh) + Q_PROPERTY(unsigned long freehigh READ getFreehigh) + Q_PROPERTY(unsigned int mem_unit READ getMemunit) + + long getUptime() const; + Sysload* getLoads() const; + unsigned long getTotalram() const; + unsigned long getFreeram() const; + unsigned long getSharedram() const; + unsigned long getBufferram() const; + unsigned long getTotalswap() const; + unsigned long getFreeswap() const; + unsigned short getProcs() const; + unsigned long getTotalhigh() const; + unsigned long getFreehigh() const; + unsigned int getMemunit() const; + +signals: + +public slots: + +private: + long uptime; /* Seconds since boot */ + Sysload* loads; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* swap space still available */ + unsigned short procs; /* Number of current processes */ + unsigned long totalhigh; /* Total high memory size */ + unsigned long freehigh; /* Available high memory size */ + unsigned int mem_unit; /* Memory unit size in bytes */ +}; + +#endif // SYSINFO_H diff --git a/src/sysload.cpp b/src/sysload.cpp new file mode 100644 index 0000000..fefec18 --- /dev/null +++ b/src/sysload.cpp @@ -0,0 +1,24 @@ +#include "sysload.h" + +Sysload::Sysload(float loads[3], QObject *parent) : + QObject(parent), + avg_1(loads[0]), + avg_5(loads[1]), + avg_15(loads[2]) +{ +} + +float Sysload::getAvg1() const +{ + return avg_1; +} + +float Sysload::getAvg5() const +{ + return avg_5; +} + +float Sysload::getAvg15() const +{ + return avg_15; +} diff --git a/src/sysload.h b/src/sysload.h new file mode 100644 index 0000000..0eb39f1 --- /dev/null +++ b/src/sysload.h @@ -0,0 +1,33 @@ +#ifndef SYSLOAD_H +#define SYSLOAD_H + +#include +#include + +class Sysload : public QObject +{ + Q_OBJECT +public: + explicit Sysload(float loads[3], QObject* parent = 0); + + Q_PROPERTY(float avg_1 READ getAvg1) + Q_PROPERTY(float avg_5 READ getAvg5) + Q_PROPERTY(float avg_15 READ getAvg15) + + float getAvg1() const; + float getAvg5() const; + float getAvg15() const; + +signals: + +public slots: + +private: + float avg_1; + float avg_5; + float avg_15; + + +}; + +#endif // SYSLOAD_H diff --git a/src/uptimechecker.cpp b/src/uptimechecker.cpp index 253072b..b519eea 100644 --- a/src/uptimechecker.cpp +++ b/src/uptimechecker.cpp @@ -11,11 +11,9 @@ UptimeChecker::UptimeChecker(QObject *parent) : QObject(parent) {} -QString UptimeChecker::fetchUptime() +SysinfoC* UptimeChecker::fetchUptime() { - QProcess process; - process.start("uptime"); - process.waitForFinished(-1); - QByteArray out = process.readAllStandardOutput(); - return QString(out); + struct sysinfo info; + sysinfo(&info); + return new SysinfoC(&info, this); } diff --git a/src/uptimechecker.h b/src/uptimechecker.h index 1898e82..8757020 100644 --- a/src/uptimechecker.h +++ b/src/uptimechecker.h @@ -8,8 +8,8 @@ #define UPTIMECHECKER_H #include -#include -#include +#include "sys/sysinfo.h" +#include "sysinfoc.h" class UptimeChecker : public QObject { @@ -17,7 +17,7 @@ class UptimeChecker : public QObject public: explicit UptimeChecker(QObject *parent = 0); - Q_INVOKABLE QString fetchUptime(); + Q_INVOKABLE SysinfoC* fetchUptime(); }; #endif // UPTIMECHECKER_H From 3f125400e2fd8d7a0c15bc6c83cf5a7ed48993d2 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Tue, 4 Feb 2014 15:05:22 +0200 Subject: [PATCH 03/11] Display labels next to load averages and make cover prettier. Closes #3, #4 --- qml/cover/CoverPage.qml | 101 ++++++++++++++++++++++++++++------------ qml/pages/FirstPage.qml | 78 ++++++++++++++++++++++--------- 2 files changed, 125 insertions(+), 54 deletions(-) diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml index 9a6aeaf..f1315d3 100644 --- a/qml/cover/CoverPage.qml +++ b/qml/cover/CoverPage.qml @@ -16,43 +16,29 @@ CoverBackground { days.text = uptime.days + " days" time.text = uptime.hours + " h " + uptime.minutes + " min" load1.text = uptime.load1.toFixed(2) - load5_15.text = uptime.load5.toFixed(2) + " " + uptime.load15 -.toFixed(2) + load5.text = uptime.load5.toFixed(2) + load15.text = uptime.load15.toFixed(2) } Column { width: cover.width spacing: Theme.paddingSmall - - Label { - id: heading - anchors.horizontalCenter: parent.horizontalCenter - text: "Uptime" - color: "white" - font.pixelSize: Theme.fontSizeMedium - } - - Separator { - x: Theme.paddingLarge - width: parent.width - Theme.paddingLarge * 2 - horizontalAlignment: Qt.AlignCenter - color: Theme.highlightColor - } + y: Theme.paddingLarge Label { id: days anchors.horizontalCenter: parent.horizontalCenter text: "Refreshing..." - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + font.family: Theme.fontFamilyHeading } Label { id: time anchors.horizontalCenter: parent.horizontalCenter text: "" - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + font.family: Theme.fontFamilyHeading } Separator { @@ -62,20 +48,73 @@ CoverBackground { color: Theme.highlightColor } - Label { - id: load1 + Row { + width: parent.width - Theme.paddingLarge * 2 anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeSmall + spacing: 15 + + Label { + text: "1" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 4 + font.family: Theme.fontFamilyHeading + } + + Label { + id: load1 + text: "" + color: Theme.primaryColor + horizontalAlignment: Qt.AlignLeft + width: 3 * parent.width / 4 + font.family: Theme.fontFamilyHeading + } } - Label { - id: load5_15 + Row { + width: parent.width - Theme.paddingLarge * 2 anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeSmall + spacing: 15 + + Label { + text: "5" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 4 + font.family: Theme.fontFamilyHeading + } + + Label { + id: load5 + text: "" + color: Theme.primaryColor + horizontalAlignment: Qt.AlignLeft + width: 3 * parent.width / 4 + font.family: Theme.fontFamilyHeading + } + } + + Row { + width: parent.width - Theme.paddingLarge * 2 + anchors.horizontalCenter: parent.horizontalCenter + spacing: 15 + + Label { + text: "15" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 4 + font.family: Theme.fontFamilyHeading + } + + Label { + id: load15 + text: "" + color: Theme.primaryColor + horizontalAlignment: Qt.AlignLeft + width: 3 * parent.width / 4 + font.family: Theme.fontFamilyHeading + } } } diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 090bc1d..24bc365 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -24,8 +24,8 @@ Page { days.text = uptime.days + " days" time.text = uptime.hours + " h " + uptime.minutes + " min" load1.text = uptime.load1.toFixed(2) - load5_15.text = uptime.load5.toFixed(2) + " " + uptime.load15 -.toFixed(2) + load5.text = uptime.load5.toFixed(2) + load15.text = uptime.load15.toFixed(2) } // To enable PullDownMenu, place our content in a SilicaFlickable @@ -61,14 +61,14 @@ Page { width: page.width spacing: Theme.paddingLarge PageHeader { - title: "SailTime" + title: "Uptime" } Label { id: days anchors.horizontalCenter: parent.horizontalCenter text: "Refreshing..." - color: Theme.highlightColor + color: Theme.primaryColor font.pixelSize: Theme.fontSizeLarge } @@ -76,31 +76,63 @@ Page { id: time anchors.horizontalCenter: parent.horizontalCenter text: "" - color: Theme.highlightColor + color: Theme.primaryColor font.pixelSize: Theme.fontSizeLarge } - Separator { - x: Theme.paddingLarge + PageHeader { + title: "Load averages" + } + + Row + { width: parent.width - Theme.paddingLarge * 2 - horizontalAlignment: Qt.AlignCenter - color: Theme.highlightColor - } - - Label { - id: load1 anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeLarge - } + spacing: 18 - Label { - id: load5_15 - anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Theme.highlightColor - font.pixelSize: Theme.fontSizeLarge + Label { + text: "1" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 24 + } + + Label { + id: load1 + text: "" + color: Theme.primaryColor + width: 3 * parent.width / 12 + horizontalAlignment: Qt.AlignLeft + } + + Label { + text: "5" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 24 + } + + Label { + id: load5 + text: "" + color: Theme.primaryColor + width: 3 * parent.width / 12 + horizontalAlignment: Qt.AlignLeft + } + Label { + text: "15" + color: Theme.secondaryColor + horizontalAlignment: Qt.AlignRight + width: parent.width / 24 + } + + Label { + id: load15 + text: "" + color: Theme.primaryColor + width: 3 * parent.width / 12 + horizontalAlignment: Qt.AlignLeft + } } } } From 0898ef2fd726379edc49d9d3df568675026d12a0 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Wed, 5 Feb 2014 22:31:29 +0200 Subject: [PATCH 04/11] Use angled brackets to match other files --- src/uptimechecker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uptimechecker.h b/src/uptimechecker.h index 8757020..2357e50 100644 --- a/src/uptimechecker.h +++ b/src/uptimechecker.h @@ -8,7 +8,7 @@ #define UPTIMECHECKER_H #include -#include "sys/sysinfo.h" +#include #include "sysinfoc.h" class UptimeChecker : public QObject From 0316fd20071be7a1e8f768e9f87ed2e97dc583d8 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Wed, 5 Feb 2014 22:33:34 +0200 Subject: [PATCH 05/11] Add system information section to main view --- qml/harbour-sailtime.qml | 2 +- qml/pages/FirstPage.qml | 170 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 163 insertions(+), 9 deletions(-) diff --git a/qml/harbour-sailtime.qml b/qml/harbour-sailtime.qml index 3209c55..e955986 100644 --- a/qml/harbour-sailtime.qml +++ b/qml/harbour-sailtime.qml @@ -80,7 +80,7 @@ ApplicationWindow "load15": sysinfo.loads.avg_15, } - firstpage.updatePage(uptime); + firstpage.updatePage(sysinfo, uptime); coverpage.updateCover(uptime); } diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 24bc365..94f6a6c 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -20,12 +20,70 @@ Page { updateDisplay(); } - function updatePage(uptime) { - days.text = uptime.days + " days" - time.text = uptime.hours + " h " + uptime.minutes + " min" - load1.text = uptime.load1.toFixed(2) - load5.text = uptime.load5.toFixed(2) - load15.text = uptime.load15.toFixed(2) + function updatePage(sysinfo, uptime) { + days.text = uptime.days + " days"; + time.text = uptime.hours + " h " + uptime.minutes + " min"; + load1.text = uptime.load1.toFixed(2); + load5.text = uptime.load5.toFixed(2); + load15.text = uptime.load15.toFixed(2); + + + // Memory bar + + var meminuse = sysinfo.totalram - sysinfo.freeram; + + usedmem.width = (5 * usedmem.parent.width / 6 - Theme.paddingLarge * 2) * (meminuse / sysinfo.totalram); + freemem.width = (5 * freemem.parent.width / 6 - Theme.paddingLarge * 2) * (sysinfo.freeram / sysinfo.totalram); + + var usedram = scaleMem((sysinfo.totalram - sysinfo.freeram), sysinfo.mem_unit); + var totalram = scaleMem(sysinfo.totalram, sysinfo.mem_unit); + + memlegend.text = usedram[0].toFixed(2) + " " + usedram[1] + "B/" + + totalram[0].toFixed(2) + " " + totalram[1] + "B (" + + (usedram[0] / totalram[0] * 100).toFixed(2) + " %)"; + + + // Swap bar + + var swapinuse = sysinfo.totalswap - sysinfo.freeswap; + + usedswap.width = (5 * usedswap.parent.width / 6 - Theme.paddingLarge * 2) * (swapinuse / sysinfo.totalswap); + freeswap.width = (5 * freeswap.parent.width / 6 - Theme.paddingLarge * 2) * (sysinfo.freeswap / sysinfo.totalswap); + + var usedswap_scale = scaleMem((sysinfo.totalswap - sysinfo.freeswap), sysinfo.mem_unit); + var totalswap_scale = scaleMem(sysinfo.totalswap, sysinfo.mem_unit); + + swaplegend.text = usedswap_scale[0].toFixed(2) + " " + usedswap_scale[1] + "B/" + + totalswap_scale[0].toFixed(2) + " " + totalswap_scale[1] + "B (" + + (usedswap_scale[0] / totalswap_scale[0] * 100).toFixed(2) + " %)"; + + + // Processes amount + + procs.text = sysinfo.procs + " processes"; + } + + // Scale memory sizes to human readable bytes according to mem_unit + // Return memory size in bytes and prefix + function scaleMem(mem, mem_unit) { + var scaled = mem * mem_unit; + + var size_factor = 1024; + var size_units = ['', 'ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']; + + var remainder = 0; + + for (var i = 0; i < size_units.length; ++i) { + remainder = scaled / Math.pow(size_factor, i); + + if (remainder < size_factor) { + return [remainder, size_units[i]]; + } + } + + // If we have passed yottabytes in memory size, just rudely display as + // YB. + return [remainder, size_units[size_units.length - 1]]; } // To enable PullDownMenu, place our content in a SilicaFlickable @@ -57,9 +115,9 @@ Page { // of the page, followed by our content. Column { id: column - width: page.width - spacing: Theme.paddingLarge + spacing: Theme.paddingMedium + PageHeader { title: "Uptime" } @@ -119,6 +177,7 @@ Page { width: 3 * parent.width / 12 horizontalAlignment: Qt.AlignLeft } + Label { text: "15" color: Theme.secondaryColor @@ -134,6 +193,101 @@ Page { horizontalAlignment: Qt.AlignLeft } } + + PageHeader { + title: "System information" + } + + Item { + height: Theme.fontSizeLarge + width: parent.width + + Label { + id: memlabel + text: "Mem" + color: Theme.secondaryColor + width: parent.width / 6 + horizontalAlignment: Qt.AlignRight + } + + Rectangle { + anchors.left: memlabel.right + anchors.leftMargin: Theme.paddingLarge + id: usedmem + height: Theme.fontSizeLarge + width: 0 + color: Theme.secondaryColor + } + + Rectangle { + anchors.left: usedmem.right + id: freemem + height: Theme.fontSizeLarge + width: 0 + color: Theme.highlightColor + } + + Label { + anchors.left: memlabel.right + anchors.leftMargin: Theme.paddingLarge + id: memlegend + color: Theme.primaryColor + width: 5 * parent.width / 6 - Theme.paddingLarge * 2 + horizontalAlignment: Qt.AlignCenter + + // Overlay the label on the bar + z: 1 + font.pixelSize: Theme.fontSizeExtraSmall + } + } + + Item { + height: Theme.fontSizeLarge + width: parent.width + + Label { + id: swaplabel + text: "Swap" + color: Theme.secondaryColor + width: parent.width / 6 + horizontalAlignment: Qt.AlignRight + } + + Rectangle { + anchors.left: swaplabel.right + anchors.leftMargin: Theme.paddingLarge + id: usedswap + height: Theme.fontSizeLarge + width: 0 + color: Theme.secondaryColor + } + + Rectangle { + anchors.left: usedswap.right + id: freeswap + height: Theme.fontSizeLarge + width: 0 + color: Theme.highlightColor + } + + Label { + anchors.left: swaplabel.right + anchors.leftMargin: Theme.paddingLarge + id: swaplegend + color: Theme.primaryColor + width: 5 * parent.width / 6 - Theme.paddingLarge * 2 + horizontalAlignment: Qt.AlignCenter + + // Overlay the label on the bar + z: 1 + font.pixelSize: Theme.fontSizeExtraSmall + } + } + + Label { + id: procs + anchors.horizontalCenter: parent.horizontalCenter + } } } } From 37567a777ac56f93bcbc2df312567f9b758f35c3 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Thu, 6 Feb 2014 23:17:54 +0200 Subject: [PATCH 06/11] Use this for consistency. --- src/sysinfoc.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sysinfoc.cpp b/src/sysinfoc.cpp index 22617f3..a18750c 100644 --- a/src/sysinfoc.cpp +++ b/src/sysinfoc.cpp @@ -31,60 +31,60 @@ float SysinfoC::load2Float(unsigned long load) long SysinfoC::getUptime() const { - return uptime; + return this->uptime; } Sysload* SysinfoC::getLoads() const { - return loads; + return this->loads; } unsigned long SysinfoC::getTotalram() const { - return totalram; + return this->totalram; } unsigned long SysinfoC::getFreeram() const { - return freeram; + return this->freeram; } unsigned long SysinfoC::getSharedram() const { - return sharedram; + return this->sharedram; } unsigned long SysinfoC::getBufferram() const { - return bufferram; + return this->bufferram; } unsigned long SysinfoC::getTotalswap() const { - return totalswap; + return this->totalswap; } unsigned long SysinfoC::getFreeswap() const { - return freeswap; + return this->freeswap; } unsigned short SysinfoC::getProcs() const { - return procs; + return this->procs; } unsigned long SysinfoC::getTotalhigh() const { - return totalhigh; + return this->totalhigh; } unsigned long SysinfoC::getFreehigh() const { - return freehigh; + return this->freehigh; } unsigned int SysinfoC::getMemunit() const { - return mem_unit; + return this->mem_unit; } From a1a559ba3f04c991908e1e77b9286c354d3ed6b8 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Thu, 6 Feb 2014 23:18:54 +0200 Subject: [PATCH 07/11] Implement uptime record feature and setting to toggle it. --- qml/harbour-sailtime.qml | 30 ++++++++++++++++++++---- qml/pages/FirstPage.qml | 28 ++++++++++++++++++++++- qml/pages/SecondPage.qml | 48 +++++++++++++++++++++++++++++++++------ rpm/harbour-sailtime.spec | 20 ++++++++-------- rpm/harbour-sailtime.yaml | 20 ++++++++-------- 5 files changed, 113 insertions(+), 33 deletions(-) diff --git a/qml/harbour-sailtime.qml b/qml/harbour-sailtime.qml index e955986..02ea269 100644 --- a/qml/harbour-sailtime.qml +++ b/qml/harbour-sailtime.qml @@ -11,6 +11,7 @@ import harbour.sailtime.SysinfoC 1.0 import harbour.sailtime.Sysload 1.0 import "cover" import "pages" +import "js/storage.js" as Storage ApplicationWindow { @@ -19,7 +20,7 @@ ApplicationWindow // Refresh whenever app is activated onApplicationActiveChanged: { if (applicationActive) { - updateDisplay() + updateDisplay(); } } @@ -32,17 +33,21 @@ ApplicationWindow onChangeTimer: { if (enabled) { //console.log("Starting timer") - refreshTimer.start() + refreshTimer.start(); } else { //console.log("Stopping timer") - refreshTimer.stop() + refreshTimer.stop(); } } onChangeInterval: { //console.log("Timer interval: " + interval) - refreshTimer.interval = interval * 60 * 1000 + refreshTimer.interval = interval * 60 * 1000; + } + + onChangeRecord: { + firstpage.setRecordEnabled(enabled); } } @@ -63,13 +68,19 @@ ApplicationWindow } function updateDisplay() { + Storage.db = Storage.connect(); + var sysinfo = checker.fetchUptime(); var uptime_s = sysinfo.uptime; var days = Math.floor(uptime_s / 84600); var hours = Math.floor(uptime_s / 3600 % 24); var minutes = Math.floor(uptime_s / 60 % 60); - var seconds = Math.floor(uptime_s % 60); + + var record = Storage.readSetting(Storage.db, "record", 0); + var rDays = Math.floor(record / 84600); + var rHours = Math.floor(record / 3600 % 24); + var rMinutes = Math.floor(record / 60 % 60); var uptime = { "days": days, @@ -78,10 +89,19 @@ ApplicationWindow "load1": sysinfo.loads.avg_1, "load5": sysinfo.loads.avg_5, "load15": sysinfo.loads.avg_15, + "record": record, + "rDays": rDays, + "rHours": rHours, + "rMinutes": rMinutes, } firstpage.updatePage(sysinfo, uptime); coverpage.updateCover(uptime); + + // Update new record to db if feature is activated + if (Storage.readSetting(Storage.db, "recordEnable", false) && uptime_s >= record) { + Storage.storeSetting(Storage.db, "record", uptime_s); + } } UptimeChecker { diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 94f6a6c..4e3d811 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -23,6 +23,15 @@ Page { function updatePage(sysinfo, uptime) { days.text = uptime.days + " days"; time.text = uptime.hours + " h " + uptime.minutes + " min"; + + if (sysinfo.uptime >= uptime.record) { + recordLabel.text = "Making new record!"; + } + else { + recordLabel.text = "Record: " + uptime.rDays + " days " + uptime.rHours + " h " + uptime.rMinutes + " min"; + } + + load1.text = uptime.load1.toFixed(2); load5.text = uptime.load5.toFixed(2); load15.text = uptime.load15.toFixed(2); @@ -60,9 +69,16 @@ Page { // Processes amount - procs.text = sysinfo.procs + " processes"; + procs.text = sysinfo.procs + " processes + threads"; } + + function setRecordEnabled(enable) + { + recordLabel.visible = enable; + } + + // Scale memory sizes to human readable bytes according to mem_unit // Return memory size in bytes and prefix function scaleMem(mem, mem_unit) { @@ -138,6 +154,16 @@ Page { font.pixelSize: Theme.fontSizeLarge } + Label { + id: recordLabel + anchors.horizontalCenter: parent.horizontalCenter + text: "" + color: Theme.secondaryColor + font.pixelSize: Theme.fontSizeMedium + visible: false + } + + PageHeader { title: "Load averages" } diff --git a/qml/pages/SecondPage.qml b/qml/pages/SecondPage.qml index 360a02a..464aa48 100644 --- a/qml/pages/SecondPage.qml +++ b/qml/pages/SecondPage.qml @@ -14,6 +14,7 @@ Dialog { signal changeTimer(bool enabled) signal changeInterval(int interval) + signal changeRecord(bool enabled) property alias timerEnable : timerEnable property alias refreshInterval : intervalSlider @@ -29,7 +30,10 @@ Dialog { } timerEnable.checked = Storage.readSetting(Storage.db, - "timerEnable", false) + "timerEnable", false); + + recordEnable.checked = Storage.readSetting(Storage.db, + "recordEnable", false); } // Load values when app is started to start timers if needed @@ -37,6 +41,7 @@ Dialog { getSettings(); changeTimer(timerEnable.checked); changeInterval(intervalSlider.value); + changeRecord(recordEnable.checked); } onOpened: { @@ -46,13 +51,18 @@ Dialog { onAccepted: { Storage.storeSetting(Storage.db, "timerEnable", - timerEnable.checked) - changeTimer(timerEnable.checked) + timerEnable.checked); + changeTimer(timerEnable.checked); Storage.storeSetting(Storage.db, "interval", - intervalSlider.value) - changeInterval(intervalSlider.value) + intervalSlider.value); + changeInterval(intervalSlider.value); + + Storage.storeSetting(Storage.db, + "recordEnable", + recordEnable.checked); + changeRecord(recordEnable.checked); } SilicaFlickable { @@ -65,8 +75,8 @@ Dialog { spacing: Theme.paddingLarge DialogHeader { - title: "Settings" - acceptText: "Save" + title: "Save" + acceptText: "Settings" } TextSwitch { @@ -85,6 +95,30 @@ Dialog { valueText: value + " min" width: parent.width - Theme.paddingLarge * 2 } + + Label { + font.pixelSize: Theme.fontSizeSmall + color: Theme.secondaryColor + text: "Note that due to the power saving features of Sailfish OS, the update may not occur at the specified interval when the device is locked." + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - Theme.paddingLarge * 2 + wrapMode: Text.WordWrap + } + + TextSwitch { + id: recordEnable + checked: false + text: "Store uptime record" + } + + Label { + font.pixelSize: Theme.fontSizeSmall + color: Theme.secondaryColor + text: "Record is stored whenever the uptime is updated." + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width - Theme.paddingLarge * 2 + wrapMode: Text.WordWrap + } } } } diff --git a/rpm/harbour-sailtime.spec b/rpm/harbour-sailtime.spec index 8b9136b..a4f2da5 100644 --- a/rpm/harbour-sailtime.spec +++ b/rpm/harbour-sailtime.spec @@ -21,10 +21,10 @@ URL: http://example.org/ Source0: %{name}-%{version}.tar.bz2 Source100: harbour-sailtime.yaml Requires: sailfishsilica-qt5 >= 0.10.9 -BuildRequires: pkgconfig(Qt5Quick) -BuildRequires: pkgconfig(Qt5Qml) -BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(sailfishapp) >= 0.0.10 +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Quick) BuildRequires: desktop-file-utils %description @@ -64,13 +64,13 @@ desktop-file-install --delete-original \ %files %defattr(-,root,root,-) -%{_bindir} -%{_datadir}/%{name}/qml -%{_datadir}/applications/%{name}.desktop -%{_datadir}/icons/hicolor/86x86/apps/%{name}.png -/usr/bin -/usr/share/harbour-sailtime -/usr/share/applications /usr/share/icons/hicolor/86x86/apps +/usr/share/applications +/usr/share/harbour-sailtime +/usr/bin +%{_datadir}/icons/hicolor/86x86/apps/%{name}.png +%{_datadir}/applications/%{name}.desktop +%{_datadir}/%{name}/qml +%{_bindir} # >> files # << files diff --git a/rpm/harbour-sailtime.yaml b/rpm/harbour-sailtime.yaml index 41c6066..48b012c 100644 --- a/rpm/harbour-sailtime.yaml +++ b/rpm/harbour-sailtime.yaml @@ -14,19 +14,19 @@ Description: |- Configure: none Builder: qtc5 PkgConfigBR: -- Qt5Quick -- Qt5Qml -- Qt5Core - sailfishapp >= 0.0.10 +- Qt5Core +- Qt5Qml +- Qt5Quick Requires: - sailfishsilica-qt5 >= 0.10.9 Files: -- '%{_bindir}' -- '%{_datadir}/%{name}/qml' -- '%{_datadir}/applications/%{name}.desktop' -- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png' -- /usr/bin -- /usr/share/harbour-sailtime -- /usr/share/applications - /usr/share/icons/hicolor/86x86/apps +- /usr/share/applications +- /usr/share/harbour-sailtime +- /usr/bin +- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png' +- '%{_datadir}/applications/%{name}.desktop' +- '%{_datadir}/%{name}/qml' +- '%{_bindir}' PkgBR: [] From bc52f567a8fa46161d935afbd6331905d49f7c78 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Thu, 6 Feb 2014 23:34:54 +0200 Subject: [PATCH 08/11] Parse record to int when reading from storage to fix comparison --- qml/harbour-sailtime.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qml/harbour-sailtime.qml b/qml/harbour-sailtime.qml index 02ea269..2830f80 100644 --- a/qml/harbour-sailtime.qml +++ b/qml/harbour-sailtime.qml @@ -77,7 +77,7 @@ ApplicationWindow var hours = Math.floor(uptime_s / 3600 % 24); var minutes = Math.floor(uptime_s / 60 % 60); - var record = Storage.readSetting(Storage.db, "record", 0); + var record = parseInt(Storage.readSetting(Storage.db, "record", 0)); var rDays = Math.floor(record / 84600); var rHours = Math.floor(record / 3600 % 24); var rMinutes = Math.floor(record / 60 % 60); @@ -98,8 +98,10 @@ ApplicationWindow firstpage.updatePage(sysinfo, uptime); coverpage.updateCover(uptime); + var recordEnable = Storage.readSetting(Storage.db, "recordEnable", false); + // Update new record to db if feature is activated - if (Storage.readSetting(Storage.db, "recordEnable", false) && uptime_s >= record) { + if (recordEnable && (uptime_s >= record)) { Storage.storeSetting(Storage.db, "record", uptime_s); } } From ba9a2ff99dab710499efd440417075fc30ed7685 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Fri, 7 Feb 2014 13:35:12 +0200 Subject: [PATCH 09/11] Make progress bars more sensible looking and text easier to read on the bars --- qml/pages/FirstPage.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 4e3d811..77a7702 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -242,7 +242,7 @@ Page { id: usedmem height: Theme.fontSizeLarge width: 0 - color: Theme.secondaryColor + color: Theme.highlightColor } Rectangle { @@ -250,14 +250,14 @@ Page { id: freemem height: Theme.fontSizeLarge width: 0 - color: Theme.highlightColor + color: Theme.secondaryHighlightColor } Label { anchors.left: memlabel.right anchors.leftMargin: Theme.paddingLarge id: memlegend - color: Theme.primaryColor + color: "black" width: 5 * parent.width / 6 - Theme.paddingLarge * 2 horizontalAlignment: Qt.AlignCenter @@ -285,7 +285,7 @@ Page { id: usedswap height: Theme.fontSizeLarge width: 0 - color: Theme.secondaryColor + color: Theme.highlightColor } Rectangle { @@ -293,14 +293,14 @@ Page { id: freeswap height: Theme.fontSizeLarge width: 0 - color: Theme.highlightColor + color: Theme.secondaryHighlightColor } Label { anchors.left: swaplabel.right anchors.leftMargin: Theme.paddingLarge id: swaplegend - color: Theme.primaryColor + color: "black" width: 5 * parent.width / 6 - Theme.paddingLarge * 2 horizontalAlignment: Qt.AlignCenter From 694501edb869947ab82ec5328ecd162fef5b5140 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Tue, 11 Feb 2014 16:13:57 +0200 Subject: [PATCH 10/11] Format uptime strings to read "1 day" instead of "1 days" --- qml/cover/CoverPage.qml | 12 ++++++----- qml/harbour-sailtime.qml | 45 ++++++++++++++++++++++++++++----------- qml/pages/AboutPage.qml | 2 +- qml/pages/FirstPage.qml | 6 ++++-- rpm/harbour-sailtime.spec | 2 +- rpm/harbour-sailtime.yaml | 2 +- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml index f1315d3..ca72a13 100644 --- a/qml/cover/CoverPage.qml +++ b/qml/cover/CoverPage.qml @@ -13,11 +13,13 @@ CoverBackground { property alias cover : cover function updateCover(uptime) { - days.text = uptime.days + " days" - time.text = uptime.hours + " h " + uptime.minutes + " min" - load1.text = uptime.load1.toFixed(2) - load5.text = uptime.load5.toFixed(2) - load15.text = uptime.load15.toFixed(2) + var strings = formatUptime(uptime.days, uptime.hours, uptime.minutes); + + days.text = strings.days; + time.text = strings.hours + " " + strings.minutes; + load1.text = uptime.load1.toFixed(2); + load5.text = uptime.load5.toFixed(2); + load15.text = uptime.load15.toFixed(2); } Column { diff --git a/qml/harbour-sailtime.qml b/qml/harbour-sailtime.qml index 2830f80..ad73feb 100644 --- a/qml/harbour-sailtime.qml +++ b/qml/harbour-sailtime.qml @@ -72,27 +72,22 @@ ApplicationWindow var sysinfo = checker.fetchUptime(); var uptime_s = sysinfo.uptime; - - var days = Math.floor(uptime_s / 84600); - var hours = Math.floor(uptime_s / 3600 % 24); - var minutes = Math.floor(uptime_s / 60 % 60); + var uptime_d = divideUptime(uptime_s); var record = parseInt(Storage.readSetting(Storage.db, "record", 0)); - var rDays = Math.floor(record / 84600); - var rHours = Math.floor(record / 3600 % 24); - var rMinutes = Math.floor(record / 60 % 60); + var record_d = divideUptime(record); var uptime = { - "days": days, - "hours": hours, - "minutes": minutes, + "days": uptime_d.days, + "hours": uptime_d.hours, + "minutes": uptime_d.minutes, "load1": sysinfo.loads.avg_1, "load5": sysinfo.loads.avg_5, "load15": sysinfo.loads.avg_15, "record": record, - "rDays": rDays, - "rHours": rHours, - "rMinutes": rMinutes, + "rDays": record_d.days, + "rHours": record_d.hours, + "rMinutes": record_d.minutes, } firstpage.updatePage(sysinfo, uptime); @@ -106,6 +101,30 @@ ApplicationWindow } } + // Divide uptime to days, hours and minutes + function divideUptime(seconds) { + var days = Math.floor(seconds / 84600); + var hours = Math.floor(seconds / 3600 % 24); + var minutes = Math.floor(seconds / 60 % 60); + return { + "days": days, + "hours": hours, + "minutes": minutes + }; + } + + // Return formatted language strings with plural forms + function formatUptime(days, hours, minutes) { + var days_str = days + " day" + ((days !== 1)? "s" : ""); + var hours_str = hours + " h"; + var minutes_str = minutes + " min"; + return { + "days": days_str, + "hours": hours_str, + "minutes": minutes_str + }; + } + UptimeChecker { id: checker } diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 977dd49..acaa628 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -29,7 +29,7 @@ Page { Label { anchors.horizontalCenter: parent.horizontalCenter - text: "SailTime 1.1.0" + text: "SailTime 1.1.1" color: Theme.highlightColor font.pixelSize: Theme.fontSizeLarge } diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 77a7702..9b2bf9b 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -21,8 +21,10 @@ Page { } function updatePage(sysinfo, uptime) { - days.text = uptime.days + " days"; - time.text = uptime.hours + " h " + uptime.minutes + " min"; + var strings = formatUptime(uptime.days, uptime.hours, uptime.minutes); + + days.text = strings.days; + time.text = strings.hours + " " + strings.minutes; if (sysinfo.uptime >= uptime.record) { recordLabel.text = "Making new record!"; diff --git a/rpm/harbour-sailtime.spec b/rpm/harbour-sailtime.spec index a4f2da5..c696e12 100644 --- a/rpm/harbour-sailtime.spec +++ b/rpm/harbour-sailtime.spec @@ -13,7 +13,7 @@ Name: harbour-sailtime %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: SailTime -Version: 1.1.0 +Version: 1.1.1 Release: 1 Group: Qt/Qt License: MIT Expat licence diff --git a/rpm/harbour-sailtime.yaml b/rpm/harbour-sailtime.yaml index 48b012c..36ecf21 100644 --- a/rpm/harbour-sailtime.yaml +++ b/rpm/harbour-sailtime.yaml @@ -1,6 +1,6 @@ Name: harbour-sailtime Summary: SailTime -Version: 1.1.0 +Version: 1.1.1 Release: 1 Group: Qt/Qt URL: http://example.org/ From eb0bd02cad34a35ab99db4b72fc2c600d254a7c0 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Tue, 11 Feb 2014 16:32:38 +0200 Subject: [PATCH 11/11] Also change uptime record to use new string style --- qml/pages/FirstPage.qml | 3 ++- rpm/harbour-sailtime.spec | 2 +- rpm/harbour-sailtime.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 9b2bf9b..1659f80 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -30,7 +30,8 @@ Page { recordLabel.text = "Making new record!"; } else { - recordLabel.text = "Record: " + uptime.rDays + " days " + uptime.rHours + " h " + uptime.rMinutes + " min"; + var rStrings = formatUptime(uptime.rDays, uptime.rHours, uptime.rMinutes); + recordLabel.text = "Record: " + rStrings.days + " " + rStrings.hours + " " + rStrings.minutes; } diff --git a/rpm/harbour-sailtime.spec b/rpm/harbour-sailtime.spec index c696e12..8e90210 100644 --- a/rpm/harbour-sailtime.spec +++ b/rpm/harbour-sailtime.spec @@ -14,7 +14,7 @@ Name: harbour-sailtime %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: SailTime Version: 1.1.1 -Release: 1 +Release: 2 Group: Qt/Qt License: MIT Expat licence URL: http://example.org/ diff --git a/rpm/harbour-sailtime.yaml b/rpm/harbour-sailtime.yaml index 36ecf21..c1ff5ef 100644 --- a/rpm/harbour-sailtime.yaml +++ b/rpm/harbour-sailtime.yaml @@ -1,7 +1,7 @@ Name: harbour-sailtime Summary: SailTime Version: 1.1.1 -Release: 1 +Release: 2 Group: Qt/Qt URL: http://example.org/ License: "MIT Expat licence"