Disable charts animations on Samsung S8

This commit is contained in:
Michael Zanetti 2022-02-06 13:06:03 +01:00
parent 801f44e8d2
commit a7a8d996c4
8 changed files with 16 additions and 12 deletions

View File

@ -108,7 +108,7 @@ int main(int argc, char *argv[])
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
application.installTranslator(&qtTranslator); application.installTranslator(&qtTranslator);
qCInfo(dcApplication()) << application.applicationName() << APP_VERSION << "running on" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion(); qCInfo(dcApplication()) << application.applicationName() << APP_VERSION << "running on" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion() << PlatformHelper::instance()->deviceManufacturer() << PlatformHelper::instance()->deviceModel();
qCInfo(dcApplication()) << "Locale info:" << QLocale() << QLocale().name() << QLocale().language() << QLocale().system(); qCInfo(dcApplication()) << "Locale info:" << QLocale() << QLocale().name() << QLocale().language() << QLocale().system();
QTranslator appTranslator; QTranslator appTranslator;

View File

@ -90,7 +90,7 @@ Item {
titleFont.pixelSize: app.largeFont titleFont.pixelSize: app.largeFont
animationDuration: 300 animationDuration: 300
animationOptions: ChartView.SeriesAnimations animationOptions: NymeaUtils.chartsAnimationOptions
RowLayout { RowLayout {
anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: app.margins / 2; leftMargin: app.margins * 1.5; rightMargin: app.margins } anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: app.margins / 2; leftMargin: app.margins * 1.5; rightMargin: app.margins }
@ -296,7 +296,7 @@ Item {
var newMin = xAxis.min.getTime() + diffMaxToNew; var newMin = xAxis.min.getTime() + diffMaxToNew;
xAxis.max = new Date(newPoint.x); xAxis.max = new Date(newPoint.x);
xAxis.min = new Date(newMin) xAxis.min = new Date(newMin)
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
} }
@ -389,7 +389,7 @@ Item {
// If the user scrolled closer than 5 pixels to the right edge, enable autoscroll // If the user scrolled closer than 5 pixels to the right edge, enable autoscroll
autoScroll = overshoot > -5; autoScroll = overshoot > -5;
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
function zoomInLimited(dy) { function zoomInLimited(dy) {
@ -397,7 +397,7 @@ Item {
var oldMax = xAxis.max; var oldMax = xAxis.max;
chartView.scrollRight(dy); chartView.scrollRight(dy);
xAxis.min = new Date(xAxis.min.getTime() - xAxis.timeDiff * 1000 * 2) xAxis.min = new Date(xAxis.min.getTime() - xAxis.timeDiff * 1000 * 2)
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
onPressed: { onPressed: {

View File

@ -206,7 +206,7 @@ StatsBase {
labels.push(entries[0].timestamp) labels.push(entries[0].timestamp)
categoryAxis.timestamps = labels categoryAxis.timestamps = labels
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
onLiveEntryChanged: { onLiveEntryChanged: {
@ -291,7 +291,7 @@ StatsBase {
map[consumer.id] = barSet map[consumer.id] = barSet
} }
barSeries.thingBarSetMap = map barSeries.thingBarSetMap = map
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
Item { Item {

View File

@ -9,7 +9,7 @@ import Nymea 1.0
ChartView { ChartView {
id: root id: root
backgroundColor: "transparent" backgroundColor: "transparent"
animationOptions: Qt.application.active ? ChartView.SeriesAnimations : ChartView.NoAnimation animationOptions: Qt.application.active ? NymeaUtils.chartsAnimationOptions : ChartView.NoAnimation
title: qsTr("Consumers balance") title: qsTr("Consumers balance")
titleColor: Style.foregroundColor titleColor: Style.foregroundColor
legend.visible: false legend.visible: false

View File

@ -9,7 +9,7 @@ import Nymea 1.0
ChartView { ChartView {
id: consumptionPieChart id: consumptionPieChart
backgroundColor: "transparent" backgroundColor: "transparent"
animationOptions: Qt.application.active ? ChartView.SeriesAnimations : ChartView.NoAnimation animationOptions: Qt.application.active ? NymeaUtils.chartsAnimationOptions : ChartView.NoAnimation
title: qsTr("My energy mix") title: qsTr("My energy mix")
titleColor: Style.foregroundColor titleColor: Style.foregroundColor
legend.visible: false legend.visible: false

View File

@ -9,7 +9,7 @@ import Nymea 1.0
ChartView { ChartView {
id: productionPieChart id: productionPieChart
backgroundColor: "transparent" backgroundColor: "transparent"
animationOptions: Qt.application.active ? ChartView.SeriesAnimations : ChartView.NoAnimation animationOptions: Qt.application.active ? NymeaUtils.chartsAnimationOptions : ChartView.NoAnimation
title: qsTr("My energy production") title: qsTr("My energy production")
titleColor: Style.foregroundColor titleColor: Style.foregroundColor
legend.visible: false legend.visible: false

View File

@ -169,7 +169,7 @@ StatsBase {
// print("assigning categories:", labels) // print("assigning categories:", labels)
categoryAxis.timestamps = labels categoryAxis.timestamps = labels
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
for (var i = 0; i < entries.length; i++) { for (var i = 0; i < entries.length; i++) {
// print("Appending to set", JSON.stringify(entries[i])) // print("Appending to set", JSON.stringify(entries[i]))
@ -215,7 +215,7 @@ StatsBase {
d.acquisitionSet.append(acquisitionValue) d.acquisitionSet.append(acquisitionValue)
d.returnSet.append(returnValue) d.returnSet.append(returnValue)
chartView.animationOptions = ChartView.SeriesAnimations chartView.animationOptions = NymeaUtils.chartsAnimationOptions
} }
} }

View File

@ -1,6 +1,7 @@
pragma Singleton pragma Singleton
import QtQuick 2.9 import QtQuick 2.9
import Nymea 1.0 import Nymea 1.0
import QtCharts 2.3
Item { Item {
id: root id: root
@ -145,4 +146,7 @@ Item {
function hasPermissionScope(permissions, requestedScope) { function hasPermissionScope(permissions, requestedScope) {
return (permissions & requestedScope) === requestedScope; return (permissions & requestedScope) === requestedScope;
} }
property bool inhibitChartsAnimation: ["SM-G950x", "SM-G955x", "SM-G892A"].indexOf(PlatformHelper.deviceModel) >= 0
property int chartsAnimationOptions: !inhibitChartsAnimation ? ChartView.SeriesAnimations : ChartView.NoAnimation
} }