Improved: Switched to stricter code formatter (Uncrustify) for better consistency across all source files.
This commit is contained in:
1 parent
a1be4cc70f
commit
57e8158efd
202 files changed
+4595
-4284
No files matched your search
@@ -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 <QGraphicsScene>
|
||||
@@ -31,14 +31,14 @@ ChannelGraphItem::ChannelGraphItem(const QString& name)
|
||||
|
||||
QRectF ChannelGraphItem::boundingRect() const
|
||||
{
|
||||
if(cachedRect.isNull())
|
||||
if (cachedRect.isNull())
|
||||
{
|
||||
QFontMetrics metrics(scene()->font());
|
||||
int width = metrics.width(name);
|
||||
// we only use upper case characters and digits, so everything is above the baseline
|
||||
int height = metrics.ascent();
|
||||
// make it at least quadratic
|
||||
if(width < height)
|
||||
if (width < height)
|
||||
width = height;
|
||||
// shift by 0.5 to have sharp lines
|
||||
cachedRect.setLeft(0.5);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/*
|
||||
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 <QGraphicsItem>
|
||||
|
||||
#include "ChannelGraphScene.h"
|
||||
|
||||
ChannelGraphScene::ChannelGraphScene(QWidget *parent) :
|
||||
QGraphicsScene(parent)
|
||||
ChannelGraphScene::ChannelGraphScene(QWidget* parent)
|
||||
: QGraphicsScene(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QPointF ChannelGraphScene::getNextChannelPoint(QGraphicsItem* lastItem, bool output)
|
||||
{
|
||||
int x = 0;
|
||||
if(lastItem != NULL)
|
||||
if (lastItem != NULL)
|
||||
{
|
||||
QRectF lastRect = lastItem->sceneBoundingRect();
|
||||
x = lastRect.left() + lastRect.width() + 1 + 10;
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,7 +25,7 @@ class ChannelGraphScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChannelGraphScene(QWidget *parent = 0);
|
||||
explicit ChannelGraphScene(QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
QPointF getNextChannelPoint(QGraphicsItem* lastItem, bool output);
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
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 "CompactToolBar.h"
|
||||
|
||||
CompactToolBar::CompactToolBar(QWidget *parent) :
|
||||
QToolBar(parent)
|
||||
CompactToolBar::CompactToolBar(QWidget* parent)
|
||||
: QToolBar(parent)
|
||||
{
|
||||
setMinimumHeight(1);
|
||||
setOrientation(Qt::Vertical);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,7 +25,7 @@ class CompactToolBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CompactToolBar(QWidget *parent = 0);
|
||||
explicit CompactToolBar(QWidget* parent = 0);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
void updateMaximumHeight();
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/*
|
||||
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 <QKeyEvent>
|
||||
|
||||
#include "EscapableLineEdit.h"
|
||||
|
||||
EscapableLineEdit::EscapableLineEdit(QWidget *parent) :
|
||||
QLineEdit(parent)
|
||||
EscapableLineEdit::EscapableLineEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void EscapableLineEdit::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
|
||||
if(event->key() == Qt::Key_Escape)
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
emit editingCanceled();
|
||||
else
|
||||
QLineEdit::keyPressEvent(event);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,7 +25,7 @@ class EscapableLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EscapableLineEdit(QWidget *parent = 0);
|
||||
explicit EscapableLineEdit(QWidget* parent = 0);
|
||||
|
||||
signals:
|
||||
void editingCanceled();
|
||||
|
||||
@@ -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 <cmath>
|
||||
@@ -31,16 +31,16 @@ ExponentialSpinBox::ExponentialSpinBox(QWidget* parent)
|
||||
void ExponentialSpinBox::stepBy(int steps)
|
||||
{
|
||||
qint64 v = value();
|
||||
if(steps > 0)
|
||||
if (steps > 0)
|
||||
{
|
||||
v <<= steps;
|
||||
if(v > maximum())
|
||||
if (v > maximum())
|
||||
v = maximum();
|
||||
}
|
||||
else
|
||||
{
|
||||
v >>= -steps;
|
||||
if(v < minimum())
|
||||
if (v < minimum())
|
||||
v = minimum();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <QSpinBox>
|
||||
|
||||
@@ -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;
|
||||
|
||||
FrequencyPlotHRuler::FrequencyPlotHRuler(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
FrequencyPlotHRuler::FrequencyPlotHRuler(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,43 +46,43 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*)
|
||||
double fromHz = s->xToHz(topLeft.x());
|
||||
double toHz = s->xToHz(bottomRight.x());
|
||||
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 = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
if (x != -1)
|
||||
{
|
||||
QString text;
|
||||
if(hz < 1000)
|
||||
if (hz < 1000)
|
||||
text = QString("%0").arg(hz);
|
||||
else
|
||||
text = QString("%0k").arg(hz / 1000);
|
||||
if(metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x)
|
||||
if (metrics.width(text) + 2 < s->hzToX(hz + hzBase) - x)
|
||||
painter.drawText(x - topLeft.x() + offsetLeft + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
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 = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
if (x != -1)
|
||||
{
|
||||
QString text;
|
||||
if(hz < 1000)
|
||||
if (hz < 1000)
|
||||
text = QString("%0").arg(hz);
|
||||
else
|
||||
text = QString("%0k").arg(hz / 1000);
|
||||
@@ -92,13 +92,13 @@ void FrequencyPlotHRuler::paintEvent(QPaintEvent*)
|
||||
}
|
||||
|
||||
QPoint mousePos = view->getLastMousePos();
|
||||
if(!mousePos.isNull())
|
||||
if (!mousePos.isNull())
|
||||
{
|
||||
QPointF mouseScenePos = view->mapToScene(mousePos);
|
||||
|
||||
double hz = s->xToHz(mouseScenePos.x());
|
||||
double x = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
if (x != -1)
|
||||
{
|
||||
QString text = QString("%0").arg(hz, 0, 'f', 1);
|
||||
QFontMetrics metrics = painter.fontMetrics();
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -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 <QGraphicsScene>
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -26,7 +26,7 @@ class FrequencyPlotItem : public QGraphicsItem
|
||||
public:
|
||||
FrequencyPlotItem(double hz, double db);
|
||||
|
||||
enum { Type = UserType + 1 };
|
||||
enum {Type = UserType + 1};
|
||||
virtual int type() const
|
||||
{
|
||||
return Type;
|
||||
|
||||
@@ -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 "FrequencyPlotView.h"
|
||||
@@ -31,12 +31,11 @@ static double maxDb = 100;
|
||||
|
||||
vector<double> FrequencyPlotScene::bands15 = {25, 40, 63, 100, 160, 250, 400, 630, 1000, 1600, 2500, 4000, 6300, 10000, 16000};
|
||||
vector<double> FrequencyPlotScene::bands31 = {20, 25, 31.5, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800,
|
||||
1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000
|
||||
};
|
||||
1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000};
|
||||
vector<double> FrequencyPlotScene::bandsVar;
|
||||
|
||||
FrequencyPlotScene::FrequencyPlotScene(QObject *parent) :
|
||||
QGraphicsScene(parent)
|
||||
FrequencyPlotScene::FrequencyPlotScene(QObject* parent)
|
||||
: QGraphicsScene(parent)
|
||||
{
|
||||
updateSceneRect();
|
||||
}
|
||||
@@ -53,7 +52,7 @@ double FrequencyPlotScene::xToHz(double x)
|
||||
|
||||
double FrequencyPlotScene::hzToX(double hz)
|
||||
{
|
||||
if(hz < minHz || hz > maxHz)
|
||||
if (hz < minHz || hz > maxHz)
|
||||
return -1;
|
||||
|
||||
return log(hz / minHz) / log(maxHz / minHz) * maxX * zoomX;
|
||||
@@ -61,12 +60,12 @@ double FrequencyPlotScene::hzToX(double hz)
|
||||
|
||||
double FrequencyPlotScene::yToDb(double y)
|
||||
{
|
||||
return (minDb + (1 - y / zoomY / maxY) * (maxDb - minDb));
|
||||
return(minDb + (1 - y / zoomY / maxY) * (maxDb - minDb));
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::dbToY(double db)
|
||||
{
|
||||
if(db < minDb || db > maxDb)
|
||||
if (db < minDb || db > maxDb)
|
||||
return -1;
|
||||
|
||||
return (1 - (db - minDb) / (maxDb - minDb)) * maxY * zoomY;
|
||||
@@ -88,7 +87,7 @@ void FrequencyPlotScene::setZoom(double zoomX, double zoomY)
|
||||
this->zoomY = zoomY;
|
||||
updateSceneRect();
|
||||
|
||||
for(QGraphicsItem* item : items())
|
||||
for (QGraphicsItem* item : items())
|
||||
{
|
||||
FrequencyPlotItem* plotItem = (FrequencyPlotItem*)item;
|
||||
plotItem->updatePos();
|
||||
@@ -107,7 +106,7 @@ int FrequencyPlotScene::getBandCount() const
|
||||
|
||||
void FrequencyPlotScene::setBandCount(int value)
|
||||
{
|
||||
if(value != bandCount)
|
||||
if (value != bandCount)
|
||||
{
|
||||
bandCount = value;
|
||||
update();
|
||||
@@ -121,9 +120,9 @@ const vector<double>& FrequencyPlotScene::getBands()
|
||||
return getBands(bandCount);
|
||||
}
|
||||
|
||||
const std::vector<double>&FrequencyPlotScene::getBands(int count)
|
||||
const std::vector<double>& FrequencyPlotScene::getBands(int count)
|
||||
{
|
||||
switch(count)
|
||||
switch (count)
|
||||
{
|
||||
case 15:
|
||||
return bands15;
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -28,9 +28,9 @@ class FrequencyPlotScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotScene(QObject *parent = 0);
|
||||
explicit FrequencyPlotScene(QObject* parent = 0);
|
||||
|
||||
void addItem(FrequencyPlotItem *item);
|
||||
void addItem(FrequencyPlotItem* item);
|
||||
|
||||
double xToHz(double x);
|
||||
double hzToX(double hz);
|
||||
|
||||
@@ -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 <QWheelEvent>
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "FrequencyPlotScene.h"
|
||||
#include "FrequencyPlotVRuler.h"
|
||||
|
||||
FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
|
||||
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;
|
||||
@@ -51,23 +51,23 @@ void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
|
||||
double toDb = ceil(s->yToDb(bottomRight.y()) / dbStep) * dbStep;
|
||||
|
||||
painter.setPen(QColor(50, 50, 50));
|
||||
for(double db = toDb; db <= fromDb; db += dbStep)
|
||||
for (double db = toDb; db <= fromDb; db += dbStep)
|
||||
{
|
||||
if(abs(db) < 1e-6)
|
||||
if (abs(db) < 1e-6)
|
||||
db = 0;
|
||||
double y = s->dbToY(db);
|
||||
if(y != -1)
|
||||
if (y != -1)
|
||||
painter.drawText(0, y - topLeft.y() - 1, width(), 0, Qt::TextDontClip | Qt::AlignCenter, QString("%0").arg(db));
|
||||
}
|
||||
|
||||
QPoint mousePos = view->getLastMousePos();
|
||||
if(!mousePos.isNull())
|
||||
if (!mousePos.isNull())
|
||||
{
|
||||
QPointF mouseScenePos = view->mapToScene(mousePos);
|
||||
|
||||
double db = s->yToDb(mouseScenePos.y());
|
||||
double y = s->dbToY(db);
|
||||
if(y != -1)
|
||||
if (y != -1)
|
||||
{
|
||||
QString text = QString("%0").arg(db, 0, 'f', 1);
|
||||
QFontMetrics metrics = painter.fontMetrics();
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,7 +25,7 @@ class FrequencyPlotVRuler : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotVRuler(QWidget *parent = 0);
|
||||
explicit FrequencyPlotVRuler(QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -29,7 +29,7 @@ class FrequencyPlotView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotView(QWidget *parent = 0);
|
||||
explicit FrequencyPlotView(QWidget* parent = 0);
|
||||
|
||||
FrequencyPlotScene* scene() const;
|
||||
void setScene(FrequencyPlotScene* scene);
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
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 <QMouseEvent>
|
||||
|
||||
#include "ResizeCorner.h"
|
||||
|
||||
ResizeCorner::ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, std::function<QSize()> getFunc, std::function<void(QSize)> setFunc, QWidget *parent)
|
||||
ResizeCorner::ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize, std::function<QSize()> getFunc, std::function<void(QSize)> setFunc, QWidget* parent)
|
||||
: QLabel(parent), minimumSize(minimumSize), maximumSize(maximumSize), getFunc(getFunc), setFunc(setFunc), filterTable(filterTable)
|
||||
{
|
||||
setPixmap(QPixmap(":/icons/resize_corner.png"));
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -30,7 +30,7 @@ class ResizeCorner : public QLabel
|
||||
|
||||
public:
|
||||
explicit ResizeCorner(FilterTable* filterTable, QSize minimumSize, QSize maximumSize,
|
||||
std::function<QSize()> getFunc, std::function<void(QSize)> setFunc, QWidget *parent = 0);
|
||||
std::function<QSize()> getFunc, std::function<void(QSize)> setFunc, QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
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 "ResizingLineEdit.h"
|
||||
|
||||
ResizingLineEdit::ResizingLineEdit(QWidget *parent) :
|
||||
QLineEdit(parent)
|
||||
ResizingLineEdit::ResizingLineEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(readjustSize()));
|
||||
|
||||
readjustSize();
|
||||
}
|
||||
|
||||
ResizingLineEdit::ResizingLineEdit(const QString& text, QWidget* parent) :
|
||||
QLineEdit(text, parent)
|
||||
ResizingLineEdit::ResizingLineEdit(const QString& text, QWidget* parent)
|
||||
: QLineEdit(text, parent)
|
||||
{
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(readjustSize()));
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,8 +25,8 @@ class ResizingLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResizingLineEdit(QWidget *parent = 0);
|
||||
explicit ResizingLineEdit(const QString& text, QWidget* parent=0);
|
||||
explicit ResizingLineEdit(QWidget* parent = 0);
|
||||
explicit ResizingLineEdit(const QString& text, QWidget* parent = 0);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
|
||||
Reference in new issue
Block a user