aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format1
-rw-r--r--src/jalv_qt.cpp61
-rw-r--r--src/jalv_qt.hpp118
-rw-r--r--wscript6
4 files changed, 123 insertions, 63 deletions
diff --git a/.clang-format b/.clang-format
index f935f70..4692c52 100644
--- a/.clang-format
+++ b/.clang-format
@@ -22,5 +22,6 @@ IndentPPDirectives: AfterHash
KeepEmptyLinesAtTheStartOfBlocks: false
SpacesInContainerLiterals: false
StatementMacros:
+ - Q_OBJECT
- _Pragma
...
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index 79de303..7818a58 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -14,6 +14,7 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "jalv_qt.hpp"
#include "jalv_internal.h"
#include "lilv/lilv.h"
@@ -283,66 +284,6 @@ FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
return static_cast<QLayout*>(parent)->spacing();
}
-class PresetAction : public QAction
-{
- Q_OBJECT // NOLINT
-
- public
- : PresetAction(QObject* parent, Jalv* jalv, LilvNode* preset)
- : QAction(parent)
- , _jalv(jalv)
- , _preset(preset)
- {
- connect(this, SIGNAL(triggered()), this, SLOT(presetChosen()));
- }
-
- Q_SLOT void presetChosen() { jalv_apply_preset(_jalv, _preset); }
-
-private:
- Jalv* _jalv;
- LilvNode* _preset;
-};
-
-struct PortContainer {
- Jalv* jalv;
- struct Port* port;
-};
-
-class Control : public QGroupBox
-{
- Q_OBJECT // NOLINT
-
- public : explicit Control(PortContainer portContainer, QWidget* parent);
-
- Q_SLOT void dialChanged(int value);
-
- void setValue(float value);
-
-private:
- void setRange(float min, float max);
- QString getValueLabel(float value);
- float getValue();
- int stringWidth(const QString& str);
-
- QDial* dial;
- const LilvPlugin* plugin;
- struct Port* port;
-
- QLabel* label;
- QString name;
- int steps;
- float max;
- float min;
- bool isInteger;
- bool isEnum;
- bool isLogarithmic;
-
- std::vector<float> scalePoints;
- std::map<float, const char*> scaleMap;
-};
-
-#include "jalv_qt5_meta.hpp" // IWYU pragma: keep
-
extern "C" {
int
diff --git a/src/jalv_qt.hpp b/src/jalv_qt.hpp
new file mode 100644
index 0000000..b114504
--- /dev/null
+++ b/src/jalv_qt.hpp
@@ -0,0 +1,118 @@
+/*
+ Copyright 2007-2022 David Robillard <d@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 "lilv/lilv.h"
+#include "suil/suil.h"
+#include "zix/sem.h"
+
+#include <QtGlobal>
+
+#include <QAction>
+#include <QApplication>
+#include <QDial>
+#include <QFontMetrics>
+#include <QGroupBox>
+#include <QGuiApplication>
+#include <QHBoxLayout>
+#include <QKeySequence>
+#include <QLabel>
+#include <QLayout>
+#include <QLayoutItem>
+#include <QList>
+#include <QMainWindow>
+#include <QMenu>
+#include <QMenuBar>
+#include <QObject>
+#include <QPoint>
+#include <QRect>
+#include <QScreen>
+#include <QScrollArea>
+#include <QSize>
+#include <QSizePolicy>
+#include <QString>
+#include <QStyle>
+#include <QTimer>
+#include <QVBoxLayout>
+#include <QWidget>
+#include <QtCore>
+
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <cstring>
+#include <map>
+#include <vector>
+
+class PresetAction : public QAction
+{
+ Q_OBJECT // NOLINT
+
+public:
+ PresetAction(QObject* parent, Jalv* jalv, LilvNode* preset)
+ : QAction(parent)
+ , _jalv(jalv)
+ , _preset(preset)
+ {
+ connect(this, SIGNAL(triggered()), this, SLOT(presetChosen()));
+ }
+
+ Q_SLOT void presetChosen() { jalv_apply_preset(_jalv, _preset); }
+
+private:
+ Jalv* _jalv;
+ LilvNode* _preset;
+};
+
+struct PortContainer {
+ Jalv* jalv;
+ struct Port* port;
+};
+
+class Control : public QGroupBox
+{
+ Q_OBJECT // NOLINT
+
+public:
+ explicit Control(PortContainer portContainer, QWidget* parent);
+
+ Q_SLOT void dialChanged(int value);
+
+ void setValue(float value);
+
+private:
+ void setRange(float min, float max);
+ QString getValueLabel(float value);
+ float getValue();
+ int stringWidth(const QString& str);
+
+ QDial* dial;
+ const LilvPlugin* plugin;
+ struct Port* port;
+
+ QLabel* label;
+ QString name;
+ int steps;
+ float max;
+ float min;
+ bool isInteger;
+ bool isEnum;
+ bool isLogarithmic;
+
+ std::vector<float> scalePoints;
+ std::map<float, const char*> scaleMap;
+};
diff --git a/wscript b/wscript
index c465dbd..3851356 100644
--- a/wscript
+++ b/wscript
@@ -335,10 +335,10 @@ def build(bld):
# Qt5 version
if bld.env.HAVE_QT5:
obj = bld(rule = '${MOC5} ${SRC} > ${TGT}',
- source = 'src/jalv_qt.cpp',
- target = 'jalv_qt5_meta.hpp')
+ source = 'src/jalv_qt.hpp',
+ target = 'jalv_qt5_meta.cpp')
obj = bld(features = 'c cxx cxxprogram',
- source = source + ' src/jalv_qt.cpp',
+ source = source + ' src/jalv_qt.cpp jalv_qt5_meta.cpp',
target = 'jalv.qt5',
cflags = bld.env.PTHREAD_CFLAGS,
linkflags = bld.env.PTHREAD_LINKFLAGS,