--- qsampler/trunk/src/qsamplerMainForm.cpp 2010/07/21 18:33:25 2112 +++ qsampler/trunk/src/qsamplerMainForm.cpp 2015/01/22 19:01:32 2718 @@ -1,8 +1,8 @@ // qsamplerMainForm.cpp // /**************************************************************************** - Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved. - Copyright (C) 2007, 2008 Christian Schoenebeck + Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2007,2008,2015 Christian Schoenebeck This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -35,8 +35,10 @@ #include "qsamplerOptionsForm.h" #include "qsamplerDeviceStatusForm.h" +#include +#include + #include -#include #include #include @@ -56,12 +58,13 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + #if QT_VERSION < 0x040500 namespace Qt { const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); -#if QT_VERSION < 0x040200 -const WindowFlags CustomizeWindowHint = WindowFlags(0x02000000); -#endif } #endif @@ -96,7 +99,7 @@ //------------------------------------------------------------------------- // LADISH Level 1 support stuff. -#ifdef HAVE_SIGNAL_H +#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) #include @@ -202,7 +205,7 @@ m_iTimerSlot = 0; -#ifdef HAVE_SIGNAL_H +#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) // Set to ignore any fatal "Broken pipe" signals. ::signal(SIGPIPE, SIG_IGN); @@ -221,14 +224,14 @@ // Install SIGUSR1 signal handler. struct sigaction usr1; usr1.sa_handler = qsampler_sigusr1_handler; - ::sigemptyset(&usr1.sa_mask); + sigemptyset(&usr1.sa_mask); usr1.sa_flags = 0; usr1.sa_flags |= SA_RESTART; ::sigaction(SIGUSR1, &usr1, NULL); #else // HAVE_SIGNAL_H - m_pSocketNotifier = NULL; + m_pUsr1Notifier = NULL; #endif // !HAVE_SIGNAL_H @@ -251,13 +254,10 @@ QObject::connect(m_pVolumeSlider, SIGNAL(valueChanged(int)), SLOT(volumeChanged(int))); - //m_ui.channelsToolbar->setHorizontallyStretchable(true); - //m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider); m_ui.channelsToolbar->addWidget(m_pVolumeSlider); // Volume spin-box m_ui.channelsToolbar->addSeparator(); m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); - m_pVolumeSpinBox->setMaximumHeight(24); m_pVolumeSpinBox->setSuffix(" %"); m_pVolumeSpinBox->setMinimum(0); m_pVolumeSpinBox->setMaximum(100); @@ -269,12 +269,13 @@ #endif // Make it an MDI workspace. - m_pWorkspace = new QWorkspace(this); - m_pWorkspace->setScrollBarsEnabled(true); + m_pWorkspace = new QMdiArea(this); + m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); // Set the activation connection. QObject::connect(m_pWorkspace, - SIGNAL(windowActivated(QWidget *)), - SLOT(activateStrip(QWidget *))); + SIGNAL(subWindowActivated(QMdiSubWindow *)), + SLOT(activateStrip(QMdiSubWindow *))); // Make it shine :-) setCentralWidget(m_pWorkspace); @@ -391,6 +392,11 @@ QObject::connect(m_ui.channelsMenu, SIGNAL(aboutToShow()), SLOT(channelsMenuAboutToShow())); +#ifdef CONFIG_VOLUME + QObject::connect(m_ui.channelsToolbar, + SIGNAL(orientationChanged(Qt::Orientation)), + SLOT(channelsToolbarOrientation(Qt::Orientation))); +#endif } // Destructor. @@ -403,7 +409,7 @@ WSACleanup(); #endif -#ifdef HAVE_SIGNAL_H +#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) if (m_pUsr1Notifier) delete m_pUsr1Notifier; #endif @@ -691,10 +697,14 @@ // LADISH Level 1 -- SIGUSR1 signal handler. void MainForm::handle_sigusr1 (void) { +#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) + char c; if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0) saveSession(false); + +#endif } @@ -886,15 +896,20 @@ if (bClose) { // Remove all channel strips from sight... m_pWorkspace->setUpdatesEnabled(false); - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel); + QList wlist = m_pWorkspace->subWindowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) { Channel *pChannel = pChannelStrip->channel(); if (bForce && pChannel) pChannel->removeChannel(); delete pChannelStrip; } + if (pMdiSubWindow) + delete pMdiSubWindow; } m_pWorkspace->setUpdatesEnabled(true); // We're now clean, for sure. @@ -1185,10 +1200,12 @@ #endif // CONFIG_MIDI_INSTRUMENT // Sampler channel mapping. - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip - = static_cast (wlist.at(iChannel)); + QList wlist = m_pWorkspace->subWindowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) { Channel *pChannel = pChannelStrip->channel(); if (pChannel) { @@ -1236,13 +1253,13 @@ ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; if (pChannel->channelSolo()) ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; -#ifdef CONFIG_MIDI_INSTRUMENT + #ifdef CONFIG_MIDI_INSTRUMENT if (pChannel->midiMap() >= 0) { ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel << " " << midiInstrumentMap[pChannel->midiMap()] << endl; } -#endif -#ifdef CONFIG_FXSEND + #endif + #ifdef CONFIG_FXSEND int iChannelID = pChannel->channelID(); int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); for (int iFxSend = 0; @@ -1266,18 +1283,18 @@ << " " << iAudioSrc << " " << piRouting[iAudioSrc] << endl; } -#ifdef CONFIG_FXSEND_LEVEL + #ifdef CONFIG_FXSEND_LEVEL ts << "SET FX_SEND LEVEL " << iChannel << " " << iFxSend << " " << pFxSendInfo->level << endl; -#endif + #endif } // Check for errors... else if (::lscp_client_get_errno(m_pClient)) { appendMessagesClient("lscp_get_fxsend_info"); iErrors++; } } -#endif + #endif ts << endl; } } @@ -1502,7 +1519,7 @@ if (m_pClient == NULL) return; - ChannelStrip* pChannelStrip = activeChannelStrip(); + ChannelStrip *pChannelStrip = activeChannelStrip(); if (pChannelStrip == NULL) return; @@ -1527,16 +1544,11 @@ if (!pChannel->removeChannel()) return; - // Just delete the channel strip. - delete pChannelStrip; - - // Do we auto-arrange? - if (m_pOptions && m_pOptions->bAutoArrange) - channelsArrange(); - // We'll be dirty, for sure... m_iDirtyCount++; - stabilizeForm(); + + // Just delete the channel strip. + destroyChannelStrip(pChannelStrip); } @@ -1546,7 +1558,7 @@ if (m_pClient == NULL) return; - ChannelStrip* pChannelStrip = activeChannelStrip(); + ChannelStrip *pChannelStrip = activeChannelStrip(); if (pChannelStrip == NULL) return; @@ -1561,7 +1573,7 @@ if (m_pClient == NULL) return; - ChannelStrip* pChannelStrip = activeChannelStrip(); + ChannelStrip *pChannelStrip = activeChannelStrip(); if (pChannelStrip == NULL) return; @@ -1576,7 +1588,7 @@ if (m_pClient == NULL) return; - ChannelStrip* pChannelStrip = activeChannelStrip(); + ChannelStrip *pChannelStrip = activeChannelStrip(); if (pChannelStrip == NULL) return; @@ -1594,9 +1606,12 @@ // Invoque the channel strip procedure, // for all channels out there... m_pWorkspace->setUpdatesEnabled(false); - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); + QList wlist = m_pWorkspace->subWindowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) pChannelStrip->channelReset(); } @@ -1699,7 +1714,7 @@ OptionsForm* pOptionsForm = new OptionsForm(this); if (pOptionsForm) { // Check out some initial nullities(tm)... - ChannelStrip* pChannelStrip = activeChannelStrip(); + ChannelStrip *pChannelStrip = activeChannelStrip(); if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip) m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString(); if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) @@ -1792,28 +1807,33 @@ void MainForm::channelsArrange (void) { // Full width vertical tiling - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return; m_pWorkspace->setUpdatesEnabled(false); int y = 0; - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); - /* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { - // Prevent flicker... - pChannelStrip->hide(); - pChannelStrip->showNormal(); - } */ - pChannelStrip->adjustSize(); - int iWidth = m_pWorkspace->width(); - if (iWidth < pChannelStrip->width()) - iWidth = pChannelStrip->width(); - // int iHeight = pChannelStrip->height() - // + pChannelStrip->parentWidget()->baseSize().height(); - int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); - pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); - y += iHeight; + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); + if (pChannelStrip) { + /* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { + // Prevent flicker... + pChannelStrip->hide(); + pChannelStrip->showNormal(); + } */ + pChannelStrip->adjustSize(); + int iWidth = m_pWorkspace->width(); + if (iWidth < pChannelStrip->width()) + iWidth = pChannelStrip->width(); + // int iHeight = pChannelStrip->height() + // + pChannelStrip->parentWidget()->baseSize().height(); + int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); + pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); + y += iHeight; + } } m_pWorkspace->setUpdatesEnabled(true); @@ -1958,7 +1978,7 @@ ChannelStrip *pChannelStrip = activeChannelStrip(); bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); bool bHasChannel = (bHasClient && pChannelStrip != NULL); - bool bHasChannels = (bHasClient && m_pWorkspace->windowList().count() > 0); + bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0); m_ui.fileNewAction->setEnabled(bHasClient); m_ui.fileOpenAction->setEnabled(bHasClient); m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); @@ -2054,7 +2074,7 @@ // Channel change receiver slot. -void MainForm::channelStripChanged(ChannelStrip* pChannelStrip) +void MainForm::channelStripChanged ( ChannelStrip *pChannelStrip ) { // Add this strip to the changed list... if (!m_changedStrips.contains(pChannelStrip)) { @@ -2105,7 +2125,9 @@ m_pDeviceForm->refreshDevices(); } -void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) { + +void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips ) +{ // Retrieve the current channel list. int *piChannelIDs = ::lscp_list_channels(m_pClient); if (piChannelIDs == NULL) { @@ -2117,38 +2139,45 @@ } else { // Try to (re)create each channel. m_pWorkspace->setUpdatesEnabled(false); - for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { + for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) { // Check if theres already a channel strip for this one... if (!channelStrip(piChannelIDs[iChannel])) createChannelStrip(new Channel(piChannelIDs[iChannel])); } - // Do we auto-arrange? if (m_pOptions && m_pOptions->bAutoArrange) channelsArrange(); - - stabilizeForm(); - // remove dead channel strips if (bRemoveDeadStrips) { - for (int i = 0; channelStripAt(i); ++i) { - ChannelStrip* pChannelStrip = channelStripAt(i); - bool bExists = false; - for (int j = 0; piChannelIDs[j] >= 0; ++j) { - if (!pChannelStrip->channel()) break; - if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { - // strip exists, don't touch it - bExists = true; - break; + QList wlist = m_pWorkspace->subWindowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); + if (pChannelStrip) { + bool bExists = false; + for (int j = 0; piChannelIDs[j] >= 0; ++j) { + if (!pChannelStrip->channel()) + break; + if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { + // strip exists, don't touch it + bExists = true; + break; + } } + if (!bExists) + destroyChannelStrip(pChannelStrip); } - if (!bExists) destroyChannelStrip(pChannelStrip); } } m_pWorkspace->setUpdatesEnabled(true); } + + stabilizeForm(); } + // Update the recent files list and menu. void MainForm::updateRecentFiles ( const QString& sFilename ) { @@ -2195,12 +2224,12 @@ void MainForm::updateInstrumentNames (void) { // Full channel list update... - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return; m_pWorkspace->setUpdatesEnabled(false); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel); if (pChannelStrip) pChannelStrip->updateInstrumentName(true); @@ -2224,13 +2253,16 @@ return; // Full channel list update... - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return; m_pWorkspace->setUpdatesEnabled(false); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) pChannelStrip->setDisplayFont(font); } @@ -2242,13 +2274,16 @@ void MainForm::updateDisplayEffect (void) { // Full channel list update... - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return; m_pWorkspace->setUpdatesEnabled(false); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); } @@ -2270,13 +2305,16 @@ #endif // Full channel list update... - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return; m_pWorkspace->setUpdatesEnabled(false); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); } @@ -2384,7 +2422,7 @@ // qsamplerMainForm -- MDI channel strip management. // The channel strip creation executive. -ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel ) +ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) { if (m_pClient == NULL || pChannel == NULL) return NULL; @@ -2407,14 +2445,15 @@ } // Add it to workspace... - m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint); + m_pWorkspace->addSubWindow(pChannelStrip, + Qt::SubWindow | Qt::FramelessWindowHint); // Actual channel strip setup... pChannelStrip->setup(pChannel); QObject::connect(pChannelStrip, - SIGNAL(channelChanged(ChannelStrip*)), - SLOT(channelStripChanged(ChannelStrip*))); + SIGNAL(channelChanged(ChannelStrip *)), + SLOT(channelStripChanged(ChannelStrip *))); // Now we show up us to the world. pChannelStrip->show(); @@ -2426,9 +2465,17 @@ return pChannelStrip; } -void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) { + +void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) +{ + QMdiSubWindow *pMdiSubWindow + = static_cast (pChannelStrip->parentWidget()); + if (pMdiSubWindow == NULL) + return; + // Just delete the channel strip. delete pChannelStrip; + delete pMdiSubWindow; // Do we auto-arrange? if (m_pOptions && m_pOptions->bAutoArrange) @@ -2437,39 +2484,50 @@ stabilizeForm(); } + // Retrieve the active channel strip. -ChannelStrip* MainForm::activeChannelStrip (void) +ChannelStrip *MainForm::activeChannelStrip (void) { - return static_cast (m_pWorkspace->activeWindow()); + QMdiSubWindow *pMdiSubWindow = m_pWorkspace->activeSubWindow(); + if (pMdiSubWindow) + return static_cast (pMdiSubWindow->widget()); + else + return NULL; } // Retrieve a channel strip by index. -ChannelStrip* MainForm::channelStripAt ( int iChannel ) +ChannelStrip *MainForm::channelStripAt ( int iChannel ) { if (!m_pWorkspace) return NULL; - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return NULL; if (iChannel < 0 || iChannel >= wlist.size()) return NULL; - return dynamic_cast (wlist.at(iChannel)); + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + return static_cast (pMdiSubWindow->widget()); + else + return NULL; } // Retrieve a channel strip by sampler channel id. -ChannelStrip* MainForm::channelStrip ( int iChannelID ) +ChannelStrip *MainForm::channelStrip ( int iChannelID ) { - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (wlist.isEmpty()) return NULL; - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip - = static_cast (wlist.at(iChannel)); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) { Channel *pChannel = pChannelStrip->channel(); if (pChannel && pChannel->channelID() == iChannelID) @@ -2489,12 +2547,14 @@ m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction); m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction); - QWidgetList wlist = m_pWorkspace->windowList(); + QList wlist = m_pWorkspace->subWindowList(); if (!wlist.isEmpty()) { m_ui.channelsMenu->addSeparator(); - for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip - = static_cast (wlist.at(iChannel)); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) { QAction *pAction = m_ui.channelsMenu->addAction( pChannelStrip->windowTitle(), @@ -2516,7 +2576,7 @@ if (pAction == NULL) return; - ChannelStrip* pChannelStrip = channelStripAt(pAction->data().toInt()); + ChannelStrip *pChannelStrip = channelStripAt(pAction->data().toInt()); if (pChannelStrip) { pChannelStrip->showNormal(); pChannelStrip->setFocus(); @@ -2577,11 +2637,12 @@ if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { m_iTimerSlot = 0; // Update the channel stream usage for each strip... - QWidgetList wlist = m_pWorkspace->windowList(); - for (int iChannel = 0; - iChannel < (int) wlist.count(); iChannel++) { - ChannelStrip* pChannelStrip - = (ChannelStrip*) wlist.at(iChannel); + QList wlist = m_pWorkspace->subWindowList(); + for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { + ChannelStrip *pChannelStrip = NULL; + QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip && pChannelStrip->isVisible()) pChannelStrip->updateChannelUsage(); } @@ -2633,9 +2694,7 @@ // Setup stdout/stderr capture... // if (m_pOptions->bStdoutCapture) { -#if QT_VERSION >= 0x040200 m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); -#endif QObject::connect(m_pServer, SIGNAL(readyReadStandardOutput()), SLOT(readServerStdout())); @@ -2690,7 +2749,8 @@ "according to your current sampler session and you could alter the\n" "sampler session at any time by relaunching QSampler.\n\n" "Do you want LinuxSampler to stop?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes) == QMessageBox::No) { bForceServerStop = false; } @@ -2700,13 +2760,13 @@ if (m_pServer && bForceServerStop) { appendMessages(tr("Server is stopping...")); if (m_pServer->state() == QProcess::Running) { -#if defined(WIN32) + #if defined(WIN32) // Try harder... m_pServer->kill(); -#else + #else // Try softly... m_pServer->terminate(); -#endif + #endif } } // Do final processing anyway. else processServerExit(); @@ -2935,10 +2995,11 @@ // Channel strip activation/selection. -void MainForm::activateStrip ( QWidget *pWidget ) +void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow ) { - ChannelStrip *pChannelStrip - = static_cast (pWidget); + ChannelStrip *pChannelStrip = NULL; + if (pMdiSubWindow) + pChannelStrip = static_cast (pMdiSubWindow->widget()); if (pChannelStrip) pChannelStrip->setSelected(true); @@ -2946,6 +3007,30 @@ } +// Channel toolbar orientation change. +void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation ) +{ +#ifdef CONFIG_VOLUME + m_pVolumeSlider->setOrientation(orientation); + if (orientation == Qt::Horizontal) { + m_pVolumeSlider->setMinimumHeight(24); + m_pVolumeSlider->setMaximumHeight(32); + m_pVolumeSlider->setMinimumWidth(120); + m_pVolumeSlider->setMaximumWidth(640); + m_pVolumeSpinBox->setMaximumWidth(64); + m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows); + } else { + m_pVolumeSlider->setMinimumHeight(120); + m_pVolumeSlider->setMaximumHeight(480); + m_pVolumeSlider->setMinimumWidth(24); + m_pVolumeSlider->setMaximumWidth(32); + m_pVolumeSpinBox->setMaximumWidth(32); + m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons); + } +#endif +} + + } // namespace QSampler