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* parent = nullptr, 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:
59 void progChanged(const QModelIndex& cur, const QModelIndex& prev);
60
61protected slots:
62 void accept() override;
63 void reject() override;
64
65protected:
67 void setBankProg(int iBank, int iProg);
68
70 QTreeWidgetItem* findBankItem(int iBank);
71
73 QStandardItem* findProgItem(int iProg);
74
75 bool validateForm();
76
78 void updatePatch(bool updateUi);
79
84 void diffSelectProgRow(int offset);
85
87 void updateSearchUi(bool isSearching);
88
90 void showAllBankPatches(bool value);
91
93 void updatePatchList();
94
95private:
96
97 void keyPressEvent(QKeyEvent* event) override;
98
99 fluid_synth_t* m_pSynth;
100 int m_iChan;
101 int m_iBank;
102 int m_iProg;
103 int m_dirty;
104 // int m_iDirtySetup;
105 // int m_iDirtyCount;
106
111
114 QLabel* m_patchLabel;
115 QStandardItemModel m_progListSourceModel;
116 QSortFilterProxyModel m_progListProxyModel;
117};
118
119
120} // namespace lmms::gui
121
122#endif
123
Definition PatchesDialog.h:44
bool m_showingAllBankPatches
Definition PatchesDialog.h:107
void updatePatch(bool updateUi)
Updates the current patch, and updates the UI controls if updateUi is true.
Definition PatchesDialog.cpp:303
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 stabilizeForm()
Stabilize current state form.
PatchesDialog(QWidget *parent=nullptr, Qt::WindowFlags wflags=QFlag{0})
void keyPressEvent(QKeyEvent *event) override
Definition PatchesDialog.cpp:343
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:115
void updatePatchList()
May show only the current bank or all of them (depends on what was set via showAllBankPatches()).
Definition PatchesDialog.cpp:402
void updateSearchUi(bool isSearching)
Used for changing things on the UI based on whether the user is searching or not.
Definition PatchesDialog.cpp:382
void progChanged(QTreeWidgetItem *curr, QTreeWidgetItem *prev)
Definition PatchesDialog.cpp:382
void showAllBankPatches(bool value)
Whether to show patches from all banks at once or not. Re-fetches as needed.
Definition PatchesDialog.cpp:394
int m_iProg
Definition PatchesDialog.h:86
QString m_selProgName
Definition PatchesDialog.h:110
int m_iBank
Definition PatchesDialog.h:85
QTreeWidgetItem * findBankItem(int iBank)
Finds the bank item from the sidebar of a given bank number.
~PatchesDialog() override=default
int m_selBank
Definition PatchesDialog.h:109
void setBankProg(int iBank, int iProg)
Realize a bank-program selection.
bool validateForm()
Check whether the dialog fields are valid.
void reject() override
QSortFilterProxyModel m_progListProxyModel
Model to allow searching.
Definition PatchesDialog.h:116
int m_selProg
Definition PatchesDialog.h:108
void diffSelectProgRow(int offset)
Definition PatchesDialog.cpp:365
static PuglViewHint int value
Definition pugl.h:1708
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:209
IntModel LcdSpinBoxModel
Definition LcdSpinBox.h:88