--- qsampler/trunk/src/qsamplerMainForm.ui.h 2004/09/29 16:05:24 265 +++ qsampler/trunk/src/qsamplerMainForm.ui.h 2004/11/16 15:26:18 295 @@ -487,8 +487,8 @@ qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); if (pChannelStrip) { qsamplerChannel *pChannel = pChannelStrip->channel(); - if (bForce && pChannel && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) - appendMessagesClient("lscp_remove_channel"); + if (bForce && pChannel) + pChannel->removeChannel(); delete pChannelStrip; } } @@ -552,7 +552,7 @@ // Try to (re)create each channel. m_pWorkspace->setUpdatesEnabled(false); for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { - createChannel(iChannelID, false); + createChannelStrip(iChannelID); QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); } m_pWorkspace->setUpdatesEnabled(true); @@ -767,20 +767,11 @@ if (m_pClient == NULL) return; - // Create the new sampler channel. - int iChannelID = ::lscp_add_channel(m_pClient); - if (iChannelID < 0) { - appendMessagesClient("lscp_add_channel"); - appendMessagesError(tr("Could not create the new channel.\n\nSorry.")); + // Just create the channel strip, given an invalid channel id. + qsamplerChannelStrip *pChannelStrip = createChannelStrip(-1); + if (pChannelStrip == NULL) return; - } - - // Log this happening. - appendMessages(tr("Channel %1 created.").arg(iChannelID)); - - // Just create the channel strip with given id. - createChannel(iChannelID, true); - + // We'll be dirty, for sure... m_iDirtyCount++; // Stabilize form anyway. @@ -814,15 +805,9 @@ } // Remove the existing sampler channel. - if (::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { - appendMessagesClient("lscp_remove_channel"); - appendMessagesError(tr("Could not remove channel.\n\nSorry.")); + if (!pChannel->removeChannel()) return; - } - // Log this happening. - appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID())); - // Just delete the channel strip. delete pChannelStrip; @@ -847,7 +832,7 @@ return; // Just invoque the channel strip procedure. - pChannelStrip->showChannelSetup(false); + pChannelStrip->channelSetup(); } @@ -865,15 +850,8 @@ if (pChannel == NULL) return; - // Remove the existing sampler channel. - if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { - appendMessagesClient("lscp_reset_channel"); - appendMessagesError(tr("Could not reset channel.\n\nSorry.")); - return; - } - - // Log this. - appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID())); + // Reset the existing sampler channel. + pChannel->resetChannel(); // Refresh channel strip info. pChannelStrip->updateChannelInfo(); @@ -949,6 +927,7 @@ bool bOldServerStart = m_pOptions->bServerStart; QString sOldServerCmdLine = m_pOptions->sServerCmdLine; QString sOldDisplayFont = m_pOptions->sDisplayFont; + bool bOldDisplayEffect = m_pOptions->bDisplayEffect; int iOldMaxVolume = m_pOptions->iMaxVolume; QString sOldMessagesFont = m_pOptions->sMessagesFont; bool bOldStdoutCapture = m_pOptions->bStdoutCapture; @@ -973,6 +952,9 @@ (!bOldCompletePath && m_pOptions->bCompletePath) || (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) updateRecentFilesMenu(); + if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) || + (!bOldDisplayEffect && m_pOptions->bDisplayEffect)) + updateDisplayEffect(); if (sOldDisplayFont != m_pOptions->sDisplayFont) updateDisplayFont(); if (iOldMaxVolume != m_pOptions->iMaxVolume) @@ -1240,6 +1222,28 @@ } +// Update channel strips background effect. +void qsamplerMainForm::updateDisplayEffect (void) +{ + QPixmap pm; + if (m_pOptions->bDisplayEffect) + pm = QPixmap::fromMimeSource("displaybg1.png"); + + // Full channel list update... + QWidgetList wlist = m_pWorkspace->windowList(); + if (wlist.isEmpty()) + return; + + m_pWorkspace->setUpdatesEnabled(false); + for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { + qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); + if (pChannelStrip) + pChannelStrip->setDisplayBackground(pm); + } + m_pWorkspace->setUpdatesEnabled(true); +} + + // Force update of the channels maximum volume setting. void qsamplerMainForm::updateMaxVolume (void) { @@ -1354,10 +1358,10 @@ // qsamplerMainForm -- MDI channel strip management. // The channel strip creation executive. -void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt ) +qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID ) { if (m_pClient == NULL) - return; + return NULL; // Prepare for auto-arrange? qsamplerChannelStrip *pChannelStrip = NULL; @@ -1374,18 +1378,29 @@ // Add a new channel itema... WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder; pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); - pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); + // Actual channel setup. pChannelStrip->setup(this, iChannelID); - // We'll need a display font. - QFont font; - if (m_pOptions && font.fromString(m_pOptions->sDisplayFont)) - pChannelStrip->setDisplayFont(font); - // Track channel setup changes. QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); // Before we show it up, may be we'll // better ask for some initial values? - if (bPrompt) - pChannelStrip->showChannelSetup(true); + if (iChannelID < 0 && !pChannelStrip->channelSetup()) { + // No luck, bail out... + delete pChannelStrip; + return NULL; + } + + // Set some initial aesthetic options... + if (m_pOptions) { + // Background display effect... + pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); + // We'll need a display font. + QFont font; + if (font.fromString(m_pOptions->sDisplayFont)) + pChannelStrip->setDisplayFont(font); + // Maximum allowed volume setting. + pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); + } + // Now we show up us to the world. pChannelStrip->show(); // Only then, we'll auto-arrange... @@ -1395,6 +1410,9 @@ int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); } + + // Return our successful reference... + return pChannelStrip; }