41 |
#include "qsamplerMessages.h" |
#include "qsamplerMessages.h" |
42 |
|
|
43 |
#include "qsamplerChannelStrip.h" |
#include "qsamplerChannelStrip.h" |
44 |
|
|
45 |
|
#include "qsamplerDeviceForm.h" |
46 |
#include "qsamplerOptionsForm.h" |
#include "qsamplerOptionsForm.h" |
47 |
|
|
48 |
#include "config.h" |
#include "config.h" |
107 |
m_pOptions = NULL; |
m_pOptions = NULL; |
108 |
|
|
109 |
// All child forms are to be created later, not earlier than setup. |
// All child forms are to be created later, not earlier than setup. |
110 |
m_pMessages = NULL; |
m_pMessages = NULL; |
111 |
|
m_pDeviceForm = NULL; |
112 |
|
|
113 |
// We'll start clean. |
// We'll start clean. |
114 |
m_iUntitled = 0; |
m_iUntitled = 0; |
141 |
pLabel = new QLabel(tr("Connected"), this); |
pLabel = new QLabel(tr("Connected"), this); |
142 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
143 |
pLabel->setMinimumSize(pLabel->sizeHint()); |
pLabel->setMinimumSize(pLabel->sizeHint()); |
144 |
m_status[QSAMPLER_STATUS_CLIENT] = pLabel; |
m_statusItem[QSAMPLER_STATUS_CLIENT] = pLabel; |
145 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
146 |
// Server address. |
// Server address. |
147 |
pLabel = new QLabel(this); |
pLabel = new QLabel(this); |
148 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
149 |
m_status[QSAMPLER_STATUS_SERVER] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SERVER] = pLabel; |
150 |
statusBar()->addWidget(pLabel, 1); |
statusBar()->addWidget(pLabel, 1); |
151 |
// Channel title. |
// Channel title. |
152 |
pLabel = new QLabel(this); |
pLabel = new QLabel(this); |
153 |
pLabel->setAlignment(Qt::AlignLeft); |
pLabel->setAlignment(Qt::AlignLeft); |
154 |
m_status[QSAMPLER_STATUS_CHANNEL] = pLabel; |
m_statusItem[QSAMPLER_STATUS_CHANNEL] = pLabel; |
155 |
statusBar()->addWidget(pLabel, 2); |
statusBar()->addWidget(pLabel, 2); |
156 |
// Session modification status. |
// Session modification status. |
157 |
pLabel = new QLabel(tr("MOD"), this); |
pLabel = new QLabel(tr("MOD"), this); |
158 |
pLabel->setAlignment(Qt::AlignHCenter); |
pLabel->setAlignment(Qt::AlignHCenter); |
159 |
pLabel->setMinimumSize(pLabel->sizeHint()); |
pLabel->setMinimumSize(pLabel->sizeHint()); |
160 |
m_status[QSAMPLER_STATUS_SESSION] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
161 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
162 |
|
|
163 |
// Create the recent files sub-menu. |
// Create the recent files sub-menu. |
176 |
{ |
{ |
177 |
// Do final processing anyway. |
// Do final processing anyway. |
178 |
processServerExit(); |
processServerExit(); |
179 |
|
|
180 |
// Delete recentfiles menu. |
#if defined(WIN32) |
181 |
if (m_pRecentFilesMenu) |
WSACleanup(); |
182 |
delete m_pRecentFilesMenu; |
#endif |
|
// Delete status item labels one by one. |
|
|
if (m_status[QSAMPLER_STATUS_CLIENT]) |
|
|
delete m_status[QSAMPLER_STATUS_CLIENT]; |
|
|
if (m_status[QSAMPLER_STATUS_SERVER]) |
|
|
delete m_status[QSAMPLER_STATUS_SERVER]; |
|
|
if (m_status[QSAMPLER_STATUS_CHANNEL]) |
|
|
delete m_status[QSAMPLER_STATUS_CHANNEL]; |
|
|
if (m_status[QSAMPLER_STATUS_SESSION]) |
|
|
delete m_status[QSAMPLER_STATUS_SESSION]; |
|
183 |
|
|
184 |
// Finally drop any widgets around... |
// Finally drop any widgets around... |
185 |
|
if (m_pDeviceForm) |
186 |
|
delete m_pDeviceForm; |
187 |
if (m_pMessages) |
if (m_pMessages) |
188 |
delete m_pMessages; |
delete m_pMessages; |
189 |
if (m_pWorkspace) |
if (m_pWorkspace) |
190 |
delete m_pWorkspace; |
delete m_pWorkspace; |
191 |
|
|
192 |
#if defined(WIN32) |
// Delete status item labels one by one. |
193 |
WSACleanup(); |
if (m_statusItem[QSAMPLER_STATUS_CLIENT]) |
194 |
#endif |
delete m_statusItem[QSAMPLER_STATUS_CLIENT]; |
195 |
|
if (m_statusItem[QSAMPLER_STATUS_SERVER]) |
196 |
|
delete m_statusItem[QSAMPLER_STATUS_SERVER]; |
197 |
|
if (m_statusItem[QSAMPLER_STATUS_CHANNEL]) |
198 |
|
delete m_statusItem[QSAMPLER_STATUS_CHANNEL]; |
199 |
|
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
200 |
|
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
201 |
|
|
202 |
|
// Delete recentfiles menu. |
203 |
|
if (m_pRecentFilesMenu) |
204 |
|
delete m_pRecentFilesMenu; |
205 |
} |
} |
206 |
|
|
207 |
|
|
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, 0, wflags); |
221 |
// Set message defaults... |
// Set message defaults... |
222 |
updateMessagesFont(); |
updateMessagesFont(); |
223 |
updateMessagesLimit(); |
updateMessagesLimit(); |
246 |
QTextIStream istr(&sDockables); |
QTextIStream istr(&sDockables); |
247 |
istr >> *this; |
istr >> *this; |
248 |
} |
} |
249 |
// Try to restore old window positioning. |
// Try to restore old window positioning and initial visibility. |
250 |
m_pOptions->loadWidgetGeometry(this); |
m_pOptions->loadWidgetGeometry(this); |
251 |
|
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
252 |
|
|
253 |
// Final startup stabilization... |
// Final startup stabilization... |
254 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
286 |
QTextOStream ostr(&sDockables); |
QTextOStream ostr(&sDockables); |
287 |
ostr << *this; |
ostr << *this; |
288 |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
289 |
// And the main windows state. |
// And the children, and the main windows state,. |
290 |
|
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
291 |
m_pOptions->saveWidgetGeometry(this); |
m_pOptions->saveWidgetGeometry(this); |
292 |
|
// Close popup widgets. |
293 |
|
if (m_pDeviceForm) |
294 |
|
m_pDeviceForm->close(); |
295 |
// Stop client and/or server, gracefully. |
// Stop client and/or server, gracefully. |
296 |
stopServer(); |
stopServer(); |
297 |
} |
} |
598 |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
599 |
appendMessagesClient("lscp_client_query"); |
appendMessagesClient("lscp_client_query"); |
600 |
iErrors++; |
iErrors++; |
|
break; |
|
601 |
} |
} |
602 |
} |
} |
603 |
// Try to make it snappy :) |
// Try to make it snappy :) |
607 |
// Ok. we've read it. |
// Ok. we've read it. |
608 |
file.close(); |
file.close(); |
609 |
|
|
|
// Have we any errors? |
|
|
if (iErrors > 0) |
|
|
appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
|
|
|
|
610 |
// Now we'll try to create (update) the whole GUI session. |
// Now we'll try to create (update) the whole GUI session. |
611 |
updateSession(); |
updateSession(); |
612 |
|
|
613 |
|
// Have we any errors? |
614 |
|
if (iErrors > 0) |
615 |
|
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
616 |
|
|
617 |
// Save as default session directory. |
// Save as default session directory. |
618 |
if (m_pOptions) |
if (m_pOptions) |
619 |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
620 |
// We're not dirty anymore. |
// We're not dirty anymore, if loaded without errors, |
621 |
m_iDirtyCount = 0; |
m_iDirtyCount = iErrors; |
622 |
// Stabilize form... |
// Stabilize form... |
623 |
m_sFilename = sFilename; |
m_sFilename = sFilename; |
624 |
updateRecentFiles(sFilename); |
updateRecentFiles(sFilename); |
641 |
} |
} |
642 |
|
|
643 |
// Write the file. |
// Write the file. |
644 |
int iErrors = 0; |
int iErrors = 0; |
645 |
QTextStream ts(&file); |
QTextStream ts(&file); |
646 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
647 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") |
652 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
653 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
654 |
ts << "# " << tr("Date") |
ts << "# " << tr("Date") |
655 |
<< ": " << QDate::currentDate().toString("MMMM dd yyyy") |
<< ": " << QDate::currentDate().toString("MMM dd yyyy") |
656 |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
657 |
ts << "#" << endl; |
ts << "#" << endl; |
658 |
ts << endl; |
ts << endl; |
659 |
|
// It is assumed that this new kind of device+session file |
660 |
|
// will be loaded from a complete |
661 |
|
int *piDeviceIDs; |
662 |
|
int iDevice; |
663 |
|
ts << "RESET" << endl; |
664 |
|
// Audio device mapping. |
665 |
|
QMap<int, int> audioDeviceMap; |
666 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
667 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
668 |
|
ts << endl; |
669 |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
670 |
|
// Audio device specification... |
671 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
672 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
673 |
|
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
674 |
|
qsamplerDeviceParamMap::ConstIterator deviceParam; |
675 |
|
for (deviceParam = device.params().begin(); |
676 |
|
deviceParam != device.params().end(); |
677 |
|
++deviceParam) { |
678 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
679 |
|
if (!param.fix && !param.value.isEmpty()) |
680 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
681 |
|
} |
682 |
|
ts << endl; |
683 |
|
// Audio channel parameters... |
684 |
|
int iPort = 0; |
685 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
686 |
|
pPort; |
687 |
|
pPort = device.ports().next(), ++iPort) { |
688 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
689 |
|
for (portParam = pPort->params().begin(); |
690 |
|
portParam != pPort->params().end(); |
691 |
|
++portParam) { |
692 |
|
const qsamplerDeviceParam& param = portParam.data(); |
693 |
|
if (!param.fix && !param.value.isEmpty()) { |
694 |
|
ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice |
695 |
|
<< " " << iPort << " " << portParam.key() |
696 |
|
<< "='" << param.value << "'" << endl; |
697 |
|
} |
698 |
|
} |
699 |
|
} |
700 |
|
// Audio device index/id mapping. |
701 |
|
audioDeviceMap[device.deviceID()] = iDevice; |
702 |
|
// Try to keep it snappy :) |
703 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
704 |
|
} |
705 |
|
// MIDI device mapping. |
706 |
|
QMap<int, int> midiDeviceMap; |
707 |
|
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
708 |
|
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
709 |
|
ts << endl; |
710 |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
711 |
|
// MIDI device specification... |
712 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
713 |
|
<< " " << tr("Device") << " " << iDevice << endl; |
714 |
|
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
715 |
|
qsamplerDeviceParamMap::ConstIterator deviceParam; |
716 |
|
for (deviceParam = device.params().begin(); |
717 |
|
deviceParam != device.params().end(); |
718 |
|
++deviceParam) { |
719 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
720 |
|
if (!param.fix && !param.value.isEmpty()) |
721 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
722 |
|
} |
723 |
|
ts << endl; |
724 |
|
// MIDI port parameters... |
725 |
|
int iPort = 0; |
726 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
727 |
|
pPort; |
728 |
|
pPort = device.ports().next(), ++iPort) { |
729 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
730 |
|
for (portParam = pPort->params().begin(); |
731 |
|
portParam != pPort->params().end(); |
732 |
|
++portParam) { |
733 |
|
const qsamplerDeviceParam& param = portParam.data(); |
734 |
|
if (!param.fix && !param.value.isEmpty()) { |
735 |
|
ts << "SET MIDI_INPUT_CHANNEL_PARAMETER " << iDevice |
736 |
|
<< " " << iPort << " " << portParam.key() |
737 |
|
<< "='" << param.value << "'" << endl; |
738 |
|
} |
739 |
|
} |
740 |
|
} |
741 |
|
// MIDI device index/id mapping. |
742 |
|
midiDeviceMap[device.deviceID()] = iDevice; |
743 |
|
// Try to keep it snappy :) |
744 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
745 |
|
} |
746 |
|
ts << endl; |
747 |
|
// Sampler channel mapping. |
748 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
749 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
750 |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
751 |
if (pChannelStrip) { |
if (pChannelStrip) { |
752 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
753 |
if (pChannel) { |
if (pChannel) { |
754 |
ts << "# Channel " << iChannel << endl; |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
755 |
ts << "ADD CHANNEL" << endl; |
ts << "ADD CHANNEL" << endl; |
756 |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel << " " << pChannel->audioDriver() << endl; |
if (audioDeviceMap.isEmpty()) { |
757 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel << " " << pChannel->midiDriver() << endl; |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel |
758 |
// ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel << " " << pChannel->midiPort() << endl; |
<< " " << pChannel->audioDriver() << endl; |
759 |
|
} else { |
760 |
|
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel |
761 |
|
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
762 |
|
} |
763 |
|
if (midiDeviceMap.isEmpty()) { |
764 |
|
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel |
765 |
|
<< " " << pChannel->midiDriver() << endl; |
766 |
|
} else { |
767 |
|
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel |
768 |
|
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
769 |
|
} |
770 |
|
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel |
771 |
|
<< " " << pChannel->midiPort() << endl; |
772 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
773 |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
774 |
ts << "ALL"; |
ts << "ALL"; |
806 |
} |
} |
807 |
|
|
808 |
|
|
809 |
|
// Session change receiver slot. |
810 |
|
void qsamplerMainForm::sessionDirty (void) |
811 |
|
{ |
812 |
|
// Just mark the dirty form. |
813 |
|
m_iDirtyCount++; |
814 |
|
// and update the form status... |
815 |
|
stabilizeForm(); |
816 |
|
} |
817 |
|
|
818 |
|
|
819 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
820 |
// qsamplerMainForm -- File Action slots. |
// qsamplerMainForm -- File Action slots. |
821 |
|
|
1103 |
} |
} |
1104 |
|
|
1105 |
|
|
1106 |
|
// Show/hide the device configurator form. |
1107 |
|
void qsamplerMainForm::viewDevices (void) |
1108 |
|
{ |
1109 |
|
if (m_pOptions == NULL) |
1110 |
|
return; |
1111 |
|
|
1112 |
|
if (m_pDeviceForm) { |
1113 |
|
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
1114 |
|
m_pDeviceForm->setClient(m_pClient); |
1115 |
|
if (m_pDeviceForm->isVisible()) { |
1116 |
|
m_pDeviceForm->hide(); |
1117 |
|
} else { |
1118 |
|
m_pDeviceForm->show(); |
1119 |
|
m_pDeviceForm->raise(); |
1120 |
|
m_pDeviceForm->setActiveWindow(); |
1121 |
|
} |
1122 |
|
} |
1123 |
|
} |
1124 |
|
|
1125 |
|
|
1126 |
// Show options dialog. |
// Show options dialog. |
1127 |
void qsamplerMainForm::viewOptions (void) |
void qsamplerMainForm::viewOptions (void) |
1128 |
{ |
{ |
1147 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1148 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1149 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
1150 |
|
bool bOldKeepOnTop = m_pOptions->bKeepOnTop; |
1151 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
1152 |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
1153 |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
1160 |
if (pOptionsForm->exec()) { |
if (pOptionsForm->exec()) { |
1161 |
// Warn if something will be only effective on next run. |
// Warn if something will be only effective on next run. |
1162 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1163 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture)) { |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1164 |
|
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1165 |
|
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
1166 |
QMessageBox::information(this, tr("Information"), |
QMessageBox::information(this, tr("Information"), |
1167 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1168 |
"next time you start this program."), tr("OK")); |
"next time you start this program."), tr("OK")); |
1318 |
void qsamplerMainForm::stabilizeForm (void) |
void qsamplerMainForm::stabilizeForm (void) |
1319 |
{ |
{ |
1320 |
// Update the main application caption... |
// Update the main application caption... |
1321 |
QString sSessioName = sessionName(m_sFilename); |
QString sSessionName = sessionName(m_sFilename); |
1322 |
if (m_iDirtyCount > 0) |
if (m_iDirtyCount > 0) |
1323 |
sSessioName += '*'; |
sSessionName += '*'; |
1324 |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName)); |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
1325 |
|
|
1326 |
// Update the main menu state... |
// Update the main menu state... |
1327 |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1338 |
editSetupChannelAction->setEnabled(bHasChannel); |
editSetupChannelAction->setEnabled(bHasChannel); |
1339 |
editResetChannelAction->setEnabled(bHasChannel); |
editResetChannelAction->setEnabled(bHasChannel); |
1340 |
editResetAllChannelsAction->setEnabled(bHasChannel); |
editResetAllChannelsAction->setEnabled(bHasChannel); |
|
channelsArrangeAction->setEnabled(bHasChannel); |
|
1341 |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
1342 |
|
viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible()); |
1343 |
|
viewDevicesAction->setEnabled(bHasClient); |
1344 |
|
channelsArrangeAction->setEnabled(bHasChannel); |
1345 |
|
|
1346 |
// Client/Server status... |
// Client/Server status... |
1347 |
if (bHasClient) { |
if (bHasClient) { |
1348 |
m_status[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
1349 |
m_status[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort)); |
m_statusItem[QSAMPLER_STATUS_SERVER]->setText(m_pOptions->sServerHost + ":" + QString::number(m_pOptions->iServerPort)); |
1350 |
} else { |
} else { |
1351 |
m_status[QSAMPLER_STATUS_CLIENT]->clear(); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->clear(); |
1352 |
m_status[QSAMPLER_STATUS_SERVER]->clear(); |
m_statusItem[QSAMPLER_STATUS_SERVER]->clear(); |
1353 |
} |
} |
1354 |
// Channel status... |
// Channel status... |
1355 |
if (bHasChannel) |
if (bHasChannel) |
1356 |
m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption()); |
m_statusItem[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption()); |
1357 |
else |
else |
1358 |
m_status[QSAMPLER_STATUS_CHANNEL]->clear(); |
m_statusItem[QSAMPLER_STATUS_CHANNEL]->clear(); |
1359 |
// Session status... |
// Session status... |
1360 |
if (m_iDirtyCount > 0) |
if (m_iDirtyCount > 0) |
1361 |
m_status[QSAMPLER_STATUS_SESSION]->setText(tr("MOD")); |
m_statusItem[QSAMPLER_STATUS_SESSION]->setText(tr("MOD")); |
1362 |
else |
else |
1363 |
m_status[QSAMPLER_STATUS_SESSION]->clear(); |
m_statusItem[QSAMPLER_STATUS_SESSION]->clear(); |
1364 |
|
|
1365 |
// Recent files menu. |
// Recent files menu. |
1366 |
m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0); |
m_pRecentFilesMenu->setEnabled(bHasClient && m_pOptions->recentFiles.count() > 0); |
1408 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1409 |
} |
} |
1410 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1411 |
|
|
1412 |
|
// Remember to refresh devices |
1413 |
|
if (m_pDeviceForm) |
1414 |
|
m_pDeviceForm->refreshDevices(); |
1415 |
} |
} |
1416 |
|
|
1417 |
|
|
2017 |
// Log success here. |
// Log success here. |
2018 |
appendMessages(tr("Client connected.")); |
appendMessages(tr("Client connected.")); |
2019 |
|
|
2020 |
|
// Hard-notify device configuration form, |
2021 |
|
// if visible, that we're ready... |
2022 |
|
if (m_pDeviceForm && m_pDeviceForm->isVisible()) |
2023 |
|
m_pDeviceForm->setClient(m_pClient); |
2024 |
|
|
2025 |
// Is any session pending to be loaded? |
// Is any session pending to be loaded? |
2026 |
if (!m_pOptions->sSessionFile.isEmpty()) { |
if (!m_pOptions->sSessionFile.isEmpty()) { |
2027 |
// Just load the prabably startup session... |
// Just load the prabably startup session... |
2042 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
2043 |
return; |
return; |
2044 |
|
|
2045 |
|
// Hard-notify device configuration form, |
2046 |
|
// if visible, that we're running out... |
2047 |
|
if (m_pDeviceForm && m_pDeviceForm->isVisible()) |
2048 |
|
m_pDeviceForm->setClient(NULL); |
2049 |
|
|
2050 |
// Log prepare here. |
// Log prepare here. |
2051 |
appendMessages(tr("Client disconnecting...")); |
appendMessages(tr("Client disconnecting...")); |
2052 |
|
|