aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv_qt4.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-30 23:19:28 +0000
committerDavid Robillard <d@drobilla.net>2011-05-30 23:19:28 +0000
commite8103f203c62daf7fb269a35e4fc0c92b7b16fe2 (patch)
treeb087d65fc3ee9ba6d8b656960f3a9d196f07ffdf /src/jalv_qt4.cpp
downloadjalv-e8103f203c62daf7fb269a35e4fc0c92b7b16fe2.tar.gz
jalv-e8103f203c62daf7fb269a35e4fc0c92b7b16fe2.tar.bz2
jalv-e8103f203c62daf7fb269a35e4fc0c92b7b16fe2.zip
Add "Jalv", a stand-alone version of lv2jack that supports plugin UIs via Suil
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3344 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/jalv_qt4.cpp')
-rw-r--r--src/jalv_qt4.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/jalv_qt4.cpp b/src/jalv_qt4.cpp
new file mode 100644
index 0000000..79cf985
--- /dev/null
+++ b/src/jalv_qt4.cpp
@@ -0,0 +1,59 @@
+/*
+ Copyright 2007-2011 David Robillard <http://drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include "jalv_internal.h"
+
+#include <QApplication>
+#include <QPushButton>
+#include <QMainWindow>
+
+static QApplication* app = NULL;
+
+extern "C" {
+
+void
+jalv_init(int* argc, char*** argv)
+{
+ app = new QApplication(*argc, *argv, true);
+}
+
+LilvNode*
+jalv_native_ui_type(Jalv* jalv)
+{
+ return lilv_new_uri(jalv->world,
+ "http://lv2plug.in/ns/extensions/ui#Qt4UI");
+}
+
+int
+jalv_open_ui(Jalv* jalv,
+ SuilInstance* instance)
+{
+ if (instance) {
+ QWidget* widget = (QWidget*)suil_instance_get_widget(instance);
+ widget->show();
+ } else {
+ QPushButton* button = new QPushButton("Close");
+ button->show();
+ QObject::connect(button, SIGNAL(clicked()), app, SLOT(quit()));
+ }
+ app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));
+
+ int ret = app->exec();
+ sem_post(jalv->done);
+ return ret;
+}
+
+} // extern "C"