aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules2
-rw-r--r--NEWS9
-rw-r--r--doc/jalv.14
-rw-r--r--doc/jalv.gtk.14
-rw-r--r--src/jack.c4
-rw-r--r--src/jalv.c104
-rw-r--r--src/jalv_console.c31
-rw-r--r--src/jalv_gtk.c42
-rw-r--r--src/jalv_gtkmm2.cpp14
-rw-r--r--src/jalv_internal.h16
-rw-r--r--src/jalv_qt.cpp48
-rw-r--r--src/state.c5
m---------waflib0
-rw-r--r--wscript118
14 files changed, 321 insertions, 80 deletions
diff --git a/.gitmodules b/.gitmodules
index 0ebe4f2..b2babe7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "waflib"]
path = waflib
- url = ../autowaf
+ url = ../autowaf.git
diff --git a/NEWS b/NEWS
index 140ab7c..d22aa6a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,16 @@
+jalv (1.6.5) unstable;
+
+ * Support port events for ui:showInterface UIs
+ * Add a command line argument to select a specific UI
+
+ -- David Robillard <d@drobilla.net> Sun, 05 Apr 2020 11:14:53 +0000
+
jalv (1.6.4) stable;
* Support rdfs:label for port groups
* Use screen refresh rate with Gtk3 and Qt5
- -- David Robillard <d@drobilla.net> Sun, 10 Nov 2019 22:56:49 +0100
+ -- David Robillard <d@drobilla.net> Sun, 10 Nov 2019 21:56:49 +0000
jalv (1.6.2) stable;
diff --git a/doc/jalv.1 b/doc/jalv.1
index 9f65001..3f4fd73 100644
--- a/doc/jalv.1
+++ b/doc/jalv.1
@@ -21,6 +21,10 @@ Set control value (e.g. "vol=1.4").
Dump plugin <=> UI communication.
.TP
+\fB\-U URI\fR
+Load the UI with the given URI.
+
+.TP
\fB\-h\fR
Print the command line options.
diff --git a/doc/jalv.gtk.1 b/doc/jalv.gtk.1
index 5177e1d..8062e06 100644
--- a/doc/jalv.gtk.1
+++ b/doc/jalv.gtk.1
@@ -21,6 +21,10 @@ Set control value (e.g. "vol=1.4").
Dump plugin <=> UI communication.
.TP
+\fB\-U URI\fR
+Load the UI with the given URI.
+
+.TP
\fB\-g\fR, \fB\-\-generic\-ui\fR
Use Jalv generic UI and not the plugin UI.
diff --git a/src/jack.c b/src/jack.c
index 7a3d6dc..a27e261 100644
--- a/src/jack.c
+++ b/src/jack.c
@@ -177,7 +177,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
{ 0, jalv->urids.patch_Get } };
lv2_evbuf_write(&iter, 0, 0,
get.atom.type, get.atom.size,
- (const uint8_t*)LV2_ATOM_BODY(&get));
+ (const uint8_t*)LV2_ATOM_BODY_CONST(&get));
}
if (port->sys_port) {
@@ -496,7 +496,7 @@ jalv_backend_activate_port(Jalv* jalv, uint32_t port_index)
if (port->sys_port) {
// Set port order to index
char index_str[16];
- snprintf(index_str, sizeof(index_str), "%d", port_index);
+ snprintf(index_str, sizeof(index_str), "%u", port_index);
jack_set_property(client, jack_port_uuid(port->sys_port),
"http://jackaudio.org/metadata/order", index_str,
"http://www.w3.org/2001/XMLSchema#integer");
diff --git a/src/jalv.c b/src/jalv.c
index adee072..e3f4069 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -411,6 +411,7 @@ jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent)
&parent_feature,
&jalv->features.options_feature,
&idle_feature,
+ &jalv->features.request_value_feature,
NULL
};
@@ -469,13 +470,13 @@ jalv_ui_write(void* const jalv_handle,
Jalv* const jalv = (Jalv*)jalv_handle;
if (protocol != 0 && protocol != jalv->urids.atom_eventTransfer) {
- fprintf(stderr, "UI write with unsupported protocol %d (%s)\n",
+ fprintf(stderr, "UI write with unsupported protocol %u (%s)\n",
protocol, unmap_uri(jalv, protocol));
return;
}
if (port_index >= jalv->num_ports) {
- fprintf(stderr, "UI write to out of range port index %d\n",
+ fprintf(stderr, "UI write to out of range port index %u\n",
port_index);
return;
}
@@ -527,7 +528,7 @@ jalv_apply_ui_events(Jalv* jalv, uint32_t nframes)
lv2_evbuf_write(&e, nframes, 0, atom->type, atom->size,
(const uint8_t*)LV2_ATOM_BODY_CONST(atom));
} else {
- fprintf(stderr, "error: Unknown control change protocol %d\n",
+ fprintf(stderr, "error: Unknown control change protocol %u\n",
ev.protocol);
}
}
@@ -731,6 +732,65 @@ setup_signals(Jalv* const jalv)
#endif
}
+static const LilvUI*
+jalv_select_custom_ui(const Jalv* const jalv)
+{
+ const char* const native_ui_type_uri = jalv_native_ui_type();
+
+ if (jalv->opts.ui_uri) {
+ // Specific UI explicitly requested by user
+ LilvNode* uri = lilv_new_uri(jalv->world, jalv->opts.ui_uri);
+ const LilvUI* ui = lilv_uis_get_by_uri(jalv->uis, uri);
+
+ lilv_node_free(uri);
+ return ui;
+ }
+
+#ifdef HAVE_SUIL
+ if (native_ui_type_uri) {
+ // Try to find an embeddable UI
+ LilvNode* native_type = lilv_new_uri(jalv->world, native_ui_type_uri);
+
+ LILV_FOREACH (uis, u, jalv->uis) {
+ const LilvUI* ui = lilv_uis_get(jalv->uis, u);
+ const LilvNode* type = NULL;
+ const bool supported = lilv_ui_is_supported(
+ ui, suil_ui_supported, native_type, &type);
+
+ if (supported) {
+ lilv_node_free(native_type);
+ return ui;
+ }
+ }
+
+ lilv_node_free(native_type);
+ }
+#endif
+
+ if (!native_ui_type_uri && jalv->opts.show_ui) {
+ // Try to find a UI with ui:showInterface
+ LILV_FOREACH (uis, u, jalv->uis) {
+ const LilvUI* ui = lilv_uis_get(jalv->uis, u);
+ const LilvNode* ui_node = lilv_ui_get_uri(ui);
+
+ lilv_world_load_resource(jalv->world, ui_node);
+
+ const bool supported = lilv_world_ask(jalv->world,
+ ui_node,
+ jalv->nodes.lv2_extensionData,
+ jalv->nodes.ui_showInterface);
+
+ lilv_world_unload_resource(jalv->world, ui_node);
+
+ if (supported) {
+ return ui;
+ }
+ }
+ }
+
+ return NULL;
+}
+
int
jalv_open(Jalv* const jalv, int* argc, char*** argv)
{
@@ -844,6 +904,10 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
init_feature(&jalv->features.log_feature,
LV2_LOG__log, &jalv->features.llog);
+ jalv->features.request_value.handle = jalv;
+ init_feature(&jalv->features.request_value_feature,
+ LV2_UI__requestValue, &jalv->features.request_value);
+
zix_sem_init(&jalv->done, 0);
zix_sem_init(&jalv->paused, 0);
@@ -870,6 +934,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
jalv->nodes.lv2_control = lilv_new_uri(world, LV2_CORE__control);
jalv->nodes.lv2_default = lilv_new_uri(world, LV2_CORE__default);
jalv->nodes.lv2_enumeration = lilv_new_uri(world, LV2_CORE__enumeration);
+ jalv->nodes.lv2_extensionData = lilv_new_uri(world, LV2_CORE__extensionData);
jalv->nodes.lv2_integer = lilv_new_uri(world, LV2_CORE__integer);
jalv->nodes.lv2_maximum = lilv_new_uri(world, LV2_CORE__maximum);
jalv->nodes.lv2_minimum = lilv_new_uri(world, LV2_CORE__minimum);
@@ -889,6 +954,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
jalv->nodes.rdfs_label = lilv_new_uri(world, LILV_NS_RDFS "label");
jalv->nodes.rdfs_range = lilv_new_uri(world, LILV_NS_RDFS "range");
jalv->nodes.rsz_minimumSize = lilv_new_uri(world, LV2_RESIZE_PORT__minimumSize);
+ jalv->nodes.ui_showInterface = lilv_new_uri(world, LV2_UI__showInterface);
jalv->nodes.work_interface = lilv_new_uri(world, LV2_WORKER__interface);
jalv->nodes.work_schedule = lilv_new_uri(world, LV2_WORKER__schedule);
jalv->nodes.end = NULL;
@@ -963,25 +1029,23 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
}
/* Get a plugin UI */
- const char* native_ui_type_uri = jalv_native_ui_type();
jalv->uis = lilv_plugin_get_uis(jalv->plugin);
- if (!jalv->opts.generic_ui && native_ui_type_uri) {
-#ifdef HAVE_SUIL
- const LilvNode* native_ui_type = lilv_new_uri(jalv->world, native_ui_type_uri);
- LILV_FOREACH(uis, u, jalv->uis) {
- const LilvUI* this_ui = lilv_uis_get(jalv->uis, u);
- if (lilv_ui_is_supported(this_ui,
- suil_ui_supported,
- native_ui_type,
- &jalv->ui_type)) {
- /* TODO: Multiple UI support */
- jalv->ui = this_ui;
- break;
+ if (!jalv->opts.generic_ui) {
+ if ((jalv->ui = jalv_select_custom_ui(jalv))) {
+ const char* host_type_uri = jalv_native_ui_type();
+ if (host_type_uri) {
+ LilvNode* host_type = lilv_new_uri(jalv->world, host_type_uri);
+
+ if (!lilv_ui_is_supported(jalv->ui,
+ suil_ui_supported,
+ host_type,
+ &jalv->ui_type)) {
+ jalv->ui = NULL;
+ }
+
+ lilv_node_free(host_type);
}
}
-#endif
- } else if (!jalv->opts.generic_ui && jalv->opts.show_ui) {
- jalv->ui = lilv_uis_get(jalv->uis, lilv_uis_begin(jalv->uis));
}
/* Create ringbuffers for UI if necessary */
@@ -1029,7 +1093,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
/* The UI can only go so fast, clamp to reasonable limits */
jalv->ui_update_hz = MIN(60, jalv->ui_update_hz);
jalv->opts.buffer_size = MAX(4096, jalv->opts.buffer_size);
- fprintf(stderr, "Comm buffers: %d bytes\n", jalv->opts.buffer_size);
+ fprintf(stderr, "Comm buffers: %u bytes\n", jalv->opts.buffer_size);
fprintf(stderr, "Update rate: %.01f Hz\n", jalv->ui_update_hz);
/* Build options array to pass to plugin */
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 7d11714..2d4a197 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -38,6 +38,7 @@ print_usage(const char* name, bool error)
fprintf(os, " -b SIZE Buffer size for plugin <=> UI communication\n");
fprintf(os, " -c SYM=VAL Set control value (e.g. \"vol=1.4\")\n");
fprintf(os, " -d Dump plugin <=> UI communication\n");
+ fprintf(os, " -U URI Load the UI with the given URI\n");
fprintf(os, " -h Display this help and exit\n");
fprintf(os, " -l DIR Load state from save directory\n");
fprintf(os, " -n NAME JACK client name\n");
@@ -50,12 +51,16 @@ print_usage(const char* name, bool error)
}
void
-jalv_ui_port_event(ZIX_UNUSED Jalv* jalv,
- ZIX_UNUSED uint32_t port_index,
- ZIX_UNUSED uint32_t buffer_size,
- ZIX_UNUSED uint32_t protocol,
- ZIX_UNUSED const void* buffer)
+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);
+ }
}
int
@@ -70,6 +75,12 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
opts->show_ui = true;
} else if ((*argv)[a][1] == 'p') {
opts->print_controls = true;
+ } else if ((*argv)[a][1] == 'U') {
+ if (++a == *argc) {
+ fprintf(stderr, "Missing argument for -U\n");
+ return 1;
+ }
+ opts->ui_uri = jalv_strdup((*argv)[a]);
} else if ((*argv)[a][1] == 'u') {
if (++a == *argc) {
fprintf(stderr, "Missing argument for -u\n");
@@ -155,7 +166,7 @@ jalv_print_preset(Jalv* jalv,
static void
jalv_process_command(Jalv* jalv, const char* cmd)
{
- char sym[64];
+ char sym[1024];
uint32_t index;
float value;
if (!strncmp(cmd, "help", 4)) {
@@ -172,7 +183,7 @@ jalv_process_command(Jalv* jalv, const char* cmd)
} else if (strcmp(cmd, "presets\n") == 0) {
jalv_unload_presets(jalv);
jalv_load_presets(jalv, jalv_print_preset, NULL);
- } else if (sscanf(cmd, "preset %[a-zA-Z0-9_:/-.#]\n", sym) == 1) {
+ } else if (sscanf(cmd, "preset %1023[a-zA-Z0-9_:/-.#]\n", sym) == 1) {
LilvNode* preset = lilv_new_uri(jalv->world, sym);
jalv_apply_preset(jalv, preset);
lilv_node_free(preset);
@@ -188,8 +199,8 @@ jalv_process_command(Jalv* jalv, const char* cmd)
} else {
fprintf(stderr, "error: port index out of range\n");
}
- } else if (sscanf(cmd, "set %[a-zA-Z0-9_] %f", sym, &value) == 2 ||
- sscanf(cmd, "%[a-zA-Z0-9_] = %f", sym, &value) == 2) {
+ } else if (sscanf(cmd, "set %1023[a-zA-Z0-9_] %f", sym, &value) == 2 ||
+ sscanf(cmd, "%1023[a-zA-Z0-9_] = %f", sym, &value) == 2) {
struct Port* port = NULL;
for (uint32_t i = 0; i < jalv->num_ports; ++i) {
struct Port* p = &jalv->ports[i];
@@ -262,7 +273,7 @@ jalv_open_ui(Jalv* jalv)
if (!jalv_run_custom_ui(jalv) && !jalv->opts.non_interactive) {
// Primitive command prompt for setting control values
while (!zix_sem_try_wait(&jalv->done)) {
- char line[128];
+ char line[1024];
printf("> ");
if (fgets(line, sizeof(line), stdin)) {
jalv_process_command(jalv, line);
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index 71259bd..375ea76 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -97,6 +97,8 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
"Load state from preset", "URI" },
{ "dump", 'd', 0, G_OPTION_ARG_NONE, &opts->dump,
"Dump plugin <=> UI communication", NULL },
+ { "ui-uri", 'U', 0, G_OPTION_ARG_STRING, &opts->ui_uri,
+ "Load the UI with the given URI", "URI" },
{ "trace", 't', 0, G_OPTION_ARG_NONE, &opts->trace,
"Print trace messages from plugin", NULL },
{ "show-hidden", 's', 0, G_OPTION_ARG_NONE, &opts->show_hidden,
@@ -630,6 +632,42 @@ patch_put_get(Jalv* jalv,
return 0;
}
+static LV2UI_Request_Value_Status
+on_request_value(LV2UI_Feature_Handle handle,
+ const LV2_URID key,
+ const LV2_URID type,
+ const LV2_Feature* const* features)
+{
+ Jalv* jalv = (Jalv*)handle;
+ ControlID* control = get_property_control(&jalv->controls, key);
+
+ if (!control) {
+ return LV2UI_REQUEST_VALUE_ERR_UNKNOWN;
+ } else if (control->value_type != jalv->forge.Path) {
+ return LV2UI_REQUEST_VALUE_ERR_UNSUPPORTED;
+ }
+
+ GtkWidget* dialog =
+ gtk_file_chooser_dialog_new("Choose file",
+ GTK_WINDOW(jalv->window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
+ char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ set_control(control, strlen(path) + 1, jalv->forge.Path, path);
+
+ g_free(path);
+ }
+
+ gtk_widget_destroy(dialog);
+
+ return 0;
+}
+
static void
property_changed(Jalv* jalv, LV2_URID key, const LV2_Atom* value)
{
@@ -776,7 +814,7 @@ file_changed(GtkFileChooserButton* widget,
const char* filename = gtk_file_chooser_get_filename(
GTK_FILE_CHOOSER(widget));
- set_control(control, strlen(filename), jalv->forge.Path, filename);
+ set_control(control, strlen(filename) + 1, jalv->forge.Path, filename);
}
static Controller*
@@ -1197,6 +1235,8 @@ jalv_open_ui(Jalv* jalv)
jalv_ui_instantiate(jalv, jalv_native_ui_type(), alignment);
}
+ jalv->features.request_value.request = on_request_value;
+
if (jalv->ui_instance) {
GtkWidget* widget = (GtkWidget*)suil_instance_get_widget(
jalv->ui_instance);
diff --git a/src/jalv_gtkmm2.cpp b/src/jalv_gtkmm2.cpp
index 3f5a0e9..065b971 100644
--- a/src/jalv_gtkmm2.cpp
+++ b/src/jalv_gtkmm2.cpp
@@ -24,7 +24,7 @@ LV2_DISABLE_DEPRECATION_WARNINGS
#include <gtkmm/window.h>
LV2_RESTORE_WARNINGS
-Gtk::Main* jalv_gtk_main = NULL;
+static Gtk::Main* jalv_gtk_main = nullptr;
int
jalv_init(int* argc, char*** argv, JalvOptions* opts)
@@ -70,23 +70,27 @@ jalv_open_ui(Jalv* jalv)
Gtk::Window* window = new Gtk::Window();
if (jalv->ui) {
- jalv_ui_instantiate(jalv, jalv_native_ui_type(), NULL);
+ jalv_ui_instantiate(jalv, jalv_native_ui_type(), nullptr);
}
if (jalv->ui_instance) {
- GtkWidget* widget = (GtkWidget*)suil_instance_get_widget(
- jalv->ui_instance);
+ GtkWidget* widget = static_cast<GtkWidget*>(
+ suil_instance_get_widget(jalv->ui_instance));
+
Gtk::Widget* widgetmm = Glib::wrap(widget);
window->add(*Gtk::manage(widgetmm));
widgetmm->show_all();
g_timeout_add(1000 / jalv->ui_update_hz,
- (GSourceFunc)jalv_update, jalv);
+ reinterpret_cast<GSourceFunc>(jalv_update),
+ jalv);
} else {
Gtk::Button* button = Gtk::manage(new Gtk::Button("Close"));
window->add(*Gtk::manage(button));
}
+ jalv_init_ui(jalv);
+
window->set_resizable(jalv_ui_is_resizable(jalv));
window->show_all();
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 4d25109..0932460 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -17,6 +17,8 @@
#ifndef JALV_INTERNAL_H
#define JALV_INTERNAL_H
+#define _POSIX_C_SOURCE 200809L
+
#include "lv2_evbuf.h"
#include "symap.h"
@@ -39,6 +41,7 @@
#include "lv2/options/options.h"
#include "lv2/resize-port/resize-port.h"
#include "lv2/state/state.h"
+#include "lv2/ui/ui.h"
#include "lv2/urid/urid.h"
#include "lv2/worker/worker.h"
@@ -55,6 +58,12 @@
# define REALTIME
#endif
+#ifdef __GNUC__
+# define JALV_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
+#else
+# define JALV_LOG_FUNC(fmt, arg1)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -174,6 +183,7 @@ typedef struct {
int show_ui; ///< Show non-embedded UI
int print_controls; ///< Print control changes to stdout
int non_interactive; ///< Do not listen for commands on stdin
+ char* ui_uri; ///< URI of UI to load
} JalvOptions;
typedef struct {
@@ -223,6 +233,7 @@ typedef struct {
LilvNode* lv2_control;
LilvNode* lv2_default;
LilvNode* lv2_enumeration;
+ LilvNode* lv2_extensionData;
LilvNode* lv2_integer;
LilvNode* lv2_maximum;
LilvNode* lv2_minimum;
@@ -242,6 +253,7 @@ typedef struct {
LilvNode* rdfs_label;
LilvNode* rdfs_range;
LilvNode* rsz_minimumSize;
+ LilvNode* ui_showInterface;
LilvNode* work_interface;
LilvNode* work_schedule;
LilvNode* end; ///< NULL terminator for easy freeing of entire structure
@@ -278,6 +290,8 @@ typedef struct {
LV2_Options_Option options[6];
LV2_Feature options_feature;
LV2_Feature safe_restore_feature;
+ LV2UI_Request_Value request_value;
+ LV2_Feature request_value_feature;
LV2_Extension_Data_Feature ext_data;
} JalvFeatures;
@@ -518,11 +532,13 @@ jalv_strjoin(const char* a, const char* b)
return out;
}
+JALV_LOG_FUNC(3, 4)
int
jalv_printf(LV2_Log_Handle handle,
LV2_URID type,
const char* fmt, ...);
+JALV_LOG_FUNC(3, 0)
int
jalv_vprintf(LV2_Log_Handle handle,
LV2_URID type,
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());
diff --git a/src/state.c b/src/state.c
index dab6c02..4f8100a 100644
--- a/src/state.c
+++ b/src/state.c
@@ -31,11 +31,6 @@
#include <sys/stat.h>
#include <sys/types.h>
-#define NS_JALV "http://drobilla.net/ns/jalv#"
-#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#"
-#define NS_XSD "http://www.w3.org/2001/XMLSchema#"
-
char*
jalv_make_path(LV2_State_Make_Path_Handle handle,
const char* path)
diff --git a/waflib b/waflib
-Subproject 0bde0c2e022c479b8c7e3933eca0cbc01282562
+Subproject 116a28fa5f92e58a46dc878751019ba74a61e54
diff --git a/wscript b/wscript
index af363ca..4562825 100644
--- a/wscript
+++ b/wscript
@@ -7,7 +7,7 @@ from waflib import Options
from waflib.extras import autowaf as autowaf
# Version of this package (even if built as a child)
-JALV_VERSION = '1.6.4'
+JALV_VERSION = '1.6.5'
# Mandatory waf variables
APPNAME = 'jalv' # Package name for waf dist
@@ -42,38 +42,117 @@ def configure(conf):
conf.load('autowaf', cache=True)
autowaf.set_c_lang(conf, 'c99')
- conf.check_pkg('lv2 >= 1.16.0', uselib_store='LV2')
+ if Options.options.ultra_strict:
+ autowaf.add_compiler_flags(conf.env, 'c', {
+ 'clang': [
+ '-Wno-bad-function-cast',
+ '-Wno-missing-noreturn',
+ ],
+ 'gcc': [
+ '-Wno-bad-function-cast',
+ '-Wno-c++-compat',
+ ],
+ })
+
+ autowaf.add_compiler_flags(conf.env, '*', {
+ 'clang': [
+ '-Wno-atomic-implicit-seq-cst',
+ '-Wno-c99-extensions',
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-disabled-macro-expansion',
+ '-Wno-documentation-unknown-command',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-format-nonliteral',
+ '-Wno-implicit-fallthrough',
+ '-Wno-implicit-float-conversion',
+ '-Wno-padded',
+ '-Wno-redundant-parens',
+ '-Wno-reserved-id-macro',
+ '-Wno-shorten-64-to-32',
+ '-Wno-sign-conversion',
+ '-Wno-switch-enum',
+ '-Wno-unused-macros',
+ '-Wno-unused-parameter',
+ '-Wno-vla',
+ ],
+ 'gcc': [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-conversion',
+ '-Wno-double-promotion',
+ '-Wno-float-conversion',
+ '-Wno-float-equal',
+ '-Wno-padded',
+ '-Wno-pedantic',
+ '-Wno-stack-protector',
+ '-Wno-switch-enum',
+ '-Wno-unused-macros',
+ '-Wno-unused-parameter',
+ '-Wno-vla',
+ ],
+ })
+
+ autowaf.add_compiler_flags(conf.env, 'cxx', {
+ 'clang': [
+ '-Wno-extra-semi-stmt',
+ '-Wno-old-style-cast',
+ '-Wno-weak-vtables',
+ '-Wno-zero-as-null-pointer-constant',
+ ],
+ 'gcc': [
+ '-Wno-effc++',
+ ],
+ })
+
+ conf.check_pkg('lv2 >= 1.17.2', uselib_store='LV2')
conf.check_pkg('lilv-0 >= 0.24.0', uselib_store='LILV')
conf.check_pkg('serd-0 >= 0.24.0', uselib_store='SERD')
conf.check_pkg('sord-0 >= 0.14.0', uselib_store='SORD')
conf.check_pkg('sratom-0 >= 0.6.0', uselib_store='SRATOM')
if Options.options.portaudio:
conf.check_pkg('portaudio-2.0 >= 2.0.0',
- uselib_store='PORTAUDIO', mandatory=False)
+ uselib_store='PORTAUDIO',
+ system=True,
+ mandatory=False)
else:
- conf.check_pkg('jack >= 0.120.0', uselib_store='JACK')
+ conf.check_pkg('jack >= 0.120.0',
+ uselib_store='JACK',
+ system=True)
if not Options.options.no_gui and not Options.options.no_gtk:
if not Options.options.no_gtk2:
- conf.check_pkg('gtk+-2.0 >= 2.18.0', uselib_store='GTK2',
+ conf.check_pkg('gtk+-2.0 >= 2.18.0',
+ uselib_store='GTK2',
+ system=True,
mandatory=False)
if not Options.options.no_gtkmm:
- conf.check_pkg('gtkmm-2.4 >= 2.20.0', uselib_store='GTKMM2',
+ conf.check_pkg('gtkmm-2.4 >= 2.20.0',
+ uselib_store='GTKMM2',
+ system=True,
mandatory=False)
if not Options.options.no_gtk3:
- conf.check_pkg('gtk+-3.0 >= 3.0.0', uselib_store='GTK3',
+ conf.check_pkg('gtk+-3.0 >= 3.0.0',
+ uselib_store='GTK3',
+ system=True,
mandatory=False)
if not Options.options.no_gui and not Options.options.no_qt:
if not Options.options.no_qt4:
- conf.check_pkg('QtGui >= 4.0.0', uselib_store='QT4',
+ conf.check_pkg('QtGui >= 4.0.0',
+ uselib_store='QT4',
+ system=True,
mandatory=False)
if conf.env.HAVE_QT4:
if not conf.find_program('moc-qt4', var='MOC4', mandatory=False):
conf.find_program('moc', var='MOC4')
if not Options.options.no_qt5:
- conf.check_pkg('Qt5Widgets >= 5.1.0', uselib_store='QT5',
+ conf.check_pkg('Qt5Widgets >= 5.1.0',
+ uselib_store='QT5',
+ system=True,
mandatory=False)
if conf.env.HAVE_QT5:
if not conf.find_program('moc-qt5', var='MOC5', mandatory=False):
@@ -90,12 +169,20 @@ def configure(conf):
header_name = 'jack/jack.h',
define_name = 'HAVE_JACK_PORT_TYPE_GET_BUFFER_SIZE',
uselib = 'JACK',
+ return_type = 'size_t',
+ arg_types = 'jack_client_t*,const char*',
mandatory = False)
conf.check_function('c', 'jack_set_property',
header_name = 'jack/metadata.h',
define_name = 'HAVE_JACK_METADATA',
uselib = 'JACK',
+ return_type = 'int',
+ arg_types = '''jack_client_t*,
+ jack_uuid_t,
+ const char*,
+ const char*,
+ const char*''',
mandatory = False)
defines = ['_POSIX_C_SOURCE=200809L']
@@ -104,29 +191,36 @@ def configure(conf):
header_name = 'unistd.h',
defines = defines,
define_name = 'HAVE_ISATTY',
+ return_type = 'int',
+ arg_types = 'int',
mandatory = False)
conf.check_function('c', 'fileno',
header_name = 'stdio.h',
defines = defines,
define_name = 'HAVE_FILENO',
+ return_type = 'int',
+ arg_types = 'FILE*',
mandatory = False)
conf.check_function('c', 'mlock',
header_name = 'sys/mman.h',
defines = defines,
define_name = 'HAVE_MLOCK',
+ return_type = 'int',
+ arg_types = 'const void*,size_t',
mandatory = False)
conf.check_function('c', 'sigaction',
header_name = 'signal.h',
defines = defines,
define_name = 'HAVE_SIGACTION',
+ return_type = 'int',
+ arg_types = '''int,
+ const struct sigaction*,
+ struct sigaction*''',
mandatory = False)
- if conf.is_defined('HAVE_ISATTY') and conf.is_defined('HAVE_FILENO'):
- conf.env.append_unique('CFLAGS', ['-D_POSIX_C_SOURCE=200809L'])
-
if not Options.options.no_jack_session:
conf.define('JALV_JACK_SESSION', 1)