1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2014, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007, 2008 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
65 |
#if QT_VERSION < 0x040500 |
#if QT_VERSION < 0x040500 |
66 |
namespace Qt { |
namespace Qt { |
67 |
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
|
#if QT_VERSION < 0x040200 |
|
|
const WindowFlags CustomizeWindowHint = WindowFlags(0x02000000); |
|
|
#endif |
|
68 |
} |
} |
69 |
#endif |
#endif |
70 |
|
|
254 |
QObject::connect(m_pVolumeSlider, |
QObject::connect(m_pVolumeSlider, |
255 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
256 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
|
//m_ui.channelsToolbar->setHorizontallyStretchable(true); |
|
|
//m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider); |
|
257 |
m_ui.channelsToolbar->addWidget(m_pVolumeSlider); |
m_ui.channelsToolbar->addWidget(m_pVolumeSlider); |
258 |
// Volume spin-box |
// Volume spin-box |
259 |
m_ui.channelsToolbar->addSeparator(); |
m_ui.channelsToolbar->addSeparator(); |
260 |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
|
m_pVolumeSpinBox->setMaximumHeight(24); |
|
261 |
m_pVolumeSpinBox->setSuffix(" %"); |
m_pVolumeSpinBox->setSuffix(" %"); |
262 |
m_pVolumeSpinBox->setMinimum(0); |
m_pVolumeSpinBox->setMinimum(0); |
263 |
m_pVolumeSpinBox->setMaximum(100); |
m_pVolumeSpinBox->setMaximum(100); |
270 |
|
|
271 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
272 |
m_pWorkspace = new QMdiArea(this); |
m_pWorkspace = new QMdiArea(this); |
273 |
|
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
274 |
|
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
275 |
// Set the activation connection. |
// Set the activation connection. |
276 |
QObject::connect(m_pWorkspace, |
QObject::connect(m_pWorkspace, |
277 |
SIGNAL(subWindowActivated(QMdiSubWindow *)), |
SIGNAL(subWindowActivated(QMdiSubWindow *)), |
392 |
QObject::connect(m_ui.channelsMenu, |
QObject::connect(m_ui.channelsMenu, |
393 |
SIGNAL(aboutToShow()), |
SIGNAL(aboutToShow()), |
394 |
SLOT(channelsMenuAboutToShow())); |
SLOT(channelsMenuAboutToShow())); |
395 |
|
#ifdef CONFIG_VOLUME |
396 |
|
QObject::connect(m_ui.channelsToolbar, |
397 |
|
SIGNAL(orientationChanged(Qt::Orientation)), |
398 |
|
SLOT(channelsToolbarOrientation(Qt::Orientation))); |
399 |
|
#endif |
400 |
} |
} |
401 |
|
|
402 |
// Destructor. |
// Destructor. |
908 |
pChannel->removeChannel(); |
pChannel->removeChannel(); |
909 |
delete pChannelStrip; |
delete pChannelStrip; |
910 |
} |
} |
911 |
|
if (pMdiSubWindow) |
912 |
|
delete pMdiSubWindow; |
913 |
} |
} |
914 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
915 |
// We're now clean, for sure. |
// We're now clean, for sure. |
1253 |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
1254 |
if (pChannel->channelSolo()) |
if (pChannel->channelSolo()) |
1255 |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
1256 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1257 |
if (pChannel->midiMap() >= 0) { |
if (pChannel->midiMap() >= 0) { |
1258 |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
1259 |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
1260 |
} |
} |
1261 |
#endif |
#endif |
1262 |
#ifdef CONFIG_FXSEND |
#ifdef CONFIG_FXSEND |
1263 |
int iChannelID = pChannel->channelID(); |
int iChannelID = pChannel->channelID(); |
1264 |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
1265 |
for (int iFxSend = 0; |
for (int iFxSend = 0; |
1283 |
<< " " << iAudioSrc |
<< " " << iAudioSrc |
1284 |
<< " " << piRouting[iAudioSrc] << endl; |
<< " " << piRouting[iAudioSrc] << endl; |
1285 |
} |
} |
1286 |
#ifdef CONFIG_FXSEND_LEVEL |
#ifdef CONFIG_FXSEND_LEVEL |
1287 |
ts << "SET FX_SEND LEVEL " << iChannel |
ts << "SET FX_SEND LEVEL " << iChannel |
1288 |
<< " " << iFxSend |
<< " " << iFxSend |
1289 |
<< " " << pFxSendInfo->level << endl; |
<< " " << pFxSendInfo->level << endl; |
1290 |
#endif |
#endif |
1291 |
} // Check for errors... |
} // Check for errors... |
1292 |
else if (::lscp_client_get_errno(m_pClient)) { |
else if (::lscp_client_get_errno(m_pClient)) { |
1293 |
appendMessagesClient("lscp_get_fxsend_info"); |
appendMessagesClient("lscp_get_fxsend_info"); |
1294 |
iErrors++; |
iErrors++; |
1295 |
} |
} |
1296 |
} |
} |
1297 |
#endif |
#endif |
1298 |
ts << endl; |
ts << endl; |
1299 |
} |
} |
1300 |
} |
} |
1544 |
if (!pChannel->removeChannel()) |
if (!pChannel->removeChannel()) |
1545 |
return; |
return; |
1546 |
|
|
|
// Just delete the channel strip. |
|
|
delete pChannelStrip; |
|
|
|
|
|
// Do we auto-arrange? |
|
|
if (m_pOptions && m_pOptions->bAutoArrange) |
|
|
channelsArrange(); |
|
|
|
|
1547 |
// We'll be dirty, for sure... |
// We'll be dirty, for sure... |
1548 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1549 |
stabilizeForm(); |
|
1550 |
|
// Just delete the channel strip. |
1551 |
|
destroyChannelStrip(pChannelStrip); |
1552 |
} |
} |
1553 |
|
|
1554 |
|
|
2445 |
} |
} |
2446 |
|
|
2447 |
// Add it to workspace... |
// Add it to workspace... |
2448 |
m_pWorkspace->addSubWindow(pChannelStrip, Qt::FramelessWindowHint); |
m_pWorkspace->addSubWindow(pChannelStrip, |
2449 |
|
Qt::SubWindow | Qt::FramelessWindowHint); |
2450 |
|
|
2451 |
// Actual channel strip setup... |
// Actual channel strip setup... |
2452 |
pChannelStrip->setup(pChannel); |
pChannelStrip->setup(pChannel); |
2468 |
|
|
2469 |
void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) |
void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) |
2470 |
{ |
{ |
2471 |
|
QMdiSubWindow *pMdiSubWindow |
2472 |
|
= static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget()); |
2473 |
|
if (pMdiSubWindow == NULL) |
2474 |
|
return; |
2475 |
|
|
2476 |
// Just delete the channel strip. |
// Just delete the channel strip. |
2477 |
delete pChannelStrip; |
delete pChannelStrip; |
2478 |
|
delete pMdiSubWindow; |
2479 |
|
|
2480 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2481 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2694 |
|
|
2695 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2696 |
// if (m_pOptions->bStdoutCapture) { |
// if (m_pOptions->bStdoutCapture) { |
|
#if QT_VERSION >= 0x040200 |
|
2697 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
|
#endif |
|
2698 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2699 |
SIGNAL(readyReadStandardOutput()), |
SIGNAL(readyReadStandardOutput()), |
2700 |
SLOT(readServerStdout())); |
SLOT(readServerStdout())); |
2749 |
"according to your current sampler session and you could alter the\n" |
"according to your current sampler session and you could alter the\n" |
2750 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2751 |
"Do you want LinuxSampler to stop?"), |
"Do you want LinuxSampler to stop?"), |
2752 |
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) |
QMessageBox::Yes | QMessageBox::No, |
2753 |
|
QMessageBox::Yes) == QMessageBox::No) |
2754 |
{ |
{ |
2755 |
bForceServerStop = false; |
bForceServerStop = false; |
2756 |
} |
} |
2760 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && bForceServerStop) { |
2761 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2762 |
if (m_pServer->state() == QProcess::Running) { |
if (m_pServer->state() == QProcess::Running) { |
2763 |
#if defined(WIN32) |
#if defined(WIN32) |
2764 |
// Try harder... |
// Try harder... |
2765 |
m_pServer->kill(); |
m_pServer->kill(); |
2766 |
#else |
#else |
2767 |
// Try softly... |
// Try softly... |
2768 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2769 |
#endif |
#endif |
2770 |
} |
} |
2771 |
} // Do final processing anyway. |
} // Do final processing anyway. |
2772 |
else processServerExit(); |
else processServerExit(); |
3007 |
} |
} |
3008 |
|
|
3009 |
|
|
3010 |
|
// Channel toolbar orientation change. |
3011 |
|
void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation ) |
3012 |
|
{ |
3013 |
|
#ifdef CONFIG_VOLUME |
3014 |
|
m_pVolumeSlider->setOrientation(orientation); |
3015 |
|
if (orientation == Qt::Horizontal) { |
3016 |
|
m_pVolumeSlider->setMinimumHeight(24); |
3017 |
|
m_pVolumeSlider->setMaximumHeight(32); |
3018 |
|
m_pVolumeSlider->setMinimumWidth(120); |
3019 |
|
m_pVolumeSlider->setMaximumWidth(640); |
3020 |
|
m_pVolumeSpinBox->setMaximumWidth(64); |
3021 |
|
m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows); |
3022 |
|
} else { |
3023 |
|
m_pVolumeSlider->setMinimumHeight(120); |
3024 |
|
m_pVolumeSlider->setMaximumHeight(480); |
3025 |
|
m_pVolumeSlider->setMinimumWidth(24); |
3026 |
|
m_pVolumeSlider->setMaximumWidth(32); |
3027 |
|
m_pVolumeSpinBox->setMaximumWidth(32); |
3028 |
|
m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons); |
3029 |
|
} |
3030 |
|
#endif |
3031 |
|
} |
3032 |
|
|
3033 |
|
|
3034 |
} // namespace QSampler |
} // namespace QSampler |
3035 |
|
|
3036 |
|
|