From dd4d6c49367f4db61aaad103f1726e976319c941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 31 Jan 2017 16:34:27 +0100 Subject: [PATCH] [apps/statisctics] Adjust to display mode to preferences Change-Id: I744cb8e88fd2c5d14bf4c288037762b8f3a8fa8c --- apps/statistics/box_controller.cpp | 4 +++- apps/statistics/calculation_controller.cpp | 4 +++- apps/statistics/histogram_controller.cpp | 10 ++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/statistics/box_controller.cpp b/apps/statistics/box_controller.cpp index 20975b333..fa43a54ab 100644 --- a/apps/statistics/box_controller.cpp +++ b/apps/statistics/box_controller.cpp @@ -1,4 +1,5 @@ #include "box_controller.h" +#include "../apps_container.h" #include namespace Statistics { @@ -68,7 +69,8 @@ void BoxController::reloadBannerView() { CalculPointer calculationMethods[5] = {&Store::minValue, &Store::firstQuartile, &Store::median, &Store::thirdQuartile, &Store::maxValue}; float calculation = (m_store->*calculationMethods[(int)m_view.selectedQuantile()])(); - Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + AppsContainer * container = (AppsContainer *)app()->container(); + Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); m_boxBannerView.setLegendAtIndex(buffer, 1); } diff --git a/apps/statistics/calculation_controller.cpp b/apps/statistics/calculation_controller.cpp index a6ce8305f..d3a2a9ff3 100644 --- a/apps/statistics/calculation_controller.cpp +++ b/apps/statistics/calculation_controller.cpp @@ -1,5 +1,6 @@ #include "calculation_controller.h" #include "../constant.h" +#include "../apps_container.h" #include #include @@ -87,7 +88,8 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int float calculation = (m_store->*calculationMethods[j])(); EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell; char buffer[Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; - Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + AppsContainer * container = (AppsContainer *)app()->container(); + Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); myCell->setText(buffer); } } diff --git a/apps/statistics/histogram_controller.cpp b/apps/statistics/histogram_controller.cpp index d1b2c6dc2..26cb43ffd 100644 --- a/apps/statistics/histogram_controller.cpp +++ b/apps/statistics/histogram_controller.cpp @@ -1,4 +1,5 @@ #include "histogram_controller.h" +#include "../apps_container.h" #include #include #include @@ -123,15 +124,16 @@ Responder * HistogramController::tabController() const { } void HistogramController::reloadBannerView() { + AppsContainer * container = (AppsContainer *)app()->container(); char buffer[k_maxNumberOfCharacters+ Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)*2]; const char * legend = "Interval ["; int legendLength = strlen(legend); strlcpy(buffer, legend, legendLength+1); float lowerBound = m_store->startOfBarAtIndex(m_selectedBarIndex); - int lowerBoundNumberOfChar = Float(lowerBound).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + int lowerBoundNumberOfChar = Float(lowerBound).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); buffer[legendLength+lowerBoundNumberOfChar] = ';'; float upperBound = m_store->endOfBarAtIndex(m_selectedBarIndex); - int upperBoundNumberOfChar = Float(upperBound).convertFloatToText(buffer+legendLength+lowerBoundNumberOfChar+1, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + int upperBoundNumberOfChar = Float(upperBound).convertFloatToText(buffer+legendLength+lowerBoundNumberOfChar+1, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); buffer[legendLength+lowerBoundNumberOfChar+upperBoundNumberOfChar+1] = '['; buffer[legendLength+lowerBoundNumberOfChar+upperBoundNumberOfChar+2] = 0; m_bannerView.setLegendAtIndex(buffer, 0); @@ -140,14 +142,14 @@ void HistogramController::reloadBannerView() { legendLength = strlen(legend); strlcpy(buffer, legend, legendLength+1); float size = m_store->heightOfBarAtIndex(m_selectedBarIndex); - Float(size).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + Float(size).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); m_bannerView.setLegendAtIndex(buffer, 1); legend = "Frequence: "; legendLength = strlen(legend); strlcpy(buffer, legend, legendLength+1); float frequency = size/m_store->sumOfColumn(1); - Float(frequency).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits); + Float(frequency).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode()); m_bannerView.setLegendAtIndex(buffer, 2); }