252 |
} |
} |
253 |
|
|
254 |
|
|
255 |
|
// Window drag-n-drop event handlers. |
256 |
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
257 |
{ |
{ |
258 |
bool bAccept = false; |
bool bAccept = false; |
277 |
} |
} |
278 |
|
|
279 |
|
|
280 |
|
// Context menu event handler. |
281 |
|
void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
282 |
|
{ |
283 |
|
stabilizeForm(); |
284 |
|
|
285 |
|
editMenu->exec(pEvent->globalPos()); |
286 |
|
} |
287 |
|
|
288 |
|
|
289 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
290 |
// qsamplerMainForm -- Brainless public property accessors. |
// qsamplerMainForm -- Brainless public property accessors. |
291 |
|
|
559 |
// ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
// ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
560 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl; |
561 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
562 |
ts << "LOAD INSTRUMENT " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl; |
ts << "LOAD INSTRUMENT NON_MODAL " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl; |
563 |
ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl; |
ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl; |
564 |
ts << endl; |
ts << endl; |
565 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
1472 |
// And try to stop server. |
// And try to stop server. |
1473 |
if (m_pServer) { |
if (m_pServer) { |
1474 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
1475 |
if (m_pServer->isRunning()) { |
if (m_pServer->isRunning()) |
1476 |
m_pServer->tryTerminate(); |
m_pServer->tryTerminate(); |
|
return; |
|
|
} |
|
1477 |
} |
} |
1478 |
|
|
1479 |
|
// Give it some time to terminate gracefully and stabilize... |
1480 |
|
QTime t; |
1481 |
|
t.start(); |
1482 |
|
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
1483 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1484 |
|
|
1485 |
// Do final processing anyway. |
// Do final processing anyway. |
1486 |
processServerExit(); |
processServerExit(); |
1487 |
} |
} |
1525 |
|
|
1526 |
|
|
1527 |
// The LSCP client callback procedure. |
// The LSCP client callback procedure. |
1528 |
lscp_status_t qsampler_client_callback ( lscp_client_t *pClient, const char *pchBuffer, int cchBuffer, void *pvData ) |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, lscp_event_t /*event*/, const char */*pchBuffer*/, int /*cchBuffer*/, void */*pvData*/ ) |
1529 |
{ |
{ |
1530 |
qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData; |
// FIXME: DO NOT EVER call any GUI code here, |
1531 |
if (pMainForm == NULL) |
// as this is run under some other thread context. |
1532 |
return LSCP_FAILED; |
// A custom event must be posted here... |
1533 |
|
// |
1534 |
char *pszBuffer = (char *) malloc(cchBuffer + 1); |
// QApplication::postEvent((qjackctlMainForm *) pvData, new QCustomEvent(...)); |
|
if (pszBuffer == NULL) |
|
|
return LSCP_FAILED; |
|
|
|
|
|
memcpy(pszBuffer, pchBuffer, cchBuffer); |
|
|
pszBuffer[cchBuffer] = (char) 0; |
|
|
pMainForm->appendMessagesColor(pszBuffer, "#996699"); |
|
|
free(pszBuffer); |
|
1535 |
|
|
1536 |
return LSCP_OK; |
return LSCP_OK; |
1537 |
} |
} |