Editor: Include headers where necessary

Avoids propagating dependencies through indirect inclusions, and also
gets rid of some header dependencies entirely.
This commit is contained in:
Lioncash 2019-08-27 20:51:38 -04:00
parent 107ddeb5a9
commit ef86e69421
32 changed files with 485 additions and 124 deletions

View File

@ -1,8 +1,11 @@
#include "ADSREditor.hpp" #include "ADSREditor.hpp"
#include "MainWindow.hpp" #include "MainWindow.hpp"
#include <QVBoxLayout>
#include <QPainter> #include <QCheckBox>
#include <QDoubleSpinBox>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPainter>
#include <QVBoxLayout>
const QColor Red = QColor(255, 127, 127); const QColor Red = QColor(255, 127, 127);
const QColor Green = QColor(127, 255, 127); const QColor Green = QColor(127, 255, 127);
@ -217,6 +220,8 @@ ADSRView::ADSRView(QWidget* parent) : QWidget(parent) {
m_gridFont.setPointSize(8); m_gridFont.setPointSize(8);
} }
ADSRView::~ADSRView() = default;
ADSREditor* ADSRControls::getEditor() const { return qobject_cast<ADSREditor*>(parentWidget()); } ADSREditor* ADSRControls::getEditor() const { return qobject_cast<ADSREditor*>(parentWidget()); }
void ADSRControls::loadData() { void ADSRControls::loadData() {
@ -945,6 +950,8 @@ ADSRControls::ADSRControls(QWidget* parent) : QFrame(parent) {
setLayout(mainLayout); setLayout(mainLayout);
} }
ADSRControls::~ADSRControls() = default;
bool ADSREditor::loadData(ProjectModel::ADSRNode* node) { bool ADSREditor::loadData(ProjectModel::ADSRNode* node) {
m_adsrView->loadData(node); m_adsrView->loadData(node);
m_controls->loadData(); m_controls->loadData();
@ -966,3 +973,5 @@ ADSREditor::ADSREditor(QWidget* parent) : EditorWidget(parent), m_adsrView(new A
layout->addWidget(m_controls); layout->addWidget(m_controls);
setLayout(layout); setLayout(layout);
} }
ADSREditor::~ADSREditor() = default;

View File

@ -1,15 +1,22 @@
#pragma once #pragma once
#include "EditorWidget.hpp" #include <cstdint>
#include <vector>
#include <QFrame> #include <QFrame>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QCheckBox>
#include <QLabel>
#include <QStaticText> #include <QStaticText>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/Common.hpp>
class ADSREditor; class ADSREditor;
class QCheckBox;
class QDoubleSpinBox;
class QLabel;
class ADSRView : public QWidget { class ADSRView : public QWidget {
Q_OBJECT Q_OBJECT
friend class ADSRControls; friend class ADSRControls;
@ -23,6 +30,8 @@ class ADSRView : public QWidget {
public: public:
explicit ADSRView(QWidget* parent = Q_NULLPTR); explicit ADSRView(QWidget* parent = Q_NULLPTR);
~ADSRView() override;
void loadData(ProjectModel::ADSRNode* node); void loadData(ProjectModel::ADSRNode* node);
void unloadData(); void unloadData();
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
@ -53,8 +62,11 @@ class ADSRControls : public QFrame {
public: public:
explicit ADSRControls(QWidget* parent = Q_NULLPTR); explicit ADSRControls(QWidget* parent = Q_NULLPTR);
~ADSRControls() override;
void loadData(); void loadData();
void unloadData(); void unloadData();
public slots: public slots:
void attackChanged(double val); void attackChanged(double val);
void decayChanged(double val); void decayChanged(double val);
@ -74,6 +86,8 @@ class ADSREditor : public EditorWidget {
public: public:
explicit ADSREditor(QWidget* parent = Q_NULLPTR); explicit ADSREditor(QWidget* parent = Q_NULLPTR);
~ADSREditor() override;
bool loadData(ProjectModel::ADSRNode* node); bool loadData(ProjectModel::ADSRNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;

View File

@ -1,8 +1,11 @@
#include "Common.hpp" #include "Common.hpp"
#include "MainWindow.hpp" #include "MainWindow.hpp"
#include <QDir>
#include <QMessageBox> #include <QMessageBox>
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
#include <QTransform>
boo::SystemString QStringToSysString(const QString& str) { boo::SystemString QStringToSysString(const QString& str) {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -1,13 +1,19 @@
#pragma once #pragma once
#include "boo/System.hpp" #include <functional>
#include <QString>
#include <QDir>
#include <QMessageBox> #include <QMessageBox>
#include <QString>
#include <boo/System.hpp>
class MainWindow; class MainWindow;
extern MainWindow* g_MainWindow; extern MainWindow* g_MainWindow;
class QDir;
class QRectF;
class QTransform;
class UIMessenger : public QObject { class UIMessenger : public QObject {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -7,9 +7,12 @@
#include <QGridLayout> #include <QGridLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QJSValueIterator> #include <QJSValueIterator>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPainter> #include <QPainter>
#include <QPushButton>
class CurveEditUndoCommand : public EditorUndoCommand { class CurveEditUndoCommand : public EditorUndoCommand {
public: public:
@ -163,6 +166,8 @@ CurveView::CurveView(QWidget* parent) : QWidget(parent) {
m_gridFont.setPointSize(8); m_gridFont.setPointSize(8);
} }
CurveView::~CurveView() = default;
CurveEditor* CurveControls::getEditor() const { return qobject_cast<CurveEditor*>(parentWidget()); } CurveEditor* CurveControls::getEditor() const { return qobject_cast<CurveEditor*>(parentWidget()); }
void CurveControls::loadData() { void CurveControls::loadData() {
@ -270,6 +275,8 @@ CurveControls::CurveControls(QWidget* parent) : QFrame(parent) {
m_lineEdit->setToolTip(docStr); m_lineEdit->setToolTip(docStr);
} }
CurveControls::~CurveControls() = default;
bool CurveEditor::loadData(ProjectModel::CurveNode* node) { bool CurveEditor::loadData(ProjectModel::CurveNode* node) {
m_curveView->loadData(node); m_curveView->loadData(node);
m_controls->loadData(); m_controls->loadData();
@ -292,3 +299,5 @@ CurveEditor::CurveEditor(QWidget* parent)
layout->addWidget(m_controls); layout->addWidget(m_controls);
setLayout(layout); setLayout(layout);
} }
CurveEditor::~CurveEditor() = default;

View File

@ -2,16 +2,21 @@
#include <array> #include <array>
#include "EditorWidget.hpp"
#include <QFrame> #include <QFrame>
#include <QLabel>
#include <QStaticText>
#include <QLineEdit>
#include <QPushButton>
#include <QJSEngine> #include <QJSEngine>
#include <QStaticText>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/Common.hpp>
class CurveEditor; class CurveEditor;
class QLabel;
class QLineEdit;
class QPushButton;
class CurveView : public QWidget { class CurveView : public QWidget {
Q_OBJECT Q_OBJECT
friend class CurveControls; friend class CurveControls;
@ -23,6 +28,8 @@ class CurveView : public QWidget {
public: public:
explicit CurveView(QWidget* parent = Q_NULLPTR); explicit CurveView(QWidget* parent = Q_NULLPTR);
~CurveView() override;
void loadData(ProjectModel::CurveNode* node); void loadData(ProjectModel::CurveNode* node);
void unloadData(); void unloadData();
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
@ -43,9 +50,12 @@ class CurveControls : public QFrame {
public: public:
explicit CurveControls(QWidget* parent = Q_NULLPTR); explicit CurveControls(QWidget* parent = Q_NULLPTR);
~CurveControls() override;
void loadData(); void loadData();
void unloadData(); void unloadData();
void resizeEvent(QResizeEvent* ev) override; void resizeEvent(QResizeEvent* ev) override;
public slots: public slots:
void exprCommit(); void exprCommit();
}; };
@ -59,6 +69,8 @@ class CurveEditor : public EditorWidget {
public: public:
explicit CurveEditor(QWidget* parent = Q_NULLPTR); explicit CurveEditor(QWidget* parent = Q_NULLPTR);
~CurveEditor() override;
bool loadData(ProjectModel::CurveNode* node); bool loadData(ProjectModel::CurveNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;

View File

@ -5,6 +5,8 @@
EditorWidget::EditorWidget(QWidget* parent) : QWidget(parent) {} EditorWidget::EditorWidget(QWidget* parent) : QWidget(parent) {}
EditorWidget::~EditorWidget() = default;
void EditorUndoCommand::undo() { g_MainWindow->openEditor(m_node.get()); } void EditorUndoCommand::undo() { g_MainWindow->openEditor(m_node.get()); }
void EditorUndoCommand::redo() { g_MainWindow->openEditor(m_node.get()); } void EditorUndoCommand::redo() { g_MainWindow->openEditor(m_node.get()); }
@ -92,6 +94,8 @@ FieldProjectNode::FieldProjectNode(ProjectModel::CollectionNode* collection, QWi
setCollection(collection); setCollection(collection);
} }
FieldProjectNode::~FieldProjectNode() = default;
void FieldProjectNode::setCollection(ProjectModel::CollectionNode* collection) { void FieldProjectNode::setCollection(ProjectModel::CollectionNode* collection) {
m_collection = collection; m_collection = collection;
@ -153,6 +157,8 @@ FieldPageObjectNode::FieldPageObjectNode(ProjectModel::GroupNode* group, QWidget
setGroup(group); setGroup(group);
} }
FieldPageObjectNode::~FieldPageObjectNode() = default;
void FieldPageObjectNode::setGroup(ProjectModel::GroupNode* group) { void FieldPageObjectNode::setGroup(ProjectModel::GroupNode* group) {
m_group = group; m_group = group;

View File

@ -1,29 +1,34 @@
#pragma once #pragma once
#include <QWidget>
#include <QUndoCommand>
#include <QApplication>
#include <QSpinBox>
#include <QComboBox>
#include <QWheelEvent>
#include <QItemEditorFactory>
#include <QToolButton>
#include <QAction> #include <QAction>
#include <QPushButton> #include <QComboBox>
#include <QItemEditorFactory>
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
#include <QPushButton>
#include <QSpinBox>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QToolButton>
#include <QUndoCommand>
#include <QWheelEvent>
#include <QWidget>
#include "ProjectModel.hpp" #include "ProjectModel.hpp"
#include <amuse/Common.hpp>
class EditorWidget : public QWidget { class EditorWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit EditorWidget(QWidget* parent = Q_NULLPTR); explicit EditorWidget(QWidget* parent = Q_NULLPTR);
~EditorWidget() override;
virtual bool valid() const { return true; } virtual bool valid() const { return true; }
virtual void unloadData() {} virtual void unloadData() {}
virtual ProjectModel::INode* currentNode() const { return nullptr; } virtual ProjectModel::INode* currentNode() const { return nullptr; }
virtual void setEditorEnabled(bool en) { setEnabled(en); } virtual void setEditorEnabled(bool en) { setEnabled(en); }
virtual AmuseItemEditFlags itemEditFlags() const { return AmuseItemNone; } virtual AmuseItemEditFlags itemEditFlags() const { return AmuseItemNone; }
public slots: public slots:
virtual void itemCutAction() {} virtual void itemCutAction() {}
virtual void itemCopyAction() {} virtual void itemCopyAction() {}
@ -130,6 +135,8 @@ class FieldProjectNode : public QWidget {
public: public:
explicit FieldProjectNode(ProjectModel::CollectionNode* collection = Q_NULLPTR, QWidget* parent = Q_NULLPTR); explicit FieldProjectNode(ProjectModel::CollectionNode* collection = Q_NULLPTR, QWidget* parent = Q_NULLPTR);
~FieldProjectNode() override;
void setCollection(ProjectModel::CollectionNode* collection); void setCollection(ProjectModel::CollectionNode* collection);
ProjectModel::CollectionNode* collection() const { return m_collection; } ProjectModel::CollectionNode* collection() const { return m_collection; }
int currentIndex() const { return m_comboBox.currentIndex(); } int currentIndex() const { return m_comboBox.currentIndex(); }
@ -137,10 +144,13 @@ public:
void showPopup() { m_comboBox.showPopup(); } void showPopup() { m_comboBox.showPopup(); }
ProjectModel::BasePoolObjectNode* currentNode() const; ProjectModel::BasePoolObjectNode* currentNode() const;
bool event(QEvent* ev) override; bool event(QEvent* ev) override;
private slots: private slots:
void _currentIndexChanged(int); void _currentIndexChanged(int);
public slots: public slots:
void openCurrent(); void openCurrent();
signals: signals:
void currentIndexChanged(int); void currentIndexChanged(int);
}; };
@ -153,6 +163,8 @@ class FieldPageObjectNode : public QWidget {
public: public:
explicit FieldPageObjectNode(ProjectModel::GroupNode* group = Q_NULLPTR, QWidget* parent = Q_NULLPTR); explicit FieldPageObjectNode(ProjectModel::GroupNode* group = Q_NULLPTR, QWidget* parent = Q_NULLPTR);
~FieldPageObjectNode() override;
void setGroup(ProjectModel::GroupNode* group); void setGroup(ProjectModel::GroupNode* group);
ProjectModel::GroupNode* group() const { return m_group; } ProjectModel::GroupNode* group() const { return m_group; }
int currentIndex() const { return m_comboBox.currentIndex(); } int currentIndex() const { return m_comboBox.currentIndex(); }
@ -161,10 +173,13 @@ public:
void showPopup() { m_comboBox.showPopup(); } void showPopup() { m_comboBox.showPopup(); }
ProjectModel::BasePoolObjectNode* currentNode() const; ProjectModel::BasePoolObjectNode* currentNode() const;
bool event(QEvent* ev) override; bool event(QEvent* ev) override;
private slots: private slots:
void _currentIndexChanged(int); void _currentIndexChanged(int);
public slots: public slots:
void openCurrent(); void openCurrent();
signals: signals:
void currentIndexChanged(int); void currentIndexChanged(int);
}; };

View File

@ -1,10 +1,14 @@
#include "KeyboardWidget.hpp" #include "KeyboardWidget.hpp"
#include <QApplication>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QSvgRenderer>
#include <QMouseEvent> #include <QMouseEvent>
#include <QScrollArea> #include <QScrollArea>
#include <QApplication>
#include <QScrollBar> #include <QScrollBar>
#include <QSvgRenderer>
#include "Common.hpp"
#include "StatusBarWidget.hpp"
const QString NaturalKeyNames[] = {QStringLiteral("C"), QStringLiteral("D"), QStringLiteral("E"), QStringLiteral("F"), const QString NaturalKeyNames[] = {QStringLiteral("C"), QStringLiteral("D"), QStringLiteral("E"), QStringLiteral("F"),
QStringLiteral("G"), QStringLiteral("A"), QStringLiteral("B")}; QStringLiteral("G"), QStringLiteral("A"), QStringLiteral("B")};
@ -70,6 +74,8 @@ KeyboardWidget::KeyboardWidget(QWidget* parent) : QWidget(parent) {
setMouseTracking(true); setMouseTracking(true);
} }
KeyboardWidget::~KeyboardWidget() = default;
std::pair<int, int> KeyboardWidget::_getOctaveAndKey(QMouseEvent* event) const { std::pair<int, int> KeyboardWidget::_getOctaveAndKey(QMouseEvent* event) const {
for (KeyboardOctave* oct : m_widgets) { for (KeyboardOctave* oct : m_widgets) {
QPoint localPos = oct->mapFromParent(event->pos()); QPoint localPos = oct->mapFromParent(event->pos());
@ -144,6 +150,8 @@ void KeyboardWidget::showEvent(QShowEvent* event) {
KeyboardSlider::KeyboardSlider(QWidget* parent) : QSlider(parent) {} KeyboardSlider::KeyboardSlider(QWidget* parent) : QSlider(parent) {}
KeyboardSlider::~KeyboardSlider() = default;
void KeyboardSlider::enterEvent(QEvent* event) { void KeyboardSlider::enterEvent(QEvent* event) {
if (m_statusFocus) if (m_statusFocus)
m_statusFocus->enter(); m_statusFocus->enter();

View File

@ -1,11 +1,10 @@
#pragma once #pragma once
#include <QWidget>
#include <QSvgWidget>
#include <QSlider> #include <QSlider>
#include <QString>
#include <QSvgWidget>
#include <QWheelEvent> #include <QWheelEvent>
#include "StatusBarWidget.hpp" #include <QWidget>
#include "Common.hpp"
extern const QString NaturalKeyNames[7]; extern const QString NaturalKeyNames[7];
extern const QString SharpKeyNames[5]; extern const QString SharpKeyNames[5];
@ -14,6 +13,7 @@ extern const int NaturalKeyNumbers[7];
extern const int SharpKeyNumbers[5]; extern const int SharpKeyNumbers[5];
class KeyboardWidget; class KeyboardWidget;
class StatusBarFocus;
class KeyboardOctave : public QSvgWidget { class KeyboardOctave : public QSvgWidget {
Q_OBJECT Q_OBJECT
@ -45,6 +45,8 @@ class KeyboardWidget : public QWidget {
public: public:
explicit KeyboardWidget(QWidget* parent = Q_NULLPTR); explicit KeyboardWidget(QWidget* parent = Q_NULLPTR);
~KeyboardWidget() override;
void setStatusFocus(StatusBarFocus* statusFocus) { m_statusFocus = statusFocus; } void setStatusFocus(StatusBarFocus* statusFocus) { m_statusFocus = statusFocus; }
void mouseMoveEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override;
@ -68,6 +70,8 @@ protected:
public: public:
explicit KeyboardSlider(QWidget* parent = Q_NULLPTR); explicit KeyboardSlider(QWidget* parent = Q_NULLPTR);
~KeyboardSlider() override;
void enterEvent(QEvent* event) override; void enterEvent(QEvent* event) override;
void leaveEvent(QEvent* event) override; void leaveEvent(QEvent* event) override;
void setStatusFocus(StatusBarFocus* statusFocus); void setStatusFocus(StatusBarFocus* statusFocus);

View File

@ -2,8 +2,11 @@
#include <array> #include <array>
#include <QCheckBox>
#include <QPainter> #include <QPainter>
#include <QScrollArea>
#include <QScrollBar> #include <QScrollBar>
#include <QSpinBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "KeyboardWidget.hpp" #include "KeyboardWidget.hpp"
@ -182,6 +185,8 @@ KeymapView::KeymapView(QWidget* parent)
m_widgetToSvg = RectToRect(QRect(0, 0, 280, 200), m_octaveRenderer.viewBoxF()); m_widgetToSvg = RectToRect(QRect(0, 0, 280, 200), m_octaveRenderer.viewBoxF());
} }
KeymapView::~KeymapView() = default;
KeymapEditor* KeymapControls::getEditor() const { return qobject_cast<KeymapEditor*>(parentWidget()); } KeymapEditor* KeymapControls::getEditor() const { return qobject_cast<KeymapEditor*>(parentWidget()); }
void KeymapControls::setPaintIdx(int idx) { void KeymapControls::setPaintIdx(int idx) {
@ -356,6 +361,8 @@ KeymapControls::KeymapControls(QWidget* parent) : QFrame(parent) {
setLayout(mainLayout); setLayout(mainLayout);
} }
KeymapControls::~KeymapControls() = default;
void KeymapEditor::_touch() { void KeymapEditor::_touch() {
if (m_controlKeymap.macro.id == 0xffff) if (m_controlKeymap.macro.id == 0xffff)
m_controls->setPaintIdx(-1); m_controls->setPaintIdx(-1);
@ -514,3 +521,5 @@ KeymapEditor::KeymapEditor(QWidget* parent)
layout->addWidget(m_controls); layout->addWidget(m_controls);
setLayout(layout); setLayout(layout);
} }
KeymapEditor::~KeymapEditor() = default;

View File

@ -1,20 +1,25 @@
#pragma once #pragma once
#include "EditorWidget.hpp"
#include <array> #include <array>
#include <bitset> #include <bitset>
#include <cstdint>
#include <unordered_map>
#include <QCheckBox>
#include <QFrame> #include <QFrame>
#include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QScrollArea>
#include <QStaticText> #include <QStaticText>
#include <QSpinBox>
#include <QSvgRenderer> #include <QSvgRenderer>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/AudioGroupPool.hpp>
#include <amuse/Common.hpp>
class KeymapEditor; class KeymapEditor;
class QCheckBox;
class QScrollArea;
class QSpinBox;
class PaintButton : public QPushButton { class PaintButton : public QPushButton {
Q_OBJECT Q_OBJECT
@ -48,6 +53,8 @@ class KeymapView : public QWidget {
public: public:
explicit KeymapView(QWidget* parent = Q_NULLPTR); explicit KeymapView(QWidget* parent = Q_NULLPTR);
~KeymapView() override;
void loadData(ProjectModel::KeymapNode* node); void loadData(ProjectModel::KeymapNode* node);
void unloadData(); void unloadData();
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
@ -75,8 +82,11 @@ class KeymapControls : public QFrame {
public: public:
explicit KeymapControls(QWidget* parent = Q_NULLPTR); explicit KeymapControls(QWidget* parent = Q_NULLPTR);
~KeymapControls() override;
void loadData(ProjectModel::KeymapNode* node); void loadData(ProjectModel::KeymapNode* node);
void unloadData(); void unloadData();
public slots: public slots:
void controlChanged(); void controlChanged();
void paintButtonPressed(); void paintButtonPressed();
@ -103,6 +113,8 @@ class KeymapEditor : public EditorWidget {
public: public:
explicit KeymapEditor(QWidget* parent = Q_NULLPTR); explicit KeymapEditor(QWidget* parent = Q_NULLPTR);
~KeymapEditor() override;
bool loadData(ProjectModel::KeymapNode* node); bool loadData(ProjectModel::KeymapNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;

View File

@ -100,6 +100,8 @@ public:
SoundMacroDelegate::SoundMacroDelegate(QObject* parent) : BaseObjectDelegate(parent) {} SoundMacroDelegate::SoundMacroDelegate(QObject* parent) : BaseObjectDelegate(parent) {}
SoundMacroDelegate::~SoundMacroDelegate() = default;
ProjectModel::INode* SoundMacroDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const { ProjectModel::INode* SoundMacroDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const {
const LayersModel* model = static_cast<const LayersModel*>(__model); const LayersModel* model = static_cast<const LayersModel*>(__model);
const amuse::LayerMapping& layer = (*model->m_node->m_obj)[index.row()]; const amuse::LayerMapping& layer = (*model->m_node->m_obj)[index.row()];
@ -507,6 +509,8 @@ amuse::LayerMapping LayersModel::_removeRow(int row) {
LayersModel::LayersModel(QObject* parent) : QAbstractTableModel(parent) {} LayersModel::LayersModel(QObject* parent) : QAbstractTableModel(parent) {}
LayersModel::~LayersModel() = default;
void LayersTableView::deleteSelection() { void LayersTableView::deleteSelection() {
const QModelIndexList list = selectionModel()->selectedRows(); const QModelIndexList list = selectionModel()->selectedRows();
if (list.isEmpty()) { if (list.isEmpty()) {
@ -566,6 +570,8 @@ LayersTableView::LayersTableView(QWidget* parent) : QTableView(parent) {
setItemDelegateForColumn(7, &m_unsignedDelegate); setItemDelegateForColumn(7, &m_unsignedDelegate);
} }
LayersTableView::~LayersTableView() = default;
bool LayersEditor::loadData(ProjectModel::LayersNode* node) { bool LayersEditor::loadData(ProjectModel::LayersNode* node) {
m_model.loadData(node); m_model.loadData(node);
return true; return true;
@ -626,3 +632,5 @@ LayersEditor::LayersEditor(QWidget* parent)
m_addRemoveButtons.removeAction()->setToolTip(tr("Remove selected layer mappings")); m_addRemoveButtons.removeAction()->setToolTip(tr("Remove selected layer mappings"));
connect(m_addRemoveButtons.removeAction(), &QAction::triggered, this, &LayersEditor::itemDeleteAction); connect(m_addRemoveButtons.removeAction(), &QAction::triggered, this, &LayersEditor::itemDeleteAction);
} }
LayersEditor::~LayersEditor() = default;

View File

@ -1,11 +1,15 @@
#pragma once #pragma once
#include "EditorWidget.hpp"
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QTableView>
#include <QAction> #include <QAction>
#include <QToolButton>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QTableView>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/AudioGroupPool.hpp>
#include <amuse/Common.hpp>
class SoundMacroDelegate : public BaseObjectDelegate { class SoundMacroDelegate : public BaseObjectDelegate {
Q_OBJECT Q_OBJECT
@ -14,9 +18,12 @@ protected:
public: public:
explicit SoundMacroDelegate(QObject* parent = Q_NULLPTR); explicit SoundMacroDelegate(QObject* parent = Q_NULLPTR);
~SoundMacroDelegate() override;
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
private slots: private slots:
void smIndexChanged(); void smIndexChanged();
}; };
@ -30,6 +37,8 @@ class LayersModel : public QAbstractTableModel {
public: public:
explicit LayersModel(QObject* parent = Q_NULLPTR); explicit LayersModel(QObject* parent = Q_NULLPTR);
~LayersModel() override;
void loadData(ProjectModel::LayersNode* node); void loadData(ProjectModel::LayersNode* node);
void unloadData(); void unloadData();
@ -62,6 +71,8 @@ class LayersTableView : public QTableView {
public: public:
explicit LayersTableView(QWidget* parent = Q_NULLPTR); explicit LayersTableView(QWidget* parent = Q_NULLPTR);
~LayersTableView() override;
void setModel(QAbstractItemModel* model) override; void setModel(QAbstractItemModel* model) override;
void deleteSelection(); void deleteSelection();
}; };
@ -75,11 +86,14 @@ class LayersEditor : public EditorWidget {
public: public:
explicit LayersEditor(QWidget* parent = Q_NULLPTR); explicit LayersEditor(QWidget* parent = Q_NULLPTR);
~LayersEditor() override;
bool loadData(ProjectModel::LayersNode* node); bool loadData(ProjectModel::LayersNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;
void resizeEvent(QResizeEvent* ev) override; void resizeEvent(QResizeEvent* ev) override;
AmuseItemEditFlags itemEditFlags() const override; AmuseItemEditFlags itemEditFlags() const override;
private slots: private slots:
void rowsInserted(const QModelIndex& parent, int first, int last); void rowsInserted(const QModelIndex& parent, int first, int last);
void rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row); void rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);

View File

@ -1,6 +1,9 @@
#include "MIDIReader.hpp" #include "MIDIReader.hpp"
#include "MainWindow.hpp" #include "MainWindow.hpp"
#include <amuse/Engine.hpp>
MIDIReader::MIDIReader(amuse::Engine& engine, bool useLock) : amuse::BooBackendMIDIReader(engine, useLock) {} MIDIReader::MIDIReader(amuse::Engine& engine, bool useLock) : amuse::BooBackendMIDIReader(engine, useLock) {}
void MIDIReader::noteOff(uint8_t chan, uint8_t key, uint8_t velocity) { void MIDIReader::noteOff(uint8_t chan, uint8_t key, uint8_t velocity) {

View File

@ -1,10 +1,18 @@
#pragma once #pragma once
#include "amuse/Voice.hpp" #include <cstdint>
#include "amuse/BooBackend.hpp" #include <memory>
#include "amuse/Common.hpp" #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <amuse/BooBackend.hpp>
#include <amuse/Common.hpp>
#include <amuse/Voice.hpp>
namespace amuse {
class Engine;
}
class MIDIReader : public amuse::BooBackendMIDIReader { class MIDIReader : public amuse::BooBackendMIDIReader {
std::unordered_map<uint8_t, amuse::ObjToken<amuse::Voice>> m_chanVoxs; std::unordered_map<uint8_t, amuse::ObjToken<amuse::Voice>> m_chanVoxs;
std::unordered_set<amuse::ObjToken<amuse::Voice>> m_keyoffVoxs; std::unordered_set<amuse::ObjToken<amuse::Voice>> m_keyoffVoxs;

View File

@ -1,24 +1,33 @@
#include "MainWindow.hpp" #include "MainWindow.hpp"
#include <QFileDialog>
#include <QMessageBox>
#include <QLineEdit>
#include <QInputDialog>
#include <QProgressDialog>
#include <QMouseEvent>
#include <QClipboard> #include <QClipboard>
#include <QFileDialog>
#include <QInputDialog>
#include <QLineEdit>
#include <QMessageBox>
#include <QMouseEvent>
#include <QProgressDialog>
#include <QtSvg/QtSvg> #include <QtSvg/QtSvg>
#include "amuse/ContainerRegistry.hpp" #include <QUndoStack>
#include "ADSREditor.hpp"
#include "Common.hpp" #include "Common.hpp"
#include "CurveEditor.hpp"
#include "KeymapEditor.hpp"
#include "LayersEditor.hpp"
#include "MIDIReader.hpp"
#include "NewSoundMacroDialog.hpp"
#include "SampleEditor.hpp"
#include "SongGroupEditor.hpp" #include "SongGroupEditor.hpp"
#include "SoundGroupEditor.hpp" #include "SoundGroupEditor.hpp"
#include "SoundGroupEditor.hpp" #include "SoundGroupEditor.hpp"
#include "SoundMacroEditor.hpp" #include "SoundMacroEditor.hpp"
#include "ADSREditor.hpp" #include "StudioSetupWidget.hpp"
#include "CurveEditor.hpp"
#include "KeymapEditor.hpp" #include <amuse/BooBackend.hpp>
#include "LayersEditor.hpp" #include <amuse/ContainerRegistry.hpp>
#include "SampleEditor.hpp" #include <amuse/Engine.hpp>
#include "NewSoundMacroDialog.hpp" #include <boo/audiodev/IAudioVoiceEngine.hpp>
MainWindow::MainWindow(QWidget* parent) MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent) : QMainWindow(parent)

View File

@ -1,37 +1,53 @@
#pragma once #pragma once
#include <QMainWindow> #include <cstdint>
#include <QUndoStack> #include <functional>
#include <QProgressDialog> #include <memory>
#include <QThread>
#include <QStyledItemDelegate>
#include <QSortFilterProxyModel>
#include <QLinkedList>
#include <QFileDialog> #include <QFileDialog>
#include "ui_MainWindow.h" #include <QLinkedList>
#include "amuse/Engine.hpp" #include <QMainWindow>
#include "amuse/BooBackend.hpp" #include <QMessageBox>
#include "boo/audiodev/IAudioVoiceEngine.hpp" #include <QStyledItemDelegate>
#include "ProjectModel.hpp" #include <QThread>
#include "EditorWidget.hpp" #include "EditorWidget.hpp"
#include "MIDIReader.hpp" #include "ProjectModel.hpp"
#include "StudioSetupWidget.hpp"
#include "ui_MainWindow.h"
#include <amuse/Common.hpp>
#include <amuse/Sequencer.hpp>
#include <amuse/Voice.hpp>
#define MaxRecentFiles 4 #define MaxRecentFiles 4
namespace amuse {
class Engine;
}
namespace boo {
struct IAudioVoiceEngine;
}
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
class MainWindow;
class SongGroupEditor;
class SoundGroupEditor;
class SoundMacroEditor;
class ADSREditor; class ADSREditor;
class CurveEditor; class CurveEditor;
class KeymapEditor; class KeymapEditor;
class LayersEditor; class LayersEditor;
class MainWindow;
class SampleEditor; class SampleEditor;
class SongGroupEditor;
class SoundGroupEditor;
class SoundMacroEditor;
class StudioSetupWidget;
class VoiceAllocator;
class QProgressDialog;
class QUndoStack;
enum BackgroundTaskId { TaskOpen, TaskImport, TaskExport, TaskReloadSamples }; enum BackgroundTaskId { TaskOpen, TaskImport, TaskExport, TaskReloadSamples };

View File

@ -155,3 +155,5 @@ NewSoundMacroDialog::NewSoundMacroDialog(const QString& groupName, QWidget* pare
setLayout(layout); setLayout(layout);
} }
NewSoundMacroDialog::~NewSoundMacroDialog() = default;

View File

@ -1,9 +1,12 @@
#pragma once #pragma once
#include <QDialog> #include <cstddef>
#include <QLineEdit> #include <cstdint>
#include <QComboBox> #include <QComboBox>
#include <QDialog>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLineEdit>
struct SoundMacroTemplateEntry { struct SoundMacroTemplateEntry {
const char* m_name; const char* m_name;
@ -19,6 +22,8 @@ class NewSoundMacroDialog : public QDialog {
public: public:
explicit NewSoundMacroDialog(const QString& groupName, QWidget* parent = Q_NULLPTR); explicit NewSoundMacroDialog(const QString& groupName, QWidget* parent = Q_NULLPTR);
~NewSoundMacroDialog() override;
QString getName() const { return m_le.text(); } QString getName() const { return m_le.text(); }
const SoundMacroTemplateEntry* getSelectedTemplate() const; const SoundMacroTemplateEntry* getSelectedTemplate() const;
}; };

View File

@ -1,11 +1,15 @@
#include "SampleEditor.hpp" #include "SampleEditor.hpp"
#include "MainWindow.hpp"
#include "amuse/DSPCodec.hpp"
#include <QPainter>
#include <QPaintEvent>
#include <QSpinBox>
#include <QScrollBar>
#include <QCheckBox> #include <QCheckBox>
#include <QPaintEvent>
#include <QPainter>
#include <QScrollArea>
#include <QScrollBar>
#include <QSpinBox>
#include "MainWindow.hpp"
#include <amuse/DSPCodec.hpp>
SampleEditor* SampleView::getEditor() const { SampleEditor* SampleView::getEditor() const {
return qobject_cast<SampleEditor*>(parentWidget()->parentWidget()->parentWidget()); return qobject_cast<SampleEditor*>(parentWidget()->parentWidget()->parentWidget());
@ -389,6 +393,8 @@ SampleView::SampleView(QWidget* parent) : QWidget(parent) {
m_rulerFont.setPointSize(8); m_rulerFont.setPointSize(8);
} }
SampleView::~SampleView() = default;
void SampleControls::zoomSliderChanged(int val) { void SampleControls::zoomSliderChanged(int val) {
SampleEditor* editor = qobject_cast<SampleEditor*>(parentWidget()); SampleEditor* editor = qobject_cast<SampleEditor*>(parentWidget());
editor->m_sampleView->setZoom(val); editor->m_sampleView->setZoom(val);
@ -740,6 +746,8 @@ SampleControls::SampleControls(QWidget* parent) : QFrame(parent) {
setLayout(mainLayout); setLayout(mainLayout);
} }
SampleControls::~SampleControls() = default;
bool SampleEditor::loadData(ProjectModel::SampleNode* node) { bool SampleEditor::loadData(ProjectModel::SampleNode* node) {
m_controls->loadData(m_sampleView->loadData(node)); m_controls->loadData(m_sampleView->loadData(node));
return true; return true;
@ -770,3 +778,5 @@ SampleEditor::SampleEditor(QWidget* parent)
layout->addWidget(m_controls); layout->addWidget(m_controls);
setLayout(layout); setLayout(layout);
} }
SampleEditor::~SampleEditor() = default;

View File

@ -1,14 +1,25 @@
#pragma once #pragma once
#include <cstdint>
#include <utility>
#include <QFont>
#include <QWidget>
#include "EditorWidget.hpp" #include "EditorWidget.hpp"
#include "ProjectModel.hpp" #include "ProjectModel.hpp"
#include <QScrollArea>
#include <QSlider> #include <amuse/AudioGroupPool.hpp>
#include <QCheckBox> #include <amuse/AudioGroupSampleDirectory.hpp>
#include <QSpinBox> #include <amuse/Common.hpp>
class SampleEditor; class SampleEditor;
class QCheckBox;
class QPushButton;
class QScrollArea;
class QSlider;
class SampleView : public QWidget { class SampleView : public QWidget {
Q_OBJECT Q_OBJECT
friend class SampleControls; friend class SampleControls;
@ -33,6 +44,8 @@ class SampleView : public QWidget {
public: public:
explicit SampleView(QWidget* parent = Q_NULLPTR); explicit SampleView(QWidget* parent = Q_NULLPTR);
~SampleView() override;
bool loadData(ProjectModel::SampleNode* node); bool loadData(ProjectModel::SampleNode* node);
void unloadData(); void unloadData();
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
@ -67,6 +80,8 @@ class SampleControls : public QFrame {
public: public:
explicit SampleControls(QWidget* parent = Q_NULLPTR); explicit SampleControls(QWidget* parent = Q_NULLPTR);
~SampleControls() override;
void doFileWrite(); void doFileWrite();
void setFileWrite(bool w); void setFileWrite(bool w);
void updateFileState(); void updateFileState();
@ -74,6 +89,7 @@ public:
void setLoopEndSample(int sample) { m_loopEnd->setValue(sample); } void setLoopEndSample(int sample) { m_loopEnd->setValue(sample); }
void loadData(bool reset); void loadData(bool reset);
void unloadData(); void unloadData();
public slots: public slots:
void zoomSliderChanged(int val); void zoomSliderChanged(int val);
void loopStateChanged(int state); void loopStateChanged(int state);
@ -97,6 +113,8 @@ class SampleEditor : public EditorWidget {
public: public:
explicit SampleEditor(QWidget* parent = Q_NULLPTR); explicit SampleEditor(QWidget* parent = Q_NULLPTR);
~SampleEditor() override;
bool loadData(ProjectModel::SampleNode* node); bool loadData(ProjectModel::SampleNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;

View File

@ -248,6 +248,8 @@ public:
PageObjectDelegate::PageObjectDelegate(QObject* parent) : BaseObjectDelegate(parent) {} PageObjectDelegate::PageObjectDelegate(QObject* parent) : BaseObjectDelegate(parent) {}
PageObjectDelegate::~PageObjectDelegate() = default;
ProjectModel::INode* PageObjectDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const { ProjectModel::INode* PageObjectDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const {
const PageModel* model = static_cast<const PageModel*>(__model); const PageModel* model = static_cast<const PageModel*>(__model);
auto entry = model->m_sorted[index.row()]; auto entry = model->m_sorted[index.row()];
@ -329,6 +331,8 @@ MIDIFileFieldWidget::MIDIFileFieldWidget(QWidget* parent)
m_dialog.setAcceptMode(QFileDialog::AcceptOpen); m_dialog.setAcceptMode(QFileDialog::AcceptOpen);
} }
MIDIFileFieldWidget::~MIDIFileFieldWidget() = default;
QWidget* MIDIFileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, QWidget* MIDIFileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index) const { const QModelIndex& index) const {
MIDIFileFieldWidget* field = new MIDIFileFieldWidget(parent); MIDIFileFieldWidget* field = new MIDIFileFieldWidget(parent);
@ -507,6 +511,8 @@ MIDIFileDelegate::MIDIFileDelegate(SetupTableView* parent)
, m_fileDialogMid(parent, tr("Export MIDI"), {}, tr("MIDI(*.mid)")) , m_fileDialogMid(parent, tr("Export MIDI"), {}, tr("MIDI(*.mid)"))
, m_fileDialogSng(parent, tr("Export Song"), {}, tr("Song(*.sng)")) {} , m_fileDialogSng(parent, tr("Export Song"), {}, tr("Song(*.sng)")) {}
MIDIFileDelegate::~MIDIFileDelegate() = default;
std::unordered_map<uint8_t, amuse::SongGroupIndex::PageEntry>& PageModel::_getMap() const { std::unordered_map<uint8_t, amuse::SongGroupIndex::PageEntry>& PageModel::_getMap() const {
return m_drum ? m_node->m_index->m_drumPages : m_node->m_index->m_normPages; return m_drum ? m_node->m_index->m_drumPages : m_node->m_index->m_normPages;
} }
@ -769,6 +775,8 @@ std::pair<uint8_t, amuse::SongGroupIndex::PageEntry> PageModel::_removeRow(uint8
PageModel::PageModel(bool drum, QObject* parent) : QAbstractTableModel(parent), m_drum(drum) {} PageModel::PageModel(bool drum, QObject* parent) : QAbstractTableModel(parent), m_drum(drum) {}
PageModel::~PageModel() = default;
std::unordered_map<amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>& SetupListModel::_getMap() const { std::unordered_map<amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>& SetupListModel::_getMap() const {
return m_node->m_index->m_midiSetups; return m_node->m_index->m_midiSetups;
} }
@ -1024,6 +1032,8 @@ SetupListModel::_removeRow(amuse::SongId id) {
SetupListModel::SetupListModel(QObject* parent) : QAbstractTableModel(parent) {} SetupListModel::SetupListModel(QObject* parent) : QAbstractTableModel(parent) {}
SetupListModel::~SetupListModel() = default;
void SetupModel::loadData(std::pair<const amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>* data) { void SetupModel::loadData(std::pair<const amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>* data) {
beginResetModel(); beginResetModel();
m_data = data; m_data = data;
@ -1151,6 +1161,8 @@ Qt::ItemFlags SetupModel::flags(const QModelIndex& index) const { return Qt::Ite
SetupModel::SetupModel(QObject* parent) : QAbstractTableModel(parent) {} SetupModel::SetupModel(QObject* parent) : QAbstractTableModel(parent) {}
SetupModel::~SetupModel() = default;
void PageTableView::deleteSelection() { void PageTableView::deleteSelection() {
const QModelIndexList list = selectionModel()->selectedRows(); const QModelIndexList list = selectionModel()->selectedRows();
if (list.isEmpty()) { if (list.isEmpty()) {
@ -1196,6 +1208,8 @@ PageTableView::PageTableView(QWidget* parent) : QTableView(parent) {
setItemDelegateForColumn(3, &m_255Delegate); setItemDelegateForColumn(3, &m_255Delegate);
} }
PageTableView::~PageTableView() = default;
void SetupTableView::setModel(QAbstractItemModel* list, QAbstractItemModel* table) { void SetupTableView::setModel(QAbstractItemModel* list, QAbstractItemModel* table) {
{ {
m_listView->setModel(list); m_listView->setModel(list);
@ -1256,6 +1270,8 @@ SetupTableView::SetupTableView(QWidget* parent)
m_tableView->setItemDelegateForColumn(4, &m_127Delegate); m_tableView->setItemDelegateForColumn(4, &m_127Delegate);
} }
SetupTableView::~SetupTableView() = default;
void ColoredTabBarStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter, void ColoredTabBarStyle::drawControl(QStyle::ControlElement element, const QStyleOption* option, QPainter* painter,
const QWidget* widget) const { const QWidget* widget) const {
if (qobject_cast<const ColoredTabBar*>(widget) && element == QStyle::CE_TabBarTab) { if (qobject_cast<const ColoredTabBar*>(widget) && element == QStyle::CE_TabBarTab) {
@ -1591,3 +1607,5 @@ SongGroupEditor::SongGroupEditor(QWidget* parent)
m_tabs.setCurrentIndex(0); m_tabs.setCurrentIndex(0);
} }
SongGroupEditor::~SongGroupEditor() = default;

View File

@ -1,18 +1,29 @@
#pragma once #pragma once
#include "EditorWidget.hpp" #include <array>
#include <cstdint>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include <QFileDialog>
#include <QLineEdit>
#include <QProxyStyle>
#include <QPushButton>
#include <QSplitter>
#include <QStyledItemDelegate>
#include <QTabWidget> #include <QTabWidget>
#include <QAbstractTableModel>
#include <QTableView> #include <QTableView>
#include <QToolButton> #include <QToolButton>
#include <QAction>
#include <QSplitter> #include "EditorWidget.hpp"
#include <QListView> #include "ProjectModel.hpp"
#include <QLineEdit>
#include <QPushButton> #include <amuse/AudioGroupProject.hpp>
#include <QFileDialog> #include <amuse/Common.hpp>
#include <QProxyStyle> #include <amuse/Sequencer.hpp>
#include "amuse/Sequencer.hpp"
class SetupTableView; class SetupTableView;
@ -23,9 +34,12 @@ protected:
public: public:
explicit PageObjectDelegate(QObject* parent = Q_NULLPTR); explicit PageObjectDelegate(QObject* parent = Q_NULLPTR);
~PageObjectDelegate() override;
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
private slots: private slots:
void objIndexChanged(); void objIndexChanged();
}; };
@ -38,11 +52,15 @@ class MIDIFileFieldWidget : public QWidget {
public: public:
explicit MIDIFileFieldWidget(QWidget* parent = Q_NULLPTR); explicit MIDIFileFieldWidget(QWidget* parent = Q_NULLPTR);
~MIDIFileFieldWidget() override;
QString path() const { return m_le.text(); } QString path() const { return m_le.text(); }
void setPath(const QString& path) { m_le.setText(path); } void setPath(const QString& path) { m_le.setText(path); }
public slots: public slots:
void buttonPressed(); void buttonPressed();
void fileDialogOpened(const QString& path); void fileDialogOpened(const QString& path);
signals: signals:
void pathChanged(); void pathChanged();
}; };
@ -54,17 +72,21 @@ class MIDIFileDelegate : public QStyledItemDelegate {
public: public:
explicit MIDIFileDelegate(SetupTableView* parent = Q_NULLPTR); explicit MIDIFileDelegate(SetupTableView* parent = Q_NULLPTR);
~MIDIFileDelegate() override;
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void destroyEditor(QWidget* editor, const QModelIndex& index) const override; void destroyEditor(QWidget* editor, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,
const QModelIndex& index) override; const QModelIndex& index) override;
private slots: private slots:
void doExportMIDI(); void doExportMIDI();
void _doExportMIDI(const QString& path); void _doExportMIDI(const QString& path);
void doExportSNG(); void doExportSNG();
void _doExportSNG(const QString& path); void _doExportSNG(const QString& path);
public slots: public slots:
void pathChanged(); void pathChanged();
}; };
@ -92,6 +114,8 @@ class PageModel : public QAbstractTableModel {
public: public:
explicit PageModel(bool drum, QObject* parent = Q_NULLPTR); explicit PageModel(bool drum, QObject* parent = Q_NULLPTR);
~PageModel() override;
void loadData(ProjectModel::SongGroupNode* node); void loadData(ProjectModel::SongGroupNode* node);
void unloadData(); void unloadData();
@ -138,6 +162,8 @@ class SetupListModel : public QAbstractTableModel {
public: public:
explicit SetupListModel(QObject* parent = Q_NULLPTR); explicit SetupListModel(QObject* parent = Q_NULLPTR);
~SetupListModel() override;
void loadData(ProjectModel::SongGroupNode* node); void loadData(ProjectModel::SongGroupNode* node);
void unloadData(); void unloadData();
@ -159,6 +185,8 @@ class SetupModel : public QAbstractTableModel {
public: public:
explicit SetupModel(QObject* parent = Q_NULLPTR); explicit SetupModel(QObject* parent = Q_NULLPTR);
~SetupModel() override;
void loadData(std::pair<const amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>* data); void loadData(std::pair<const amuse::SongId, std::array<amuse::SongGroupIndex::MIDISetup, 16>>* data);
void unloadData(); void unloadData();
@ -180,6 +208,8 @@ class PageTableView : public QTableView {
public: public:
explicit PageTableView(QWidget* parent = Q_NULLPTR); explicit PageTableView(QWidget* parent = Q_NULLPTR);
~PageTableView() override;
void setModel(QAbstractItemModel* model) override; void setModel(QAbstractItemModel* model) override;
void deleteSelection(); void deleteSelection();
}; };
@ -197,6 +227,8 @@ class SetupTableView : public QSplitter {
public: public:
explicit SetupTableView(QWidget* parent = Q_NULLPTR); explicit SetupTableView(QWidget* parent = Q_NULLPTR);
~SetupTableView() override;
void setModel(QAbstractItemModel* list, QAbstractItemModel* table); void setModel(QAbstractItemModel* list, QAbstractItemModel* table);
void deleteSelection(); void deleteSelection();
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;
@ -264,6 +296,8 @@ class SongGroupEditor : public EditorWidget {
public: public:
explicit SongGroupEditor(QWidget* parent = Q_NULLPTR); explicit SongGroupEditor(QWidget* parent = Q_NULLPTR);
~SongGroupEditor() override;
bool loadData(ProjectModel::SongGroupNode* node); bool loadData(ProjectModel::SongGroupNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;
@ -271,6 +305,7 @@ public:
void resizeEvent(QResizeEvent* ev) override; void resizeEvent(QResizeEvent* ev) override;
QTableView* getSetupListView() const { return m_setupTable->m_listView; } QTableView* getSetupListView() const { return m_setupTable->m_listView; }
AmuseItemEditFlags itemEditFlags() const override; AmuseItemEditFlags itemEditFlags() const override;
private slots: private slots:
void doAdd(); void doAdd();
void doSelectionChanged(); void doSelectionChanged();

View File

@ -115,6 +115,8 @@ public:
SFXObjectDelegate::SFXObjectDelegate(QObject* parent) : BaseObjectDelegate(parent) {} SFXObjectDelegate::SFXObjectDelegate(QObject* parent) : BaseObjectDelegate(parent) {}
SFXObjectDelegate::~SFXObjectDelegate() = default;
ProjectModel::INode* SFXObjectDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const { ProjectModel::INode* SFXObjectDelegate::getNode(const QAbstractItemModel* __model, const QModelIndex& index) const {
const SFXModel* model = static_cast<const SFXModel*>(__model); const SFXModel* model = static_cast<const SFXModel*>(__model);
auto entry = model->m_sorted[index.row()]; auto entry = model->m_sorted[index.row()];
@ -458,6 +460,8 @@ std::tuple<amuse::SFXId, std::string, amuse::SFXGroupIndex::SFXEntry> SFXModel::
SFXModel::SFXModel(QObject* parent) : QAbstractTableModel(parent) {} SFXModel::SFXModel(QObject* parent) : QAbstractTableModel(parent) {}
SFXModel::~SFXModel() = default;
void SFXTableView::deleteSelection() { void SFXTableView::deleteSelection() {
QModelIndexList list = selectionModel()->selectedRows(); QModelIndexList list = selectionModel()->selectedRows();
if (list.isEmpty()) if (list.isEmpty())
@ -507,6 +511,8 @@ SFXTableView::SFXTableView(QWidget* parent) : QTableView(parent) {
setItemDelegateForColumn(6, &m_127Delegate); setItemDelegateForColumn(6, &m_127Delegate);
} }
SFXTableView::~SFXTableView() = default;
void SFXPlayerWidget::clicked() { void SFXPlayerWidget::clicked() {
if (!m_vox) { if (!m_vox) {
m_vox = g_MainWindow->startSFX(m_groupId, m_sfxId); m_vox = g_MainWindow->startSFX(m_groupId, m_sfxId);
@ -634,3 +640,5 @@ SoundGroupEditor::SoundGroupEditor(QWidget* parent)
m_addRemoveButtons.removeAction()->setToolTip(tr("Remove selected SFX entries")); m_addRemoveButtons.removeAction()->setToolTip(tr("Remove selected SFX entries"));
connect(m_addRemoveButtons.removeAction(), &QAction::triggered, this, &SoundGroupEditor::itemDeleteAction); connect(m_addRemoveButtons.removeAction(), &QAction::triggered, this, &SoundGroupEditor::itemDeleteAction);
} }
SoundGroupEditor::~SoundGroupEditor() = default;

View File

@ -1,9 +1,20 @@
#pragma once #pragma once
#include "EditorWidget.hpp" #include <tuple>
#include <unordered_map>
#include <vector>
#include <QAction>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QTableView> #include <QTableView>
#include "amuse/Voice.hpp" #include <QToolButton>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/AudioGroupProject.hpp>
#include <amuse/Common.hpp>
#include <amuse/Voice.hpp>
class SFXObjectDelegate : public BaseObjectDelegate { class SFXObjectDelegate : public BaseObjectDelegate {
Q_OBJECT Q_OBJECT
@ -12,9 +23,12 @@ protected:
public: public:
explicit SFXObjectDelegate(QObject* parent = Q_NULLPTR); explicit SFXObjectDelegate(QObject* parent = Q_NULLPTR);
~SFXObjectDelegate() override;
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override; void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
private slots: private slots:
void objIndexChanged(); void objIndexChanged();
}; };
@ -50,6 +64,8 @@ class SFXModel : public QAbstractTableModel {
public: public:
explicit SFXModel(QObject* parent = Q_NULLPTR); explicit SFXModel(QObject* parent = Q_NULLPTR);
~SFXModel() override;
void loadData(ProjectModel::SoundGroupNode* node); void loadData(ProjectModel::SoundGroupNode* node);
void unloadData(); void unloadData();
@ -73,6 +89,8 @@ class SFXTableView : public QTableView {
public: public:
explicit SFXTableView(QWidget* parent = Q_NULLPTR); explicit SFXTableView(QWidget* parent = Q_NULLPTR);
~SFXTableView() override;
void setModel(QAbstractItemModel* model) override; void setModel(QAbstractItemModel* model) override;
void deleteSelection(); void deleteSelection();
}; };
@ -108,6 +126,8 @@ class SoundGroupEditor : public EditorWidget {
public: public:
explicit SoundGroupEditor(QWidget* parent = Q_NULLPTR); explicit SoundGroupEditor(QWidget* parent = Q_NULLPTR);
~SoundGroupEditor() override;
bool loadData(ProjectModel::SoundGroupNode* node); bool loadData(ProjectModel::SoundGroupNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;
@ -115,6 +135,7 @@ public:
void resizeEvent(QResizeEvent* ev) override; void resizeEvent(QResizeEvent* ev) override;
QTableView* getSFXListView() const { return m_sfxTable; } QTableView* getSFXListView() const { return m_sfxTable; }
AmuseItemEditFlags itemEditFlags() const override; AmuseItemEditFlags itemEditFlags() const override;
private slots: private slots:
void rowsInserted(const QModelIndex& parent, int first, int last); void rowsInserted(const QModelIndex& parent, int first, int last);
void rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row); void rowsMoved(const QModelIndex& parent, int start, int end, const QModelIndex& destination, int row);

View File

@ -1,14 +1,17 @@
#include "SoundMacroEditor.hpp" #include "SoundMacroEditor.hpp"
#include "MainWindow.hpp"
#include <QCheckBox>
#include <QGridLayout>
#include <QLayoutItem>
#include <QLineEdit>
#include <QPainter> #include <QPainter>
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QGridLayout>
#include <QLineEdit>
#include <QSplitter>
#include <QScrollArea> #include <QScrollArea>
#include <QScrollBar> #include <QScrollBar>
#include <QApplication> #include <QSplitter>
#include <QCheckBox> #include <QVBoxLayout>
#include "MainWindow.hpp"
TargetButton::TargetButton(QWidget* parent) : QPushButton(parent) { TargetButton::TargetButton(QWidget* parent) : QPushButton(parent) {
QIcon targetIcon(QStringLiteral(":/icons/IconSoundMacroTarget.svg")); QIcon targetIcon(QStringLiteral(":/icons/IconSoundMacroTarget.svg"));
@ -267,6 +270,8 @@ CommandWidget::CommandWidget(QWidget* parent, amuse::SoundMacro::ICmd* cmd, Soun
CommandWidget::CommandWidget(QWidget* parent, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing) CommandWidget::CommandWidget(QWidget* parent, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing)
: CommandWidget(parent, nullptr, op, listing) {} : CommandWidget(parent, nullptr, op, listing) {}
CommandWidget::~CommandWidget() = default;
class ValChangedUndoCommand : public EditorUndoCommand { class ValChangedUndoCommand : public EditorUndoCommand {
amuse::SoundMacro::ICmd* m_cmd; amuse::SoundMacro::ICmd* m_cmd;
const amuse::SoundMacro::CmdIntrospection::Field& m_field; const amuse::SoundMacro::CmdIntrospection::Field& m_field;
@ -500,6 +505,8 @@ CommandWidgetContainer::CommandWidgetContainer(QWidget* parent, _Args&&... args)
setLayout(outerLayout); setLayout(outerLayout);
} }
CommandWidgetContainer::~CommandWidgetContainer() = default;
void SoundMacroListing::startAutoscroll(QWidget* source, QMouseEvent* event, int delta) { void SoundMacroListing::startAutoscroll(QWidget* source, QMouseEvent* event, int delta) {
if (m_autoscrollTimer == -1) if (m_autoscrollTimer == -1)
m_autoscrollTimer = startTimer(50); m_autoscrollTimer = startTimer(50);
@ -781,6 +788,8 @@ SoundMacroListing::SoundMacroListing(QWidget* parent) : QWidget(parent), m_layou
reindex(); reindex();
} }
SoundMacroListing::~SoundMacroListing() = default;
CatalogueItem::CatalogueItem(amuse::SoundMacro::CmdOp op, const QString& name, const QString& doc, QWidget* parent) CatalogueItem::CatalogueItem(amuse::SoundMacro::CmdOp op, const QString& name, const QString& doc, QWidget* parent)
: QWidget(parent), m_op(op), m_label(name) { : QWidget(parent), m_op(op), m_label(name) {
QHBoxLayout* layout = new QHBoxLayout; QHBoxLayout* layout = new QHBoxLayout;
@ -809,6 +818,8 @@ CatalogueItem::CatalogueItem(const CatalogueItem& other, QWidget* parent) : QWid
setLayout(layout); setLayout(layout);
} }
CatalogueItem::~CatalogueItem() = default;
static const char* CategoryStrings[] = { static const char* CategoryStrings[] = {
QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Control"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Pitch"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Control"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Pitch"),
QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Sample"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Setup"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Sample"), QT_TRANSLATE_NOOP("SoundMacroCatalogue", "Setup"),
@ -1045,3 +1056,5 @@ SoundMacroEditor::SoundMacroEditor(QWidget* parent)
layout->addWidget(m_splitter); layout->addWidget(m_splitter);
setLayout(layout); setLayout(layout);
} }
SoundMacroEditor::~SoundMacroEditor() = default;

View File

@ -1,20 +1,25 @@
#pragma once #pragma once
#include "EditorWidget.hpp"
#include <QStaticText>
#include <QVBoxLayout>
#include <QPropertyAnimation>
#include <QSplitter>
#include <QLabel> #include <QLabel>
#include <QMouseEvent> #include <QMouseEvent>
#include <QSpinBox>
#include <QComboBox>
#include <QTreeWidget>
#include <QPushButton> #include <QPushButton>
#include <QStaticText>
#include <QTreeWidget>
#include "EditorWidget.hpp"
#include "ProjectModel.hpp"
#include <amuse/AudioGroupPool.hpp>
#include <amuse/Common.hpp>
class CatalogueItem;
class SoundMacroEditor; class SoundMacroEditor;
class SoundMacroListing; class SoundMacroListing;
class CatalogueItem;
class QLayoutItem;
class QPropertyAnimation;
class QSplitter;
class QVBoxLayout;
class TargetButton : public QPushButton { class TargetButton : public QPushButton {
Q_OBJECT Q_OBJECT
@ -72,6 +77,8 @@ private:
public: public:
CommandWidget(QWidget* parent, amuse::SoundMacro::ICmd* cmd, SoundMacroListing* listing); CommandWidget(QWidget* parent, amuse::SoundMacro::ICmd* cmd, SoundMacroListing* listing);
CommandWidget(QWidget* parent, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing); CommandWidget(QWidget* parent, amuse::SoundMacro::CmdOp op, SoundMacroListing* listing);
~CommandWidget() override;
void paintEvent(QPaintEvent* event) override; void paintEvent(QPaintEvent* event) override;
QString getText() const { return m_titleLabel.text(); } QString getText() const { return m_titleLabel.text(); }
}; };
@ -85,12 +92,14 @@ class CommandWidgetContainer : public QWidget {
void animateClosed(); void animateClosed();
void snapOpen(); void snapOpen();
void snapClosed(); void snapClosed();
private slots: private slots:
void animationDestroyed(); void animationDestroyed();
public: public:
template <class... _Args> template <class... _Args>
CommandWidgetContainer(QWidget* parent, _Args&&... args); CommandWidgetContainer(QWidget* parent, _Args&&... args);
~CommandWidgetContainer() override;
}; };
class SoundMacroListing : public QWidget { class SoundMacroListing : public QWidget {
@ -123,6 +132,8 @@ class SoundMacroListing : public QWidget {
public: public:
explicit SoundMacroListing(QWidget* parent = Q_NULLPTR); explicit SoundMacroListing(QWidget* parent = Q_NULLPTR);
~SoundMacroListing() override;
bool loadData(ProjectModel::SoundMacroNode* node); bool loadData(ProjectModel::SoundMacroNode* node);
void unloadData(); void unloadData();
ProjectModel::INode* currentNode() const; ProjectModel::INode* currentNode() const;
@ -139,6 +150,8 @@ public:
explicit CatalogueItem(amuse::SoundMacro::CmdOp op, const QString& name, const QString& doc, explicit CatalogueItem(amuse::SoundMacro::CmdOp op, const QString& name, const QString& doc,
QWidget* parent = Q_NULLPTR); QWidget* parent = Q_NULLPTR);
explicit CatalogueItem(const CatalogueItem& other, QWidget* parent = Q_NULLPTR); explicit CatalogueItem(const CatalogueItem& other, QWidget* parent = Q_NULLPTR);
~CatalogueItem() override;
amuse::SoundMacro::CmdOp getCmdOp() const { return m_op; } amuse::SoundMacro::CmdOp getCmdOp() const { return m_op; }
QString getText() const { return m_label.text(); } QString getText() const { return m_label.text(); }
}; };
@ -171,6 +184,8 @@ class SoundMacroEditor : public EditorWidget {
public: public:
explicit SoundMacroEditor(QWidget* parent = Q_NULLPTR); explicit SoundMacroEditor(QWidget* parent = Q_NULLPTR);
~SoundMacroEditor() override;
bool loadData(ProjectModel::SoundMacroNode* node); bool loadData(ProjectModel::SoundMacroNode* node);
void unloadData() override; void unloadData() override;
ProjectModel::INode* currentNode() const override; ProjectModel::INode* currentNode() const override;

View File

@ -49,6 +49,8 @@ StatusBarWidget::StatusBarWidget(QWidget* parent)
addPermanentWidget(&m_volumeSlider); addPermanentWidget(&m_volumeSlider);
} }
StatusBarWidget::~StatusBarWidget() = default;
void StatusBarWidget::setVoiceCount(int voices) { void StatusBarWidget::setVoiceCount(int voices) {
if (voices != m_cachedVoiceCount) { if (voices != m_cachedVoiceCount) {
m_voiceCount.setText(QString::number(voices)); m_voiceCount.setText(QString::number(voices));

View File

@ -1,11 +1,10 @@
#pragma once #pragma once
#include <QStatusBar>
#include <QLabel> #include <QLabel>
#include <QMouseEvent>
#include <QPushButton> #include <QPushButton>
#include <QSlider> #include <QSlider>
#include <QMouseEvent> #include <QStatusBar>
#include <cmath>
class StatusBarFocus; class StatusBarFocus;
@ -43,6 +42,8 @@ class StatusBarWidget : public QStatusBar {
public: public:
explicit StatusBarWidget(QWidget* parent = Q_NULLPTR); explicit StatusBarWidget(QWidget* parent = Q_NULLPTR);
~StatusBarWidget() override;
void setNormalMessage(const QString& message) { m_normalMessage.setText(message); } void setNormalMessage(const QString& message) { m_normalMessage.setText(message); }
void setVoiceCount(int voices); void setVoiceCount(int voices);

View File

@ -1,11 +1,17 @@
#include "StudioSetupWidget.hpp" #include "StudioSetupWidget.hpp"
#include "amuse/EffectChorus.hpp"
#include "amuse/EffectDelay.hpp" #include <QApplication>
#include "amuse/EffectReverb.hpp"
#include <QPainter> #include <QPainter>
#include <QScrollBar> #include <QScrollBar>
#include <QStylePainter> #include <QStylePainter>
#include <amuse/EffectBase.hpp>
#include <amuse/EffectChorus.hpp>
#include <amuse/EffectDelay.hpp>
#include <amuse/EffectReverb.hpp>
#include <amuse/Studio.hpp>
#include <amuse/Submix.hpp>
using namespace std::literals; using namespace std::literals;
static const EffectIntrospection ReverbStdIntrospective = { static const EffectIntrospection ReverbStdIntrospective = {
@ -159,6 +165,8 @@ Uint32X8Popup::Uint32X8Popup(int min, int max, QWidget* parent) : QFrame(parent,
setLayout(layout); setLayout(layout);
} }
Uint32X8Popup::~Uint32X8Popup() = default;
void Uint32X8Popup::setValue(int chanIdx, int val) { m_sliders[chanIdx]->setValue(val); } void Uint32X8Popup::setValue(int chanIdx, int val) { m_sliders[chanIdx]->setValue(val); }
void Uint32X8Popup::doValueChanged(int val) { void Uint32X8Popup::doValueChanged(int val) {
@ -172,6 +180,8 @@ Uint32X8Button::Uint32X8Button(int min, int max, QWidget* parent)
connect(this, &Uint32X8Button::pressed, this, &Uint32X8Button::onPressed); connect(this, &Uint32X8Button::pressed, this, &Uint32X8Button::onPressed);
} }
Uint32X8Button::~Uint32X8Button() = default;
void Uint32X8Button::paintEvent(QPaintEvent*) { void Uint32X8Button::paintEvent(QPaintEvent*) {
QStylePainter painter(this); QStylePainter painter(this);
painter.setPen(palette().color(QPalette::Text)); painter.setPen(palette().color(QPalette::Text));
@ -291,6 +301,8 @@ EffectWidget::EffectWidget(QWidget* parent, amuse::EffectBaseTypeless* effect, a
setLayout(mainLayout); setLayout(mainLayout);
} }
EffectWidget::~EffectWidget() = default;
void EffectWidget::paintEvent(QPaintEvent* event) { void EffectWidget::paintEvent(QPaintEvent* event) {
/* Rounded frame */ /* Rounded frame */
QPainter painter(this); QPainter painter(this);
@ -398,6 +410,8 @@ EffectWidgetContainer::EffectWidgetContainer(QWidget* parent, _Args&&... args)
setLayout(outerLayout); setLayout(outerLayout);
} }
EffectWidgetContainer::~EffectWidgetContainer() = default;
void EffectListing::startAutoscroll(QWidget* source, QMouseEvent* event, int delta) { void EffectListing::startAutoscroll(QWidget* source, QMouseEvent* event, int delta) {
if (m_autoscrollTimer == -1) if (m_autoscrollTimer == -1)
m_autoscrollTimer = startTimer(50); m_autoscrollTimer = startTimer(50);
@ -624,6 +638,8 @@ EffectListing::EffectListing(QWidget* parent) : QWidget(parent), m_layout(new QV
reindex(); reindex();
} }
EffectListing::~EffectListing() = default;
EffectCatalogueItem::EffectCatalogueItem(amuse::EffectType type, const QString& name, const QString& doc, EffectCatalogueItem::EffectCatalogueItem(amuse::EffectType type, const QString& name, const QString& doc,
QWidget* parent) QWidget* parent)
: QWidget(parent), m_type(type), m_iconLab(this), m_label(name, this) { : QWidget(parent), m_type(type), m_iconLab(this), m_label(name, this) {
@ -654,6 +670,8 @@ EffectCatalogueItem::EffectCatalogueItem(const EffectCatalogueItem& other, QWidg
setLayout(layout); setLayout(layout);
} }
EffectCatalogueItem::~EffectCatalogueItem() = default;
static const char* EffectStrings[] = { static const char* EffectStrings[] = {
QT_TRANSLATE_NOOP("EffectCatalogue", "Reverb Standard"), QT_TRANSLATE_NOOP("EffectCatalogue", "Reverb High"), QT_TRANSLATE_NOOP("EffectCatalogue", "Reverb Standard"), QT_TRANSLATE_NOOP("EffectCatalogue", "Reverb High"),
QT_TRANSLATE_NOOP("EffectCatalogue", "Delay"), QT_TRANSLATE_NOOP("EffectCatalogue", "Chorus")}; QT_TRANSLATE_NOOP("EffectCatalogue", "Delay"), QT_TRANSLATE_NOOP("EffectCatalogue", "Chorus")};
@ -875,3 +893,5 @@ StudioSetupWidget::StudioSetupWidget(QWidget* parent)
layout->addWidget(m_splitter); layout->addWidget(m_splitter);
setLayout(layout); setLayout(layout);
} }
StudioSetupWidget::~StudioSetupWidget() = default;

View File

@ -1,19 +1,31 @@
#pragma once #pragma once
#include "EditorWidget.hpp" #include <string>
#include <QWidget>
#include <QTreeWidget>
#include <QLabel> #include <QLabel>
#include <QVBoxLayout>
#include <QLayoutItem> #include <QLayoutItem>
#include <QStaticText> #include <QMouseEvent>
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QPushButton>
#include <QScrollArea> #include <QScrollArea>
#include <QSplitter> #include <QSplitter>
#include "amuse/Studio.hpp" #include <QStaticText>
#include <QTreeWidget>
#include <QVBoxLayout>
#include <QWidget>
#include "EditorWidget.hpp"
class EffectListing; class EffectListing;
namespace amuse {
class EffectBaseTypeless;
class Studio;
class Submix;
enum class EffectType;
} // namespace amuse
struct EffectIntrospection { struct EffectIntrospection {
struct Field { struct Field {
enum class Type { Invalid, UInt32, UInt32x8, Float }; enum class Type { Invalid, UInt32, UInt32x8, Float };
@ -33,9 +45,13 @@ class Uint32X8Popup : public QFrame {
public: public:
explicit Uint32X8Popup(int min, int max, QWidget* parent = Q_NULLPTR); explicit Uint32X8Popup(int min, int max, QWidget* parent = Q_NULLPTR);
~Uint32X8Popup() override;
void setValue(int chanIdx, int val); void setValue(int chanIdx, int val);
private slots: private slots:
void doValueChanged(int val); void doValueChanged(int val);
signals: signals:
void valueChanged(int chanIdx, int val); void valueChanged(int chanIdx, int val);
}; };
@ -46,9 +62,12 @@ class Uint32X8Button : public QPushButton {
public: public:
explicit Uint32X8Button(int min, int max, QWidget* parent = Q_NULLPTR); explicit Uint32X8Button(int min, int max, QWidget* parent = Q_NULLPTR);
~Uint32X8Button() override;
void paintEvent(QPaintEvent* event) override; void paintEvent(QPaintEvent* event) override;
Uint32X8Popup* popup() const { return m_popup; } Uint32X8Popup* popup() const { return m_popup; }
QStyleOptionComboBox comboStyleOption() const; QStyleOptionComboBox comboStyleOption() const;
private slots: private slots:
void onPressed(); void onPressed();
}; };
@ -64,6 +83,7 @@ class EffectWidget : public QWidget {
amuse::EffectBaseTypeless* m_effect; amuse::EffectBaseTypeless* m_effect;
const EffectIntrospection* m_introspection; const EffectIntrospection* m_introspection;
void setIndex(int index); void setIndex(int index);
private slots: private slots:
void numChanged(int); void numChanged(int);
void numChanged(double); void numChanged(double);
@ -72,6 +92,7 @@ private slots:
private: private:
explicit EffectWidget(QWidget* parent, amuse::EffectBaseTypeless* effect, amuse::EffectType type); explicit EffectWidget(QWidget* parent, amuse::EffectBaseTypeless* effect, amuse::EffectType type);
~EffectWidget() override;
public: public:
EffectListing* getParent() const; EffectListing* getParent() const;
@ -96,6 +117,7 @@ private slots:
public: public:
template <class... _Args> template <class... _Args>
EffectWidgetContainer(QWidget* parent, _Args&&... args); EffectWidgetContainer(QWidget* parent, _Args&&... args);
~EffectWidgetContainer() override;
}; };
class EffectListing : public QWidget { class EffectListing : public QWidget {
@ -128,6 +150,8 @@ class EffectListing : public QWidget {
public: public:
explicit EffectListing(QWidget* parent = Q_NULLPTR); explicit EffectListing(QWidget* parent = Q_NULLPTR);
~EffectListing() override;
bool loadData(amuse::Submix* submix); bool loadData(amuse::Submix* submix);
void unloadData(); void unloadData();
void timerEvent(QTimerEvent* event) override; void timerEvent(QTimerEvent* event) override;
@ -143,6 +167,8 @@ public:
explicit EffectCatalogueItem(amuse::EffectType type, const QString& name, const QString& doc, explicit EffectCatalogueItem(amuse::EffectType type, const QString& name, const QString& doc,
QWidget* parent = Q_NULLPTR); QWidget* parent = Q_NULLPTR);
explicit EffectCatalogueItem(const EffectCatalogueItem& other, QWidget* parent = Q_NULLPTR); explicit EffectCatalogueItem(const EffectCatalogueItem& other, QWidget* parent = Q_NULLPTR);
~EffectCatalogueItem() override;
amuse::EffectType getType() const { return m_type; } amuse::EffectType getType() const { return m_type; }
QString getText() const { return m_label.text(); } QString getText() const { return m_label.text(); }
}; };
@ -173,6 +199,8 @@ class StudioSetupWidget : public QWidget {
public: public:
explicit StudioSetupWidget(QWidget* parent = Q_NULLPTR); explicit StudioSetupWidget(QWidget* parent = Q_NULLPTR);
~StudioSetupWidget() override;
bool loadData(amuse::Studio* studio); bool loadData(amuse::Studio* studio);
void unloadData(); void unloadData();