aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-09-29 19:41:06 -0400
committerDavid Robillard <d@drobilla.net>2024-10-12 14:07:10 -0400
commit6ae46ac55746f54e05a1eb8f8fc3fe807e70a945 (patch)
treea7ba61bd46aaad763480f125bbc482d322cfd7cd /src
parentcce70d5b7e2dfb0a7379fb7a5f6ee4f4299859d7 (diff)
downloadjalv-6ae46ac55746f54e05a1eb8f8fc3fe807e70a945.tar.gz
jalv-6ae46ac55746f54e05a1eb8f8fc3fe807e70a945.tar.bz2
jalv-6ae46ac55746f54e05a1eb8f8fc3fe807e70a945.zip
Use anonymous namespaces
Diffstat (limited to 'src')
-rw-r--r--src/jalv_qt.cpp96
1 files changed, 52 insertions, 44 deletions
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index 759498c..f13ee6f 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -53,7 +53,9 @@
constexpr int CONTROL_WIDTH = 150;
constexpr int DIAL_STEPS = 10000;
-static QApplication* app = nullptr;
+namespace {
+
+QApplication* app = nullptr;
class FlowLayout final : public QLayout
{
@@ -264,46 +266,6 @@ FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
return static_cast<QLayout*>(parent)->spacing();
}
-extern "C" {
-
-int
-jalv_frontend_init(JalvFrontendArgs* const args, JalvOptions*)
-{
- app = new QApplication(*args->argc, *args->argv, true);
- app->setStyleSheet("QGroupBox::title { subcontrol-position: top center }");
- --*args->argc;
- ++*args->argv;
- return 0;
-}
-
-const char*
-jalv_frontend_ui_type(void)
-{
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- return "http://lv2plug.in/ns/extensions/ui#Qt5UI";
-#else
- return "http://lv2plug.in/ns/extensions/ui#Qt6UI";
-#endif
-}
-
-void
-jalv_ui_port_event(Jalv* jalv,
- uint32_t port_index,
- uint32_t buffer_size,
- uint32_t protocol,
- const void* buffer)
-{
- if (jalv->ui_instance) {
- suil_instance_port_event(
- jalv->ui_instance, port_index, buffer_size, protocol, buffer);
- } else {
- auto* const control = static_cast<Control*>(jalv->ports[port_index].widget);
- if (control) {
- control->setValue(*static_cast<const float*>(buffer));
- }
- }
-}
-
class Timer : public QTimer
{
public:
@@ -317,7 +279,7 @@ private:
Jalv* _jalv;
};
-static int
+int
add_preset_to_menu(Jalv* jalv,
const LilvNode* node,
const LilvNode* title,
@@ -332,6 +294,8 @@ add_preset_to_menu(Jalv* jalv,
return 0;
}
+} // namespace
+
Control::Control(PortContainer portContainer, QWidget* parent)
: QGroupBox(parent)
, dial(new QDial())
@@ -527,7 +491,9 @@ Control::dialChanged(int)
port->control = value;
}
-static bool
+namespace {
+
+bool
portGroupLessThan(const PortContainer& p1, const PortContainer& p2)
{
const Jalv* jalv = p1.jalv;
@@ -548,7 +514,7 @@ portGroupLessThan(const PortContainer& p1, const PortContainer& p2)
return cmp < 0;
}
-static QWidget*
+QWidget*
build_control_widget(Jalv* jalv)
{
const LilvPlugin* plugin = jalv->plugin;
@@ -616,6 +582,48 @@ build_control_widget(Jalv* jalv)
return grid;
}
+} // namespace
+
+extern "C" {
+
+int
+jalv_frontend_init(JalvFrontendArgs* const args, JalvOptions*)
+{
+ app = new QApplication(*args->argc, *args->argv, true);
+ app->setStyleSheet("QGroupBox::title { subcontrol-position: top center }");
+ --*args->argc;
+ ++*args->argv;
+ return 0;
+}
+
+const char*
+jalv_frontend_ui_type(void)
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ return "http://lv2plug.in/ns/extensions/ui#Qt5UI";
+#else
+ return "http://lv2plug.in/ns/extensions/ui#Qt6UI";
+#endif
+}
+
+void
+jalv_ui_port_event(Jalv* jalv,
+ uint32_t port_index,
+ uint32_t buffer_size,
+ uint32_t protocol,
+ const void* buffer)
+{
+ if (jalv->ui_instance) {
+ suil_instance_port_event(
+ jalv->ui_instance, port_index, buffer_size, protocol, buffer);
+ } else {
+ auto* const control = static_cast<Control*>(jalv->ports[port_index].widget);
+ if (control) {
+ control->setValue(*static_cast<const float*>(buffer));
+ }
+ }
+}
+
bool
jalv_frontend_discover(const Jalv*)
{