LMMS
Loading...
Searching...
No Matches
PatchesDialog.h
Go to the documentation of this file.
1/*
2 * PatchesDialog.h - display sf2 patches
3 *
4 * Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail/dot/com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25
26#ifndef _PATCHES_DIALOG_H
27#define _PATCHES_DIALOG_H
28
29#include <fluidsynth/types.h>
30#include <QSortFilterProxyModel>
31#include <QStandardItemModel>
32#include <QEvent>
33
34#include "ui_PatchesDialog.h"
35#include "LcdSpinBox.h"
36
37class QLabel;
38
39
40namespace lmms::gui
41{
42
43//----------------------------------------------------------------------------
44// qsynthPresetForm -- UI wrapper form.
45
46class PatchesDialog : public QDialog, private Ui::PatchesDialog
47{
48 Q_OBJECT
49
50public:
51 PatchesDialog(QWidget* pParent = 0, Qt::WindowFlags wflags = QFlag(0));
52 ~PatchesDialog() override = default;
53
54 void setup(fluid_synth_t* pSynth, int iChan, const QString& _chanName, LcdSpinBoxModel* _bankModel,
55 LcdSpinBoxModel* _progModel, QLabel* _patchLabel);
56
57public slots:
60 void progChanged(const QModelIndex& cur, const QModelIndex& prev);
61
62protected slots:
63 void accept() override;
64 void reject() override;
65
66protected:
67
68 void setBankProg(int iBank, int iProg);
69
70 QTreeWidgetItem* findBankItem(int iBank);
71
73 QStandardItem* findProgItem(int iProg);
74
76
80 void updatePatch(bool updateUi);
81
86 void diffSelectProgRow(int offset);
87
88private:
89
90 void keyPressEvent(QKeyEvent* event) override;
91
92 fluid_synth_t* m_pSynth;
93 int m_iChan;
94 int m_iBank;
95 int m_iProg;
96 int m_dirty;
97 // int m_iDirtySetup;
98 // int m_iDirtyCount;
99
102
105 QLabel* m_patchLabel;
106 QStandardItemModel m_progListSourceModel;
107 QSortFilterProxyModel m_progListProxyModel;
108};
109
110
111} // namespace lmms::gui
112
113#endif
114
Definition PatchesDialog.h:44
void updatePatch(bool updateUi)
Definition PatchesDialog.cpp:398
int m_dirty
Definition PatchesDialog.h:88
LcdSpinBoxModel * m_progModel
Definition PatchesDialog.h:91
QStandardItem * findProgItem(int iProg)
Finds the program item of given program number id in the source model.
void keyPressEvent(QKeyEvent *event) override
Definition PatchesDialog.cpp:437
QLabel * m_patchLabel
Definition PatchesDialog.h:92
GigInstance * m_pSynth
Definition PatchesDialog.h:82
void setup(GigInstance *pSynth, int iChan, const QString &chanName, LcdSpinBoxModel *bankModel, LcdSpinBoxModel *progModel, QLabel *patchLabel)
Definition PatchesDialog.cpp:111
int m_iChan
Definition PatchesDialog.h:84
void accept() override
LcdSpinBoxModel * m_bankModel
Definition PatchesDialog.h:90
QStandardItemModel m_progListSourceModel
Programs on the selected bank.
Definition PatchesDialog.h:106
void progChanged(QTreeWidgetItem *curr, QTreeWidgetItem *prev)
Definition PatchesDialog.cpp:382
int m_iProg
Definition PatchesDialog.h:86
QString m_selProgName
Definition PatchesDialog.h:101
int m_iBank
Definition PatchesDialog.h:85
QTreeWidgetItem * findBankItem(int iBank)
~PatchesDialog() override=default
PatchesDialog(QWidget *pParent=0, Qt::WindowFlags wflags=QFlag(0))
void setBankProg(int iBank, int iProg)
void reject() override
QSortFilterProxyModel m_progListProxyModel
Model to allow searching.
Definition PatchesDialog.h:107
int m_selProg
Definition PatchesDialog.h:100
void diffSelectProgRow(int offset)
Definition PatchesDialog.cpp:459
Definition AudioPortAudio.cpp:223
IntModel LcdSpinBoxModel
Definition LcdSpinBox.h:88