Version 1.0
Added: Configuration Editor, which allows to edit configurations in a graphical user interface. Contains GUIs for most commands supported by E-APO, but as lines can also be edited directly, all commands can be used. Added: Command "GraphicEQ", which can act as a regular, fixed-band graphic equalizer (via the GUI) but also supports variable bands so that any desired frequency response can be specified. Internally, it is implemented via convolution with a generated IR. Added: Command "Convolution", which allows to convolve the signal with a user-provided impulse response to achieve e.g. equalization or reverberation effects. Improved: Configurator performs checks for registry values that are needed for the operation of E-APO, which may be changed by driver installations, fixing the values if necessary. Improved: Configurator shows which is the default device as a hint to the user.
This commit is contained in:
1 parent
d68b958bc8
commit
b8cdd47f71
284 files changed
+17622
-322
No files matched your search
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ChannelGraphItem.h"
|
||||
|
||||
static const float margin = 5;
|
||||
|
||||
ChannelGraphItem::ChannelGraphItem(const QString& name)
|
||||
: name(name)
|
||||
{
|
||||
}
|
||||
|
||||
QRectF ChannelGraphItem::boundingRect() const
|
||||
{
|
||||
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)
|
||||
width = height;
|
||||
// shift by 0.5 to have sharp lines
|
||||
cachedRect.setLeft(0.5);
|
||||
cachedRect.setTop(0.5);
|
||||
cachedRect.setWidth(width + 2 * margin);
|
||||
cachedRect.setHeight(height + 2 * margin);
|
||||
}
|
||||
|
||||
return cachedRect;
|
||||
}
|
||||
|
||||
QString ChannelGraphItem::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
void ChannelGraphItem::paint(QPainter* painter, QColor color)
|
||||
{
|
||||
QRectF rect = boundingRect();
|
||||
QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
|
||||
gradient.setColorAt(0, QColor(255, 255, 255));
|
||||
gradient.setColorAt(1, color);
|
||||
painter->setBrush(gradient);
|
||||
painter->drawRoundedRect(rect, margin, margin);
|
||||
painter->drawText(rect.translated(1, -1), Qt::AlignCenter, name);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class ChannelGraphItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
explicit ChannelGraphItem(const QString& name = 0);
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
QString getName() const;
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter* painter, QColor color);
|
||||
|
||||
private:
|
||||
QString name;
|
||||
mutable QRectF cachedRect;
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "ChannelGraphScene.h"
|
||||
|
||||
ChannelGraphScene::ChannelGraphScene(QWidget *parent) :
|
||||
QGraphicsScene(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QPointF ChannelGraphScene::getNextChannelPoint(QGraphicsItem* lastItem, bool output)
|
||||
{
|
||||
int x = 0;
|
||||
if(lastItem != NULL)
|
||||
{
|
||||
QRectF lastRect = lastItem->sceneBoundingRect();
|
||||
x = lastRect.left() + lastRect.width() + 1 + 10;
|
||||
}
|
||||
|
||||
return QPointF(x, output ? 50 : 0);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsScene>
|
||||
|
||||
class ChannelGraphScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ChannelGraphScene(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
QPointF getNextChannelPoint(QGraphicsItem* lastItem, bool output);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include "CompactToolBar.h"
|
||||
|
||||
CompactToolBar::CompactToolBar(QWidget *parent) :
|
||||
QToolBar(parent)
|
||||
{
|
||||
setMinimumHeight(1);
|
||||
setOrientation(Qt::Vertical);
|
||||
setIconSize(QSize(16, 16));
|
||||
}
|
||||
|
||||
QSize CompactToolBar::sizeHint() const
|
||||
{
|
||||
return QSize(1, 1);
|
||||
}
|
||||
|
||||
void CompactToolBar::updateMaximumHeight()
|
||||
{
|
||||
setMaximumHeight(QToolBar::sizeHint().height());
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QToolBar>
|
||||
|
||||
class CompactToolBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CompactToolBar(QWidget *parent = 0);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
void updateMaximumHeight();
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "EscapableLineEdit.h"
|
||||
|
||||
EscapableLineEdit::EscapableLineEdit(QWidget *parent) :
|
||||
QLineEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void EscapableLineEdit::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
|
||||
if(event->key() == Qt::Key_Escape)
|
||||
emit editingCanceled();
|
||||
else
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class EscapableLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EscapableLineEdit(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void editingCanceled();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <QPainter>
|
||||
|
||||
#include "FrequencyPlotView.h"
|
||||
#include "FrequencyPlotHRuler.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
FrequencyPlotHRuler::FrequencyPlotHRuler(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void FrequencyPlotHRuler::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter painter(this);
|
||||
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
|
||||
FrequencyPlotScene* s = view->scene();
|
||||
QFontMetrics metrics = painter.fontMetrics();
|
||||
painter.setPen(QColor(50, 50, 50));
|
||||
|
||||
QPointF topLeft = view->mapToScene(0, 0);
|
||||
QPointF bottomRight = view->mapToScene(view->viewport()->width(), view->viewport()->height());
|
||||
double fromHz = s->xToHz(topLeft.x());
|
||||
double toHz = s->xToHz(bottomRight.x());
|
||||
const vector<double>& bands = s->getBands();
|
||||
if(bands.empty())
|
||||
{
|
||||
double hzBase = pow(10, floor(log10(fromHz)));
|
||||
fromHz = floor(fromHz / hzBase) * hzBase;
|
||||
fromHz += hzBase;
|
||||
if(round(fromHz / hzBase) >= 10)
|
||||
hzBase *= 10;
|
||||
for(double hz = fromHz; hz <= toHz;)
|
||||
{
|
||||
double x = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
{
|
||||
QString text;
|
||||
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)
|
||||
painter.drawText(x - topLeft.x() + height() + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
hz += hzBase;
|
||||
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++)
|
||||
{
|
||||
double hz = *it;
|
||||
double x = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
{
|
||||
QString text;
|
||||
if(hz < 1000)
|
||||
text = QString("%0").arg(hz);
|
||||
else
|
||||
text = QString("%0k").arg(hz / 1000);
|
||||
painter.drawText(x - topLeft.x() + height() + 1, 0, 0, height(), Qt::TextDontClip | Qt::AlignCenter, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class FrequencyPlotHRuler : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotHRuler(QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include "FrequencyPlotScene.h"
|
||||
#include "FrequencyPlotItem.h"
|
||||
|
||||
FrequencyPlotItem::FrequencyPlotItem(double hz, double db)
|
||||
: hz(hz), db(db)
|
||||
{
|
||||
setFlag(ItemSendsScenePositionChanges);
|
||||
}
|
||||
|
||||
void FrequencyPlotItem::updatePos()
|
||||
{
|
||||
setFlag(ItemSendsScenePositionChanges, false);
|
||||
FrequencyPlotScene* s = qobject_cast<FrequencyPlotScene*>(scene());
|
||||
setPos(floor(s->hzToX(hz)) + 0.5, floor(s->dbToY(db)) + 0.5);
|
||||
setFlag(ItemSendsScenePositionChanges, true);
|
||||
}
|
||||
|
||||
double FrequencyPlotItem::getHz() const
|
||||
{
|
||||
return hz;
|
||||
}
|
||||
|
||||
void FrequencyPlotItem::setHz(double value)
|
||||
{
|
||||
hz = value;
|
||||
}
|
||||
|
||||
double FrequencyPlotItem::getDb() const
|
||||
{
|
||||
return db;
|
||||
}
|
||||
|
||||
void FrequencyPlotItem::setDb(double value)
|
||||
{
|
||||
db = value;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class FrequencyPlotItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
FrequencyPlotItem(double hz, double db);
|
||||
|
||||
enum { Type = UserType + 1 };
|
||||
virtual int type() const
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
|
||||
void updatePos();
|
||||
|
||||
double getHz() const;
|
||||
void setHz(double value);
|
||||
|
||||
double getDb() const;
|
||||
void setDb(double value);
|
||||
|
||||
private:
|
||||
double hz;
|
||||
double db;
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include "FrequencyPlotView.h"
|
||||
#include "FrequencyPlotScene.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static double maxX = 1000;
|
||||
static double maxY = 500;
|
||||
static double minHz = 1;
|
||||
static double maxHz = 30000;
|
||||
static double minDb = -100;
|
||||
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
|
||||
};
|
||||
vector<double> FrequencyPlotScene::bandsVar;
|
||||
|
||||
FrequencyPlotScene::FrequencyPlotScene(QObject *parent) :
|
||||
QGraphicsScene(parent)
|
||||
{
|
||||
updateSceneRect();
|
||||
}
|
||||
|
||||
void FrequencyPlotScene::addItem(FrequencyPlotItem* item)
|
||||
{
|
||||
QGraphicsScene::addItem(item);
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::xToHz(double x)
|
||||
{
|
||||
return pow(maxHz / minHz, x / zoom / maxX) * minHz;
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::hzToX(double hz)
|
||||
{
|
||||
if(hz < minHz || hz > maxHz)
|
||||
return -1;
|
||||
|
||||
return log(hz / minHz) / log(maxHz / minHz) * maxX * zoom;
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::yToDb(double y)
|
||||
{
|
||||
return (minDb + (1 - y / zoom / maxY) * (maxDb - minDb));
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::dbToY(double db)
|
||||
{
|
||||
if(db < minDb || db > maxDb)
|
||||
return -1;
|
||||
|
||||
return (1 - (db - minDb) / (maxDb - minDb)) * maxY * zoom;
|
||||
}
|
||||
|
||||
double FrequencyPlotScene::getZoom() const
|
||||
{
|
||||
return zoom;
|
||||
}
|
||||
|
||||
void FrequencyPlotScene::setZoom(double value)
|
||||
{
|
||||
zoom = value;
|
||||
updateSceneRect();
|
||||
|
||||
for(QGraphicsItem* item : items())
|
||||
{
|
||||
FrequencyPlotItem* plotItem = (FrequencyPlotItem*)item;
|
||||
plotItem->updatePos();
|
||||
}
|
||||
}
|
||||
|
||||
void FrequencyPlotScene::updateSceneRect()
|
||||
{
|
||||
setSceneRect(0, 0, maxX * zoom, maxY * zoom);
|
||||
}
|
||||
|
||||
int FrequencyPlotScene::getBandCount() const
|
||||
{
|
||||
return bandCount;
|
||||
}
|
||||
|
||||
void FrequencyPlotScene::setBandCount(int value)
|
||||
{
|
||||
if(value != bandCount)
|
||||
{
|
||||
bandCount = value;
|
||||
update();
|
||||
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(views()[0]);
|
||||
view->updateHRuler();
|
||||
}
|
||||
}
|
||||
|
||||
const vector<double>& FrequencyPlotScene::getBands()
|
||||
{
|
||||
return getBands(bandCount);
|
||||
}
|
||||
|
||||
const std::vector<double>&FrequencyPlotScene::getBands(int count)
|
||||
{
|
||||
switch(count)
|
||||
{
|
||||
case 15:
|
||||
return bands15;
|
||||
case 31:
|
||||
return bands31;
|
||||
default:
|
||||
return bandsVar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include "FrequencyPlotItem.h"
|
||||
|
||||
class FrequencyPlotScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotScene(QObject *parent = 0);
|
||||
|
||||
void addItem(FrequencyPlotItem *item);
|
||||
|
||||
double xToHz(double x);
|
||||
double hzToX(double hz);
|
||||
double yToDb(double y);
|
||||
double dbToY(double db);
|
||||
|
||||
double getZoom() const;
|
||||
void setZoom(double value);
|
||||
|
||||
int getBandCount() const;
|
||||
virtual void setBandCount(int value);
|
||||
|
||||
const std::vector<double>& getBands();
|
||||
const std::vector<double>& getBands(int count);
|
||||
|
||||
protected:
|
||||
static std::vector<double> bands15;
|
||||
static std::vector<double> bands31;
|
||||
static std::vector<double> bandsVar;
|
||||
|
||||
private:
|
||||
void updateSceneRect();
|
||||
|
||||
double zoom = 1.0;
|
||||
int bandCount = -1;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include "FrequencyPlotView.h"
|
||||
#include "FrequencyPlotScene.h"
|
||||
#include "FrequencyPlotVRuler.h"
|
||||
|
||||
FrequencyPlotVRuler::FrequencyPlotVRuler(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void FrequencyPlotVRuler::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter painter(this);
|
||||
FrequencyPlotView* view = qobject_cast<FrequencyPlotView*>(parentWidget());
|
||||
FrequencyPlotScene* scene = view->scene();
|
||||
|
||||
QPointF topLeft = view->mapToScene(0, 0);
|
||||
QPointF bottomRight = view->mapToScene(view->viewport()->width(), view->viewport()->height());
|
||||
double dbHeight = abs(scene->yToDb(topLeft.y()) - scene->yToDb(bottomRight.y()));
|
||||
double dbStep = dbHeight / 4;
|
||||
|
||||
double dbBase = pow(10, floor(log10(dbStep)));
|
||||
if(dbStep >= 5 * dbBase)
|
||||
dbStep = 5 * dbBase;
|
||||
else if(dbStep >= 2 * dbBase)
|
||||
dbStep = 2 * dbBase;
|
||||
else
|
||||
dbStep = dbBase;
|
||||
|
||||
double fromDb = floor(scene->yToDb(topLeft.y()) / dbStep) * dbStep;
|
||||
double toDb = ceil(scene->yToDb(bottomRight.y()) / dbStep) * dbStep;
|
||||
|
||||
painter.setPen(QColor(50, 50, 50));
|
||||
for(double db = toDb; db <= fromDb; db += dbStep)
|
||||
{
|
||||
if(abs(db) < 1e-6)
|
||||
db = 0;
|
||||
double y = scene->dbToY(db);
|
||||
if(y != -1)
|
||||
painter.drawText(0, y - topLeft.y() - 1, width(), 0, Qt::TextDontClip | Qt::AlignCenter, QString("%0").arg(db));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class FrequencyPlotVRuler : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotVRuler(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
};
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "FrequencyPlotItem.h"
|
||||
#include "FrequencyPlotView.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
FrequencyPlotView::FrequencyPlotView(QWidget *parent) :
|
||||
QGraphicsView(parent)
|
||||
{
|
||||
setViewportMargins(20, 0, 0, 20);
|
||||
hRuler = new FrequencyPlotHRuler(this);
|
||||
vRuler = new FrequencyPlotVRuler(this);
|
||||
}
|
||||
|
||||
FrequencyPlotScene* FrequencyPlotView::scene() const
|
||||
{
|
||||
return qobject_cast<FrequencyPlotScene*>(QGraphicsView::scene());
|
||||
}
|
||||
|
||||
void FrequencyPlotView::setScene(FrequencyPlotScene* scene)
|
||||
{
|
||||
QGraphicsView::setScene(scene);
|
||||
}
|
||||
|
||||
void FrequencyPlotView::drawBackground(QPainter* painter, const QRectF& drawRect)
|
||||
{
|
||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
QRectF rect = drawRect;
|
||||
if(!sceneRect().contains(rect))
|
||||
{
|
||||
rect = rect.intersected(sceneRect());
|
||||
painter->setClipRect(rect);
|
||||
}
|
||||
|
||||
FrequencyPlotScene* s = scene();
|
||||
QPointF topLeft = mapToScene(0, 0);
|
||||
QPointF bottomRight = mapToScene(viewport()->width(), viewport()->height());
|
||||
double dbHeight = abs(s->yToDb(topLeft.y()) - s->yToDb(bottomRight.y()));
|
||||
double dbStep = dbHeight / 4;
|
||||
|
||||
double dbBase = pow(10, floor(log10(dbStep)));
|
||||
if(dbStep >= 5 * dbBase)
|
||||
dbStep = 5 * dbBase;
|
||||
else if(dbStep >= 2 * dbBase)
|
||||
dbStep = 2 * dbBase;
|
||||
else
|
||||
dbStep = dbBase;
|
||||
|
||||
double fromDb = floor(s->yToDb(rect.top() + rect.height()) / dbStep) * dbStep;
|
||||
double toDb = ceil(s->yToDb(rect.top()) / dbStep) * dbStep;
|
||||
|
||||
painter->setPen(QColor(200, 200, 200));
|
||||
for(double db = fromDb; db <= toDb; db += dbStep)
|
||||
{
|
||||
double y = floor(s->dbToY(db)) + 0.5;
|
||||
if(y != -1)
|
||||
painter->drawLine(topLeft.x(), y, bottomRight.x(), y);
|
||||
}
|
||||
|
||||
double fromHz = s->xToHz(rect.left());
|
||||
double toHz = s->xToHz(rect.left() + rect.width());
|
||||
|
||||
const vector<double>& bands = s->getBands();
|
||||
if(bands.empty())
|
||||
{
|
||||
double hzBase = pow(10, floor(log10(fromHz)));
|
||||
fromHz = floor(fromHz / hzBase) * hzBase;
|
||||
fromHz += hzBase;
|
||||
if(round(fromHz / hzBase) >= 10)
|
||||
hzBase *= 10;
|
||||
for(double hz = fromHz; hz <= toHz;)
|
||||
{
|
||||
double x = floor(s->hzToX(hz)) + 0.5;
|
||||
if(x >= 0)
|
||||
painter->drawLine(x, topLeft.y(), x, bottomRight.y());
|
||||
|
||||
hz += hzBase;
|
||||
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++)
|
||||
{
|
||||
double hz = *it;
|
||||
double x = floor(s->hzToX(hz)) + 0.5;
|
||||
if(x >= 0)
|
||||
painter->drawLine(x, topLeft.y(), x, bottomRight.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FrequencyPlotView::updateHRuler()
|
||||
{
|
||||
hRuler->update();
|
||||
}
|
||||
|
||||
void FrequencyPlotView::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
FrequencyPlotScene* s = scene();
|
||||
QPointF scenePos = mapToScene(event->pos());
|
||||
double hz = s->xToHz(scenePos.x());
|
||||
double db = s->yToDb(scenePos.y());
|
||||
|
||||
qreal zoomFactor = pow(1.001, event->angleDelta().y());
|
||||
s->setZoom(max(0.5, min(30, s->getZoom() * zoomFactor)));
|
||||
|
||||
double x = s->hzToX(hz);
|
||||
if(x != -1)
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + round(x - scenePos.x()));
|
||||
double y = s->dbToY(db);
|
||||
if(y != -1)
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value() + round(y - scenePos.y()));
|
||||
|
||||
resetCachedContent();
|
||||
viewport()->update();
|
||||
hRuler->update();
|
||||
vRuler->update();
|
||||
}
|
||||
|
||||
void FrequencyPlotView::scrollContentsBy(int dx, int dy)
|
||||
{
|
||||
QGraphicsView::scrollContentsBy(dx, dy);
|
||||
|
||||
if(dx != 0)
|
||||
hRuler->update();
|
||||
if(dy != 0)
|
||||
vRuler->update();
|
||||
}
|
||||
|
||||
void FrequencyPlotView::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
||||
const QRect rect = viewport()->geometry();
|
||||
hRuler->setGeometry(rect.x() - 20, rect.y() + rect.height(), rect.width() + 20, 20);
|
||||
vRuler->setGeometry(rect.x() - 20, rect.y(), 20, rect.height() + 20);
|
||||
}
|
||||
|
||||
void FrequencyPlotView::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
|
||||
lastMousePos = event->pos();
|
||||
}
|
||||
|
||||
void FrequencyPlotView::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if(event->buttons() & Qt::RightButton)
|
||||
{
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - (event->x() - lastMousePos.x()));
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value() - (event->y() - lastMousePos.y()));
|
||||
}
|
||||
else
|
||||
{
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
lastMousePos = event->pos();
|
||||
}
|
||||
|
||||
void FrequencyPlotView::showEvent(QShowEvent* event)
|
||||
{
|
||||
QGraphicsView::showEvent(event);
|
||||
|
||||
horizontalScrollBar()->setValue(scene()->hzToX(20));
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "FrequencyPlotScene.h"
|
||||
#include "FrequencyPlotHRuler.h"
|
||||
#include "FrequencyPlotVRuler.h"
|
||||
|
||||
class FrequencyPlotView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrequencyPlotView(QWidget *parent = 0);
|
||||
|
||||
FrequencyPlotScene* scene() const;
|
||||
void setScene(FrequencyPlotScene* scene);
|
||||
|
||||
void drawBackground(QPainter* painter, const QRectF& drawRect) override;
|
||||
|
||||
void updateHRuler();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void scrollContentsBy(int dx, int dy) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private:
|
||||
FrequencyPlotHRuler* hRuler;
|
||||
FrequencyPlotVRuler* vRuler;
|
||||
QPoint lastMousePos;
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#include "ResizingLineEdit.h"
|
||||
|
||||
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)
|
||||
{
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(readjustSize()));
|
||||
|
||||
readjustSize();
|
||||
}
|
||||
|
||||
QSize ResizingLineEdit::sizeHint() const
|
||||
{
|
||||
QSize originalSize = QLineEdit::sizeHint();
|
||||
|
||||
QFontMetrics metrics = fontMetrics();
|
||||
QSize contentSize(metrics.width(text()), metrics.height());
|
||||
QStyleOptionFrameV2 opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
QSize size = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, contentSize, this);
|
||||
return QSize(size.width(), originalSize.height());
|
||||
}
|
||||
|
||||
void ResizingLineEdit::readjustSize()
|
||||
{
|
||||
setFixedWidth(sizeHint().width());
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class ResizingLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResizingLineEdit(QWidget *parent = 0);
|
||||
explicit ResizingLineEdit(const QString& text, QWidget* parent=0);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
private slots:
|
||||
void readjustSize();
|
||||
};
|
||||
Reference in new issue
Block a user