211 |
// We got options? |
// We got options? |
212 |
m_pOptions = pOptions; |
m_pOptions = pOptions; |
213 |
|
|
214 |
|
// What style do we create these forms? |
215 |
|
WFlags wflags = Qt::WType_TopLevel; |
216 |
|
if (m_pOptions->bKeepOnTop) |
217 |
|
wflags |= Qt::WStyle_Tool; |
218 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
219 |
m_pMessages = new qsamplerMessages(this); |
m_pMessages = new qsamplerMessages(this); |
220 |
m_pDeviceForm = new qsamplerDeviceForm(this); |
m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags); |
221 |
// Set message defaults... |
// Set message defaults... |
222 |
updateMessagesFont(); |
updateMessagesFont(); |
223 |
updateMessagesLimit(); |
updateMessagesLimit(); |
275 |
// Some windows default fonts is here on demand too. |
// Some windows default fonts is here on demand too. |
276 |
if (bQueryClose && m_pMessages) |
if (bQueryClose && m_pMessages) |
277 |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
|
// Other windows just need asking if it can close gracefully... |
|
|
if (bQueryClose && m_pDeviceForm) |
|
|
bQueryClose = m_pDeviceForm->queryClose(); |
|
278 |
// Try to save current positioning. |
// Try to save current positioning. |
279 |
if (bQueryClose) { |
if (bQueryClose) { |
280 |
// Save decorations state. |
// Save decorations state. |
642 |
} |
} |
643 |
|
|
644 |
// Write the file. |
// Write the file. |
645 |
int iErrors = 0; |
int iErrors = 0; |
646 |
QTextStream ts(&file); |
QTextStream ts(&file); |
647 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
648 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") |
653 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
654 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
655 |
ts << "# " << tr("Date") |
ts << "# " << tr("Date") |
656 |
<< ": " << QDate::currentDate().toString("MMMM dd yyyy") |
<< ": " << QDate::currentDate().toString("MMM dd yyyy") |
657 |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
658 |
ts << "#" << endl; |
ts << "#" << endl; |
659 |
ts << endl; |
ts << endl; |
660 |
|
// It is assumed that this new kind of device+session file |
661 |
|
// will be loaded from a complete |
662 |
|
int *piDeviceIDs; |
663 |
|
int iDevice; |
664 |
|
ts << "RESET" << endl; |
665 |
|
// Audio device mapping. |
666 |
|
QMap<int, int> audioDeviceMap; |
667 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
668 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
669 |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
670 |
|
ts << endl; |
671 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
672 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
673 |
|
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
674 |
|
const qsamplerDeviceParamMap& params = device.params(); |
675 |
|
qsamplerDeviceParamMap::ConstIterator iter; |
676 |
|
for (iter = params.begin(); iter != params.end(); ++iter) |
677 |
|
ts << " " << iter.key() << "='" << iter.data().value << "'"; |
678 |
|
ts << endl; |
679 |
|
audioDeviceMap[device.deviceID()] = iDevice; |
680 |
|
// Try to keep it snappy :) |
681 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
682 |
|
} |
683 |
|
// MIDI device mapping. |
684 |
|
QMap<int, int> midiDeviceMap; |
685 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
686 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
687 |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
688 |
|
ts << endl; |
689 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
690 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
691 |
|
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
692 |
|
const qsamplerDeviceParamMap& params = device.params(); |
693 |
|
qsamplerDeviceParamMap::ConstIterator iter; |
694 |
|
for (iter = params.begin(); iter != params.end(); ++iter) |
695 |
|
ts << " " << iter.key() << "='" << iter.data().value << "'"; |
696 |
|
ts << endl; |
697 |
|
midiDeviceMap[device.deviceID()] = iDevice; |
698 |
|
// Try to keep it snappy :) |
699 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
700 |
|
} |
701 |
|
ts << endl; |
702 |
|
// Sampler channel mapping. |
703 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
704 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
705 |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
706 |
if (pChannelStrip) { |
if (pChannelStrip) { |
707 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
708 |
if (pChannel) { |
if (pChannel) { |
709 |
ts << "# Channel " << iChannel << endl; |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
710 |
ts << "ADD CHANNEL" << endl; |
ts << "ADD CHANNEL" << endl; |
711 |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel << " " << pChannel->audioDriver() << endl; |
if (audioDeviceMap.isEmpty()) { |
712 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel << " " << pChannel->midiDriver() << endl; |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel |
713 |
// ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel << " " << pChannel->midiPort() << endl; |
<< " " << pChannel->audioDriver() << endl; |
714 |
|
} else { |
715 |
|
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel |
716 |
|
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
717 |
|
} |
718 |
|
if (midiDeviceMap.isEmpty()) { |
719 |
|
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel |
720 |
|
<< " " << pChannel->midiDriver() << endl; |
721 |
|
} else { |
722 |
|
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel |
723 |
|
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
724 |
|
} |
725 |
|
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel |
726 |
|
<< " " << pChannel->midiPort() << endl; |
727 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
728 |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
729 |
ts << "ALL"; |
ts << "ALL"; |
761 |
} |
} |
762 |
|
|
763 |
|
|
764 |
|
// Session change receiver slot. |
765 |
|
void qsamplerMainForm::sessionDirty (void) |
766 |
|
{ |
767 |
|
// Just mark the dirty form. |
768 |
|
m_iDirtyCount++; |
769 |
|
// and update the form status... |
770 |
|
stabilizeForm(); |
771 |
|
} |
772 |
|
|
773 |
|
|
774 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
775 |
// qsamplerMainForm -- File Action slots. |
// qsamplerMainForm -- File Action slots. |
776 |
|
|
1102 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1103 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1104 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
1105 |
|
bool bOldKeepOnTop = m_pOptions->bKeepOnTop; |
1106 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
1107 |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
1108 |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
1115 |
if (pOptionsForm->exec()) { |
if (pOptionsForm->exec()) { |
1116 |
// Warn if something will be only effective on next run. |
// Warn if something will be only effective on next run. |
1117 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1118 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture)) { |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1119 |
|
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1120 |
|
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
1121 |
QMessageBox::information(this, tr("Information"), |
QMessageBox::information(this, tr("Information"), |
1122 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1123 |
"next time you start this program."), tr("OK")); |
"next time you start this program."), tr("OK")); |