--- qsampler/trunk/src/qsamplerMainForm.ui.h 2004/11/16 15:26:18 295 +++ qsampler/trunk/src/qsamplerMainForm.ui.h 2004/11/17 17:17:18 302 @@ -104,8 +104,9 @@ m_pMessages = NULL; // We'll start clean. - m_iUntitled = 0; - m_iDirtyCount = 0; + m_iUntitled = 0; + m_iDirtyCount = 0; + m_iChangeCount = 0; m_pServer = NULL; m_pClient = NULL; @@ -566,6 +567,9 @@ m_sFilename = sFilename; updateRecentFiles(sFilename); appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); + + // Make that an overall update. + m_iChangeCount++; stabilizeForm(); return true; } @@ -767,15 +771,9 @@ if (m_pClient == NULL) return; - // Just create the channel strip, given an invalid channel id. - qsamplerChannelStrip *pChannelStrip = createChannelStrip(-1); - if (pChannelStrip == NULL) - return; - - // We'll be dirty, for sure... - m_iDirtyCount++; - // Stabilize form anyway. - stabilizeForm(); + // Just create the channel strip, + // by giving an invalid channel id. + createChannelStrip(-1); } @@ -853,8 +851,8 @@ // Reset the existing sampler channel. pChannel->resetChannel(); - // Refresh channel strip info. - pChannelStrip->updateChannelInfo(); + // And force a deferred update. + m_iChangeCount++; } @@ -1142,6 +1140,8 @@ // Channel change receiver slot. void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * ) { + // Flag that we're update those channel strips. + m_iChangeCount++; // Just mark the dirty form. m_iDirtyCount++; // and update the form status... @@ -1502,15 +1502,19 @@ } // Refresh each channel usage, on each period... - if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) { + if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) { m_iTimerSlot += QSAMPLER_TIMER_MSECS; - if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { + if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled()) { m_iTimerSlot = 0; + m_iChangeCount = 0; QWidgetList wlist = m_pWorkspace->windowList(); for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); - if (pChannelStrip && pChannelStrip->isVisible()) - pChannelStrip->updateChannelUsage(); + if (pChannelStrip && pChannelStrip->isVisible()) { + // If we can't make it clean, try next time. + if (!pChannelStrip->updateChannelUsage()) + m_iChangeCount++; + } } } }