Browse Source

Follow project coding style. Issue #2192.

adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
cd4f288f67
  1. 27
      src/gui/properties/speedplotview.cpp
  2. 3
      src/gui/properties/speedplotview.h
  3. 5
      src/gui/properties/speedwidget.cpp

27
src/gui/properties/speedplotview.cpp

@ -85,16 +85,18 @@ void SpeedPlotView::pushPoint(SpeedPlotView::PointData point) @@ -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) @@ -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() @@ -157,10 +159,9 @@ int SpeedPlotView::maxYValue()
if (!m_properties[static_cast<GraphID>(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 *) @@ -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 *) @@ -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)
{
}
{}

3
src/gui/properties/speedplotview.h

@ -37,9 +37,10 @@ @@ -37,9 +37,10 @@
#include <QMap>
class QPen;
class SpeedPlotView : public QGraphicsView
class SpeedPlotView: public QGraphicsView
{
Q_OBJECT
public:
enum GraphID
{

5
src/gui/properties/speedwidget.cpp

@ -45,8 +45,7 @@ @@ -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() @@ -55,7 +54,6 @@ void ComboBoxMenuButton::showPopup()
QComboBox::hidePopup();
}
SpeedWidget::SpeedWidget(PropertiesWidget *parent)
: QWidget(parent)
{
@ -202,4 +200,3 @@ void SpeedWidget::saveSettings() const @@ -202,4 +200,3 @@ void SpeedWidget::saveSettings() const
preferences->setSpeedWidgetGraphEnable(id, action->isChecked());
}
}

Loading…
Cancel
Save