aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jalv_qt.cpp')
-rw-r--r--src/jalv_qt.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index 5c3cd59..a63a508 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -60,10 +60,10 @@ public:
explicit FlowLayout(int margin, int hSpacing, int vSpacing);
- FlowLayout(const FlowLayout&) = delete;
+ FlowLayout(const FlowLayout&) = delete;
FlowLayout& operator=(const FlowLayout&) = delete;
- FlowLayout(FlowLayout&&) = delete;
+ FlowLayout(FlowLayout&&) = delete;
FlowLayout&& operator=(FlowLayout&&) = delete;
~FlowLayout() override;
@@ -213,10 +213,10 @@ FlowLayout::doLayout(const QRect& rect, bool testOnly) const
int bottom = 0;
getContentsMargins(&left, &top, &right, &bottom);
- QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom);
- int x = effectiveRect.x();
- int y = effectiveRect.y();
- int lineHeight = 0;
+ const QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom);
+ int x = effectiveRect.x();
+ int y = effectiveRect.y();
+ int lineHeight = 0;
QLayoutItem* item = nullptr;
foreach (item, itemList) {
@@ -396,7 +396,7 @@ Control::Control(PortContainer portContainer, QWidget* parent)
}
// Find and set min, max and default values for port
- float defaultValue = ndef ? lilv_node_as_float(ndef) : port->control;
+ const float defaultValue = ndef ? lilv_node_as_float(ndef) : port->control;
setRange(lilv_node_as_float(nmin), lilv_node_as_float(nmax));
setValue(defaultValue);
@@ -505,10 +505,11 @@ Control::getValue()
}
if (isLogarithmic) {
- return min * powf(max / min, (float)dial->value() / (steps - 1));
+ return min *
+ powf(max / min, static_cast<float>(dial->value()) / (steps - 1));
}
- return (float)dial->value() / steps;
+ return static_cast<float>(dial->value()) / steps;
}
int
@@ -524,7 +525,7 @@ Control::stringWidth(const QString& str)
void
Control::dialChanged(int)
{
- float value = getValue();
+ const float value = getValue();
label->setText(getValueLabel(value));
port->control = value;
@@ -578,8 +579,8 @@ build_control_widget(Jalv* jalv)
LilvNode* lastGroup = nullptr;
QHBoxLayout* groupLayout = nullptr;
for (int i = 0; i < portContainers.count(); ++i) {
- PortContainer portContainer = portContainers[i];
- Port* port = portContainer.port;
+ const PortContainer portContainer = portContainers[i];
+ Port* const port = portContainer.port;
auto* const control = new Control(portContainer, nullptr);
LilvNode* group =
@@ -608,7 +609,7 @@ build_control_widget(Jalv* jalv)
lilv_node_free(lastGroup);
lastGroup = group;
- uint32_t index = lilv_port_get_index(plugin, port->lilv_port);
+ const uint32_t index = lilv_port_get_index(plugin, port->lilv_port);
jalv->ports[index].widget = control;
}
lilv_node_free(lastGroup);
@@ -627,13 +628,14 @@ jalv_frontend_discover(Jalv*)
float
jalv_frontend_refresh_rate(Jalv*)
{
- return (float)QGuiApplication::primaryScreen()->refreshRate();
+ return static_cast<float>(QGuiApplication::primaryScreen()->refreshRate());
}
float
jalv_frontend_scale_factor(Jalv*)
{
- return (float)QGuiApplication::primaryScreen()->devicePixelRatio();
+ return static_cast<float>(
+ QGuiApplication::primaryScreen()->devicePixelRatio());
}
LilvNode*
@@ -696,7 +698,7 @@ jalv_frontend_open(Jalv* jalv)
auto* const timer = new Timer(jalv);
timer->start(1000 / jalv->ui_update_hz);
- int ret = app->exec();
+ const int ret = app->exec();
zix_sem_post(&jalv->done);
return ret;
}