Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r62]: trunk / src / qjackctlPatchbayForm.ui.h Maximize Restore History

Download this file

qjackctlPatchbayForm.ui.h    403 lines (315 with data), 11.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
// qjackctlPatchbayForm.ui.h
//
// ui.h extension file, included from the uic-generated form implementation.
/****************************************************************************
Copyright (C) 2003, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*****************************************************************************/
#include <qmessagebox.h>
#include <qfiledialog.h>
#include <qfileinfo.h>
#include "config.h"
#include "qjackctlPatchbayFile.h"
// Kind of constructor.
void qjackctlPatchbayForm::init (void)
{
// Create the patchbay view object.
m_pPatchbay = new qjackctlPatchbay(PatchbayView);
m_iUntitled = 0;
// Connect it to some UI feedback slot.
QObject::connect(PatchbayView->OListView(), SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(stabilizeForm()));
QObject::connect(PatchbayView->IListView(), SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(stabilizeForm()));
QObject::connect(PatchbayView->OListView(), SIGNAL(currentChanged(QListViewItem *)), this, SLOT(stabilizeForm()));
QObject::connect(PatchbayView->IListView(), SIGNAL(currentChanged(QListViewItem *)), this, SLOT(stabilizeForm()));
newPatchbayFile(false);
}
// Kind of destructor.
void qjackctlPatchbayForm::destroy (void)
{
// May delete the patchbay view object.
delete m_pPatchbay;
}
// Notify our parent that we're emerging.
void qjackctlPatchbayForm::showEvent ( QShowEvent *pShowEvent )
{
qjackctlMainForm *pMainForm = (qjackctlMainForm *) QWidget::parent();
if (pMainForm)
pMainForm->stabilizeForm();
stabilizeForm();
QWidget::showEvent(pShowEvent);
}
// Notify our parent that we're closing.
void qjackctlPatchbayForm::hideEvent ( QHideEvent *pHideEvent )
{
QWidget::hideEvent(pHideEvent);
qjackctlMainForm *pMainForm = (qjackctlMainForm *) QWidget::parent();
if (pMainForm)
pMainForm->stabilizeForm();
}
// Window close event handlers.
bool qjackctlPatchbayForm::queryClose (void)
{
bool bQueryClose = true;
if (PatchbayView->dirty()) {
switch (QMessageBox::warning(this, tr("Warning"),
tr("The patchbay definition has been changed:") + "\n\n" +
"\"" + m_sPatchbayName + "\"\n\n" +
tr("Do you want to save the changes?"),
tr("Save"), tr("Discard"), tr("Cancel"))) {
case 0: // Save...
savePatchbay();
// Fall thru....
case 1: // Discard
break;
default: // Cancel.
bQueryClose = false;
}
}
return bQueryClose;
}
// Refresh complete form.
void qjackctlPatchbayForm::refreshForm ( void )
{
m_pPatchbay->refresh();
stabilizeForm();
}
// A helper stabilization slot.
void qjackctlPatchbayForm::stabilizeForm ( void )
{
SavePatchbayPushButton->setEnabled(PatchbayView->dirty());
ActivatePatchbayPushButton->setEnabled(QFileInfo(m_sPatchbayPath).exists());
QString sText = m_sPatchbayName;
if (PatchbayView->dirty()) {
sText += " [" + tr("modified") + "]";
} else {
qjackctlMainForm *pMainForm = (qjackctlMainForm *) QWidget::parent();
if (pMainForm && pMainForm->isActivePatchbay(m_sPatchbayPath))
sText += " [" + tr("active") + "]";
}
PatchbayTextLabel->setText(sText);
qjackctlSocketItem *pSocketItem = (m_pPatchbay->OSocketList())->selectedSocketItem();
if (pSocketItem) {
OSocketEditPushButton->setEnabled(true);
OSocketRemovePushButton->setEnabled(true);
OSocketMoveUpPushButton->setEnabled(pSocketItem->itemAbove() != NULL);
OSocketMoveDownPushButton->setEnabled(pSocketItem->nextSibling() != NULL);
} else {
OSocketEditPushButton->setEnabled(false);
OSocketRemovePushButton->setEnabled(false);
OSocketMoveUpPushButton->setEnabled(false);
OSocketMoveDownPushButton->setEnabled(false);
}
pSocketItem = (m_pPatchbay->ISocketList())->selectedSocketItem();
if (pSocketItem) {
ISocketEditPushButton->setEnabled(true);
ISocketRemovePushButton->setEnabled(true);
ISocketMoveUpPushButton->setEnabled(pSocketItem->itemAbove() != NULL);
ISocketMoveDownPushButton->setEnabled(pSocketItem->nextSibling() != NULL);
} else {
ISocketEditPushButton->setEnabled(false);
ISocketRemovePushButton->setEnabled(false);
ISocketMoveUpPushButton->setEnabled(false);
ISocketMoveDownPushButton->setEnabled(false);
}
ConnectPushButton->setEnabled(m_pPatchbay->canConnectSelected());
DisconnectPushButton->setEnabled(m_pPatchbay->canDisconnectSelected());
DisconnectAllPushButton->setEnabled(m_pPatchbay->canDisconnectAll());
}
// Patchbay path accessor.
QString& qjackctlPatchbayForm::patchbayPath (void)
{
return m_sPatchbayPath;
}
// Reset patchbay definition from scratch.
void qjackctlPatchbayForm::newPatchbayFile ( bool bSnapshot )
{
m_pPatchbay->clear();
m_sPatchbayPath = QString::null;
m_sPatchbayName = tr("Untitled") + QString::number(m_iUntitled++);
if (bSnapshot)
m_pPatchbay->connectionsSnapshot();
stabilizeForm();
}
// Load patchbay definitions from specific file path.
void qjackctlPatchbayForm::loadPatchbayFile ( const QString& sFileName )
{
// We'll have a temporary rack...
qjackctlPatchbayRack rack;
// Step 1: load from file...
if (!qjackctlPatchbayFile::load(&rack, sFileName)) {
QMessageBox::critical(this, tr("Load error"),
tr("Could not load patchbay definition file:") + "\n\n\"" + sFileName + "\"",
tr("Cancel"));
return;
}
// Step 2: load from rack...
m_pPatchbay->loadRack(&rack);
// Step 3: stabilize form...
m_sPatchbayPath = sFileName;
m_sPatchbayName = QFileInfo(sFileName).baseName();
stabilizeForm();
}
// Save current patchbay definition to specific file path.
void qjackctlPatchbayForm::savePatchbayFile ( const QString& sFileName )
{
// We'll have a temporary rack...
qjackctlPatchbayRack rack;
// Step 1: save to rack...
m_pPatchbay->saveRack(&rack);
// Step 2: save to file...
if (!qjackctlPatchbayFile::save(&rack, sFileName)) {
QMessageBox::critical(this, tr("Save error"),
tr("Could not save patchbay definition file:") + "\n\n\"" + sFileName + "\"",
tr("Cancel"));
return;
}
// Step 3: stabilize form...
m_sPatchbayPath = sFileName;
m_sPatchbayName = QFileInfo(sFileName).baseName();
stabilizeForm();
}
// Create a new patchbay definition from scratch.
void qjackctlPatchbayForm::newPatchbay()
{
// Ask for a snapshot for scratch...
bool bSnapshot = false;
if (m_pPatchbay->jackClient()) {
bSnapshot = (QMessageBox::information(this,
tr("New Patchbay definition"),
tr("JACK is currently running.") + "\n\n" +
tr("Create the new patchbay definition with a") + "\n" +
tr("snapshot of all actual client connections?"),
tr("Yes"), tr("No")) == 0);
}
// Check if we can discard safely the current one...
if (!queryClose())
return;
// Reset patchbay editor.
newPatchbayFile(bSnapshot);
}
// Load patchbay definitions from file.
void qjackctlPatchbayForm::loadPatchbay()
{
QString sFileName = QFileDialog::getOpenFileName(
m_sPatchbayPath, // Start here.
tr("Patchbay Definition files") + " (*.xml)", // Filter (XML files)
this, 0, // Parent and name (none)
tr("Load Patchbay Definition") // Caption.
);
if (sFileName.isEmpty())
return;
// Check if we're going to discard safely the current one...
if (!queryClose())
return;
// Load it right away.
loadPatchbayFile(sFileName);
}
// Save current patchbay definition to file.
void qjackctlPatchbayForm::savePatchbay()
{
QString sFileName = QFileDialog::getSaveFileName(
m_sPatchbayPath, // Start here.
tr("Patchbay Definition files") + " (*.xml)", // Filter (XML files)
this, 0, // Parent and name (none)
tr("Save Patchbay Definition") // Caption.
);
if (sFileName.isEmpty())
return;
// Save it right away.
savePatchbayFile(sFileName);
}
// Set current active patchbay definition file.
void qjackctlPatchbayForm::activatePatchbay()
{
if (queryClose()) {
qjackctlMainForm *pMainForm = (qjackctlMainForm *) QWidget::parent();
if (pMainForm)
pMainForm->activatePatchbay(m_sPatchbayPath);
}
}
// (Un)Bind a JACK client to this form.
void qjackctlPatchbayForm::setJackClient ( jack_client_t *pJackClient )
{
m_pPatchbay->setJackClient(pJackClient);
}
// Output socket list push button handlers gallore...
void qjackctlPatchbayForm::addOSocket()
{
(m_pPatchbay->OSocketList())->addSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::removeOSocket()
{
(m_pPatchbay->OSocketList())->removeSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::editOSocket()
{
(m_pPatchbay->OSocketList())->editSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::moveUpOSocket()
{
(m_pPatchbay->OSocketList())->moveUpSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::moveDownOSocket()
{
(m_pPatchbay->OSocketList())->moveDownSocketItem();
stabilizeForm();
}
// Input socket list push button handlers gallore...
void qjackctlPatchbayForm::addISocket()
{
(m_pPatchbay->ISocketList())->addSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::removeISocket()
{
(m_pPatchbay->ISocketList())->removeSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::editISocket()
{
(m_pPatchbay->ISocketList())->editSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::moveUpISocket()
{
(m_pPatchbay->ISocketList())->moveUpSocketItem();
stabilizeForm();
}
void qjackctlPatchbayForm::moveDownISocket()
{
(m_pPatchbay->ISocketList())->moveDownSocketItem();
stabilizeForm();
}
// Connect current selected ports.
void qjackctlPatchbayForm::connectSelected (void)
{
m_pPatchbay->connectSelected();
stabilizeForm();
}
// Disconnect current selected ports.
void qjackctlPatchbayForm::disconnectSelected (void)
{
m_pPatchbay->disconnectSelected();
stabilizeForm();
}
// Disconnect all connected ports.
void qjackctlPatchbayForm::disconnectAll()
{
m_pPatchbay->disconnectAll();
stabilizeForm();
}
// end of qjackctlPatchbayForm.ui.h