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 :) |
853 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
854 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
855 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
856 |
|
int iOldMaxVolume = m_pOptions->iMaxVolume; |
857 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
858 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
859 |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
879 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
880 |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
881 |
updateDisplayFont(); |
updateDisplayFont(); |
882 |
|
if (iOldMaxVolume != m_pOptions->iMaxVolume) |
883 |
|
updateMaxVolume(); |
884 |
if (sOldMessagesFont != m_pOptions->sMessagesFont) |
if (sOldMessagesFont != m_pOptions->sMessagesFont) |
885 |
updateMessagesFont(); |
updateMessagesFont(); |
886 |
if (( bOldMessagesLimit && !m_pOptions->bMessagesLimit) || |
if (( bOldMessagesLimit && !m_pOptions->bMessagesLimit) || |
1137 |
} |
} |
1138 |
|
|
1139 |
|
|
1140 |
|
// Force update of the channels maximum volume setting. |
1141 |
|
void qsamplerMainForm::updateMaxVolume (void) |
1142 |
|
{ |
1143 |
|
if (m_pOptions == NULL) |
1144 |
|
return; |
1145 |
|
|
1146 |
|
// Full channel list update... |
1147 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1148 |
|
if (wlist.isEmpty()) |
1149 |
|
return; |
1150 |
|
|
1151 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1152 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1153 |
|
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
1154 |
|
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
1155 |
|
} |
1156 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1157 |
|
} |
1158 |
|
|
1159 |
|
|
1160 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1161 |
// qsamplerMainForm -- Messages window form handlers. |
// qsamplerMainForm -- Messages window form handlers. |
1162 |
|
|
1270 |
// Add a new channel itema... |
// Add a new channel itema... |
1271 |
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; |
1272 |
pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1273 |
|
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
1274 |
pChannel->setup(this, iChannelID); |
pChannel->setup(this, iChannelID); |
1275 |
// We'll need a display font. |
// We'll need a display font. |
1276 |
QFont font; |
QFont font; |
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 |
} |
} |