2 |
// |
// |
3 |
// ui.h extension file, included from the uic-generated form implementation. |
// ui.h extension file, included from the uic-generated form implementation. |
4 |
/**************************************************************************** |
/**************************************************************************** |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
GNU General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
18 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
26 |
#include <qprocess.h> |
#include <qprocess.h> |
27 |
#include <qmessagebox.h> |
#include <qmessagebox.h> |
28 |
#include <qdragobject.h> |
#include <qdragobject.h> |
29 |
|
#include <qregexp.h> |
30 |
#include <qfiledialog.h> |
#include <qfiledialog.h> |
31 |
#include <qfileinfo.h> |
#include <qfileinfo.h> |
32 |
#include <qfile.h> |
#include <qfile.h> |
37 |
|
|
38 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
39 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
40 |
|
#include "qsamplerChannel.h" |
41 |
#include "qsamplerMessages.h" |
#include "qsamplerMessages.h" |
42 |
|
|
43 |
#include "qsamplerChannelStrip.h" |
#include "qsamplerChannelStrip.h" |
44 |
|
#include "qsamplerInstrumentList.h" |
45 |
|
|
46 |
|
#include "qsamplerInstrumentListForm.h" |
47 |
|
#include "qsamplerDeviceForm.h" |
48 |
#include "qsamplerOptionsForm.h" |
#include "qsamplerOptionsForm.h" |
49 |
|
|
50 |
#include "config.h" |
#ifdef HAVE_SIGNAL_H |
51 |
|
#include <signal.h> |
52 |
|
#endif |
53 |
|
|
54 |
|
#ifdef CONFIG_LIBGIG |
55 |
|
#include <gig.h> |
56 |
|
#endif |
57 |
|
|
58 |
// Timer constant stuff. |
// Timer constant stuff. |
59 |
#define QSAMPLER_TIMER_MSECS 200 |
#define QSAMPLER_TIMER_MSECS 200 |
104 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
105 |
// qsamplerMainForm -- Main window form implementation. |
// qsamplerMainForm -- Main window form implementation. |
106 |
|
|
107 |
|
// Kind of singleton reference. |
108 |
|
qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL; |
109 |
|
|
110 |
|
|
111 |
// Kind of constructor. |
// Kind of constructor. |
112 |
void qsamplerMainForm::init (void) |
void qsamplerMainForm::init (void) |
113 |
{ |
{ |
114 |
|
// Pseudo-singleton reference setup. |
115 |
|
g_pMainForm = this; |
116 |
|
|
117 |
// Initialize some pointer references. |
// Initialize some pointer references. |
118 |
m_pOptions = NULL; |
m_pOptions = NULL; |
119 |
|
|
120 |
// All child forms are to be created later, not earlier than setup. |
// All child forms are to be created later, not earlier than setup. |
121 |
m_pMessages = NULL; |
m_pMessages = NULL; |
122 |
|
m_pInstrumentListForm = NULL; |
123 |
|
m_pDeviceForm = NULL; |
124 |
|
|
125 |
// We'll start clean. |
// We'll start clean. |
126 |
m_iUntitled = 0; |
m_iUntitled = 0; |
127 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
128 |
|
|
129 |
m_pServer = NULL; |
m_pServer = NULL; |
134 |
|
|
135 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
136 |
|
|
137 |
|
#ifdef HAVE_SIGNAL_H |
138 |
|
// Set to ignore any fatal "Broken pipe" signals. |
139 |
|
::signal(SIGPIPE, SIG_IGN); |
140 |
|
#endif |
141 |
|
|
142 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
143 |
m_pWorkspace = new QWorkspace(this); |
m_pWorkspace = new QWorkspace(this); |
144 |
m_pWorkspace->setScrollBarsEnabled(true); |
m_pWorkspace->setScrollBarsEnabled(true); |
153 |
pLabel = new QLabel(tr("Connected"), this); |
pLabel = new QLabel(tr("Connected"), this); |
154 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
155 |
pLabel->setMinimumSize(pLabel->sizeHint()); |
pLabel->setMinimumSize(pLabel->sizeHint()); |
156 |
m_status[QSAMPLER_STATUS_CLIENT] = pLabel; |
m_statusItem[QSAMPLER_STATUS_CLIENT] = pLabel; |
157 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
158 |
// Server address. |
// Server address. |
159 |
pLabel = new QLabel(this); |
pLabel = new QLabel(this); |
160 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
161 |
m_status[QSAMPLER_STATUS_SERVER] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SERVER] = pLabel; |
162 |
statusBar()->addWidget(pLabel, 1); |
statusBar()->addWidget(pLabel, 1); |
163 |
// Channel title. |
// Channel title. |
164 |
pLabel = new QLabel(this); |
pLabel = new QLabel(this); |
165 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
166 |
m_status[QSAMPLER_STATUS_CHANNEL] = pLabel; |
m_statusItem[QSAMPLER_STATUS_CHANNEL] = pLabel; |
167 |
statusBar()->addWidget(pLabel, 2); |
statusBar()->addWidget(pLabel, 2); |
168 |
// Session modification status. |
// Session modification status. |
169 |
pLabel = new QLabel(tr("MOD"), this); |
pLabel = new QLabel(tr("MOD"), this); |
170 |
pLabel->setAlignment(Qt::AlignHCenter); |
pLabel->setAlignment(Qt::AlignHCenter); |
171 |
pLabel->setMinimumSize(pLabel->sizeHint()); |
pLabel->setMinimumSize(pLabel->sizeHint()); |
172 |
m_status[QSAMPLER_STATUS_SESSION] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
173 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
174 |
|
|
175 |
// Create the recent files sub-menu. |
// Create the recent files sub-menu. |
188 |
{ |
{ |
189 |
// Do final processing anyway. |
// Do final processing anyway. |
190 |
processServerExit(); |
processServerExit(); |
191 |
|
|
192 |
// Delete recentfiles menu. |
#if defined(WIN32) |
193 |
if (m_pRecentFilesMenu) |
WSACleanup(); |
194 |
delete m_pRecentFilesMenu; |
#endif |
|
// Delete status item labels one by one. |
|
|
if (m_status[QSAMPLER_STATUS_CLIENT]) |
|
|
delete m_status[QSAMPLER_STATUS_CLIENT]; |
|
|
if (m_status[QSAMPLER_STATUS_SERVER]) |
|
|
delete m_status[QSAMPLER_STATUS_SERVER]; |
|
|
if (m_status[QSAMPLER_STATUS_CHANNEL]) |
|
|
delete m_status[QSAMPLER_STATUS_CHANNEL]; |
|
|
if (m_status[QSAMPLER_STATUS_SESSION]) |
|
|
delete m_status[QSAMPLER_STATUS_SESSION]; |
|
195 |
|
|
196 |
// Finally drop any widgets around... |
// Finally drop any widgets around... |
197 |
|
if (m_pDeviceForm) |
198 |
|
delete m_pDeviceForm; |
199 |
|
if (m_pInstrumentListForm) |
200 |
|
delete m_pInstrumentListForm; |
201 |
if (m_pMessages) |
if (m_pMessages) |
202 |
delete m_pMessages; |
delete m_pMessages; |
203 |
if (m_pWorkspace) |
if (m_pWorkspace) |
204 |
delete m_pWorkspace; |
delete m_pWorkspace; |
205 |
|
|
206 |
#if defined(WIN32) |
// Delete status item labels one by one. |
207 |
WSACleanup(); |
if (m_statusItem[QSAMPLER_STATUS_CLIENT]) |
208 |
#endif |
delete m_statusItem[QSAMPLER_STATUS_CLIENT]; |
209 |
|
if (m_statusItem[QSAMPLER_STATUS_SERVER]) |
210 |
|
delete m_statusItem[QSAMPLER_STATUS_SERVER]; |
211 |
|
if (m_statusItem[QSAMPLER_STATUS_CHANNEL]) |
212 |
|
delete m_statusItem[QSAMPLER_STATUS_CHANNEL]; |
213 |
|
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
214 |
|
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
215 |
|
|
216 |
|
// Delete recentfiles menu. |
217 |
|
if (m_pRecentFilesMenu) |
218 |
|
delete m_pRecentFilesMenu; |
219 |
|
|
220 |
|
// Pseudo-singleton reference shut-down. |
221 |
|
g_pMainForm = NULL; |
222 |
} |
} |
223 |
|
|
224 |
|
|
228 |
// We got options? |
// We got options? |
229 |
m_pOptions = pOptions; |
m_pOptions = pOptions; |
230 |
|
|
231 |
|
// What style do we create these forms? |
232 |
|
Qt::WFlags wflags = Qt::WStyle_Customize |
233 |
|
| Qt::WStyle_NormalBorder |
234 |
|
| Qt::WStyle_Title |
235 |
|
| Qt::WStyle_SysMenu |
236 |
|
| Qt::WStyle_MinMax |
237 |
|
| Qt::WType_TopLevel; |
238 |
|
if (m_pOptions->bKeepOnTop) |
239 |
|
wflags |= Qt::WStyle_Tool; |
240 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
241 |
m_pMessages = new qsamplerMessages(this); |
m_pMessages = new qsamplerMessages(this); |
242 |
|
m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags); |
243 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
244 |
|
m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags); |
245 |
|
QObject::connect(m_pInstrumentListForm->InstrumentList, |
246 |
|
SIGNAL(instrumentsChanged()), |
247 |
|
SLOT(sessionDirty())); |
248 |
|
#else |
249 |
|
viewInstrumentsAction->setEnabled(false); |
250 |
|
#endif |
251 |
// Set message defaults... |
// Set message defaults... |
252 |
updateMessagesFont(); |
updateMessagesFont(); |
253 |
updateMessagesLimit(); |
updateMessagesLimit(); |
254 |
updateMessagesCapture(); |
updateMessagesCapture(); |
255 |
// Set the visibility signal. |
// Set the visibility signal. |
256 |
QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm())); |
QObject::connect(m_pMessages, |
257 |
|
SIGNAL(visibilityChanged(bool)), |
258 |
|
SLOT(stabilizeForm())); |
259 |
|
|
260 |
// Initial decorations toggle state. |
// Initial decorations toggle state. |
261 |
viewMenubarAction->setOn(m_pOptions->bMenubar); |
viewMenubarAction->setOn(m_pOptions->bMenubar); |
278 |
QTextIStream istr(&sDockables); |
QTextIStream istr(&sDockables); |
279 |
istr >> *this; |
istr >> *this; |
280 |
} |
} |
281 |
// Try to restore old window positioning. |
// Try to restore old window positioning and initial visibility. |
282 |
m_pOptions->loadWidgetGeometry(this); |
m_pOptions->loadWidgetGeometry(this); |
283 |
|
m_pOptions->loadWidgetGeometry(m_pInstrumentListForm); |
284 |
|
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
285 |
|
|
286 |
// Final startup stabilization... |
// Final startup stabilization... |
287 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
319 |
QTextOStream ostr(&sDockables); |
QTextOStream ostr(&sDockables); |
320 |
ostr << *this; |
ostr << *this; |
321 |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
322 |
// And the main windows state. |
// And the children, and the main windows state,. |
323 |
m_pOptions->saveWidgetGeometry(this); |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
324 |
|
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
325 |
|
m_pOptions->saveWidgetGeometry(this); |
326 |
|
// Close popup widgets. |
327 |
|
if (m_pInstrumentListForm) |
328 |
|
m_pInstrumentListForm->close(); |
329 |
|
if (m_pDeviceForm) |
330 |
|
m_pDeviceForm->close(); |
331 |
// Stop client and/or server, gracefully. |
// Stop client and/or server, gracefully. |
332 |
stopServer(); |
stopServer(); |
333 |
} |
} |
346 |
} |
} |
347 |
|
|
348 |
|
|
349 |
// Window drag-n-drop event handlers. |
// Drag'n'drop file handler. |
350 |
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
bool qsamplerMainForm::decodeDragFiles ( const QMimeSource *pEvent, QStringList& files ) |
351 |
{ |
{ |
352 |
bool bAccept = false; |
bool bDecode = false; |
353 |
|
|
354 |
if (QTextDrag::canDecode(pDragEnterEvent)) { |
if (QTextDrag::canDecode(pEvent)) { |
355 |
QString sUrl; |
QString sText; |
356 |
if (QTextDrag::decode(pDragEnterEvent, sUrl) && m_pClient) |
bDecode = QTextDrag::decode(pEvent, sText); |
357 |
bAccept = QFileInfo(QUrl(sUrl).path()).exists(); |
if (bDecode) { |
358 |
|
files = QStringList::split('\n', sText); |
359 |
|
for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) |
360 |
|
*iter = QUrl((*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null)).path(); |
361 |
|
} |
362 |
} |
} |
363 |
|
|
364 |
pDragEnterEvent->accept(bAccept); |
return bDecode; |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
|
// Window drag-n-drop event handlers. |
369 |
|
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
370 |
|
{ |
371 |
|
QStringList files; |
372 |
|
pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files)); |
373 |
} |
} |
374 |
|
|
375 |
|
|
376 |
void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent ) |
void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent ) |
377 |
{ |
{ |
378 |
if (QTextDrag::canDecode(pDropEvent)) { |
QStringList files; |
379 |
QString sUrl; |
|
380 |
if (QTextDrag::decode(pDropEvent, sUrl) && closeSession(true)) |
if (!decodeDragFiles(pDropEvent, files)) |
381 |
loadSessionFile(QUrl(sUrl).path()); |
return; |
382 |
} |
|
383 |
|
for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) { |
384 |
|
const QString& sPath = *iter; |
385 |
|
if (qsamplerChannel::isInstrumentFile(sPath)) { |
386 |
|
// Try to create a new channel from instrument file... |
387 |
|
qsamplerChannel *pChannel = new qsamplerChannel(); |
388 |
|
if (pChannel == NULL) |
389 |
|
return; |
390 |
|
// Start setting the instrument filename... |
391 |
|
pChannel->setInstrument(sPath, 0); |
392 |
|
// Before we show it up, may be we'll |
393 |
|
// better ask for some initial values? |
394 |
|
if (!pChannel->channelSetup(this)) { |
395 |
|
delete pChannel; |
396 |
|
return; |
397 |
|
} |
398 |
|
// Finally, give it to a new channel strip... |
399 |
|
if (!createChannelStrip(pChannel)) { |
400 |
|
delete pChannel; |
401 |
|
return; |
402 |
|
} |
403 |
|
// Make that an overall update. |
404 |
|
m_iDirtyCount++; |
405 |
|
stabilizeForm(); |
406 |
|
} // Otherwise, load an usual session file (LSCP script)... |
407 |
|
else if (closeSession(true)) |
408 |
|
loadSessionFile(sPath); |
409 |
|
// Make it look responsive...:) |
410 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
411 |
|
} |
412 |
} |
} |
413 |
|
|
414 |
|
|
418 |
// For the time being, just pump it to messages. |
// For the time being, just pump it to messages. |
419 |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
420 |
qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent; |
qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent; |
421 |
appendMessagesColor(tr("Notify event: %1 data: %2") |
if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) { |
422 |
.arg(::lscp_event_to_text(pEvent->event())) |
int iChannelID = pEvent->data().toInt(); |
423 |
.arg(pEvent->data()), "#996699"); |
qsamplerChannelStrip *pChannelStrip = channelStrip(iChannelID); |
424 |
|
if (pChannelStrip) |
425 |
|
channelStripChanged(pChannelStrip); |
426 |
|
} else { |
427 |
|
appendMessagesColor(tr("Notify event: %1 data: %2") |
428 |
|
.arg(::lscp_event_to_text(pEvent->event())) |
429 |
|
.arg(pEvent->data()), "#996699"); |
430 |
|
} |
431 |
} |
} |
432 |
} |
} |
433 |
|
|
436 |
void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
437 |
{ |
{ |
438 |
stabilizeForm(); |
stabilizeForm(); |
439 |
|
|
440 |
editMenu->exec(pEvent->globalPos()); |
editMenu->exec(pEvent->globalPos()); |
441 |
} |
} |
442 |
|
|
450 |
return m_pOptions; |
return m_pOptions; |
451 |
} |
} |
452 |
|
|
453 |
|
|
454 |
// The LSCP client descriptor property. |
// The LSCP client descriptor property. |
455 |
lscp_client_t *qsamplerMainForm::client (void) |
lscp_client_t *qsamplerMainForm::client (void) |
456 |
{ |
{ |
458 |
} |
} |
459 |
|
|
460 |
|
|
461 |
|
// The pseudo-singleton instance accessor. |
462 |
|
qsamplerMainForm *qsamplerMainForm::getInstance (void) |
463 |
|
{ |
464 |
|
return g_pMainForm; |
465 |
|
} |
466 |
|
|
467 |
|
|
468 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
469 |
// qsamplerMainForm -- Session file stuff. |
// qsamplerMainForm -- Session file stuff. |
470 |
|
|
488 |
if (!closeSession(true)) |
if (!closeSession(true)) |
489 |
return false; |
return false; |
490 |
|
|
491 |
|
// Give us what the server has, right now... |
492 |
|
updateSession(); |
493 |
|
|
494 |
// Ok increment untitled count. |
// Ok increment untitled count. |
495 |
m_iUntitled++; |
m_iUntitled++; |
496 |
|
|
512 |
|
|
513 |
// Ask for the filename to open... |
// Ask for the filename to open... |
514 |
QString sFilename = QFileDialog::getOpenFileName( |
QString sFilename = QFileDialog::getOpenFileName( |
515 |
m_pOptions->sSessionDir, // Start here. |
m_pOptions->sSessionDir, // Start here. |
516 |
tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files) |
tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files) |
517 |
this, 0, // Parent and name (none) |
this, 0, // Parent and name (none) |
518 |
tr("Open Session") // Caption. |
QSAMPLER_TITLE ": " + tr("Open Session") // Caption. |
519 |
); |
); |
520 |
|
|
521 |
// Have we cancelled? |
// Have we cancelled? |
546 |
sFilename = m_pOptions->sSessionDir; |
sFilename = m_pOptions->sSessionDir; |
547 |
// Prompt the guy... |
// Prompt the guy... |
548 |
sFilename = QFileDialog::getSaveFileName( |
sFilename = QFileDialog::getSaveFileName( |
549 |
sFilename, // Start here. |
sFilename, // Start here. |
550 |
tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files) |
tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files) |
551 |
this, 0, // Parent and name (none) |
this, 0, // Parent and name (none) |
552 |
tr("Save Session") // Caption. |
QSAMPLER_TITLE ": " + tr("Save Session") // Caption. |
553 |
); |
); |
554 |
// Have we cancelled it? |
// Have we cancelled it? |
555 |
if (sFilename.isEmpty()) |
if (sFilename.isEmpty()) |
559 |
sFilename += ".lscp"; |
sFilename += ".lscp"; |
560 |
// Check if already exists... |
// Check if already exists... |
561 |
if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) { |
if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) { |
562 |
if (QMessageBox::warning(this, tr("Warning"), |
if (QMessageBox::warning(this, |
563 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
564 |
tr("The file already exists:\n\n" |
tr("The file already exists:\n\n" |
565 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
566 |
"Do you want to replace it?") |
"Do you want to replace it?") |
582 |
|
|
583 |
// Are we dirty enough to prompt it? |
// Are we dirty enough to prompt it? |
584 |
if (m_iDirtyCount > 0) { |
if (m_iDirtyCount > 0) { |
585 |
switch (QMessageBox::warning(this, tr("Warning"), |
switch (QMessageBox::warning(this, |
586 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
587 |
tr("The current session has been changed:\n\n" |
tr("The current session has been changed:\n\n" |
588 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
589 |
"Do you want to save the changes?") |
"Do you want to save the changes?") |
606 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
607 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
608 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
609 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
610 |
if (bForce && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) |
if (pChannelStrip) { |
611 |
appendMessagesClient("lscp_remove_channel"); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
612 |
delete pChannel; |
if (bForce && pChannel) |
613 |
|
pChannel->removeChannel(); |
614 |
|
delete pChannelStrip; |
615 |
|
} |
616 |
} |
} |
617 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
618 |
// We're now clean, for sure. |
// We're now clean, for sure. |
641 |
QTextStream ts(&file); |
QTextStream ts(&file); |
642 |
while (!ts.atEnd()) { |
while (!ts.atEnd()) { |
643 |
// Read the line. |
// Read the line. |
644 |
QString sCommand = ts.readLine().simplifyWhiteSpace(); |
QString sCommand = ts.readLine().stripWhiteSpace(); |
645 |
// If not empty, nor a comment, call the server... |
// If not empty, nor a comment, call the server... |
646 |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
647 |
appendMessagesColor(sCommand, "#996633"); |
appendMessagesColor(sCommand, "#996633"); |
660 |
// Ok. we've read it. |
// Ok. we've read it. |
661 |
file.close(); |
file.close(); |
662 |
|
|
663 |
// Have we any errors? |
// Now we'll try to create (update) the whole GUI session. |
664 |
if (iErrors > 0) |
updateSession(); |
|
appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename)); |
|
665 |
|
|
666 |
// Now we'll try to create the whole GUI session. |
// Have we any errors? |
667 |
int iChannels = ::lscp_get_channels(m_pClient); |
if (iErrors > 0) |
668 |
if (iChannels < 0) { |
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
|
appendMessagesClient("lscp_get_channels"); |
|
|
appendMessagesError(tr("Could not get current number of channels.\n\nSorry.")); |
|
|
} |
|
|
|
|
|
// Try to (re)create each channel. |
|
|
m_pWorkspace->setUpdatesEnabled(false); |
|
|
for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { |
|
|
createChannel(iChannelID, false); |
|
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
|
|
} |
|
|
m_pWorkspace->setUpdatesEnabled(true); |
|
669 |
|
|
670 |
// Save as default session directory. |
// Save as default session directory. |
671 |
if (m_pOptions) |
if (m_pOptions) |
672 |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
673 |
// We're not dirty anymore. |
// We're not dirty anymore, if loaded without errors, |
674 |
m_iDirtyCount = 0; |
m_iDirtyCount = iErrors; |
675 |
// Stabilize form... |
// Stabilize form... |
676 |
m_sFilename = sFilename; |
m_sFilename = sFilename; |
677 |
updateRecentFiles(sFilename); |
updateRecentFiles(sFilename); |
678 |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
679 |
|
|
680 |
|
// Make that an overall update. |
681 |
stabilizeForm(); |
stabilizeForm(); |
682 |
return true; |
return true; |
683 |
} |
} |
686 |
// Save current session to specific file path. |
// Save current session to specific file path. |
687 |
bool qsamplerMainForm::saveSessionFile ( const QString& sFilename ) |
bool qsamplerMainForm::saveSessionFile ( const QString& sFilename ) |
688 |
{ |
{ |
689 |
|
if (m_pClient == NULL) |
690 |
|
return false; |
691 |
|
|
692 |
|
// Check whether server is apparently OK... |
693 |
|
if (::lscp_get_channels(m_pClient) < 0) { |
694 |
|
appendMessagesClient("lscp_get_channels"); |
695 |
|
return false; |
696 |
|
} |
697 |
|
|
698 |
// Open and write into real file. |
// Open and write into real file. |
699 |
QFile file(sFilename); |
QFile file(sFilename); |
700 |
if (!file.open(IO_WriteOnly | IO_Truncate)) { |
if (!file.open(IO_WriteOnly | IO_Truncate)) { |
703 |
} |
} |
704 |
|
|
705 |
// Write the file. |
// Write the file. |
706 |
int iErrors = 0; |
int iErrors = 0; |
707 |
QTextStream ts(&file); |
QTextStream ts(&file); |
708 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
709 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") |
714 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
715 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
716 |
ts << "# " << tr("Date") |
ts << "# " << tr("Date") |
717 |
<< ": " << QDate::currentDate().toString("MMMM dd yyyy") |
<< ": " << QDate::currentDate().toString("MMM dd yyyy") |
718 |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
719 |
ts << "#" << endl; |
ts << "#" << endl; |
720 |
ts << endl; |
ts << endl; |
721 |
|
|
722 |
|
// It is assumed that this new kind of device+session file |
723 |
|
// will be loaded from a complete initialized server... |
724 |
|
int *piDeviceIDs; |
725 |
|
int iDevice; |
726 |
|
ts << "RESET" << endl; |
727 |
|
|
728 |
|
// Audio device mapping. |
729 |
|
QMap<int, int> audioDeviceMap; |
730 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
731 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
732 |
|
ts << endl; |
733 |
|
qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
734 |
|
// Audio device specification... |
735 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
736 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
737 |
|
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
738 |
|
qsamplerDeviceParamMap::ConstIterator deviceParam; |
739 |
|
for (deviceParam = device.params().begin(); |
740 |
|
deviceParam != device.params().end(); |
741 |
|
++deviceParam) { |
742 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
743 |
|
if (param.value.isEmpty()) ts << "# "; |
744 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
745 |
|
} |
746 |
|
ts << endl; |
747 |
|
// Audio channel parameters... |
748 |
|
int iPort = 0; |
749 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
750 |
|
pPort; |
751 |
|
pPort = device.ports().next(), ++iPort) { |
752 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
753 |
|
for (portParam = pPort->params().begin(); |
754 |
|
portParam != pPort->params().end(); |
755 |
|
++portParam) { |
756 |
|
const qsamplerDeviceParam& param = portParam.data(); |
757 |
|
if (param.fix || param.value.isEmpty()) ts << "# "; |
758 |
|
ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice |
759 |
|
<< " " << iPort << " " << portParam.key() |
760 |
|
<< "='" << param.value << "'" << endl; |
761 |
|
} |
762 |
|
} |
763 |
|
// Audio device index/id mapping. |
764 |
|
audioDeviceMap[device.deviceID()] = iDevice; |
765 |
|
// Try to keep it snappy :) |
766 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
767 |
|
} |
768 |
|
|
769 |
|
// MIDI device mapping. |
770 |
|
QMap<int, int> midiDeviceMap; |
771 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
772 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
773 |
|
ts << endl; |
774 |
|
qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
775 |
|
// MIDI device specification... |
776 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
777 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
778 |
|
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
779 |
|
qsamplerDeviceParamMap::ConstIterator deviceParam; |
780 |
|
for (deviceParam = device.params().begin(); |
781 |
|
deviceParam != device.params().end(); |
782 |
|
++deviceParam) { |
783 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
784 |
|
if (param.value.isEmpty()) ts << "# "; |
785 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
786 |
|
} |
787 |
|
ts << endl; |
788 |
|
// MIDI port parameters... |
789 |
|
int iPort = 0; |
790 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
791 |
|
pPort; |
792 |
|
pPort = device.ports().next(), ++iPort) { |
793 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
794 |
|
for (portParam = pPort->params().begin(); |
795 |
|
portParam != pPort->params().end(); |
796 |
|
++portParam) { |
797 |
|
const qsamplerDeviceParam& param = portParam.data(); |
798 |
|
if (param.fix || param.value.isEmpty()) ts << "# "; |
799 |
|
ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice |
800 |
|
<< " " << iPort << " " << portParam.key() |
801 |
|
<< "='" << param.value << "'" << endl; |
802 |
|
} |
803 |
|
} |
804 |
|
// MIDI device index/id mapping. |
805 |
|
midiDeviceMap[device.deviceID()] = iDevice; |
806 |
|
// Try to keep it snappy :) |
807 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
808 |
|
} |
809 |
|
ts << endl; |
810 |
|
|
811 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
812 |
|
// MIDI instrument mapping... |
813 |
|
QMap<int, int> midiInstrumentMap; |
814 |
|
int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient); |
815 |
|
for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) { |
816 |
|
int iMidiMap = piMaps[iMap]; |
817 |
|
const char *pszMapName |
818 |
|
= ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap); |
819 |
|
ts << "# " << tr("MIDI instrument map") << " " << iMap; |
820 |
|
if (pszMapName) |
821 |
|
ts << " - " << pszMapName; |
822 |
|
ts << endl; |
823 |
|
ts << "ADD MIDI_INSTRUMENT_MAP"; |
824 |
|
if (pszMapName) |
825 |
|
ts << " '" << pszMapName << "'"; |
826 |
|
ts << endl; |
827 |
|
// MIDI instrument mapping... |
828 |
|
lscp_midi_instrument_t *pInstrs |
829 |
|
= ::lscp_list_midi_instruments(m_pClient, iMidiMap); |
830 |
|
for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; iInstr++) { |
831 |
|
lscp_midi_instrument_info_t *pInstrInfo |
832 |
|
= ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]); |
833 |
|
if (pInstrInfo) { |
834 |
|
ts << "MAP MIDI_INSTRUMENT " |
835 |
|
<< iMap << " " |
836 |
|
<< pInstrs[iInstr].bank << " " |
837 |
|
<< pInstrs[iInstr].prog << " " |
838 |
|
<< pInstrInfo->engine_name << " '" |
839 |
|
<< pInstrInfo->instrument_file << "' " |
840 |
|
<< pInstrInfo->instrument_nr << " " |
841 |
|
<< pInstrInfo->volume << " "; |
842 |
|
switch (pInstrInfo->load_mode) { |
843 |
|
case LSCP_LOAD_PERSISTENT: |
844 |
|
ts << "PERSISTENT"; |
845 |
|
break; |
846 |
|
case LSCP_LOAD_ON_DEMAND_HOLD: |
847 |
|
ts << "ON_DEMAND_HOLD"; |
848 |
|
break; |
849 |
|
case LSCP_LOAD_ON_DEMAND: |
850 |
|
case LSCP_LOAD_DEFAULT: |
851 |
|
default: |
852 |
|
ts << "ON_DEMAND"; |
853 |
|
break; |
854 |
|
} |
855 |
|
if (pInstrInfo->name) |
856 |
|
ts << " '" << pInstrInfo->name << "'"; |
857 |
|
ts << endl; |
858 |
|
} |
859 |
|
// MIDI device index/id mapping. |
860 |
|
midiInstrumentMap[iMidiMap] = iMap; |
861 |
|
// Try to keep it snappy :) |
862 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
863 |
|
} |
864 |
|
if (pInstrs) |
865 |
|
ts << endl; |
866 |
|
} |
867 |
|
#endif // CONFIG_MIDI_INSTRUMENT |
868 |
|
|
869 |
|
// Sampler channel mapping. |
870 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
871 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
872 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
873 |
int iChannelID = pChannel->channelID(); |
if (pChannelStrip) { |
874 |
ts << "# " << pChannel->caption() << endl; |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
875 |
ts << "ADD CHANNEL" << endl; |
if (pChannel) { |
876 |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl; |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
877 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
ts << "ADD CHANNEL" << endl; |
878 |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
if (audioDeviceMap.isEmpty()) { |
879 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel |
880 |
if (pChannel->midiChannel() > 0) |
<< " " << pChannel->audioDriver() << endl; |
881 |
ts << pChannel->midiChannel(); |
} else { |
882 |
else |
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel |
883 |
ts << "ALL"; |
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
884 |
ts << endl; |
} |
885 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
if (midiDeviceMap.isEmpty()) { |
886 |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel |
887 |
ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl; |
<< " " << pChannel->midiDriver() << endl; |
888 |
ts << endl; |
} else { |
889 |
|
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel |
890 |
|
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
891 |
|
} |
892 |
|
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel |
893 |
|
<< " " << pChannel->midiPort() << endl; |
894 |
|
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
895 |
|
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
896 |
|
ts << "ALL"; |
897 |
|
else |
898 |
|
ts << pChannel->midiChannel(); |
899 |
|
ts << endl; |
900 |
|
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl; |
901 |
|
if (pChannel->instrumentStatus() < 100) ts << "# "; |
902 |
|
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " |
903 |
|
<< pChannel->instrumentNr() << " " << iChannel << endl; |
904 |
|
qsamplerChannelRoutingMap::ConstIterator audioRoute; |
905 |
|
for (audioRoute = pChannel->audioRouting().begin(); |
906 |
|
audioRoute != pChannel->audioRouting().end(); |
907 |
|
++audioRoute) { |
908 |
|
ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel |
909 |
|
<< " " << audioRoute.key() |
910 |
|
<< " " << audioRoute.data() << endl; |
911 |
|
} |
912 |
|
ts << "SET CHANNEL VOLUME " << iChannel |
913 |
|
<< " " << pChannel->volume() << endl; |
914 |
|
if (pChannel->channelMute()) |
915 |
|
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
916 |
|
if (pChannel->channelSolo()) |
917 |
|
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
918 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
919 |
|
if (pChannel->midiMap() >= 0) { |
920 |
|
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
921 |
|
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
922 |
|
} |
923 |
|
#endif |
924 |
|
ts << endl; |
925 |
|
} |
926 |
|
} |
927 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
928 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
929 |
} |
} |
949 |
} |
} |
950 |
|
|
951 |
|
|
952 |
|
// Session change receiver slot. |
953 |
|
void qsamplerMainForm::sessionDirty (void) |
954 |
|
{ |
955 |
|
// Just mark the dirty form. |
956 |
|
m_iDirtyCount++; |
957 |
|
// and update the form status... |
958 |
|
stabilizeForm(); |
959 |
|
} |
960 |
|
|
961 |
|
|
962 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
963 |
// qsamplerMainForm -- File Action slots. |
// qsamplerMainForm -- File Action slots. |
964 |
|
|
1012 |
return; |
return; |
1013 |
|
|
1014 |
// Ask user whether he/she want's an internal sampler reset... |
// Ask user whether he/she want's an internal sampler reset... |
1015 |
if (QMessageBox::warning(this, tr("Warning"), |
if (QMessageBox::warning(this, |
1016 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
1017 |
tr("Resetting the sampler instance will close\n" |
tr("Resetting the sampler instance will close\n" |
1018 |
"all device and channel configurations.\n\n" |
"all device and channel configurations.\n\n" |
1019 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1020 |
"temporary MIDI and Audio disruption\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1021 |
"Do you want to reset the sampler engine now?"), |
"Do you want to reset the sampler engine now?"), |
1022 |
tr("Reset"), tr("Cancel")) > 0) |
tr("Reset"), tr("Cancel")) > 0) |
1023 |
return; |
return; |
1031 |
|
|
1032 |
// Log this. |
// Log this. |
1033 |
appendMessages(tr("Sampler reset.")); |
appendMessages(tr("Sampler reset.")); |
1034 |
|
|
1035 |
|
// Make it a new session... |
1036 |
|
newSession(); |
1037 |
} |
} |
1038 |
|
|
1039 |
|
|
1042 |
{ |
{ |
1043 |
if (m_pOptions == NULL) |
if (m_pOptions == NULL) |
1044 |
return; |
return; |
1045 |
|
|
1046 |
bool bRestart = true; |
bool bRestart = true; |
1047 |
|
|
1048 |
// Ask user whether he/she want's a complete restart... |
// Ask user whether he/she want's a complete restart... |
1049 |
// (if we're currently up and running) |
// (if we're currently up and running) |
1050 |
if (bRestart && m_pClient) { |
if (bRestart && m_pClient) { |
1051 |
bRestart = (QMessageBox::warning(this, tr("Warning"), |
bRestart = (QMessageBox::warning(this, |
1052 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
1053 |
tr("New settings will be effective after\n" |
tr("New settings will be effective after\n" |
1054 |
"restarting the client/server connection.\n\n" |
"restarting the client/server connection.\n\n" |
1055 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1056 |
"temporary MIDI and Audio disruption\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1057 |
"Do you want to restart the connection now?"), |
"Do you want to restart the connection now?"), |
1058 |
tr("Restart"), tr("Cancel")) == 0); |
tr("Restart"), tr("Cancel")) == 0); |
1059 |
} |
} |
1085 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1086 |
return; |
return; |
1087 |
|
|
1088 |
// Create the new sampler channel. |
// Just create the channel instance... |
1089 |
int iChannelID = ::lscp_add_channel(m_pClient); |
qsamplerChannel *pChannel = new qsamplerChannel(); |
1090 |
if (iChannelID < 0) { |
if (pChannel == NULL) |
|
appendMessagesClient("lscp_add_channel"); |
|
|
appendMessagesError(tr("Could not create the new channel.\n\nSorry.")); |
|
1091 |
return; |
return; |
|
} |
|
1092 |
|
|
1093 |
// Log this happening. |
// Before we show it up, may be we'll |
1094 |
appendMessages(tr("Channel %1 created.").arg(iChannelID)); |
// better ask for some initial values? |
1095 |
|
if (!pChannel->channelSetup(this)) { |
1096 |
|
delete pChannel; |
1097 |
|
return; |
1098 |
|
} |
1099 |
|
|
1100 |
// Just create the channel strip with given id. |
// And give it to the strip (will own the channel instance, if successful). |
1101 |
createChannel(iChannelID, true); |
if (!createChannelStrip(pChannel)) { |
1102 |
|
delete pChannel; |
1103 |
|
return; |
1104 |
|
} |
1105 |
|
|
1106 |
// We'll be dirty, for sure... |
// Make that an overall update. |
1107 |
m_iDirtyCount++; |
m_iDirtyCount++; |
|
// Stabilize form anyway. |
|
1108 |
stabilizeForm(); |
stabilizeForm(); |
1109 |
} |
} |
1110 |
|
|
1115 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1116 |
return; |
return; |
1117 |
|
|
1118 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1119 |
|
if (pChannelStrip == NULL) |
1120 |
|
return; |
1121 |
|
|
1122 |
|
qsamplerChannel *pChannel = pChannelStrip->channel(); |
1123 |
if (pChannel == NULL) |
if (pChannel == NULL) |
1124 |
return; |
return; |
1125 |
|
|
1126 |
// Prompt user if he/she's sure about this... |
// Prompt user if he/she's sure about this... |
1127 |
if (m_pOptions && m_pOptions->bConfirmRemove) { |
if (m_pOptions && m_pOptions->bConfirmRemove) { |
1128 |
if (QMessageBox::warning(this, tr("Warning"), |
if (QMessageBox::warning(this, |
1129 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
1130 |
tr("About to remove channel:\n\n" |
tr("About to remove channel:\n\n" |
1131 |
"%1\n\n" |
"%1\n\n" |
1132 |
"Are you sure?") |
"Are you sure?") |
1133 |
.arg(pChannel->caption()), |
.arg(pChannelStrip->caption()), |
1134 |
tr("OK"), tr("Cancel")) > 0) |
tr("OK"), tr("Cancel")) > 0) |
1135 |
return; |
return; |
1136 |
} |
} |
1137 |
|
|
1138 |
// Remove the existing sampler channel. |
// Remove the existing sampler channel. |
1139 |
if (::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { |
if (!pChannel->removeChannel()) |
|
appendMessagesClient("lscp_remove_channel"); |
|
|
appendMessagesError(tr("Could not remove channel.\n\nSorry.")); |
|
1140 |
return; |
return; |
|
} |
|
1141 |
|
|
|
// Log this happening. |
|
|
appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID())); |
|
|
|
|
1142 |
// Just delete the channel strip. |
// Just delete the channel strip. |
1143 |
delete pChannel; |
delete pChannelStrip; |
1144 |
|
|
1145 |
// Do we auto-arrange? |
// Do we auto-arrange? |
1146 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
1147 |
channelsArrange(); |
channelsArrange(); |
1158 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1159 |
return; |
return; |
1160 |
|
|
1161 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1162 |
if (pChannel == NULL) |
if (pChannelStrip == NULL) |
1163 |
return; |
return; |
1164 |
|
|
1165 |
// Just invoque the channel strip procedure. |
// Just invoque the channel strip procedure. |
1166 |
pChannel->channelSetup(false); |
pChannelStrip->channelSetup(); |
1167 |
} |
} |
1168 |
|
|
1169 |
|
|
1173 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1174 |
return; |
return; |
1175 |
|
|
1176 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1177 |
if (pChannel == NULL) |
if (pChannelStrip == NULL) |
1178 |
return; |
return; |
1179 |
|
|
1180 |
// Remove the existing sampler channel. |
// Just invoque the channel strip procedure. |
1181 |
if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { |
pChannelStrip->channelReset(); |
1182 |
appendMessagesClient("lscp_reset_channel"); |
} |
|
appendMessagesError(tr("Could not reset channel.\n\nSorry.")); |
|
|
return; |
|
|
} |
|
1183 |
|
|
|
// Log this. |
|
|
appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID())); |
|
1184 |
|
|
1185 |
// Refresh channel strip info. |
// Reset all sampler channels. |
1186 |
pChannel->updateChannelInfo(); |
void qsamplerMainForm::editResetAllChannels (void) |
1187 |
|
{ |
1188 |
|
if (m_pClient == NULL) |
1189 |
|
return; |
1190 |
|
|
1191 |
|
// Invoque the channel strip procedure, |
1192 |
|
// for all channels out there... |
1193 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1194 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1195 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1196 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1197 |
|
if (pChannelStrip) |
1198 |
|
pChannelStrip->channelReset(); |
1199 |
|
} |
1200 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1201 |
} |
} |
1202 |
|
|
1203 |
|
|
1249 |
} |
} |
1250 |
|
|
1251 |
|
|
1252 |
|
// Show/hide the MIDI instrument list-view form. |
1253 |
|
void qsamplerMainForm::viewInstruments (void) |
1254 |
|
{ |
1255 |
|
if (m_pOptions == NULL) |
1256 |
|
return; |
1257 |
|
|
1258 |
|
if (m_pInstrumentListForm) { |
1259 |
|
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
1260 |
|
if (m_pInstrumentListForm->isVisible()) { |
1261 |
|
m_pInstrumentListForm->hide(); |
1262 |
|
} else { |
1263 |
|
m_pInstrumentListForm->show(); |
1264 |
|
m_pInstrumentListForm->raise(); |
1265 |
|
m_pInstrumentListForm->setActiveWindow(); |
1266 |
|
} |
1267 |
|
} |
1268 |
|
} |
1269 |
|
|
1270 |
|
|
1271 |
|
// Show/hide the device configurator form. |
1272 |
|
void qsamplerMainForm::viewDevices (void) |
1273 |
|
{ |
1274 |
|
if (m_pOptions == NULL) |
1275 |
|
return; |
1276 |
|
|
1277 |
|
if (m_pDeviceForm) { |
1278 |
|
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
1279 |
|
if (m_pDeviceForm->isVisible()) { |
1280 |
|
m_pDeviceForm->hide(); |
1281 |
|
} else { |
1282 |
|
m_pDeviceForm->show(); |
1283 |
|
m_pDeviceForm->raise(); |
1284 |
|
m_pDeviceForm->setActiveWindow(); |
1285 |
|
} |
1286 |
|
} |
1287 |
|
} |
1288 |
|
|
1289 |
|
|
1290 |
// Show options dialog. |
// Show options dialog. |
1291 |
void qsamplerMainForm::viewOptions (void) |
void qsamplerMainForm::viewOptions (void) |
1292 |
{ |
{ |
1296 |
qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this); |
qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this); |
1297 |
if (pOptionsForm) { |
if (pOptionsForm) { |
1298 |
// Check out some initial nullities(tm)... |
// Check out some initial nullities(tm)... |
1299 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1300 |
if (m_pOptions->sDisplayFont.isEmpty() && pChannel) |
if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip) |
1301 |
m_pOptions->sDisplayFont = pChannel->displayFont().toString(); |
m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString(); |
1302 |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
1303 |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
1304 |
// To track down deferred or immediate changes. |
// To track down deferred or immediate changes. |
1308 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
1309 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
1310 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
1311 |
|
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1312 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1313 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
1314 |
|
bool bOldKeepOnTop = m_pOptions->bKeepOnTop; |
1315 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
1316 |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
1317 |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
1318 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
bool bOldCompletePath = m_pOptions->bCompletePath; |
1319 |
|
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
1320 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
1321 |
// Load the current setup settings. |
// Load the current setup settings. |
1322 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
1324 |
if (pOptionsForm->exec()) { |
if (pOptionsForm->exec()) { |
1325 |
// Warn if something will be only effective on next run. |
// Warn if something will be only effective on next run. |
1326 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1327 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture)) { |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1328 |
QMessageBox::information(this, tr("Information"), |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1329 |
|
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
1330 |
|
QMessageBox::information(this, |
1331 |
|
QSAMPLER_TITLE ": " + tr("Information"), |
1332 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1333 |
"next time you start this program."), tr("OK")); |
"next time you start this program."), tr("OK")); |
1334 |
updateMessagesCapture(); |
updateMessagesCapture(); |
1338 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
1339 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
1340 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
1341 |
|
if (( bOldInstrumentNames && !m_pOptions->bInstrumentNames) || |
1342 |
|
(!bOldInstrumentNames && m_pOptions->bInstrumentNames)) |
1343 |
|
updateInstrumentNames(); |
1344 |
|
if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) || |
1345 |
|
(!bOldDisplayEffect && m_pOptions->bDisplayEffect)) |
1346 |
|
updateDisplayEffect(); |
1347 |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
1348 |
updateDisplayFont(); |
updateDisplayFont(); |
1349 |
if (iOldMaxVolume != m_pOptions->iMaxVolume) |
if (iOldMaxVolume != m_pOptions->iMaxVolume) |
1386 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1387 |
int y = 0; |
int y = 0; |
1388 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1389 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1390 |
/* if (pChannel->testWState(WState_Maximized | WState_Minimized)) { |
/* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { |
1391 |
// Prevent flicker... |
// Prevent flicker... |
1392 |
pChannel->hide(); |
pChannelStrip->hide(); |
1393 |
pChannel->showNormal(); |
pChannelStrip->showNormal(); |
1394 |
} */ |
} */ |
1395 |
pChannel->adjustSize(); |
pChannelStrip->adjustSize(); |
1396 |
int iWidth = m_pWorkspace->width(); |
int iWidth = m_pWorkspace->width(); |
1397 |
if (iWidth < pChannel->width()) |
if (iWidth < pChannelStrip->width()) |
1398 |
iWidth = pChannel->width(); |
iWidth = pChannelStrip->width(); |
1399 |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
// int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
1400 |
int iHeight = pChannel->parentWidget()->frameGeometry().height(); |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1401 |
pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1402 |
y += iHeight; |
y += iHeight; |
1403 |
} |
} |
1404 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1405 |
|
|
1406 |
stabilizeForm(); |
stabilizeForm(); |
1407 |
} |
} |
1408 |
|
|
1451 |
sText += tr("GIG (libgig) file support disabled."); |
sText += tr("GIG (libgig) file support disabled."); |
1452 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1453 |
#endif |
#endif |
1454 |
|
#ifndef CONFIG_INSTRUMENT_NAME |
1455 |
|
sText += "<small><font color=\"red\">"; |
1456 |
|
sText += tr("LSCP (liblscp) instrument_name support disabled."); |
1457 |
|
sText += "</font></small><br />"; |
1458 |
|
#endif |
1459 |
|
#ifndef CONFIG_MUTE_SOLO |
1460 |
|
sText += "<small><font color=\"red\">"; |
1461 |
|
sText += tr("Sampler channel Mute/Solo support disabled."); |
1462 |
|
sText += "</font></small><br />"; |
1463 |
|
#endif |
1464 |
|
#ifndef CONFIG_MIDI_INSTRUMENT |
1465 |
|
sText += "<small><font color=\"red\">"; |
1466 |
|
sText += tr("MIDI instrument mapping support disabled."); |
1467 |
|
sText += "</font></small><br />"; |
1468 |
|
#endif |
1469 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1470 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1471 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
1472 |
sText += " "; |
sText += " "; |
1473 |
sText += ::lscp_client_version(); |
sText += ::lscp_client_version(); |
1474 |
|
#ifdef CONFIG_LIBGIG |
1475 |
|
sText += ", "; |
1476 |
|
sText += gig::libraryName().c_str(); |
1477 |
|
sText += " "; |
1478 |
|
sText += gig::libraryVersion().c_str(); |
1479 |
|
#endif |
1480 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1481 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1482 |
sText += tr("Website") + ": <a href=\"" QSAMPLER_WEBSITE "\">" QSAMPLER_WEBSITE "</a><br />\n"; |
sText += tr("Website") + ": <a href=\"" QSAMPLER_WEBSITE "\">" QSAMPLER_WEBSITE "</a><br />\n"; |
1499 |
void qsamplerMainForm::stabilizeForm (void) |
void qsamplerMainForm::stabilizeForm (void) |
1500 |
{ |
{ |
1501 |
// Update the main application caption... |
// Update the main application caption... |
1502 |
QString sSessioName = sessionName(m_sFilename); |
QString sSessionName = sessionName(m_sFilename); |
1503 |
if (m_iDirtyCount > 0) |
if (m_iDirtyCount > 0) |
1504 |
sSessioName += '*'; |
sSessionName += " *"; |
1505 |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName)); |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
1506 |
|
|
1507 |
// Update the main menu state... |
// Update the main menu state... |
1508 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1509 |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
1510 |
bool bHasChannel = (bHasClient && pChannel != NULL); |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
1511 |
fileNewAction->setEnabled(bHasClient); |
fileNewAction->setEnabled(bHasClient); |
1512 |
fileOpenAction->setEnabled(bHasClient); |
fileOpenAction->setEnabled(bHasClient); |
1513 |
fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
1518 |
editRemoveChannelAction->setEnabled(bHasChannel); |
editRemoveChannelAction->setEnabled(bHasChannel); |
1519 |
editSetupChannelAction->setEnabled(bHasChannel); |
editSetupChannelAction->setEnabled(bHasChannel); |
1520 |
editResetChannelAction->setEnabled(bHasChannel); |
editResetChannelAction->setEnabled(bHasChannel); |
1521 |
channelsArrangeAction->setEnabled(bHasChannel); |
editResetAllChannelsAction->setEnabled(bHasChannel); |
1522 |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
1523 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
1524 |
|
viewInstrumentsAction->setOn(m_pInstrumentListForm |
1525 |
|
&& m_pInstrumentListForm->isVisible()); |
1526 |
|
viewInstrumentsAction->setEnabled(bHasClient); |
1527 |
|
#endif |
1528 |
|
viewDevicesAction->setOn(m_pDeviceForm |
1529 |
|
&& m_pDeviceForm->isVisible()); |
1530 |
|
viewDevicesAction->setEnabled(bHasClient); |
1531 |
|
channelsArrangeAction->setEnabled(bHasChannel); |
1532 |
|
|
1533 |
// Client/Server status... |
// Client/Server status... |
1534 |
if (bHasClient) { |
if (bHasClient) { |
1535 |
m_status[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
1536 |
m_status[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort)); |
m_statusItem[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort)); |
1537 |
} else { |
} else { |
1538 |
m_status[QSAMPLER_STATUS_CLIENT]->clear(); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->clear(); |
1539 |
m_status[QSAMPLER_STATUS_SERVER]->clear(); |
m_statusItem[QSAMPLER_STATUS_SERVER]->clear(); |
1540 |
} |
} |
1541 |
// Channel status... |
// Channel status... |
1542 |
if (bHasChannel) |
if (bHasChannel) |
1543 |
m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption()); |
m_statusItem[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption()); |
1544 |
else |
else |
1545 |
m_status[QSAMPLER_STATUS_CHANNEL]->clear(); |
m_statusItem[QSAMPLER_STATUS_CHANNEL]->clear(); |
1546 |
// Session status... |
// Session status... |
1547 |
if (m_iDirtyCount > 0) |
if (m_iDirtyCount > 0) |
1548 |
m_status[QSAMPLER_STATUS_SESSION]->setText(tr("MOD")); |
m_statusItem[QSAMPLER_STATUS_SESSION]->setText(tr("MOD")); |
1549 |
else |
else |
1550 |
m_status[QSAMPLER_STATUS_SESSION]->clear(); |
m_statusItem[QSAMPLER_STATUS_SESSION]->clear(); |
1551 |
|
|
1552 |
// Recent files menu. |
// Recent files menu. |
1553 |
m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0); |
m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0); |
1559 |
|
|
1560 |
|
|
1561 |
// Channel change receiver slot. |
// Channel change receiver slot. |
1562 |
void qsamplerMainForm::channelChanged( qsamplerChannelStrip * ) |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) |
1563 |
{ |
{ |
1564 |
|
// Add this strip to the changed list... |
1565 |
|
if (m_changedStrips.containsRef(pChannelStrip) == 0) { |
1566 |
|
m_changedStrips.append(pChannelStrip); |
1567 |
|
pChannelStrip->resetErrorCount(); |
1568 |
|
} |
1569 |
|
|
1570 |
// Just mark the dirty form. |
// Just mark the dirty form. |
1571 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1572 |
// and update the form status... |
// and update the form status... |
1574 |
} |
} |
1575 |
|
|
1576 |
|
|
1577 |
|
// Grab and restore current sampler channels session. |
1578 |
|
void qsamplerMainForm::updateSession (void) |
1579 |
|
{ |
1580 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
1581 |
|
// FIXME Make some room for default instrument maps... |
1582 |
|
int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
1583 |
|
if (iMaps < 0) |
1584 |
|
appendMessagesClient("lscp_get_midi_instrument_maps"); |
1585 |
|
else if (iMaps < 1) { |
1586 |
|
::lscp_add_midi_instrument_map(m_pClient, tr("Chromatic").latin1()); |
1587 |
|
::lscp_add_midi_instrument_map(m_pClient, tr("Drum Kits").latin1()); |
1588 |
|
} |
1589 |
|
#endif |
1590 |
|
|
1591 |
|
// Retrieve the current channel list. |
1592 |
|
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
1593 |
|
if (piChannelIDs == NULL) { |
1594 |
|
if (::lscp_client_get_errno(m_pClient)) { |
1595 |
|
appendMessagesClient("lscp_list_channels"); |
1596 |
|
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
1597 |
|
} |
1598 |
|
return; |
1599 |
|
} |
1600 |
|
|
1601 |
|
// Try to (re)create each channel. |
1602 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1603 |
|
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
1604 |
|
// Check if theres already a channel strip for this one... |
1605 |
|
if (!channelStrip(piChannelIDs[iChannel])) |
1606 |
|
createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel])); |
1607 |
|
// Make it visibly responsive... |
1608 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1609 |
|
} |
1610 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1611 |
|
|
1612 |
|
// Remember to refresh devices and instruments... |
1613 |
|
if (m_pInstrumentListForm) |
1614 |
|
m_pInstrumentListForm->refreshInstruments(); |
1615 |
|
if (m_pDeviceForm) |
1616 |
|
m_pDeviceForm->refreshDevices(); |
1617 |
|
} |
1618 |
|
|
1619 |
|
|
1620 |
// Update the recent files list and menu. |
// Update the recent files list and menu. |
1621 |
void qsamplerMainForm::updateRecentFiles ( const QString& sFilename ) |
void qsamplerMainForm::updateRecentFiles ( const QString& sFilename ) |
1622 |
{ |
{ |
1661 |
} |
} |
1662 |
|
|
1663 |
|
|
1664 |
|
// Force update of the channels instrument names mode. |
1665 |
|
void qsamplerMainForm::updateInstrumentNames (void) |
1666 |
|
{ |
1667 |
|
// Full channel list update... |
1668 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1669 |
|
if (wlist.isEmpty()) |
1670 |
|
return; |
1671 |
|
|
1672 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1673 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1674 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1675 |
|
if (pChannelStrip) |
1676 |
|
pChannelStrip->updateInstrumentName(true); |
1677 |
|
} |
1678 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1679 |
|
} |
1680 |
|
|
1681 |
|
|
1682 |
// Force update of the channels display font. |
// Force update of the channels display font. |
1683 |
void qsamplerMainForm::updateDisplayFont (void) |
void qsamplerMainForm::updateDisplayFont (void) |
1684 |
{ |
{ |
1700 |
|
|
1701 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1702 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1703 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1704 |
pChannel->setDisplayFont(font); |
if (pChannelStrip) |
1705 |
|
pChannelStrip->setDisplayFont(font); |
1706 |
|
} |
1707 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1708 |
|
} |
1709 |
|
|
1710 |
|
|
1711 |
|
// Update channel strips background effect. |
1712 |
|
void qsamplerMainForm::updateDisplayEffect (void) |
1713 |
|
{ |
1714 |
|
QPixmap pm; |
1715 |
|
if (m_pOptions->bDisplayEffect) |
1716 |
|
pm = QPixmap::fromMimeSource("displaybg1.png"); |
1717 |
|
|
1718 |
|
// Full channel list update... |
1719 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1720 |
|
if (wlist.isEmpty()) |
1721 |
|
return; |
1722 |
|
|
1723 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1724 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1725 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1726 |
|
if (pChannelStrip) |
1727 |
|
pChannelStrip->setDisplayBackground(pm); |
1728 |
} |
} |
1729 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1730 |
} |
} |
1743 |
|
|
1744 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1745 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1746 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1747 |
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
if (pChannelStrip) |
1748 |
|
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
1749 |
} |
} |
1750 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1751 |
} |
} |
1784 |
|
|
1785 |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
1786 |
|
|
1787 |
QMessageBox::critical(this, tr("Error"), s, tr("Cancel")); |
QMessageBox::critical(this, |
1788 |
|
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
1789 |
} |
} |
1790 |
|
|
1791 |
|
|
1825 |
if (m_pOptions->bMessagesLimit) |
if (m_pOptions->bMessagesLimit) |
1826 |
m_pMessages->setMessagesLimit(m_pOptions->iMessagesLimitLines); |
m_pMessages->setMessagesLimit(m_pOptions->iMessagesLimitLines); |
1827 |
else |
else |
1828 |
m_pMessages->setMessagesLimit(0); |
m_pMessages->setMessagesLimit(-1); |
1829 |
} |
} |
1830 |
} |
} |
1831 |
|
|
1845 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
1846 |
|
|
1847 |
// The channel strip creation executive. |
// The channel strip creation executive. |
1848 |
void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt ) |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( qsamplerChannel *pChannel ) |
1849 |
{ |
{ |
1850 |
if (m_pClient == NULL) |
if (m_pClient == NULL || pChannel == NULL) |
1851 |
return; |
return NULL; |
1852 |
|
|
1853 |
// Prepare for auto-arrange? |
// Prepare for auto-arrange? |
1854 |
qsamplerChannelStrip *pChannel = NULL; |
qsamplerChannelStrip *pChannelStrip = NULL; |
1855 |
int y = 0; |
int y = 0; |
1856 |
if (m_pOptions && m_pOptions->bAutoArrange) { |
if (m_pOptions && m_pOptions->bAutoArrange) { |
1857 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1858 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1859 |
pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1860 |
// y += pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
if (pChannelStrip) { |
1861 |
y += pChannel->parentWidget()->frameGeometry().height(); |
// y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
1862 |
|
y += pChannelStrip->parentWidget()->frameGeometry().height(); |
1863 |
|
} |
1864 |
} |
} |
1865 |
} |
} |
1866 |
|
|
1867 |
// Add a new channel itema... |
// Add a new channel itema... |
1868 |
WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder; |
WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder; |
1869 |
pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1870 |
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
if (pChannelStrip == NULL) |
1871 |
pChannel->setup(this, iChannelID); |
return NULL; |
1872 |
// We'll need a display font. |
|
1873 |
QFont font; |
// Actual channel strip setup... |
1874 |
if (m_pOptions && font.fromString(m_pOptions->sDisplayFont)) |
pChannelStrip->setup(pChannel); |
1875 |
pChannel->setDisplayFont(font); |
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
1876 |
// Track channel setup changes. |
// Set some initial aesthetic options... |
1877 |
QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *))); |
if (m_pOptions) { |
1878 |
// Before we show it up, may be we'll |
// Background display effect... |
1879 |
// better ask for some initial values? |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
1880 |
if (bPrompt) |
// We'll need a display font. |
1881 |
pChannel->channelSetup(true); |
QFont font; |
1882 |
|
if (font.fromString(m_pOptions->sDisplayFont)) |
1883 |
|
pChannelStrip->setDisplayFont(font); |
1884 |
|
// Maximum allowed volume setting. |
1885 |
|
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
1886 |
|
} |
1887 |
|
|
1888 |
// Now we show up us to the world. |
// Now we show up us to the world. |
1889 |
pChannel->show(); |
pChannelStrip->show(); |
1890 |
// Only then, we'll auto-arrange... |
// Only then, we'll auto-arrange... |
1891 |
if (m_pOptions && m_pOptions->bAutoArrange) { |
if (m_pOptions && m_pOptions->bAutoArrange) { |
1892 |
int iWidth = m_pWorkspace->width(); |
int iWidth = m_pWorkspace->width(); |
1893 |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
1894 |
int iHeight = pChannel->parentWidget()->frameGeometry().height(); |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1895 |
pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1896 |
} |
} |
1897 |
|
|
1898 |
|
// This is pretty new, so we'll watch for it closely. |
1899 |
|
channelStripChanged(pChannelStrip); |
1900 |
|
|
1901 |
|
// Return our successful reference... |
1902 |
|
return pChannelStrip; |
1903 |
} |
} |
1904 |
|
|
1905 |
|
|
1906 |
// Retrieve the active channel strip. |
// Retrieve the active channel strip. |
1907 |
qsamplerChannelStrip *qsamplerMainForm::activeChannel (void) |
qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void) |
1908 |
{ |
{ |
1909 |
return (qsamplerChannelStrip *) m_pWorkspace->activeWindow(); |
return (qsamplerChannelStrip *) m_pWorkspace->activeWindow(); |
1910 |
} |
} |
1911 |
|
|
1912 |
|
|
1913 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
1914 |
qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel ) |
qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel ) |
1915 |
{ |
{ |
1916 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1917 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1918 |
return 0; |
return NULL; |
1919 |
|
|
1920 |
return (qsamplerChannelStrip *) wlist.at(iChannel); |
return (qsamplerChannelStrip *) wlist.at(iChannel); |
1921 |
} |
} |
1922 |
|
|
1923 |
|
|
1924 |
|
// Retrieve a channel strip by sampler channel id. |
1925 |
|
qsamplerChannelStrip *qsamplerMainForm::channelStrip ( int iChannelID ) |
1926 |
|
{ |
1927 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1928 |
|
if (wlist.isEmpty()) |
1929 |
|
return NULL; |
1930 |
|
|
1931 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1932 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1933 |
|
if (pChannelStrip) { |
1934 |
|
qsamplerChannel *pChannel = pChannelStrip->channel(); |
1935 |
|
if (pChannel && pChannel->channelID() == iChannelID) |
1936 |
|
return pChannelStrip; |
1937 |
|
} |
1938 |
|
} |
1939 |
|
|
1940 |
|
// Not found. |
1941 |
|
return NULL; |
1942 |
|
} |
1943 |
|
|
1944 |
|
|
1945 |
// Construct the windows menu. |
// Construct the windows menu. |
1946 |
void qsamplerMainForm::channelsMenuAboutToShow (void) |
void qsamplerMainForm::channelsMenuAboutToShow (void) |
1947 |
{ |
{ |
1953 |
if (!wlist.isEmpty()) { |
if (!wlist.isEmpty()) { |
1954 |
channelsMenu->insertSeparator(); |
channelsMenu->insertSeparator(); |
1955 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1956 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1957 |
int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int))); |
if (pChannelStrip) { |
1958 |
channelsMenu->setItemParameter(iItemID, iChannel); |
int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int))); |
1959 |
channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel); |
channelsMenu->setItemParameter(iItemID, iChannel); |
1960 |
|
channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip); |
1961 |
|
} |
1962 |
} |
} |
1963 |
} |
} |
1964 |
} |
} |
1967 |
// Windows menu activation slot |
// Windows menu activation slot |
1968 |
void qsamplerMainForm::channelsMenuActivated ( int iChannel ) |
void qsamplerMainForm::channelsMenuActivated ( int iChannel ) |
1969 |
{ |
{ |
1970 |
qsamplerChannelStrip *pChannel = channelAt(iChannel); |
qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel); |
1971 |
if (pChannel) |
if (pChannelStrip) |
1972 |
pChannel->showNormal(); |
pChannelStrip->showNormal(); |
1973 |
pChannel->setFocus(); |
pChannelStrip->setFocus(); |
1974 |
} |
} |
1975 |
|
|
1976 |
|
|
2008 |
} |
} |
2009 |
} |
} |
2010 |
} |
} |
2011 |
|
|
2012 |
// Refresh each channel usage, on each period... |
if (m_pClient) { |
2013 |
if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) { |
// Update the channel information for each pending strip... |
2014 |
m_iTimerSlot += QSAMPLER_TIMER_MSECS; |
if (m_changedStrips.count() > 0) { |
2015 |
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
for (qsamplerChannelStrip *pChannelStrip = m_changedStrips.first(); |
2016 |
m_iTimerSlot = 0; |
pChannelStrip; pChannelStrip = m_changedStrips.next()) { |
2017 |
QWidgetList wlist = m_pWorkspace->windowList(); |
// If successfull, remove from pending list... |
2018 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
if (pChannelStrip->updateChannelInfo()) |
2019 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
m_changedStrips.remove(pChannelStrip); |
2020 |
if (pChannel->isVisible()) |
} |
2021 |
pChannel->updateChannelUsage(); |
} |
2022 |
} |
// Refresh each channel usage, on each period... |
2023 |
} |
if (m_pOptions->bAutoRefresh) { |
2024 |
} |
m_iTimerSlot += QSAMPLER_TIMER_MSECS; |
2025 |
|
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
2026 |
|
m_iTimerSlot = 0; |
2027 |
|
// Update the channel stream usage for each strip... |
2028 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
2029 |
|
for (int iChannel = 0; |
2030 |
|
iChannel < (int) wlist.count(); iChannel++) { |
2031 |
|
qsamplerChannelStrip *pChannelStrip |
2032 |
|
= (qsamplerChannelStrip *) wlist.at(iChannel); |
2033 |
|
if (pChannelStrip && pChannelStrip->isVisible()) |
2034 |
|
pChannelStrip->updateChannelUsage(); |
2035 |
|
} |
2036 |
|
} |
2037 |
|
} |
2038 |
|
} |
2039 |
|
|
2040 |
// Register the next timer slot. |
// Register the next timer slot. |
2041 |
QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(timerSlot())); |
QTimer::singleShot(QSAMPLER_TIMER_MSECS, this, SLOT(timerSlot())); |
2057 |
|
|
2058 |
// Is the server process instance still here? |
// Is the server process instance still here? |
2059 |
if (m_pServer) { |
if (m_pServer) { |
2060 |
switch (QMessageBox::warning(this, tr("Warning"), |
switch (QMessageBox::warning(this, |
2061 |
|
QSAMPLER_TITLE ": " + tr("Warning"), |
2062 |
tr("Could not start the LinuxSampler server.\n\n" |
tr("Could not start the LinuxSampler server.\n\n" |
2063 |
"Maybe it ss already started."), |
"Maybe it ss already started."), |
2064 |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
2217 |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
2218 |
appendMessages(tr("Client receive timeout is set to %1 msec.").arg(::lscp_client_get_timeout(m_pClient))); |
appendMessages(tr("Client receive timeout is set to %1 msec.").arg(::lscp_client_get_timeout(m_pClient))); |
2219 |
|
|
2220 |
|
// Subscribe to channel info change notifications... |
2221 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK) |
2222 |
|
appendMessagesClient("lscp_client_subscribe"); |
2223 |
|
|
2224 |
// We may stop scheduling around. |
// We may stop scheduling around. |
2225 |
stopSchedule(); |
stopSchedule(); |
2226 |
|
|
2230 |
// Log success here. |
// Log success here. |
2231 |
appendMessages(tr("Client connected.")); |
appendMessages(tr("Client connected.")); |
2232 |
|
|
2233 |
|
// Hard-notify instrumnet and device configuration forms, |
2234 |
|
// if visible, that we're ready... |
2235 |
|
if (m_pInstrumentListForm) |
2236 |
|
m_pInstrumentListForm->refreshInstruments(); |
2237 |
|
if (m_pDeviceForm) |
2238 |
|
m_pDeviceForm->refreshDevices(); |
2239 |
|
|
2240 |
// Is any session pending to be loaded? |
// Is any session pending to be loaded? |
2241 |
if (!m_pOptions->sSessionFile.isEmpty()) { |
if (!m_pOptions->sSessionFile.isEmpty()) { |
2242 |
// Just load the prabably startup session... |
// Just load the prabably startup session... |
2271 |
// channels from the back-end server. |
// channels from the back-end server. |
2272 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
2273 |
closeSession(false); |
closeSession(false); |
2274 |
|
|
2275 |
// Close us as a client... |
// Close us as a client... |
2276 |
lscp_client_destroy(m_pClient); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO); |
2277 |
|
::lscp_client_destroy(m_pClient); |
2278 |
m_pClient = NULL; |
m_pClient = NULL; |
2279 |
|
|
2280 |
|
// Hard-notify instrumnet and device configuration forms, |
2281 |
|
// if visible, that we're running out... |
2282 |
|
if (m_pInstrumentListForm) |
2283 |
|
m_pInstrumentListForm->refreshInstruments(); |
2284 |
|
if (m_pDeviceForm) |
2285 |
|
m_pDeviceForm->refreshDevices(); |
2286 |
|
|
2287 |
// Log final here. |
// Log final here. |
2288 |
appendMessages(tr("Client disconnected.")); |
appendMessages(tr("Client disconnected.")); |
2289 |
|
|