317 |
// Window drag-n-drop event handlers. |
// Window drag-n-drop event handlers. |
318 |
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent ) |
319 |
{ |
{ |
320 |
QStringList files; |
QStringList files; |
321 |
|
pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files)); |
|
pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files)); |
|
322 |
} |
} |
323 |
|
|
324 |
|
|
423 |
if (!closeSession(true)) |
if (!closeSession(true)) |
424 |
return false; |
return false; |
425 |
|
|
426 |
|
// Give us what the server has, right now... |
427 |
|
updateSession(); |
428 |
|
|
429 |
// Ok increment untitled count. |
// Ok increment untitled count. |
430 |
m_iUntitled++; |
m_iUntitled++; |
431 |
|
|
598 |
if (iErrors > 0) |
if (iErrors > 0) |
599 |
appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
600 |
|
|
601 |
// Now we'll try to create the whole GUI session. |
// Now we'll try to create (update) the whole GUI session. |
602 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
updateSession(); |
|
if (piChannelIDs == NULL) { |
|
|
appendMessagesClient("lscp_list_channels"); |
|
|
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
|
|
} else { |
|
|
// Try to (re)create each channel. |
|
|
m_pWorkspace->setUpdatesEnabled(false); |
|
|
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
|
|
createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel])); |
|
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
|
|
} |
|
|
m_pWorkspace->setUpdatesEnabled(true); |
|
|
} |
|
603 |
|
|
604 |
// Save as default session directory. |
// Save as default session directory. |
605 |
if (m_pOptions) |
if (m_pOptions) |
764 |
|
|
765 |
// Log this. |
// Log this. |
766 |
appendMessages(tr("Sampler reset.")); |
appendMessages(tr("Sampler reset.")); |
767 |
|
|
768 |
|
// Make it a new session... |
769 |
|
newSession(); |
770 |
} |
} |
771 |
|
|
772 |
|
|
1223 |
} |
} |
1224 |
|
|
1225 |
|
|
1226 |
|
// Grab and restore current sampler channels session. |
1227 |
|
void qsamplerMainForm::updateSession (void) |
1228 |
|
{ |
1229 |
|
// Retrieve the current channel list. |
1230 |
|
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
1231 |
|
if (piChannelIDs == NULL) { |
1232 |
|
if (::lscp_client_get_errno(m_pClient)) { |
1233 |
|
appendMessagesClient("lscp_list_channels"); |
1234 |
|
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
1235 |
|
} |
1236 |
|
return; |
1237 |
|
} |
1238 |
|
|
1239 |
|
// Try to (re)create each channel. |
1240 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1241 |
|
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
1242 |
|
// Check if theres already a channel strip for this one... |
1243 |
|
if (!channelStrip(piChannelIDs[iChannel])) |
1244 |
|
createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel])); |
1245 |
|
// Make it visibly responsive... |
1246 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1247 |
|
} |
1248 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1249 |
|
} |
1250 |
|
|
1251 |
|
|
1252 |
// Update the recent files list and menu. |
// Update the recent files list and menu. |
1253 |
void qsamplerMainForm::updateRecentFiles ( const QString& sFilename ) |
void qsamplerMainForm::updateRecentFiles ( const QString& sFilename ) |
1254 |
{ |
{ |
1488 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1489 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1490 |
pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1491 |
// y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
if (pChannelStrip) { |
1492 |
y += pChannelStrip->parentWidget()->frameGeometry().height(); |
// y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
1493 |
|
y += pChannelStrip->parentWidget()->frameGeometry().height(); |
1494 |
|
} |
1495 |
} |
} |
1496 |
} |
} |
1497 |
|
|
1543 |
{ |
{ |
1544 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1545 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1546 |
return 0; |
return NULL; |
1547 |
|
|
1548 |
return (qsamplerChannelStrip *) wlist.at(iChannel); |
return (qsamplerChannelStrip *) wlist.at(iChannel); |
1549 |
} |
} |
1550 |
|
|
1551 |
|
|
1552 |
|
// Retrieve a channel strip by sampler channel id. |
1553 |
|
qsamplerChannelStrip *qsamplerMainForm::channelStrip ( int iChannelID ) |
1554 |
|
{ |
1555 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1556 |
|
if (wlist.isEmpty()) |
1557 |
|
return NULL; |
1558 |
|
|
1559 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1560 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1561 |
|
if (pChannelStrip) { |
1562 |
|
qsamplerChannel *pChannel = pChannelStrip->channel(); |
1563 |
|
if (pChannel && pChannel->channelID() == iChannelID) |
1564 |
|
return pChannelStrip; |
1565 |
|
} |
1566 |
|
} |
1567 |
|
|
1568 |
|
// Not found. |
1569 |
|
return NULL; |
1570 |
|
} |
1571 |
|
|
1572 |
|
|
1573 |
// Construct the windows menu. |
// Construct the windows menu. |
1574 |
void qsamplerMainForm::channelsMenuAboutToShow (void) |
void qsamplerMainForm::channelsMenuAboutToShow (void) |
1575 |
{ |
{ |