/[svn]/qsampler/trunk/src/qsamplerChannelFxForm.cpp
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerChannelFxForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1667 - (show annotations) (download)
Mon Feb 4 23:24:19 2008 UTC (16 years, 2 months ago) by schoenebeck
File size: 3582 byte(s)
* added FX Sends dialog to channel strips
  (still under construction, so far one can only create, destroy and rename
  FX sends, the rest is still to do)
* bumped version to 0.2.1.3

1 // qsamplerChannelFxForm.cpp
2 //
3 /****************************************************************************
4 Copyright (C) 2008, Christian Schoenebeck
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 *****************************************************************************/
21
22 #include "qsamplerAbout.h"
23 #include "qsamplerChannelFxForm.h"
24 #include "qsamplerFxSendsModel.h"
25
26 #include <QAbstractButton>
27
28 namespace QSampler {
29
30 ChannelFxForm::ChannelFxForm (
31 int SamplerChannelID, QWidget* pParent, Qt::WindowFlags wflags )
32 : QDialog(pParent, wflags)
33 {
34 m_ui.setupUi(this);
35
36 m_SamplerChannelID = SamplerChannelID;
37
38 FxSendsModel* pModel =
39 new FxSendsModel(SamplerChannelID, m_ui.SendsListView);
40 m_ui.SendsListView->setModel(pModel);
41
42 QAbstractButton* pApplyButton =
43 m_ui.buttonBox->button(QDialogButtonBox::Apply);
44 pApplyButton->setEnabled(false);
45 pApplyButton->setIcon(QIcon(":/icons/formEdit.png"));
46
47 QAbstractButton* pCancelButton =
48 m_ui.buttonBox->button(QDialogButtonBox::Cancel);
49 pCancelButton->setIcon(QIcon(":/icons/formRemove.png"));
50
51 QAbstractButton* pOkButton =
52 m_ui.buttonBox->button(QDialogButtonBox::Ok);
53 pOkButton->setIcon(QIcon(":/icons/formAccept.png"));
54
55 QAbstractButton* pResetButton =
56 m_ui.buttonBox->button(QDialogButtonBox::Reset);
57 pResetButton->setEnabled(false);
58
59 m_ui.destroyPushButton->setEnabled(false);
60
61 connect(
62 m_ui.buttonBox, SIGNAL(clicked(QAbstractButton*)),
63 this, SLOT(onButtonClicked(QAbstractButton*))
64 );
65 connect(
66 m_ui.createPushButton, SIGNAL(clicked()),
67 this, SLOT(onCreateFxSend())
68 );
69 connect(
70 m_ui.destroyPushButton, SIGNAL(clicked()),
71 this, SLOT(onDestroyFxSend())
72 );
73 connect(
74 pModel, SIGNAL(fxSendsDirtyChanged(bool)),
75 pApplyButton, SLOT(setEnabled(bool))
76 );
77 connect(
78 pModel, SIGNAL(fxSendsDirtyChanged(bool)),
79 pResetButton, SLOT(setEnabled(bool))
80 );
81 connect(
82 m_ui.SendsListView, SIGNAL(clicked(const QModelIndex&)),
83 this, SLOT(onFxSendSelection(const QModelIndex&))
84 );
85 }
86
87 ChannelFxForm::~ChannelFxForm() {
88 }
89
90 void ChannelFxForm::onButtonClicked(QAbstractButton* button) {
91 FxSendsModel* pModel = (FxSendsModel*) m_ui.SendsListView->model();
92 switch (m_ui.buttonBox->buttonRole(button)) {
93 case QDialogButtonBox::AcceptRole:
94 case QDialogButtonBox::ApplyRole:
95 pModel->applyToSampler();
96 break;
97 case QDialogButtonBox::ResetRole:
98 pModel->cleanRefresh();
99 break;
100 default: // to avoid gcc warnings
101 break;
102 }
103 }
104
105 void ChannelFxForm::onFxSendSelection(const QModelIndex& index) {
106 m_ui.destroyPushButton->setEnabled(index.isValid());
107 }
108
109 void ChannelFxForm::onCreateFxSend() {
110 FxSendsModel* pModel = (FxSendsModel*) m_ui.SendsListView->model();
111 pModel->addFxSend();
112 }
113
114 void ChannelFxForm::onDestroyFxSend() {
115 FxSendsModel* pModel = (FxSendsModel*) m_ui.SendsListView->model();
116 pModel->removeFxSend(m_ui.SendsListView->currentIndex());
117 }
118
119 } // namespace QSampler
120
121 // end of qsamplerChannelFxForm.cpp

  ViewVC Help
Powered by ViewVC