404 |
m_iDirtyCount++; |
m_iDirtyCount++; |
405 |
stabilizeForm(); |
stabilizeForm(); |
406 |
} // Otherwise, load an usual session file (LSCP script)... |
} // Otherwise, load an usual session file (LSCP script)... |
407 |
else if (closeSession(true)) |
else if (closeSession(true)) { |
408 |
loadSessionFile(sPath); |
loadSessionFile(sPath); |
409 |
|
break; |
410 |
|
} |
411 |
// Make it look responsive...:) |
// Make it look responsive...:) |
412 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
413 |
} |
} |
638 |
return false; |
return false; |
639 |
} |
} |
640 |
|
|
641 |
|
// Tell the world we'll take some time... |
642 |
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
643 |
|
|
644 |
// Read the file. |
// Read the file. |
645 |
|
int iLine = 0; |
646 |
int iErrors = 0; |
int iErrors = 0; |
647 |
QTextStream ts(&file); |
QTextStream ts(&file); |
648 |
while (!ts.atEnd()) { |
while (!ts.atEnd()) { |
649 |
// Read the line. |
// Read the line. |
650 |
QString sCommand = ts.readLine().stripWhiteSpace(); |
QString sCommand = ts.readLine().stripWhiteSpace(); |
651 |
|
iLine++; |
652 |
// If not empty, nor a comment, call the server... |
// If not empty, nor a comment, call the server... |
653 |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
|
appendMessagesColor(sCommand, "#996633"); |
|
654 |
// Remember that, no matter what, |
// Remember that, no matter what, |
655 |
// all LSCP commands are CR/LF terminated. |
// all LSCP commands are CR/LF terminated. |
656 |
sCommand += "\r\n"; |
sCommand += "\r\n"; |
657 |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
658 |
|
appendMessagesColor(QString("%1(%2): %3") |
659 |
|
.arg(QFileInfo(sFilename).fileName()).arg(iLine) |
660 |
|
.arg(sCommand.simplifyWhiteSpace()), "#996633"); |
661 |
appendMessagesClient("lscp_client_query"); |
appendMessagesClient("lscp_client_query"); |
662 |
iErrors++; |
iErrors++; |
663 |
} |
} |
672 |
// Now we'll try to create (update) the whole GUI session. |
// Now we'll try to create (update) the whole GUI session. |
673 |
updateSession(); |
updateSession(); |
674 |
|
|
675 |
|
// We're fornerly done. |
676 |
|
QApplication::restoreOverrideCursor(); |
677 |
|
|
678 |
// Have we any errors? |
// Have we any errors? |
679 |
if (iErrors > 0) |
if (iErrors > 0) |
680 |
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
714 |
return false; |
return false; |
715 |
} |
} |
716 |
|
|
717 |
|
// Tell the world we'll take some time... |
718 |
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
719 |
|
|
720 |
// Write the file. |
// Write the file. |
721 |
int iErrors = 0; |
int iErrors = 0; |
722 |
QTextStream ts(&file); |
QTextStream ts(&file); |
870 |
if (pInstrInfo->name) |
if (pInstrInfo->name) |
871 |
ts << " '" << pInstrInfo->name << "'"; |
ts << " '" << pInstrInfo->name << "'"; |
872 |
ts << endl; |
ts << endl; |
873 |
|
} // Check for errors... |
874 |
|
else if (::lscp_client_get_errno(m_pClient)) { |
875 |
|
appendMessagesClient("lscp_get_midi_instrument_info"); |
876 |
|
iErrors++; |
877 |
} |
} |
878 |
// MIDI device index/id mapping. |
// MIDI device index/id mapping. |
879 |
midiInstrumentMap[iMidiMap] = iMap; |
midiInstrumentMap[iMidiMap] = iMap; |
880 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
881 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
882 |
} |
} |
883 |
|
// Check for errors... |
884 |
if (pInstrs) |
if (pInstrs) |
885 |
ts << endl; |
ts << endl; |
886 |
|
else if (::lscp_client_get_errno(m_pClient)) { |
887 |
|
appendMessagesClient("lscp_list_midi_instruments"); |
888 |
|
iErrors++; |
889 |
|
} |
890 |
|
} |
891 |
|
// Check for errors... |
892 |
|
if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) { |
893 |
|
appendMessagesClient("lscp_list_midi_instrument_maps"); |
894 |
|
iErrors++; |
895 |
} |
} |
896 |
#endif // CONFIG_MIDI_INSTRUMENT |
#endif // CONFIG_MIDI_INSTRUMENT |
897 |
|
|
960 |
// Ok. we've wrote it. |
// Ok. we've wrote it. |
961 |
file.close(); |
file.close(); |
962 |
|
|
963 |
|
// We're fornerly done. |
964 |
|
QApplication::restoreOverrideCursor(); |
965 |
|
|
966 |
// Have we any errors? |
// Have we any errors? |
967 |
if (iErrors > 0) |
if (iErrors > 0) |
968 |
appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename)); |
1627 |
appendMessagesClient("lscp_list_channels"); |
appendMessagesClient("lscp_list_channels"); |
1628 |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
1629 |
} |
} |
1630 |
return; |
} else { |
1631 |
|
// Try to (re)create each channel. |
1632 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1633 |
|
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
1634 |
|
// Check if theres already a channel strip for this one... |
1635 |
|
if (!channelStrip(piChannelIDs[iChannel])) |
1636 |
|
createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel])); |
1637 |
|
} |
1638 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1639 |
} |
} |
1640 |
|
|
1641 |
// Try to (re)create each channel. |
// Do we auto-arrange? |
1642 |
m_pWorkspace->setUpdatesEnabled(false); |
if (m_pOptions && m_pOptions->bAutoArrange) |
1643 |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
channelsArrange(); |
|
// Check if theres already a channel strip for this one... |
|
|
if (!channelStrip(piChannelIDs[iChannel])) |
|
|
createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel])); |
|
|
// Make it visibly responsive... |
|
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
|
|
} |
|
|
m_pWorkspace->setUpdatesEnabled(true); |
|
1644 |
|
|
1645 |
// Remember to refresh devices and instruments... |
// Remember to refresh devices and instruments... |
1646 |
if (m_pInstrumentListForm) |
if (m_pInstrumentListForm) |
1817 |
|
|
1818 |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
1819 |
|
|
1820 |
|
// Make it look responsive...:) |
1821 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1822 |
|
|
1823 |
QMessageBox::critical(this, |
QMessageBox::critical(this, |
1824 |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
1825 |
} |
} |
1834 |
appendMessagesColor(s + QString(": %1 (errno=%2)") |
appendMessagesColor(s + QString(": %1 (errno=%2)") |
1835 |
.arg(::lscp_client_get_result(m_pClient)) |
.arg(::lscp_client_get_result(m_pClient)) |
1836 |
.arg(::lscp_client_get_errno(m_pClient)), "#996666"); |
.arg(::lscp_client_get_errno(m_pClient)), "#996666"); |
1837 |
|
|
1838 |
|
// Make it look responsive...:) |
1839 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1840 |
} |
} |
1841 |
|
|
1842 |
|
|