From cd4f288f67aed278e0ed9e35879a19d690e2fb43 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Wed, 13 Apr 2016 01:53:54 +0300 Subject: [PATCH] Follow project coding style. Issue #2192. --- src/gui/properties/speedplotview.cpp | 27 ++++++++++++--------------- src/gui/properties/speedplotview.h | 3 ++- src/gui/properties/speedwidget.cpp | 5 +---- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index cea241ded..1ad6aa399 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -85,16 +85,18 @@ void SpeedPlotView::pushPoint(SpeedPlotView::PointData point) m_data5Min.push_back(point); - if (m_counter30Min == 0) + if (m_counter30Min == 0) { m_data30Min.push_back(point); + } else { m_data30Min.back().x = (m_data30Min.back().x * m_counter30Min + point.x) / (m_counter30Min + 1); for (int id = UP; id < NB_GRAPHS; ++id) m_data30Min.back().y[id] = (m_data30Min.back().y[id] * m_counter30Min + point.y[id]) / (m_counter30Min + 1); } - if (m_counter6Hour == 0) + if (m_counter6Hour == 0) { m_data6Hour.push_back(point); + } else { m_data6Hour.back().x = (m_data6Hour.back().x * m_counter6Hour + point.x) / (m_counter6Hour + 1); for (int id = UP; id < NB_GRAPHS; ++id) @@ -126,10 +128,10 @@ void SpeedPlotView::setViewableLastPoints(TimePeriod period) void SpeedPlotView::replot() { - if (m_period == MIN1 - || m_period == MIN5 - || (m_period == MIN30 && m_counter30Min == 2) - || (m_period == HOUR6 && m_counter6Hour == 5)) + if ((m_period == MIN1) + || (m_period == MIN5) + || ((m_period == MIN30) && (m_counter30Min == 2)) + || ((m_period == HOUR6) && (m_counter6Hour == 5))) viewport()->update(); } @@ -157,10 +159,9 @@ int SpeedPlotView::maxYValue() if (!m_properties[static_cast(id)].enable) continue; - for (int i = queue.size() - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) { + for (int i = queue.size() - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) if (queue[i].y[id] > maxYValue) maxYValue = queue[i].y[id]; - } } return maxYValue; @@ -190,10 +191,9 @@ void SpeedPlotView::paintEvent(QPaintEvent *) }; int yAxeWidth = 0; - for (const QString &label : speedLabels) { + for (const QString &label : speedLabels) if (fontMetrics.width(label) > yAxeWidth) yAxeWidth = fontMetrics.width(label); - } int i = 0; for (const QString &label : speedLabels) { @@ -292,13 +292,10 @@ void SpeedPlotView::paintEvent(QPaintEvent *) SpeedPlotView::GraphProperties::GraphProperties() : enable(false) -{ -} +{} SpeedPlotView::GraphProperties::GraphProperties(const QString &name, const QPen &pen, bool enable) : name(name) , pen(pen) , enable(enable) -{ -} - +{} diff --git a/src/gui/properties/speedplotview.h b/src/gui/properties/speedplotview.h index f4d91ed10..2165110b6 100644 --- a/src/gui/properties/speedplotview.h +++ b/src/gui/properties/speedplotview.h @@ -37,9 +37,10 @@ #include class QPen; -class SpeedPlotView : public QGraphicsView +class SpeedPlotView: public QGraphicsView { Q_OBJECT + public: enum GraphID { diff --git a/src/gui/properties/speedwidget.cpp b/src/gui/properties/speedwidget.cpp index 196d3a79b..ba9bb03a8 100644 --- a/src/gui/properties/speedwidget.cpp +++ b/src/gui/properties/speedwidget.cpp @@ -45,8 +45,7 @@ ComboBoxMenuButton::ComboBoxMenuButton(QWidget *parent, QMenu *menu) : QComboBox(parent) , m_menu(menu) -{ -} +{} void ComboBoxMenuButton::showPopup() { @@ -55,7 +54,6 @@ void ComboBoxMenuButton::showPopup() QComboBox::hidePopup(); } - SpeedWidget::SpeedWidget(PropertiesWidget *parent) : QWidget(parent) { @@ -202,4 +200,3 @@ void SpeedWidget::saveSettings() const preferences->setSpeedWidgetGraphEnable(id, action->isChecked()); } } -