// A return of false from onIdleUpdate means it will be called again next idle update.
// A return of true means we have finished with it and the callback will be deleted.
bool LLViewerAudio::onIdleUpdate()
{
	bool fadeIsFinished = false;

	// There is a delay in the login sequence between when the parcel information has
	// arrived and the music stream is started and when the audio system is called to set
	// initial volume levels.  This code extends the fade time so you hear a full fade in.
	if ((LLStartUp::getStartupState() < STATE_STARTED))
	{
		stream_fade_timer.reset();
		stream_fade_timer.setTimerExpirySec(mFadeTime);
	}

	if (mDone)
	{
		//  This should be a rare or never occurring state.
		if (mFadeState == FADE_IDLE)
		{
			deregisterIdleListener();
			fadeIsFinished = true; // Stop calling onIdleUpdate
		}

		// we have finished the current fade operation
		if (mFadeState == FADE_OUT)
		{
			// Clear URI
			gAudiop->startInternetStream(LLStringUtil::null);
			gAudiop->stopInternetStream();
				
			if (!mNextStreamURI.empty())
			{
				mFadeState = FADE_IN;
				gAudiop->startInternetStream(mNextStreamURI);
				startFading();
			}
			else
			{
				mFadeState = FADE_IDLE;
				deregisterIdleListener();
				fadeIsFinished = true; // Stop calling onIdleUpdate
			}
		}
		else if (mFadeState == FADE_IN)
		{
			if (mNextStreamURI != gAudiop->getInternetStreamURL())
			{
				mFadeState = FADE_OUT;
				startFading();
			}
			else
			{
				mFadeState = FADE_IDLE;
				deregisterIdleListener();
				fadeIsFinished = true; // Stop calling onIdleUpdate
			}
		}
	}

	return fadeIsFinished;
}
void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
{
	// Old and new stream are identical
	if (mNextStreamURI == streamURI)
	{
		/// <FS:CR> FIRE-8419 - Don't return here. It can keep the user from toggling audio streams off/on.
		/// We handle identical stream URIs with FIRE-7093 anyways.
		//return;
		lldebugs << "Identical URI's: " << mNextStreamURI << " and " << streamURI << llendl;
		// </FS:CR>
	}

	// Record the URI we are going to be switching to	
	mNextStreamURI = streamURI;

	// <FS:Ansariel> Optional audio stream fading
	if (!gSavedSettings.getBOOL("FSFadeAudioStream"))
	{
		gAudiop->startInternetStream(mNextStreamURI);
		return;
	}
	// </FS:Ansariel>

	switch (mFadeState)
	{
		case FADE_IDLE:
		// If a stream is playing fade it out first
		if (!gAudiop->getInternetStreamURL().empty())
		{
			// The order of these tests is important, state FADE_OUT will be processed below
			mFadeState = FADE_OUT;
		}
		// Otherwise the new stream can be faded in
		else
		{
			mFadeState = FADE_IN;
			gAudiop->startInternetStream(mNextStreamURI);
			startFading();
			registerIdleListener();
			break;
		}

		case FADE_OUT:
			startFading();
			registerIdleListener();
			break;

		case FADE_IN:
			registerIdleListener();
			break;

		default:
			llwarns << "Unknown fading state: " << mFadeState << llendl;
			break;
	}
}
Ejemplo n.º 3
0
void ItemViewHoverButton::setIndex(const QModelIndex& index)
{
    m_index = index;

    if (index.isValid())
    {
        startFading();
    }
}
Ejemplo n.º 4
0
void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI)
{
    // Old and new stream are identical
    if (mNextStreamURI == streamURI)
    {
        return;
    }

    // Record the URI we are going to be switching to
    mNextStreamURI = streamURI;

    switch (mFadeState)
    {
    case FADE_IDLE:
        // If a stream is playing fade it out first
        if (!gAudiop->getInternetStreamURL().empty())
        {
            // The order of these tests is important, state FADE_OUT will be processed below
            mFadeState = FADE_OUT;
        }
        // Otherwise the new stream can be faded in
        else
        {
            mFadeState = FADE_IN;
            gAudiop->startInternetStream(mNextStreamURI);
            startFading();
            registerIdleListener();
            break;
        }

    case FADE_OUT:
        startFading();
        registerIdleListener();
        break;

    case FADE_IN:
        registerIdleListener();
        break;

    default:
        llwarns << "Unknown fading state: " << mFadeState << llendl;
        break;
    }
}
Ejemplo n.º 5
0
void ItemViewHoverButton::setVisible(bool visible)
{
    QAbstractButton::setVisible(visible);

    stopFading();

    if (visible)
    {
        startFading();
    }
}
Ejemplo n.º 6
0
void YaTabBarBase::updateFading()
{
	updateHiddenTabActions();

	for (int i = 0; i < count(); i++) {
		if (tabData(i).toBool()) {
			startFading();
			return;
		}
	}
	stopFading();
}
Ejemplo n.º 7
0
void RatingWidget::setVisible(bool visible)
{
    QWidget::setVisible(visible);

    if (visible)
    {
        startFading();
    }
    else
    {
        stopFading();
    }
}
void Controller::refreshTimeTexts() {
	auto alreadyChanged = false, leftChanged = false;
	auto timeAlready = _timeAlready;
	auto timeLeft = _timeLeft;
	if (_seekPositionMs >= 0) {
		auto playAlready = _seekPositionMs / 1000LL;
		auto playLeft = (_lastDurationMs / 1000LL) - playAlready;

		timeAlready = formatDurationText(playAlready);
		auto minus = QChar(8722);
		timeLeft = minus + formatDurationText(playLeft);
	}

	_playedAlready->setText(timeAlready, &alreadyChanged);
	_toPlayLeft->setText(timeLeft, &leftChanged);
	if (alreadyChanged || leftChanged) {
		resizeEvent(nullptr);
		startFading([this]() {
			_fadeAnimation->refreshCache();
		});
	}
}
Ejemplo n.º 9
0
void KoContextBarButton::showEvent(QShowEvent *event)
{
    stopFading();
    startFading();
    QToolButton::showEvent(event);
}
void Controller::showAnimated() {
	startFading([this]() {
		_fadeAnimation->fadeIn(st::mediaviewShowDuration);
	});
}
void Controller::hideAnimated() {
	startFading([this]() {
		_fadeAnimation->fadeOut(st::mediaviewHideDuration);
	});
}