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.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index f23a005..bf211f0 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -48,7 +48,7 @@
#define CONTROL_WIDTH 150
#define DIAL_STEPS 10000
-static QApplication* app = NULL;
+static QApplication* app = nullptr;
class FlowLayout : public QLayout
{
@@ -60,20 +60,20 @@ public:
FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
- ~FlowLayout();
+ ~FlowLayout() override;
- void addItem(QLayoutItem* item);
+ void addItem(QLayoutItem* item) override;
int horizontalSpacing() const;
int verticalSpacing() const;
- Qt::Orientations expandingDirections() const;
- bool hasHeightForWidth() const;
- int heightForWidth(int) const;
- int count() const;
- QLayoutItem* itemAt(int index) const;
- QSize minimumSize() const;
- void setGeometry(const QRect &rect);
- QSize sizeHint() const;
- QLayoutItem* takeAt(int index);
+ Qt::Orientations expandingDirections() const override;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ int count() const override;
+ QLayoutItem* itemAt(int index) const override;
+ QSize minimumSize() const override;
+ void setGeometry(const QRect &rect) override;
+ QSize sizeHint() const override;
+ QLayoutItem* takeAt(int index) override;
private:
int doLayout(const QRect &rect, bool testOnly) const;
@@ -148,14 +148,14 @@ FlowLayout::takeAt(int index)
if (index >= 0 && index < itemList.size()) {
return itemList.takeAt(index);
} else {
- return 0;
+ return nullptr;
}
}
Qt::Orientations
FlowLayout::expandingDirections() const
{
- return 0;
+ return Qt::Orientations();
}
bool
@@ -249,7 +249,7 @@ FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
return -1;
} else if (parent->isWidgetType()) {
QWidget* pw = static_cast<QWidget*>(parent);
- return pw->style()->pixelMetric(pm, 0, pw);
+ return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout*>(parent)->spacing();
}
@@ -288,7 +288,7 @@ class Control : public QGroupBox
Q_OBJECT
public:
- Control(PortContainer portContainer, QWidget* parent = 0);
+ Control(PortContainer portContainer, QWidget* parent = nullptr);
Q_SLOT void dialChanged(int value);
@@ -368,7 +368,7 @@ class Timer : public QTimer
public:
explicit Timer(Jalv* jalv) : _jalv(jalv) {}
- void timerEvent(QTimerEvent* e) {
+ void timerEvent(QTimerEvent* e) override {
jalv_update(_jalv);
}
@@ -630,8 +630,8 @@ build_control_widget(Jalv* jalv)
FlowLayout* flowLayout = new FlowLayout();
QLayout* layout = flowLayout;
- LilvNode* lastGroup = NULL;
- QHBoxLayout* groupLayout = NULL;
+ LilvNode* lastGroup = nullptr;
+ QHBoxLayout* groupLayout = nullptr;
for (int i = 0; i < portContainers.count(); ++i) {
PortContainer portContainer = portContainers[i];
Port* port = portContainer.port;
@@ -643,10 +643,10 @@ build_control_widget(Jalv* jalv)
if (!lilv_node_equals(group, lastGroup)) {
/* Group has changed */
LilvNode* groupName = lilv_world_get(
- world, group, jalv->nodes.lv2_name, NULL);
+ world, group, jalv->nodes.lv2_name, nullptr);
if (!groupName) {
groupName = lilv_world_get(
- world, group, jalv->nodes.rdfs_label, NULL);
+ world, group, jalv->nodes.rdfs_label, nullptr);
}
QGroupBox* groupBox = new QGroupBox(lilv_node_as_string(groupName));
@@ -715,8 +715,8 @@ jalv_open_ui(Jalv* jalv)
QWidget* controlWidget = build_control_widget(jalv);
widget = new QScrollArea();
- ((QScrollArea*)widget)->setWidget(controlWidget);
- ((QScrollArea*)widget)->setWidgetResizable(true);
+ static_cast<QScrollArea*>(widget)->setWidget(controlWidget);
+ static_cast<QScrollArea*>(widget)->setWidgetResizable(true);
widget->setMinimumWidth(800);
widget->setMinimumHeight(600);
}
@@ -728,6 +728,8 @@ jalv_open_ui(Jalv* jalv)
win->setCentralWidget(widget);
app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));
+ jalv_init_ui(jalv);
+
win->show();
if (jalv->ui_instance && !jalv_ui_is_resizable(jalv)) {
widget->setMinimumSize(widget->width(), widget->height());