[-]
[+]
|
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">62a1dff</param>
+ <param name="revision">0e0097c</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-valuelogger2-1.0.12.tar.bz2/src/gridmodel.cpp
^
|
@@ -1,196 +0,0 @@
-/*
-Copyright (c) 2021 Slava Monich <slava@monich.com>
-
-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:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-
-#include "gridmodel.h"
-#include "debuglog.h"
-
-#include <qmath.h>
-
-class GridModel::Grid {
-public:
- enum Role {
- ValueRole = Qt::UserRole,
- TextRole,
- CoordinateRole
- };
-
- 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& 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; }
-
-public:
- qreal value;
- qreal coord;
- QString text;
-};
-
-GridModel::GridModel(QObject* parent) :
- QAbstractListModel(parent),
- m_size(1.0),
- m_minValue(0.0),
- m_maxValue(1.0),
- m_maxCount(10),
- m_fixedGrids(false)
-{
-}
-
-GridModel::~GridModel()
-{
-}
-
-void GridModel::setSize(qreal size)
-{
- if (m_size != size) {
- m_size = size;
- DBG(size);
- updateGrids();
- emit sizeChanged();
- }
-}
-
-void GridModel::setMinValue(qreal value)
-{
- if (m_minValue != value) {
- m_minValue = value;
- DBG(value);
- updateGrids();
- emit minValueChanged();
- }
-}
-
-void GridModel::setMaxValue(qreal value)
-{
- if (m_maxValue != value) {
- m_maxValue = value;
- DBG(value);
- updateGrids();
- emit maxValueChanged();
- }
-}
-
-void GridModel::setMaxCount(int count)
-{
- if (m_maxCount != count) {
- m_maxCount = count;
- DBG(count);
- updateGrids();
- maxCountChanged();
- }
-}
-
-void GridModel::setFixedGrids(bool fixed)
-{
- if (m_fixedGrids != fixed) {
- m_fixedGrids = fixed;
- DBG(fixed);
- updateGrids();
- fixedGridsChanged();
- }
-}
-
-bool GridModel::makeGrids(QVector<Grid>* grids, qreal step)
-{
- grids->resize(0);
- const qreal span = m_maxValue - m_minValue;
- for (int i = ceil(m_minValue/step); step * i < m_maxValue; i++) {
- if (grids->count() >= m_maxCount) {
- DBG("step" << step << "is too small");
- return false;
- }
- const qreal value = step * i;
- const qreal coord = m_size * (value - m_minValue) / span;
- const Grid grid(value, coord);
- grids->append(grid);
- DBG(grids->count() << ":" << grid.value << grid.coord << grid.text);
- }
- return true;
-}
-
-void GridModel::updateGrids()
-{
- QVector<Grid> grids;
-
- if (m_size > 0 && m_maxValue > m_minValue && m_maxCount > 0) {
- if (m_fixedGrids) {
- const qreal span = m_maxValue - m_minValue;
- 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 coord = m_size * offset / span;
- const Grid grid(m_minValue + offset, coord);
- grids.append(grid);
- DBG(grids.count() << ":" << grid.value << grid.coord << grid.text);
- }
- } else {
- const qreal minStep = (m_maxValue - m_minValue)/m_maxCount;
- const int log = ceil(log10(minStep));
- const qreal roundedStep = exp10(log);
- DBG("grid" << m_minValue << ".." << m_maxValue << log << roundedStep);
- /* First try to make more grids */
- if (!makeGrids(&grids, roundedStep/10) &&
- !makeGrids(&grids, roundedStep/5) &&
- !makeGrids(&grids, roundedStep/2)) {
- makeGrids(&grids, roundedStep);
- }
- }
- }
-
- if (m_grids != grids) {
- beginResetModel();
- m_grids = grids;
- endResetModel();
- }
-}
-
-/* QAbstractItemModel */
-
-QHash<int,QByteArray> GridModel::roleNames() const
-{
- QHash<int,QByteArray> roles;
- roles.insert(Grid::ValueRole, "value");
- roles.insert(Grid::TextRole, "text");
- roles.insert(Grid::CoordinateRole, "coordinate");
- return roles;
-}
-
-int GridModel::rowCount(const QModelIndex& parent) const
-{
- return m_grids.count();
-}
-
-QVariant GridModel::data(const QModelIndex& idx, int role) const
-{
- const int row = idx.row();
- if (row >= 0 && row < m_grids.count()) {
- const Grid& grid = m_grids.at(row);
- switch ((Grid::Role)role) {
- case Grid::ValueRole: return grid.value;
- case Grid::TextRole: return grid.text;
- case Grid::CoordinateRole: return grid.coord;
- }
- }
- return QVariant();
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-valuelogger2-1.0.12.tar.bz2/src/gridmodel.h
^
|
@@ -1,81 +0,0 @@
-/*
-Copyright (c) 2021 Slava Monich <slava@monich.com>
-
-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:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-
-#ifndef GRIDMODEL_H
-#define GRIDMODEL_H
-
-#include <QAbstractListModel>
-#include <QVector>
-
-class GridModel : public QAbstractListModel
-{
- Q_OBJECT
- Q_PROPERTY(qreal size READ getSize WRITE setSize NOTIFY sizeChanged)
- Q_PROPERTY(qreal minValue READ getMinValue WRITE setMinValue NOTIFY minValueChanged)
- Q_PROPERTY(qreal maxValue READ getMaxValue WRITE setMaxValue NOTIFY maxValueChanged)
- Q_PROPERTY(int maxCount READ getMaxCount WRITE setMaxCount NOTIFY maxCountChanged)
- Q_PROPERTY(bool fixedGrids READ getFixedGrids WRITE setFixedGrids NOTIFY fixedGridsChanged)
- class Grid;
-
-public:
- explicit GridModel(QObject* parent = Q_NULLPTR);
- ~GridModel();
-
- qreal getSize() const { return m_size; }
- qreal getMinValue() const { return m_minValue; }
- qreal getMaxValue() const { return m_maxValue; }
- int getMaxCount() const { return m_maxCount; }
- bool getFixedGrids() const { return m_fixedGrids; }
-
- void setSize(qreal size);
- void setMinValue(qreal value);
- void setMaxValue(qreal value);
- void setMaxCount(int count);
- void setFixedGrids(bool fixed);
-
- /* QAbstractItemModel */
- QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex& idx, int role) const Q_DECL_OVERRIDE;
-
-private:
- bool makeGrids(QVector<Grid>* grids, qreal step);
- void updateGrids();
-
-signals:
- void sizeChanged();
- void minValueChanged();
- void maxValueChanged();
- void maxCountChanged();
- void fixedGridsChanged();
-
-private:
- QVector<Grid> m_grids;
- qreal m_size;
- qreal m_minValue;
- qreal m_maxValue;
- int m_maxCount;
- bool m_fixedGrids;
-};
-
-#endif // GRIDMODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/qml/components/ColorPanel.qml
^
|
@@ -5,6 +5,7 @@
id: thisItem
color: "black"
+
property alias brightness: mouseArea.opacity
property alias pressed: mouseArea.pressed
@@ -110,6 +111,7 @@
sourceItem: Rectangle {
width: mouseArea.width
height: mouseArea.height
+ radius: Theme.paddingSmall
gradient: Gradient {
GradientStop { position: 0.0; color: color0 }
GradientStop { position: colorStop1; color: color1 }
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/qml/components/LinePlot.qml
^
|
@@ -37,6 +37,7 @@
readonly property int thinLine: Math.max(2, Math.floor(Theme.paddingSmall/3))
readonly property int fontSize: Theme.fontSizeTiny
readonly property bool fontBold: true
+ readonly property string dateTimeFormat: "dd.MM.yyyy hh:mm"
property real min: 0.0
property real max: 1.0
@@ -153,8 +154,8 @@
xstart = t1
xend = t2
- xStart.text = Qt.formatDateTime(xstart, "dd.MM.yyyy hh:mm")
- xEnd.text = Qt.formatDateTime(xend, "dd.MM.yyyy hh:mm")
+ xStart.text = Qt.formatDateTime(xstart, dateTimeFormat)
+ xEnd.text = Qt.formatDateTime(xend, dateTimeFormat)
}
function updateScale() {
@@ -308,11 +309,56 @@
}
}
+ TimeGridModel {
+ id: timeGridModel
+
+ timeOrigin: minTime
+ timeStart: xstart
+ timeEnd: xend
+ size: canvas.width
+ maxCount: canvas.width ? Math.ceil(canvas.width/Theme.itemSizeHuge) + 1 : 0
+ fixedGrids: Settings.verticalGridLinesStyle === Settings.GridLinesFixed
+ }
+
+ Item {
+ id: topLabels
+
+ width: parent.width
+ height: valueMax.height
+ anchors.bottom: valueMax.bottom
+ visible: Settings.topGridLabels
+ readonly property real maxOpacity: grid.opacity
+ readonly property real leftMargin: valueMax.width
+ readonly property real opacityRamp: Theme.paddingLarge
+ Repeater {
+ //model: Settings.topGridLabels ? timeGridModel : 0
+ model: timeGridModel
+ delegate: Text {
+ x: model.coordinate - width/2
+ anchors.bottom: parent ? parent.bottom : undefined
+ color: Theme.primaryColor
+ text: model.text
+ horizontalAlignment: Text.AlignHCenter
+ font {
+ pixelSize: fontSize
+ bold: fontBold
+ }
+ /* Fade it when it gets too close to the edge */
+ visible: timeGridModel.fixedGrids ? (opacity === topLabels.maxOpacity) : (opacity > 0)
+ readonly property real rightX: x + width
+ opacity: (x < topLabels.leftMargin || rightX > topLabels.width) ? 0 :
+ (x < topLabels.leftMargin + topLabels.opacityRamp) ? (topLabels.maxOpacity * (x - topLabels.leftMargin) / topLabels.opacityRamp) :
+ (rightX > topLabels.width - topLabels.opacityRamp) ? (topLabels.maxOpacity * (topLabels.width - rightX) / topLabels.opacityRamp) :
+ topLabels.maxOpacity
+ }
+ }
+ }
+
ShaderEffectSource {
id: grid
readonly property int horizontalCount: 6
- readonly property int verticalCount: 5
+ readonly property int horizontalOpacityRamp: Math.max(valueMax.width, Theme.paddingLarge)
width: parent.width
anchors {
@@ -337,12 +383,17 @@
color: Theme.primaryColor
}
Repeater {
- model: grid.horizontalCount - 1
+ model: timeGridModel
delegate: VDashLine {
- x: Math.round((index + 1) * (parent.width - width)/grid.horizontalCount)
+ x: Math.round(model.coordinate)
width: thinLine
- height: parent.height
+ height: grid.height
color: Theme.primaryColor
+ /* Fade it when it gets too close to the edge */
+ visible: opacity > 0
+ opacity: (x < Theme.paddingLarge || x > grid.width - Theme.paddingLarge) ? 0 :
+ (x < grid.horizontalOpacityRamp + Theme.paddingLarge) ? ((x - Theme.paddingLarge) / grid.horizontalOpacityRamp) :
+ (x > grid.width - grid.horizontalOpacityRamp - Theme.paddingLarge) ? ((grid.width - Theme.paddingLarge - x) / grid.horizontalOpacityRamp) : 1
}
}
/* Horizontal grid lines */
@@ -359,7 +410,7 @@
color: Theme.primaryColor
}
Repeater {
- model: GridModel {
+ model: ValueGridModel {
minValue: min
maxValue: max
size: canvas.height
@@ -369,7 +420,7 @@
delegate: Column {
y: Math.round(grid.height - model.coordinate - thinLine)
width: grid.width
- /* Hide is when it gets too close to the edge */
+ /* Fade it when it gets too close to the edge */
visible: opacity > 0
opacity: y < Theme.paddingLarge ? (y / Theme.paddingLarge) :
((grid.height - y) < 2*height) ? ((grid.height - y) / (2*height)) : 1
@@ -409,7 +460,6 @@
}
/* This one can be hidden if it's not needed */
visible: Settings.rightGridLabels
- onXChanged: Debug.log(x)
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/qml/components/SettingsView.qml
^
|
@@ -15,56 +15,107 @@
PageHeader { title: qsTr("Settings") }
- SectionHeader { text: qsTr("Horizontal grid lines") }
+ SectionHeader { text: qsTr("Grid") }
- ComboBox {
+ Grid {
width: parent.width
- label: qsTr("Position")
- currentItem: (Settings.horizontalGridLinesStyle === Settings.GridLinesDynamic) ? horizontalGridLinesDynamic :
- (Settings.horizontalGridLinesStyle = Settings.GridLinesFixed) ? horizontalGridLinesFixed : null
- menu: ContextMenu {
- MenuItem {
- id: horizontalGridLinesDynamic
+ columns: landscapeLayout ? 2 : 1
- text: qsTr("Dynamic")
- onClicked: Settings.horizontalGridLinesStyle = Settings.GridLinesDynamic
- }
- MenuItem {
- id: horizontalGridLinesFixed
+ readonly property real columnWidth: width/columns
+
+ ComboBox {
+ id: timeAxisComboBox
- text: qsTr("Fixed")
- onClicked: Settings.horizontalGridLinesStyle = Settings.GridLinesFixed
+ width: parent.columnWidth
+ label: qsTr("Time axis")
+ currentItem: (Settings.verticalGridLinesStyle === Settings.GridLinesDynamic) ? verticalGridLinesDynamic :
+ (Settings.verticalGridLinesStyle = Settings.GridLinesFixed) ? verticalGridLinesFixed : null
+ menu: ContextMenu {
+ x: 0
+ width: timeAxisComboBox.width
+
+ MenuItem {
+ id: verticalGridLinesDynamic
+
+ text: qsTr("Dynamic")
+ onClicked: Settings.verticalGridLinesStyle = Settings.GridLinesDynamic
+ }
+ MenuItem {
+ id: verticalGridLinesFixed
+
+ text: qsTr("Fixed")
+ onClicked: Settings.verticalGridLinesStyle = Settings.GridLinesFixed
+ }
}
- }
+ }
+
+ TextSwitch {
+ width: parent.columnWidth
+ text: qsTr("Time labels")
+ automaticCheck: false
+ checked: Settings.topGridLabels
+ onClicked: Settings.topGridLabels = !Settings.topGridLabels
+ }
}
+
Grid {
width: parent.width
columns: landscapeLayout ? 2 : 1
readonly property real columnWidth: width/columns
- TextSwitch {
+ ComboBox {
+ id: valueAxisComboBox
+
width: parent.columnWidth
- text: qsTr("Left labels")
- automaticCheck: false
- checked: Settings.leftGridLabels
- onClicked: Settings.leftGridLabels = !Settings.leftGridLabels
+ label: qsTr("Value axis")
+ currentItem: (Settings.horizontalGridLinesStyle === Settings.GridLinesDynamic) ? horizontalGridLinesDynamic :
+ (Settings.horizontalGridLinesStyle = Settings.GridLinesFixed) ? horizontalGridLinesFixed : null
+ menu: ContextMenu {
+ x: 0
+ width: valueAxisComboBox.width
+
+ MenuItem {
+ id: horizontalGridLinesDynamic
+
+ text: qsTr("Dynamic")
+ onClicked: Settings.horizontalGridLinesStyle = Settings.GridLinesDynamic
+ }
+ MenuItem {
+ id: horizontalGridLinesFixed
+
+ text: qsTr("Fixed")
+ onClicked: Settings.horizontalGridLinesStyle = Settings.GridLinesFixed
+ }
+ }
}
- TextSwitch {
+ Column {
width: parent.columnWidth
- text: qsTr("Right labels")
- automaticCheck: false
- checked: Settings.rightGridLabels
- onClicked: Settings.rightGridLabels = !Settings.rightGridLabels
+
+ TextSwitch {
+ width: parent.width
+ text: qsTr("Left labels")
+ automaticCheck: false
+ checked: Settings.leftGridLabels
+ onClicked: Settings.leftGridLabels = !Settings.leftGridLabels
+ }
+
+ TextSwitch {
+ width: parent.width
+ text: qsTr("Right labels")
+ automaticCheck: false
+ checked: Settings.rightGridLabels
+ onClicked: Settings.rightGridLabels = !Settings.rightGridLabels
+ }
}
}
- SectionHeader { text: qsTr("Cover") }
+ SectionHeader { text: qsTr("Miscellaneous") }
TextSwitch {
width: parent.width
- text: qsTr("Show graph")
+ text: qsTr("Show graph on the cover")
automaticCheck: false
checked: Settings.showGraphOnCover
onClicked: Settings.showGraphOnCover = !Settings.showGraphOnCover
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/qml/pages/ColorEditor.qml
^
|
@@ -185,6 +185,7 @@
Rectangle {
id: sampleItem
+ radius: Theme.paddingSmall
anchors.fill: parent
color: "#" + hexText.text
layer.enabled: sample.pressed && sample.containsMouse
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/settings.cpp
^
|
@@ -30,12 +30,16 @@
Settings::Settings(QObject* parent) :
QObject(parent),
+ m_verticalGridLinesStyle(new MGConfItem(DCONF_KEY("verticalGridLinesStyle"), this)),
m_horizontalGridLinesStyle(new MGConfItem(DCONF_KEY("horizontalGridLinesStyle"), this)),
+ m_topGridLabels(new MGConfItem(DCONF_KEY("topGridLabels"), this)),
m_leftGridLabels(new MGConfItem(DCONF_KEY("leftGridLabels"), this)),
m_rightGridLabels(new MGConfItem(DCONF_KEY("rightGridLabels"), this)),
m_showGraphOnCover(new MGConfItem(DCONF_KEY("showGraphOnCover"), this))
{
+ connect(m_verticalGridLinesStyle, SIGNAL(valueChanged()), SIGNAL(verticalGridLinesStyleChanged()));
connect(m_horizontalGridLinesStyle, SIGNAL(valueChanged()), SIGNAL(horizontalGridLinesStyleChanged()));
+ connect(m_topGridLabels, SIGNAL(valueChanged()), SIGNAL(topGridLabelsChanged()));
connect(m_leftGridLabels, SIGNAL(valueChanged()), SIGNAL(leftGridLabelsChanged()));
connect(m_rightGridLabels, SIGNAL(valueChanged()), SIGNAL(rightGridLabelsChanged()));
connect(m_showGraphOnCover, SIGNAL(valueChanged()), SIGNAL(showGraphOnCoverChanged()));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/settings.h
^
|
@@ -36,7 +36,9 @@
Q_OBJECT
Q_ENUMS(GridLinesStyle)
Q_PROPERTY(QString configRoot READ getConfigRoot CONSTANT)
+ Q_PROPERTY(GridLinesStyle verticalGridLinesStyle READ getVerticalGridLinesStyle WRITE setVerticalGridLinesStyle NOTIFY verticalGridLinesStyleChanged)
Q_PROPERTY(GridLinesStyle horizontalGridLinesStyle READ getHorizontalGridLinesStyle WRITE setHorizontalGridLinesStyle NOTIFY horizontalGridLinesStyleChanged)
+ Q_PROPERTY(bool topGridLabels READ getTopGridLabels WRITE setTopGridLabels NOTIFY topGridLabelsChanged)
Q_PROPERTY(bool leftGridLabels READ getLeftGridLabels WRITE setLeftGridLabels NOTIFY leftGridLabelsChanged)
Q_PROPERTY(bool rightGridLabels READ getRightGridLabels WRITE setRightGridLabels NOTIFY rightGridLabelsChanged)
Q_PROPERTY(bool showGraphOnCover READ getShowGraphOnCover WRITE setShowGraphOnCover NOTIFY showGraphOnCoverChanged)
@@ -49,9 +51,15 @@
explicit Settings(QObject* parent = Q_NULLPTR);
+ GridLinesStyle getVerticalGridLinesStyle() const { return (GridLinesStyle) m_verticalGridLinesStyle->value((int) GridLinesDynamic).toInt(); }
+ void setVerticalGridLinesStyle(GridLinesStyle value) { m_verticalGridLinesStyle->set((int) value); }
+
GridLinesStyle getHorizontalGridLinesStyle() const { return (GridLinesStyle) m_horizontalGridLinesStyle->value((int) GridLinesDynamic).toInt(); }
void setHorizontalGridLinesStyle(GridLinesStyle value) { m_horizontalGridLinesStyle->set((int) value); }
+ bool getTopGridLabels() const { return m_topGridLabels->value(true).toBool(); }
+ void setTopGridLabels(bool value) { m_topGridLabels->set(value); }
+
bool getLeftGridLabels() const { return m_leftGridLabels->value(true).toBool(); }
void setLeftGridLabels(bool value) { m_leftGridLabels->set(value); }
@@ -68,13 +76,17 @@
static QObject* createSingleton(QQmlEngine* engine, QJSEngine* js);
signals:
+ void verticalGridLinesStyleChanged();
void horizontalGridLinesStyleChanged();
+ void topGridLabelsChanged();
void leftGridLabelsChanged();
void rightGridLabelsChanged();
void showGraphOnCoverChanged();
private:
+ MGConfItem* m_verticalGridLinesStyle;
MGConfItem* m_horizontalGridLinesStyle;
+ MGConfItem* m_topGridLabels;
MGConfItem* m_leftGridLabels;
MGConfItem* m_rightGridLabels;
MGConfItem* m_showGraphOnCover;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/timegridmodel.cpp
^
|
@@ -0,0 +1,472 @@
+/*
+Copyright (c) 2021 Slava Monich <slava@monich.com>
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+#include "timegridmodel.h"
+#include "debuglog.h"
+
+#include <qmath.h>
+
+#define COUNT(a) (sizeof(a)/sizeof((a)[0]))
+
+class TimeGridModel::Grid {
+public:
+ enum Role {
+ TimeRole = Qt::UserRole,
+ TextRole,
+ CoordinateRole
+ };
+
+ static const qint64 SpanSecondMSecs = Q_INT64_C(1000);
+ static const qint64 SpanMinuteMSecs = Q_INT64_C(60000);
+ static const qint64 SpanHourMSecs = Q_INT64_C(3600000);
+ static const qint64 SpanDayMSecs = Q_INT64_C(86400000);
+ static const qint64 MinSpanMonthMSecs = Q_INT64_C(2419200000);
+ static const qint64 MinSpanYearMSecs = Q_INT64_C(31536000000);
+
+ static const QString MSecsFormat;
+ static const QString SecsFormat;
+ static const QString TimeFormat;
+ static const QString DayFormat;
+ static const QString MonthFormat;
+ static const QString YearMonthFormat;
+ static const QString DateFormat;
+ static const QString YearFormat;
+ static const QString FixedFormat;
+
+ Grid() : coord(0.0) {}
+ Grid(const Grid& g) : time(g.time), coord(g.coord), text(g.text) {}
+ Grid(const QDateTime& t, qreal c, QString text) : time(t), coord(c), text(text) {}
+
+ Grid& operator=(const Grid& g) { time = g.time; coord = g.coord; text = g.text; return *this; }
+ bool operator==(const Grid& g) const { return coord == g.coord && text == g.text && time == g.time; }
+
+ static const QString& dateTimeFormat(qint64 spanMSecs);
+
+public:
+ QDateTime time;
+ qreal coord;
+ QString text;
+};
+
+const QString TimeGridModel::Grid::MSecsFormat("ss.zzz");
+const QString TimeGridModel::Grid::SecsFormat("hh:mm::ss");
+const QString TimeGridModel::Grid::TimeFormat("hh:mm");
+const QString TimeGridModel::Grid::DayFormat("d MMM");
+const QString TimeGridModel::Grid::MonthFormat("MMM");
+const QString TimeGridModel::Grid::YearMonthFormat("yyyy MMM");
+const QString TimeGridModel::Grid::DateFormat("dd.MM.yyyy");
+const QString TimeGridModel::Grid::YearFormat("yyyy");
+const QString TimeGridModel::Grid::FixedFormat("dd.MM.yyyy hh:mm");
+
+const QString& TimeGridModel::Grid::dateTimeFormat(qint64 spanMSecs)
+{
+ return (spanMSecs <= SpanSecondMSecs) ? MSecsFormat :
+ (spanMSecs <= SpanMinuteMSecs) ? SecsFormat :
+ (spanMSecs <= SpanDayMSecs) ? TimeFormat :
+ (spanMSecs <= MinSpanMonthMSecs) ? DayFormat :
+ (spanMSecs <= MinSpanYearMSecs) ? DateFormat :
+ YearFormat;
+}
+
+QDebug operator<<(QDebug out, const TimeGridModel::Grid& grid)
+{
+ QDebugStateSaver saver(out);
+ out.nospace() << "Grid(" <<
+ qPrintable(grid.time.toString(TimeGridModel::Grid::FixedFormat)) << ", " <<
+ grid.coord << ", " << grid.text << ")";
+ return out;
+}
+
+struct TimeGridModel::Step {
+public:
+ static QDateTime roundToSpan(const QDateTime& t, const QDateTime& o, qint64 spanMSecs);
+ static QDateTime roundToMSecs(const QDateTime& t, const QDateTime& o, int msecs) { return roundToSpan(t, o, msecs); }
+ static QDateTime roundToSecs(const QDateTime& t, const QDateTime& o, int secs) { return roundToSpan(t, o, Grid::SpanSecondMSecs * secs); }
+ static QDateTime roundToMins(const QDateTime& t, const QDateTime& o, int mins) { return roundToSpan(t, o, Grid::SpanMinuteMSecs * mins); }
+ static QDateTime roundToHours(const QDateTime& t, const QDateTime& o, int hours) { return roundToSpan(t, o, Grid::SpanHourMSecs * hours); }
+ static QDateTime roundToDays(const QDateTime& t, const QDateTime& o, int days) { return roundToSpan(t, o, Grid::SpanDayMSecs * days); }
+ static QDateTime roundToMonths(const QDateTime& t, const QDateTime&, int months);
+ static QDateTime roundToYears(const QDateTime& t, const QDateTime&, int years);
+ static QDateTime addMSecs(const QDateTime& t, int msecs) { return t.addMSecs(msecs); }
+ static QDateTime addSecs(const QDateTime& t, int secs) { return t.addMSecs(Grid::SpanSecondMSecs * secs); }
+ static QDateTime addMins(const QDateTime& t, int mins) { return t.addMSecs(Grid::SpanMinuteMSecs * mins); }
+ static QDateTime addHours(const QDateTime& t, int hours) { return t.addMSecs(Grid::SpanHourMSecs * hours); }
+ static QDateTime addDays(const QDateTime& t, int days) { return t.addMSecs(Grid::SpanDayMSecs * days); }
+ static QDateTime addMonths(const QDateTime& t, int months) { return t.addMonths(months); }
+ static QDateTime addYears(const QDateTime& t, int years) { return t.addMonths(12*years); }
+ static QString formatMSecs(const QDateTime& t, const Grid* prev) { return t.toString(Grid::MSecsFormat); }
+ static QString formatSecs(const QDateTime& t, const Grid* prev) { return t.toString(Grid::SecsFormat); }
+ static QString formatMins(const QDateTime& t, const Grid* prev) { return t.toString(Grid::TimeFormat); }
+ static QString formatHours(const QDateTime& t, const Grid* prev) { return t.toString(Grid::TimeFormat); }
+ static QString formatDays(const QDateTime& t, const Grid* prev) { return t.toString(Grid::DayFormat); }
+ static QString formatMonths(const QDateTime& t, const Grid* prev);
+ static QString formatYears(const QDateTime& t, const Grid* prev) { return t.toString(Grid::YearFormat); }
+
+ static const int MSecMultipliers[];
+ static const int SecMultipliers[];
+ static const int MinMultipliers[];
+ static const int HourMultipliers[];
+ static const int DayMultipliers[];
+ static const int MonthMultipliers[];
+ static const int YearMultipliers[];
+
+ static const Step MSecs;
+ static const Step Secs;
+ static const Step Mins;
+ static const Step Hours;
+ static const Step Days;
+ static const Step Months;
+ static const Step Years;
+
+ static const Step* AllSteps[];
+
+public:
+ QDateTime (*roundUp)(const QDateTime& t, const QDateTime& origin, int n);
+ QDateTime (*add)(const QDateTime& t, int n);
+ QString (*format)(const QDateTime& t, const Grid* prev);
+ const qint64 minSpanMSecs;
+ const char* units;
+ const int* multipliers;
+};
+
+const TimeGridModel::Step TimeGridModel::Step::MSecs =
+ { TimeGridModel::Step::roundToMSecs, TimeGridModel::Step::addMSecs,
+ TimeGridModel::Step::formatMSecs, 1, "ms",
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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 };
+
+const TimeGridModel::Step* TimeGridModel::Step::AllSteps[] = {
+ &TimeGridModel::Step::MSecs,
+ &TimeGridModel::Step::Secs,
+ &TimeGridModel::Step::Mins,
+ &TimeGridModel::Step::Hours,
+ &TimeGridModel::Step::Days,
|
[-]
[+]
|
Added |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/timegridmodel.h
^
|
@@ -0,0 +1,95 @@
+/*
+Copyright (c) 2021 Slava Monich <slava@monich.com>
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef TIMEGRIDMODEL_H
+#define TIMEGRIDMODEL_H
+
+#include <QAbstractListModel>
+#include <QDateTime>
+#include <QVector>
+
+class TimeGridModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ getSize WRITE setSize NOTIFY sizeChanged)
+ Q_PROPERTY(int minCount READ getMinCount WRITE setMinCount NOTIFY minCountChanged)
+ Q_PROPERTY(int maxCount READ getMaxCount WRITE setMaxCount NOTIFY maxCountChanged)
+ Q_PROPERTY(QDateTime timeOrigin READ getTimeOrigin WRITE setTimeOrigin NOTIFY timeOriginChanged)
+ Q_PROPERTY(QDateTime timeStart READ getTimeStart WRITE setTimeStart NOTIFY timeStartChanged)
+ Q_PROPERTY(QDateTime timeEnd READ getTimeEnd WRITE setTimeEnd NOTIFY timeEndChanged)
+ Q_PROPERTY(bool fixedGrids READ getFixedGrids WRITE setFixedGrids NOTIFY fixedGridsChanged)
+ struct Step;
+
+public:
+ class Grid;
+ explicit TimeGridModel(QObject* parent = Q_NULLPTR);
+ ~TimeGridModel();
+
+ qreal getSize() const { return m_size; }
+ int getMinCount() const { return m_minCount; }
+ int getMaxCount() const { return m_maxCount; }
+ QDateTime getTimeOrigin() const { return m_timeOrigin; }
+ QDateTime getTimeStart() const { return m_timeStart; }
+ QDateTime getTimeEnd() const { return m_timeEnd; }
+ bool getFixedGrids() const { return m_fixedGrids; }
+
+ void setSize(qreal size);
+ void setMinCount(int count);
+ void setMaxCount(int count);
+ void setTimeOrigin(QDateTime t);
+ void setTimeStart(QDateTime t);
+ void setTimeEnd(QDateTime t);
+ void setFixedGrids(bool fixed);
+
+ /* QAbstractItemModel */
+ QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex& idx, int role) const Q_DECL_OVERRIDE;
+
+private:
+ bool makeGrids(QVector<Grid>* grids, const Step* step, int n) const;
+ bool makeGrids(QVector<Grid>* grids, const Step* step) const;
+ void updateGrids();
+
+signals:
+ void sizeChanged();
+ void minCountChanged();
+ void maxCountChanged();
+ void timeOriginChanged();
+ void timeStartChanged();
+ void timeEndChanged();
+ void dateTimeFormatChanged();
+ void fixedGridsChanged();
+
+private:
+ QVector<Grid> m_grids;
+ qreal m_size;
+ int m_minCount;
+ int m_maxCount;
+ QDateTime m_timeOrigin;
+ QDateTime m_timeStart;
+ QDateTime m_timeEnd;
+ bool m_fixedGrids;
+};
+
+#endif // TIMEGRIDMODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/valuegridmodel.cpp
^
|
@@ -0,0 +1,196 @@
+/*
+Copyright (c) 2021 Slava Monich <slava@monich.com>
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+#include "valuegridmodel.h"
+#include "debuglog.h"
+
+#include <qmath.h>
+
+class ValueGridModel::Grid {
+public:
+ enum Role {
+ ValueRole = Qt::UserRole,
+ TextRole,
+ CoordinateRole
+ };
+
+ 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& 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; }
+
+public:
+ qreal value;
+ qreal coord;
+ QString text;
+};
+
+ValueGridModel::ValueGridModel(QObject* parent) :
+ QAbstractListModel(parent),
+ m_size(1.0),
+ m_minValue(0.0),
+ m_maxValue(1.0),
+ m_maxCount(10),
+ m_fixedGrids(false)
+{
+}
+
+ValueGridModel::~ValueGridModel()
+{
+}
+
+void ValueGridModel::setSize(qreal size)
+{
+ if (m_size != size) {
+ m_size = size;
+ DBG(size);
+ updateGrids();
+ emit sizeChanged();
+ }
+}
+
+void ValueGridModel::setMinValue(qreal value)
+{
+ if (m_minValue != value) {
+ m_minValue = value;
+ DBG(value);
+ updateGrids();
+ emit minValueChanged();
+ }
+}
+
+void ValueGridModel::setMaxValue(qreal value)
+{
+ if (m_maxValue != value) {
+ m_maxValue = value;
+ DBG(value);
+ updateGrids();
+ emit maxValueChanged();
+ }
+}
+
+void ValueGridModel::setMaxCount(int count)
+{
+ if (m_maxCount != count) {
+ m_maxCount = count;
+ DBG(count);
+ updateGrids();
+ maxCountChanged();
+ }
+}
+
+void ValueGridModel::setFixedGrids(bool fixed)
+{
+ if (m_fixedGrids != fixed) {
+ m_fixedGrids = fixed;
+ DBG(fixed);
+ updateGrids();
+ fixedGridsChanged();
+ }
+}
+
+bool ValueGridModel::makeGrids(QVector<Grid>* grids, qreal step)
+{
+ grids->resize(0);
+ const qreal span = m_maxValue - m_minValue;
+ for (int i = ceil(m_minValue/step); step * i < m_maxValue; i++) {
+ if (grids->count() >= m_maxCount) {
+ DBG("step" << step << "is too small");
+ return false;
+ }
+ const qreal value = step * i;
+ const qreal coord = m_size * (value - m_minValue) / span;
+ const Grid grid(value, coord);
+ grids->append(grid);
+ DBG(grids->count() << ":" << grid.value << grid.coord << grid.text);
+ }
+ return true;
+}
+
+void ValueGridModel::updateGrids()
+{
+ QVector<Grid> grids;
+
+ if (m_size > 0 && m_maxValue > m_minValue && m_maxCount > 0) {
+ if (m_fixedGrids) {
+ const qreal span = m_maxValue - m_minValue;
+ 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 coord = m_size * offset / span;
+ const Grid grid(m_minValue + offset, coord);
+ grids.append(grid);
+ DBG(grids.count() << ":" << grid.value << grid.coord << grid.text);
+ }
+ } else {
+ const qreal minStep = (m_maxValue - m_minValue)/m_maxCount;
+ const int log = ceil(log10(minStep));
+ const qreal roundedStep = exp10(log);
+ DBG("grid" << m_minValue << ".." << m_maxValue << log << roundedStep);
+ /* First try to make more grids */
+ if (!makeGrids(&grids, roundedStep/10) &&
+ !makeGrids(&grids, roundedStep/5) &&
+ !makeGrids(&grids, roundedStep/2)) {
+ makeGrids(&grids, roundedStep);
+ }
+ }
+ }
+
+ if (m_grids != grids) {
+ beginResetModel();
+ m_grids = grids;
+ endResetModel();
+ }
+}
+
+/* QAbstractItemModel */
+
+QHash<int,QByteArray> ValueGridModel::roleNames() const
+{
+ QHash<int,QByteArray> roles;
+ roles.insert(Grid::ValueRole, "value");
+ roles.insert(Grid::TextRole, "text");
+ roles.insert(Grid::CoordinateRole, "coordinate");
+ return roles;
+}
+
+int ValueGridModel::rowCount(const QModelIndex& parent) const
+{
+ return m_grids.count();
+}
+
+QVariant ValueGridModel::data(const QModelIndex& idx, int role) const
+{
+ const int row = idx.row();
+ if (row >= 0 && row < m_grids.count()) {
+ const Grid& grid = m_grids.at(row);
+ switch ((Grid::Role)role) {
+ case Grid::ValueRole: return grid.value;
+ case Grid::TextRole: return grid.text;
+ case Grid::CoordinateRole: return grid.coord;
+ }
+ }
+ return QVariant();
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/valuegridmodel.h
^
|
@@ -0,0 +1,81 @@
+/*
+Copyright (c) 2021 Slava Monich <slava@monich.com>
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef VALUEGRIDMODEL_H
+#define VALUEGRIDMODEL_H
+
+#include <QAbstractListModel>
+#include <QVector>
+
+class ValueGridModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ getSize WRITE setSize NOTIFY sizeChanged)
+ Q_PROPERTY(qreal minValue READ getMinValue WRITE setMinValue NOTIFY minValueChanged)
+ Q_PROPERTY(qreal maxValue READ getMaxValue WRITE setMaxValue NOTIFY maxValueChanged)
+ Q_PROPERTY(int maxCount READ getMaxCount WRITE setMaxCount NOTIFY maxCountChanged)
+ Q_PROPERTY(bool fixedGrids READ getFixedGrids WRITE setFixedGrids NOTIFY fixedGridsChanged)
+ class Grid;
+
+public:
+ explicit ValueGridModel(QObject* parent = Q_NULLPTR);
+ ~ValueGridModel();
+
+ qreal getSize() const { return m_size; }
+ qreal getMinValue() const { return m_minValue; }
+ qreal getMaxValue() const { return m_maxValue; }
+ int getMaxCount() const { return m_maxCount; }
+ bool getFixedGrids() const { return m_fixedGrids; }
+
+ void setSize(qreal size);
+ void setMinValue(qreal value);
+ void setMaxValue(qreal value);
+ void setMaxCount(int count);
+ void setFixedGrids(bool fixed);
+
+ /* QAbstractItemModel */
+ QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex& parent) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex& idx, int role) const Q_DECL_OVERRIDE;
+
+private:
+ bool makeGrids(QVector<Grid>* grids, qreal step);
+ void updateGrids();
+
+signals:
+ void sizeChanged();
+ void minValueChanged();
+ void maxValueChanged();
+ void maxCountChanged();
+ void fixedGridsChanged();
+
+private:
+ QVector<Grid> m_grids;
+ qreal m_size;
+ qreal m_minValue;
+ qreal m_maxValue;
+ int m_maxCount;
+ bool m_fixedGrids;
+};
+
+#endif // VALUEGRIDMODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/src/valuelogger.cpp
^
|
@@ -24,13 +24,14 @@
#include "colormodel.h"
#include "graph.h"
-#include "gridmodel.h"
#include "hdashline.h"
#include "logger.h"
#include "datamodel.h"
#include "debuglog.h"
#include "pairmodel.h"
#include "settings.h"
+#include "timegridmodel.h"
+#include "valuegridmodel.h"
#include "vdashline.h"
#include <sailfishapp.h>
@@ -69,11 +70,12 @@
const char *uri = "harbour.valuelogger";
qmlRegisterType<ColorModel>(uri, 1, 0, "ColorModel");
qmlRegisterType<Graph>(uri, 1, 0, "Graph");
- qmlRegisterType<GridModel>(uri, 1, 0, "GridModel");
qmlRegisterType<DataModel>(uri, 1, 0, "DataModel");
qmlRegisterType<HDashLine>(uri, 1, 0, "HDashLine");
qmlRegisterType<VDashLine>(uri, 1, 0, "VDashLine");
qmlRegisterType<PairModel>(uri, 1, 0, "PairModel");
+ qmlRegisterType<TimeGridModel>(uri, 1, 0, "TimeGridModel");
+ qmlRegisterType<ValueGridModel>(uri, 1, 0, "ValueGridModel");
qmlRegisterSingletonType<Settings>(uri, 1, 0, "Settings", Settings::createSingleton);
qmlRegisterSingletonType<Logger>(uri, 1, 0, "Logger", Logger::createSingleton);
qmlRegisterSingletonType<DebugLog>(uri, 1, 0, "DebugLog", DebugLog::createSingleton);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/translations/harbour-valuelogger2.ts
^
|
@@ -176,12 +176,20 @@
<translation>Settings</translation>
</message>
<message>
- <source>Horizontal grid lines</source>
- <translation>Horizontal grid lines</translation>
+ <source>Grid</source>
+ <translation>Grid</translation>
</message>
<message>
- <source>Position</source>
- <translation>Position</translation>
+ <source>Time axis</source>
+ <translation>Time axis</translation>
+ </message>
+ <message>
+ <source>Time labels</source>
+ <translation>Time labels</translation>
+ </message>
+ <message>
+ <source>Value axis</source>
+ <translation>Value axis</translation>
</message>
<message>
<source>Dynamic</source>
@@ -200,12 +208,12 @@
<translation>Right labels</translation>
</message>
<message>
- <source>Cover</source>
- <translation>Cover</translation>
+ <source>Miscellaneous</source>
+ <translation>Miscellaneous</translation>
</message>
<message>
- <source>Show graph</source>
- <translation>Show graph</translation>
+ <source>Show graph on the cover</source>
+ <translation>Show graph on the cover</translation>
</message>
</context>
<context>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/translations/harbour-valuelogger2_fi.ts
^
|
@@ -176,16 +176,24 @@
<translation>Asetukset</translation>
</message>
<message>
- <source>Horizontal grid lines</source>
- <translation type="unfinished">Vaakasuuntaiset ristikkoviivat</translation>
+ <source>Grid</source>
+ <translation type="unfinished">Ruudukko</translation>
</message>
<message>
- <source>Position</source>
- <translation type="unfinished">Positio</translation>
+ <source>Time axis</source>
+ <translation type="unfinished">Päivämääräakseli</translation>
+ </message>
+ <message>
+ <source>Time labels</source>
+ <translation type="unfinished">Päivämääräotsikot</translation>
+ </message>
+ <message>
+ <source>Value axis</source>
+ <translation type="unfinished">Arvoakseli</translation>
</message>
<message>
<source>Dynamic</source>
- <translation type="unfinished">Dynaaminen </translation>
+ <translation type="unfinished">Dynaaminen</translation>
</message>
<message>
<source>Fixed</source>
@@ -193,19 +201,19 @@
</message>
<message>
<source>Left labels</source>
- <translation type="unfinished">Vasen etiketit</translation>
+ <translation type="unfinished">Otsikot vasemmalla</translation>
</message>
<message>
<source>Right labels</source>
- <translation type="unfinished">Oikeat etiketit</translation>
+ <translation type="unfinished">Otsikot oikealla</translation>
</message>
<message>
- <source>Cover</source>
- <translation type="unfinished">Kansilehti</translation>
+ <source>Miscellaneous</source>
+ <translation type="unfinished">Sekalaista</translation>
</message>
<message>
- <source>Show graph</source>
- <translation type="unfinished">Näytä käppyrä</translation>
+ <source>Show graph on the cover</source>
+ <translation type="unfinished">Näytä käppyrä kansilehdellä</translation>
</message>
</context>
<context>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/translations/harbour-valuelogger2_pl.ts
^
|
@@ -176,36 +176,44 @@
<translation>Ustawienia</translation>
</message>
<message>
- <source>Horizontal grid lines</source>
- <translation>Poziome linie siatki</translation>
+ <source>Grid</source>
+ <translation type="unfinished">Siatka</translation>
</message>
<message>
- <source>Position</source>
- <translation>Pozycja</translation>
+ <source>Time axis</source>
+ <translation type="unfinished">Oś czasu</translation>
+ </message>
+ <message>
+ <source>Time labels</source>
+ <translation type="unfinished">Etykiety czasu</translation>
+ </message>
+ <message>
+ <source>Value axis</source>
+ <translation type="unfinished">Oś wartości</translation>
</message>
<message>
<source>Dynamic</source>
- <translation>Dynamiczna</translation>
+ <translation type="unfinished">Dynamiczna</translation>
</message>
<message>
<source>Fixed</source>
- <translation>Niezmienna</translation>
+ <translation type="unfinished">Niezmienna</translation>
</message>
<message>
<source>Left labels</source>
- <translation>Lewe etykiety</translation>
+ <translation type="unfinished">Lewe etykiety</translation>
</message>
<message>
<source>Right labels</source>
- <translation>Prawe etykiety</translation>
+ <translation type="unfinished">Prawe etykiety</translation>
</message>
<message>
- <source>Cover</source>
- <translation type="unfinished">Okładka</translation>
+ <source>Miscellaneous</source>
+ <translation type="unfinished">Różne</translation>
</message>
<message>
- <source>Show graph</source>
- <translation type="unfinished">Pokaż wykres</translation>
+ <source>Show graph on the cover</source>
+ <translation type="unfinished">Pokaż wykres na okładke</translation>
</message>
</context>
<context>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/translations/harbour-valuelogger2_ru.ts
^
|
@@ -176,20 +176,28 @@
<translation>Настройки</translation>
</message>
<message>
- <source>Horizontal grid lines</source>
- <translation>Горизонтальная сетка</translation>
+ <source>Grid</source>
+ <translation>Сетка графика</translation>
</message>
<message>
- <source>Position</source>
- <translation>Расположение</translation>
+ <source>Time axis</source>
+ <translation>Разметка оси времени</translation>
+ </message>
+ <message>
+ <source>Time labels</source>
+ <translation>Значения времени</translation>
+ </message>
+ <message>
+ <source>Value axis</source>
+ <translation>Разметка оси значений</translation>
</message>
<message>
<source>Dynamic</source>
- <translation>Динамическое</translation>
+ <translation>Динамическая</translation>
</message>
<message>
<source>Fixed</source>
- <translation>Фиксированное</translation>
+ <translation>Фиксированая</translation>
</message>
<message>
<source>Left labels</source>
@@ -200,12 +208,12 @@
<translation>Значения справа</translation>
</message>
<message>
- <source>Cover</source>
- <translation>Обложка</translation>
+ <source>Miscellaneous</source>
+ <translation>Разное</translation>
</message>
<message>
- <source>Show graph</source>
- <translation>Показывать график</translation>
+ <source>Show graph on the cover</source>
+ <translation>Показывать график на обложке</translation>
</message>
</context>
<context>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/translations/harbour-valuelogger2_sv.ts
^
|
@@ -12,11 +12,11 @@
<name>AddPair</name>
<message>
<source>Clear pair</source>
- <translation>Rensa par</translation>
+ <translation>Ta bort par</translation>
</message>
<message>
<source>Pair</source>
- <translation type="unfinished">Par</translation>
+ <translation>Para ihop</translation>
</message>
</context>
<context>
@@ -54,19 +54,19 @@
<name>ColorEditor</name>
<message>
<source>Add color</source>
- <translation type="unfinished">Lägg till färg</translation>
+ <translation>Lägg till färg</translation>
</message>
<message>
<source>Color</source>
- <translation type="unfinished">Färg</translation>
+ <translation>Färg</translation>
</message>
<message>
<source>Brightness</source>
- <translation type="unfinished">Ljusstyrka</translation>
+ <translation>Ljusstyrka</translation>
</message>
<message>
<source>Hex notation</source>
- <translation type="unfinished">Hex-format</translation>
+ <translation>Hex-format</translation>
</message>
</context>
<context>
@@ -77,7 +77,7 @@
</message>
<message>
<source>Reset colors</source>
- <translation type="unfinished">Återställ färger</translation>
+ <translation>Återställ färger</translation>
</message>
</context>
<context>
@@ -127,11 +127,11 @@
</message>
<message>
<source>No parameters.</source>
- <translation type="unfinished">Inga parametrar.</translation>
+ <translation>Inga parametrar.</translation>
</message>
<message>
<source>Open the pulley menu to add one.</source>
- <translation type="unfinished">Öppna rullgardinsmenyn för att lägga till en.</translation>
+ <translation>Öppna toppmenyn för att lägga till en.</translation>
</message>
<message>
<source>Edit parameter</source>
@@ -176,36 +176,44 @@
<translation>Inställningar</translation>
</message>
<message>
- <source>Horizontal grid lines</source>
- <translation type="unfinished">Horisontella rutnät</translation>
+ <source>Grid</source>
+ <translation type="unfinished">Rutnät</translation>
</message>
<message>
- <source>Position</source>
- <translation type="unfinished">Placera</translation>
+ <source>Time axis</source>
+ <translation type="unfinished">Tidsaxel</translation>
+ </message>
+ <message>
+ <source>Time labels</source>
+ <translation type="unfinished">Tidsetiketter</translation>
+ </message>
+ <message>
+ <source>Value axis</source>
+ <translation type="unfinished">Värdeaxel</translation>
</message>
<message>
<source>Dynamic</source>
- <translation type="unfinished">Dynamisk</translation>
+ <translation>Dynamiskt</translation>
</message>
<message>
<source>Fixed</source>
- <translation type="unfinished">Fast</translation>
+ <translation>Fast</translation>
</message>
<message>
<source>Left labels</source>
- <translation type="unfinished">Etiketter till vänster</translation>
+ <translation>Etiketter till vänster</translation>
</message>
<message>
<source>Right labels</source>
- <translation type="unfinished">Etiketter till höger</translation>
+ <translation>Etiketter till höger</translation>
</message>
<message>
- <source>Cover</source>
- <translation type="unfinished">Omslagsbild</translation>
+ <source>Miscellaneous</source>
+ <translation type="unfinished">Varierad</translation>
</message>
<message>
- <source>Show graph</source>
- <translation type="unfinished">Visa diagram</translation>
+ <source>Show graph on the cover</source>
+ <translation type="unfinished">Visa diagram på omslagsbild</translation>
</message>
</context>
<context>
@@ -224,7 +232,7 @@
</message>
<message>
<source>No data.</source>
- <translation type="unfinished">Inga data.</translation>
+ <translation>Ingen data.</translation>
</message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-valuelogger2-1.0.14.tar.bz2/valuelogger.pro
^
|
@@ -11,7 +11,7 @@
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-psabi
isEmpty(SPECVERSION) {
- SPECVERSION=1.0.12
+ SPECVERSION=1.0.14
}
DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\""
@@ -25,11 +25,12 @@
src/database.cpp \
src/datamodel.cpp \
src/graph.cpp \
- src/gridmodel.cpp \
src/hdashline.cpp \
src/logger.cpp \
src/pairmodel.cpp \
src/settings.cpp \
+ src/timegridmodel.cpp \
+ src/valuegridmodel.cpp \
src/valuelogger.cpp \
src/vdashline.cpp
@@ -39,11 +40,12 @@
src/datamodel.h \
src/debuglog.h \
src/graph.h \
- src/gridmodel.h \
src/hdashline.h \
src/logger.h \
src/pairmodel.h \
src/settings.h \
+ src/timegridmodel.h \
+ src/valuegridmodel.h \
src/vdashline.h
OTHER_FILES += qml/valuelogger.qml \
|