Improved: Switched to stricter code formatter (Uncrustify) for better consistency across all source files.

This commit is contained in:
jthedering committed 2015-11-23 21:17:34 +00:00
1 parent a1be4cc70f
commit 57e8158efd
202 files changed
+4595 -4284

No files matched your search

+38 -38
View File
@@ -1,20 +1,20 @@
/*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
@@ -26,8 +26,8 @@
using namespace std;
FrequencyPlotView::FrequencyPlotView(QWidget *parent) :
QGraphicsView(parent)
FrequencyPlotView::FrequencyPlotView(QWidget* parent)
: QGraphicsView(parent)
{
setViewportMargins(32, 0, 0, 20);
hRuler = new FrequencyPlotHRuler(this);
@@ -51,7 +51,7 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect
painter->setRenderHint(QPainter::Antialiasing, false);
QRectF rect = drawRect;
if(!sceneRect().contains(rect))
if (!sceneRect().contains(rect))
{
rect = rect.intersected(sceneRect());
painter->setClipRect(rect);
@@ -63,9 +63,9 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect
double dbStep = abs(s->yToDb(0) - s->yToDb(30));
double dbBase = pow(10, floor(log10(dbStep)));
if(dbStep >= 5 * dbBase)
if (dbStep >= 5 * dbBase)
dbStep = 5 * dbBase;
else if(dbStep >= 2 * dbBase)
else if (dbStep >= 2 * dbBase)
dbStep = 2 * dbBase;
else
dbStep = dbBase;
@@ -74,10 +74,10 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect
double toDb = ceil(s->yToDb(rect.top()) / dbStep) * dbStep;
painter->setPen(QColor(200, 200, 200));
for(double db = fromDb; db <= toDb; db += dbStep)
for (double db = fromDb; db <= toDb; db += dbStep)
{
double y = floor(s->dbToY(db)) + 0.5;
if(y != -1)
if (y != -1)
painter->drawLine(topLeft.x(), y, bottomRight.x(), y);
}
@@ -85,32 +85,32 @@ void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect
double toHz = s->xToHz(rect.left() + rect.width());
const vector<double>& bands = s->getBands();
if(bands.empty())
if (bands.empty())
{
double hzBase = pow(10, floor(log10(fromHz)));
fromHz = floor(fromHz / hzBase) * hzBase;
fromHz += hzBase;
if(round(fromHz / hzBase) >= 10)
if (round(fromHz / hzBase) >= 10)
hzBase *= 10;
for(double hz = fromHz; hz <= toHz;)
for (double hz = fromHz; hz <= toHz;)
{
double x = floor(s->hzToX(hz)) + 0.5;
if(x >= 0)
if (x >= 0)
painter->drawLine(x, topLeft.y(), x, bottomRight.y());
hz += hzBase;
if(round(hz / hzBase) >= 10)
if (round(hz / hzBase) >= 10)
hzBase *= 10;
}
}
else
{
vector<double>::const_iterator it = lower_bound(bands.cbegin(), bands.cend(), fromHz);
for(; it != bands.cend() && *it < toHz; it++)
for (; it != bands.cend() && *it < toHz; it++)
{
double hz = *it;
double x = floor(s->hzToX(hz)) + 0.5;
if(x >= 0)
if (x >= 0)
painter->drawLine(x, topLeft.y(), x, bottomRight.y());
}
}
@@ -146,25 +146,25 @@ void FrequencyPlotView::zoom(int deltaX, int deltaY, int mouseX, int mouseY)
double zoomY = max(0.5, min(30.0, s->getZoomY() * zoomFactorY));
s->setZoom(zoomX, zoomY);
if(deltaX != 0)
if (deltaX != 0)
{
double x = s->hzToX(hz);
if(x != -1)
if (x != -1)
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + round(x - scenePos.x()));
}
if(deltaY != 0)
if (deltaY != 0)
{
double y = s->dbToY(db);
if(y != -1)
if (y != -1)
verticalScrollBar()->setValue(verticalScrollBar()->value() + round(y - scenePos.y()));
}
resetCachedContent();
viewport()->update();
if(deltaX != 0)
if (deltaX != 0)
hRuler->update();
if(deltaY != 0)
if (deltaY != 0)
vRuler->update();
}
@@ -184,9 +184,9 @@ void FrequencyPlotView::scrollContentsBy(int dx, int dy)
{
QGraphicsView::scrollContentsBy(dx, dy);
if(dx != 0)
if (dx != 0)
hRuler->update();
if(dy != 0)
if (dy != 0)
vRuler->update();
}
@@ -209,7 +209,7 @@ void FrequencyPlotView::mousePressEvent(QMouseEvent* event)
void FrequencyPlotView::mouseMoveEvent(QMouseEvent* event)
{
if(event->buttons() & Qt::RightButton)
if (event->buttons() & Qt::RightButton)
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - (event->x() - lastMousePos.x()));
verticalScrollBar()->setValue(verticalScrollBar()->value() - (event->y() - lastMousePos.y()));
@@ -230,13 +230,13 @@ void FrequencyPlotView::showEvent(QShowEvent* event)
{
QGraphicsView::showEvent(event);
if(presetScrollX != -1)
if (presetScrollX != -1)
{
horizontalScrollBar()->setValue(presetScrollX);
presetScrollX = -1;
}
if(presetScrollY != -1)
if (presetScrollY != -1)
{
verticalScrollBar()->setValue(presetScrollY);
presetScrollY = -1;