diff options
author | David Robillard <d@drobilla.net> | 2012-11-14 03:54:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-11-14 03:54:34 +0000 |
commit | 39aca5e3ca582d27fb7df724c274afc67596406b (patch) | |
tree | c55f1c5080ab47dbf271f57e8ccf8d3d232da9e4 | |
parent | d46af646556e0dbee6e99aa6a9e52ae36f4e227b (diff) | |
download | jalv-39aca5e3ca582d27fb7df724c274afc67596406b.tar.gz jalv-39aca5e3ca582d27fb7df724c274afc67596406b.tar.bz2 jalv-39aca5e3ca582d27fb7df724c274afc67596406b.zip |
Add menu bar and pass parent widget in Qt version for true UI embedding
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4812 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | src/jalv_qt4.cpp | 19 | ||||
-rw-r--r-- | wscript | 2 |
3 files changed, 22 insertions, 5 deletions
@@ -1,3 +1,9 @@ +jalv (1.2.1) unstable; + + * Add menu bar and pass parent widget in Qt version for true UI embedding + + -- David Robillard <d@drobilla.net> Tue, 13 Nov 2012 22:02:45 -0500 + jalv (1.2.0) stable; * Tune UI update rate and ring size based on JACK rate and MIDI buffer size diff --git a/src/jalv_qt4.cpp b/src/jalv_qt4.cpp index c73bd9c..04bea72 100644 --- a/src/jalv_qt4.cpp +++ b/src/jalv_qt4.cpp @@ -17,8 +17,9 @@ #include "jalv_internal.h" #include <QApplication> -#include <QPushButton> #include <QMainWindow> +#include <QMenuBar> +#include <QPushButton> #include <QTimer> static QApplication* app = NULL; @@ -74,19 +75,29 @@ private: int jalv_open_ui(Jalv* jalv) { + QMainWindow* win = new QMainWindow(); + QMenu* file_menu = win->menuBar()->addMenu("&File"); + QAction* quit_action = new QAction("&Quit", win); + + QObject::connect(quit_action, SIGNAL(triggered()), win, SLOT(close())); + quit_action->setShortcuts(QKeySequence::Quit); + quit_action->setStatusTip("Quit Jalv"); + file_menu->addAction(quit_action); + if (jalv->ui) { - jalv_ui_instantiate(jalv, jalv_native_ui_type(jalv), NULL); + jalv_ui_instantiate(jalv, jalv_native_ui_type(jalv), win); } if (jalv->ui_instance) { QWidget* widget = (QWidget*)suil_instance_get_widget(jalv->ui_instance); - widget->show(); + win->setCentralWidget(widget); } else { QPushButton* button = new QPushButton("Close"); - button->show(); + win->setCentralWidget(button); QObject::connect(button, SIGNAL(clicked()), app, SLOT(quit())); } app->connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit())); + win->show(); Timer* timer = new Timer(jalv); timer->start(1000 / jalv->ui_update_hz); @@ -4,7 +4,7 @@ from waflib.extras import autowaf as autowaf import waflib.Options as Options # Version of this package (even if built as a child) -JALV_VERSION = '1.2.0' +JALV_VERSION = '1.2.1' # Variables for 'waf dist' APPNAME = 'jalv' |