[-]
[+]
|
Changed |
_service:tar_git:valuelogger.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/valuelogger.git</param>
<param name="branch">master</param>
- <param name="revision">0e0097c</param>
+ <param name="revision">022bd48</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/qml/components/LinePlot.qml
^
|
@@ -243,11 +243,10 @@
}
}
- ListView {
+ Loader {
id: legend
- readonly property real itemHeight: Math.round(fontSize * 3 / 2)
-
+ active: parInfoModel.length > 1
anchors {
left: grid.left
leftMargin: Math.round(grid.width/grid.horizontalCount/2)
@@ -257,55 +256,68 @@
topMargin: Theme.paddingLarge
}
- z: 11
- height: itemHeight * count
- model: parInfoModel
- visible: opacity > 0
-
- delegate: Item {
- height: legend.itemHeight
- width: legend.width
-
- Rectangle {
- id: legendColor
- width: Theme.paddingLarge
- height: Theme.paddingSmall/2
- color: modelData.plotcolor
- anchors.verticalCenter: parent.verticalCenter
- }
+ sourceComponent: Component {
+ ListView {
+ id: legendList
+
+ z: 11
+ height: itemHeight * count
+ model: parInfoModel
+ visible: opacity > 0
+
+ readonly property real itemHeight: Math.round(fontSize * 3 / 2)
+
+ delegate: Item {
+ height: legendList.itemHeight
+ width: legendList.width
+
+ Rectangle {
+ id: legendColor
+ width: Theme.paddingLarge
+ height: Theme.paddingSmall/2
+ color: modelData.plotcolor
+ anchors.verticalCenter: parent.verticalCenter
+ }
- Label {
- anchors {
- verticalCenter: parent.verticalCenter
- left: legendColor.right
- leftMargin: Theme.paddingSmall
- right: parent.right
+ Label {
+ anchors {
+ verticalCenter: parent.verticalCenter
+ left: legendColor.right
+ leftMargin: Theme.paddingSmall
+ right: parent.right
+ }
+ font {
+ pixelSize: fontSize
+ bold: fontBold
+ }
+ text: modelData.name
+ truncationMode: TruncationMode.Fade
+ }
}
- font {
- pixelSize: fontSize
- bold: fontBold
+
+ Behavior on opacity {
+ FadeAnimation { duration: 500 }
}
- text: modelData.name
- truncationMode: TruncationMode.Fade
- }
- }
- Behavior on opacity {
- FadeAnimation { duration: 500 }
- }
+ onOpacityChanged: {
+ if (opacity === 1.0) {
+ legendVisibility.start()
+ }
+ }
- onOpacityChanged: {
- if (opacity === 1.0) {
- legendVisibility.start()
- }
- }
+ Timer {
+ id: legendVisibility
- Timer {
- id: legendVisibility
+ interval: 2000
+ running: true
+ onTriggered: legendList.opacity = 0.0
+ }
- interval: 2000
- running: true
- onTriggered: legend.opacity = 0.0
+ function show() {
+ opacity = 1.0
+ legendVisibility.restart()
+ }
+ }
}
}
@@ -316,7 +328,7 @@
timeStart: xstart
timeEnd: xend
size: canvas.width
- maxCount: canvas.width ? Math.ceil(canvas.width/Theme.itemSizeHuge) + 1 : 0
+ maxCount: canvas.width ? (Math.ceil(canvas.width/Theme.itemSizeHuge) + (fixedGrids ? 0 : 1)) : 0
fixedGrids: Settings.verticalGridLinesStyle === Settings.GridLinesFixed
}
@@ -414,7 +426,7 @@
minValue: min
maxValue: max
size: canvas.height
- maxCount: fixedGrids ? 4 : 7
+ maxCount: canvas.height ? (Math.ceil(canvas.height/(isLandscape ? Theme.itemSizeLarge : Theme.itemSizeHuge)) + (fixedGrids ? 0 : 2)) : 0
fixedGrids: Settings.horizontalGridLinesStyle === Settings.GridLinesFixed
}
delegate: Column {
@@ -524,8 +536,9 @@
property real pressY
onClicked: {
- legend.opacity = 1.0
- legendVisibility.restart()
+ if (legend.item) {
+ legend.item.show()
+ }
}
onPressed: {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/qml/pages/DrawData.qml
^
|
@@ -12,7 +12,7 @@
PageHeader {
id: ph
- title: qsTr("Plot")
+ title: parInfo.length === 1 ? parInfo[0].name : qsTr("Plot")
}
LinePlot {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/src/graph.cpp
^
|
@@ -30,6 +30,8 @@
#include <qmath.h>
+#define PRINTABLE_TIME(d) qPrintable((d).toString(QStringLiteral("dd.MM.yyyyThh:mm")))
+
namespace {
// UTC times are signiticantly faster to compare.
// Local times are getting converted to UTC every time
@@ -137,7 +139,7 @@
{
if (m_minTime != t) {
m_minTime = t;
- DBG(t);
+ DBG(PRINTABLE_TIME(t));
emit minTimeChanged();
update();
}
@@ -147,7 +149,7 @@
{
if (m_maxTime != t) {
m_maxTime = t;
- DBG(t);
+ DBG(PRINTABLE_TIME(t));
emit maxTimeChanged();
update();
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/src/timegridmodel.cpp
^
|
@@ -27,6 +27,7 @@
#include <qmath.h>
#define COUNT(a) (sizeof(a)/sizeof((a)[0]))
+#define PRINTABLE_TIME(d) qPrintable((d).toString(QStringLiteral("dd.MM.yyyyThh:mm")))
class TimeGridModel::Grid {
public:
@@ -149,44 +150,44 @@
const int* multipliers;
};
-const TimeGridModel::Step TimeGridModel::Step::MSecs =
- { TimeGridModel::Step::roundToMSecs, TimeGridModel::Step::addMSecs,
+const TimeGridModel::Step TimeGridModel::Step::MSecs = {
+ TimeGridModel::Step::roundToMSecs, TimeGridModel::Step::addMSecs,
TimeGridModel::Step::formatMSecs, 1, "ms",
- TimeGridModel::Step::MSecMultipliers};
+ TimeGridModel::Step::MSecMultipliers };
const int TimeGridModel::Step::MSecMultipliers[] = { 1, 2, 5, 10, 20, 50, 100, 200, 500, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Secs =
- { TimeGridModel::Step::roundToSecs, TimeGridModel::Step::addSecs,
+const TimeGridModel::Step TimeGridModel::Step::Secs = {
+ TimeGridModel::Step::roundToSecs, TimeGridModel::Step::addSecs,
TimeGridModel::Step::formatSecs, TimeGridModel::Grid::SpanSecondMSecs, "sec",
TimeGridModel::Step::SecMultipliers };
const int TimeGridModel::Step::SecMultipliers[] = { 1, 2, 5, 10, 20, 30, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Mins =
- { TimeGridModel::Step::roundToMins, TimeGridModel::Step::addMins,
+const TimeGridModel::Step TimeGridModel::Step::Mins = {
+ TimeGridModel::Step::roundToMins, TimeGridModel::Step::addMins,
TimeGridModel::Step::formatMins, TimeGridModel::Grid::SpanMinuteMSecs, "min",
TimeGridModel::Step::MinMultipliers };
const int TimeGridModel::Step::MinMultipliers[] = { 1, 2, 5, 10, 20, 30, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Hours =
- { TimeGridModel::Step::roundToHours, TimeGridModel::Step::addHours,
+const TimeGridModel::Step TimeGridModel::Step::Hours = {
+ TimeGridModel::Step::roundToHours, TimeGridModel::Step::addHours,
TimeGridModel::Step::formatHours, TimeGridModel::Grid::SpanHourMSecs, "hour(s)",
TimeGridModel::Step::HourMultipliers };
const int TimeGridModel::Step::HourMultipliers[] = { 1, 2, 3, 4, 6, 12, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Days =
- { TimeGridModel::Step::roundToDays, TimeGridModel::Step::addDays,
+const TimeGridModel::Step TimeGridModel::Step::Days = {
+ TimeGridModel::Step::roundToDays, TimeGridModel::Step::addDays,
TimeGridModel::Step::formatDays, TimeGridModel::Grid::SpanDayMSecs, "day(s)",
TimeGridModel::Step::DayMultipliers };
const int TimeGridModel::Step::DayMultipliers[] = { 1, 2, 5, 10, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Months =
- { TimeGridModel::Step::roundToMonths, TimeGridModel::Step::addMonths,
+const TimeGridModel::Step TimeGridModel::Step::Months = {
+ TimeGridModel::Step::roundToMonths, TimeGridModel::Step::addMonths,
TimeGridModel::Step::formatMonths, TimeGridModel::Grid::MinSpanMonthMSecs, "month(s)",
TimeGridModel::Step::MonthMultipliers };
const int TimeGridModel::Step::MonthMultipliers[] = { 1, 3, 6, 0 };
-const TimeGridModel::Step TimeGridModel::Step::Years
- { TimeGridModel::Step::roundToYears, TimeGridModel::Step::addYears,
+const TimeGridModel::Step TimeGridModel::Step::Years = {
+ TimeGridModel::Step::roundToYears, TimeGridModel::Step::addYears,
TimeGridModel::Step::formatYears, TimeGridModel::Grid::MinSpanYearMSecs, "year(s)",
TimeGridModel::Step::YearMultipliers };
const int TimeGridModel::Step::YearMultipliers[] = { 1, 2, 5, 10, 20, 50, 100, 200, 500, 0 };
@@ -285,7 +286,7 @@
{
if (m_timeStart != t) {
m_timeStart = t;
- DBG(t);
+ DBG(PRINTABLE_TIME(t));
updateGrids();
emit timeStartChanged();
}
@@ -295,7 +296,7 @@
{
if (m_timeEnd != t) {
m_timeEnd = t;
- DBG(t);
+ DBG(PRINTABLE_TIME(t));
updateGrids();
emit timeEndChanged();
}
@@ -371,7 +372,7 @@
m_timeEnd > m_timeStart) {
const qint64 spanMSecs = m_timeStart.msecsTo(m_timeEnd);
if (m_fixedGrids) {
- DBG("grid" << m_timeStart << ".." << m_timeEnd);
+ DBG("grid" << PRINTABLE_TIME(m_timeStart) << ".." << PRINTABLE_TIME(m_timeEnd));
int i, k = COUNT(Step::AllSteps) - 1;
const Step* step = Step::AllSteps[k];
while (spanMSecs < step->minSpanMSecs && k > 0) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/src/valuegridmodel.cpp
^
|
@@ -36,8 +36,9 @@
Grid() : value(0.0), coord(0.0) {}
Grid(const Grid& g) : value(g.value), coord(g.coord), text(g.text) {}
- Grid(qreal v, qreal c) : value(v), coord(c), text(QString::number(v)) {}
+ Grid(qreal v, qreal c, qreal s) : value(v), coord(c), text(formatValue(v, s)) {}
+ static QString formatValue(qreal v, qreal s);
Grid& operator=(const Grid& g) { value = g.value; coord = g.coord; text = g.text; return *this; }
bool operator==(const Grid& g) const { return value == g.value && coord == g.coord && text == g.text; }
@@ -47,6 +48,31 @@
QString text;
};
+QString ValueGridModel::Grid::formatValue(qreal v, qreal s)
+{
+ static const QString zero("0");
+ static const QString sep1(".");
+ static const QString sep2(",");
+ int precision = 2;
+ if (v == 0.0) {
+ return zero;
+ } else if (s < 1) {
+ precision = qMax((int)ceil(-log10(s)) + 1, precision);
+ } else if (ceil(log10(qAbs(v))) > 6) {
+ return QString::number(v, 'g', 5);
+ }
+ // Apply 'f' format
+ QString text(QString::number(v, 'f', precision));
+ // Strip trailing zeros
+ while (text.endsWith(zero)) {
+ text = text.left(text.length() - 1);
+ }
+ if (text.endsWith(sep1) || text.endsWith(sep2)) {
+ text = text.left(text.length() - 1);
+ }
+ return text;
+}
+
ValueGridModel::ValueGridModel(QObject* parent) :
QAbstractListModel(parent),
m_size(1.0),
@@ -122,7 +148,7 @@
}
const qreal value = step * i;
const qreal coord = m_size * (value - m_minValue) / span;
- const Grid grid(value, coord);
+ const Grid grid(value, coord, step);
grids->append(grid);
DBG(grids->count() << ":" << grid.value << grid.coord << grid.text);
}
@@ -134,18 +160,19 @@
QVector<Grid> grids;
if (m_size > 0 && m_maxValue > m_minValue && m_maxCount > 0) {
+ const qreal span = m_maxValue - m_minValue;
if (m_fixedGrids) {
- const qreal span = m_maxValue - m_minValue;
+ const qreal step = span/(m_maxCount + 1);
DBG("grid" << m_minValue << ".." << m_maxValue);
for (int i = 0; i < m_maxCount; i++) {
- const qreal offset = (i + 1) * span / (m_maxCount + 1);
+ const qreal offset = (i + 1) * step;
const qreal coord = m_size * offset / span;
- const Grid grid(m_minValue + offset, coord);
+ const Grid grid(m_minValue + offset, coord, step);
grids.append(grid);
DBG(grids.count() << ":" << grid.value << grid.coord << grid.text);
}
} else {
- const qreal minStep = (m_maxValue - m_minValue)/m_maxCount;
+ const qreal minStep = span/m_maxCount;
const int log = ceil(log10(minStep));
const qreal roundedStep = exp10(log);
DBG("grid" << m_minValue << ".." << m_maxValue << log << roundedStep);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/translations/harbour-valuelogger2_pl.ts
^
|
@@ -177,43 +177,43 @@
</message>
<message>
<source>Grid</source>
- <translation type="unfinished">Siatka</translation>
+ <translation>Siatka</translation>
</message>
<message>
<source>Time axis</source>
- <translation type="unfinished">Oś czasu</translation>
+ <translation>Oś czasu</translation>
</message>
<message>
<source>Time labels</source>
- <translation type="unfinished">Etykiety czasu</translation>
+ <translation>Etykiety czasu</translation>
</message>
<message>
<source>Value axis</source>
- <translation type="unfinished">Oś wartości</translation>
+ <translation>Oś wartości</translation>
</message>
<message>
<source>Dynamic</source>
- <translation type="unfinished">Dynamiczna</translation>
+ <translation>Dynamiczna</translation>
</message>
<message>
<source>Fixed</source>
- <translation type="unfinished">Niezmienna</translation>
+ <translation>Niezmienna</translation>
</message>
<message>
<source>Left labels</source>
- <translation type="unfinished">Lewe etykiety</translation>
+ <translation>Lewe etykiety</translation>
</message>
<message>
<source>Right labels</source>
- <translation type="unfinished">Prawe etykiety</translation>
+ <translation>Prawe etykiety</translation>
</message>
<message>
<source>Miscellaneous</source>
- <translation type="unfinished">Różne</translation>
+ <translation>Różne</translation>
</message>
<message>
<source>Show graph on the cover</source>
- <translation type="unfinished">Pokaż wykres na okładke</translation>
+ <translation>Pokaż wykres na okładce</translation>
</message>
</context>
<context>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.15.tar.bz2/valuelogger.pro
^
|
@@ -11,7 +11,7 @@
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
isEmpty(SPECVERSION) {
- SPECVERSION=1.0.14
+ SPECVERSION=1.0.15
}
DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\""
|