void MusicRightAreaWidget::setupUi(Ui::MusicApplication* ui)
{
    m_ui = ui;
    m_downloadStatusLabel->setMovieLabel(m_ui->showDownloadGif);

    ui->lrcDisplayAllButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->lrcDisplayAllButton->setIconSize(QSize(15, 56));
    connect(ui->lrcDisplayAllButton, SIGNAL(clicked()), SLOT(musicLrcDisplayAllButtonClicked()));

    ui->musicSearchBackButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->musicSearchBackButton->setStyleSheet(MusicUIObject::MPushButtonStyle07);
    ui->musicSearchBackButton->setIconSize(QSize(25, 25));
    ui->musicSearchBackButton->setIcon(QIcon(QString::fromUtf8(":/image/back")));
//    connect(ui->musicSearchBackButton, SIGNAL(clicked()), SLOT(musicSearchRefreshButtonRefreshed()));

    ui->musicSearchRefreshButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->musicSearchRefreshButton->setStyleSheet(MusicUIObject::MPushButtonStyle07);
    ui->musicSearchRefreshButton->setIconSize(QSize(25, 25));
    ui->musicSearchRefreshButton->setIcon(QIcon(QString::fromUtf8(":/image/flash")));
    connect(ui->musicSearchRefreshButton, SIGNAL(clicked()), SLOT(musicSearchRefreshButtonRefreshed()));

    ui->musicIndexWidgetButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->musicIndexWidgetButton->setStyleSheet(MusicUIObject::MPushButtonStyle16);
    connect(ui->musicIndexWidgetButton, SIGNAL(clicked()), SLOT(musicIndexWidgetButtonSearched()));

    ui->musicSearchWidgetButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->musicSearchWidgetButton->setStyleSheet(MusicUIObject::MPushButtonStyle07);
    connect(ui->musicSearchWidgetButton, SIGNAL(clicked()), SLOT(musicSearchWidgetButtonSearched()));

    ui->musicLrcWidgetButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->musicLrcWidgetButton->setStyleSheet(MusicUIObject::MPushButtonStyle07);
    connect(ui->musicLrcWidgetButton, SIGNAL(clicked()), SLOT(musicLrcWidgetButtonSearched()));

    ui->vedioWidgetButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->vedioWidgetButton->setStyleSheet(MusicUIObject::MPushButtonStyle07);
    connect(ui->vedioWidgetButton, SIGNAL(clicked()), SLOT(musicVideoWidgetButtonSearched()));
    ///////////////////////////////////////////////////////
    connect(m_musiclrcfordesktop, SIGNAL(theCurrentLrcUpdated()), m_supperClass,
                 SLOT(musicCurrentLrcUpdated()));
    connect(m_musiclrcfordesktop, SIGNAL(changeCurrentLrcColorSetting()), m_supperClass,
                 SLOT(musicSetting()));
    connect(m_musiclrcfordesktop, SIGNAL(changeCurrentLrcColorCustom()), m_setting,
                 SLOT(changeDesktopLrcWidget()));
    connect(m_musiclrcfordesktop, SIGNAL(desktopLrcClosed()), SIGNAL(desktopLrcClosed()));
    connect(m_musiclrcfordesktop, SIGNAL(setWindowLockedChanged(bool)), SIGNAL(lockDesktopLrc(bool)));
    ///////////////////////////////////////////////////////
    connect(ui->musiclrccontainerforinline, SIGNAL(changeCurrentLrcColorCustom()), m_setting,
                 SLOT(changeInlineLrcWidget()));
    connect(ui->musiclrccontainerforinline, SIGNAL(theCurrentLrcUpdated()), m_supperClass,
                 SLOT(musicCurrentLrcUpdated()));
    connect(ui->musiclrccontainerforinline, SIGNAL(theArtBgHasChanged()),
                 SIGNAL(updateBgThemeDownload()));
    connect(ui->musiclrccontainerforinline, SIGNAL(changeCurrentLrcColorSetting()), m_supperClass,
                 SLOT(musicSetting()));
    connect(ui->musiclrccontainerforinline, SIGNAL(updateCurrentTime(qint64)), m_supperClass,
                 SLOT(updateCurrentTime(qint64)));
    connect(ui->musicSongSearchLine, SIGNAL(enterFinished(QString)),
                 SLOT(musicResearchButtonSearched(QString)));
    ///////////////////////////////////////////////////////
}
示例#2
0
GLObjectStatus* GLObject::doPhysics() {
	if (lastTimeStamp == -1) {
		updateCurrentTime();
	}

	int oldtime = lastTimeStamp;
	updateCurrentTime();

	return doPhysics(lastTimeStamp - oldtime);
}
void WIFISocketRTCDeviceClass::loop()
{
	if (WiFi.isConnected())
	{
		if (abs(((long long int)mUpdateMillis) - ((long long int)millis()))>UPDATE_MILLIS)
		{
			updateCurrentTime();
		}
		else if ((!mTryStatus) && (abs(((long long int)mTryMills) - ((long long int)millis())) > RETRY_MILLIS))
		{
			updateCurrentTime();
		}
	}
}
void MainApplication::timerEvent(QTimerEvent* event)
{
    if (event->timerId() == timerMap_[CurrentTimeTimer]) {
        updateCurrentTime();
    }
    else if (event->timerId() == timerMap_[FetchTwitterTimer]) {
        fetchTweets();
    }
    else if (event->timerId() == timerMap_[UpdateEventsTimer]) {
        updateEventTimes();
    }
    else if (event->timerId() == timerMap_[RemoveOldTweetsTimer]) {
        removeOldTweets();
    }
    else if (event->timerId() == timerMap_[FetchSchedulesTimer]) {
        fetchSchedules();
    }
    else if (event->timerId() == timerMap_[UpdateTrainsTimer]) {
        updateTrains();
    }
    else if (event->timerId() == timerMap_[UpdateTrainsTextTimer]) {
        southboundTrainModel_->redraw();
        northboundTrainModel_->redraw();
    }
}
示例#5
0
/*
  Returns the time to wait for the next timer, or null if no timers
  are waiting.
*/
bool QTimerInfoList::timerWait(timeval &tm)
{
    timeval currentTime = updateCurrentTime();
    repairTimersIfNeeded();

    // Find first waiting timer not already active
    QTimerInfo *t = 0;
    for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
        if (!(*it)->inTimerEvent) {
            t = *it;
            break;
        }
    }

    if (!t)
      return false;

    if (currentTime < t->timeout) {
        // time to wait
        tm = t->timeout - currentTime;
    } else {
        // no time to wait
        tm.tv_sec  = 0;
        tm.tv_usec = 0;
    }

    return true;
}
bool JointControllerManager::startHook()
{
  // Check that component is configured
  if (!isConfigured())
  {
    PAL_ERROR("Failed to start joint controller manager: Component has not yet been configured.");
    return false;
  }

  // Start joint interface
  if (!joint_iface_->start())
  {
    PAL_ERROR("Failed to start joint controller manager: Could not start low level joint access.");
    return false;
  }

  // Update current time
  updateCurrentTime();

  // Update current state
  if (!updateCurrentState())
  {
    PAL_ERROR("Failed to start joint controller manager: Could not update current state.");
    return false;
  }

  // Auto-start controllers
  if (!autoStartComponents())
  {
    return false;
  }

  return true;
}
void LaunchSimulationBox::updateWidget()
{
    switch (mState) {
    case LaunchSimulationBox::Wait:
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_fraction(0.0);
        mProgressBar->set_text(_("Wait"));
        mCurrentTimeLabel->set_text("");
        break;
    case LaunchSimulationBox::Init:
        changeToWatchCursor();
        mPlay->set_sensitive(false);
        mStop->set_sensitive(false);
        mProgressBar->set_fraction(0.0);
        mProgressBar->set_text(_("The simulator initializes the models"));
        mCurrentTimeLabel->set_text("");
        break;
    case LaunchSimulationBox::Play:
        mPlay->set_sensitive(false);
        mStop->set_sensitive(true);
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Error:
        resetCursor();
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_text(_("Simulation error"));
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Finish:
        resetCursor();
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_text(_("Finished"));
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Close:
        break;
    }
}
示例#8
0
void TrackControlWindow::refresh(Task* task) {
    _currentTask = task;
    if (_currentTask != NULL) {
        QModelIndex index = _taskModel->index(task->project(), task);
        if (index.isValid()) {
            ui->comboBox->setCurrentModelIndex(index);
        }
    } else {
        ui->comboBox->setCurrentModelIndex(QModelIndex());
    }
    updateCurrentTime();
}
示例#9
0
void QTimerInfoList::registerTimer(int timerId, int interval, QObject *object)
{
    QTimerInfo *t = new QTimerInfo;
    t->id = timerId;
    t->interval.tv_sec  = interval / 1000;
    t->interval.tv_usec = (interval % 1000) * 1000;
    t->timeout = updateCurrentTime() + t->interval;
    t->obj = object;
    t->inTimerEvent = false;

    timerInsert(t);
}
void JointControllerManager::updateHook()
{
  // Get data needed by controllers
  updateCurrentTime();
  if (!updateCurrentState()) {error();}

  // Update running controllers
  BOOST_FOREACH(const ControllerDataPtr controller_data, getRunningControllers())
  {
    controller_data->controller->getActivity()->execute();
  }

  // Send control commands
  if (!updateReferenceState()) {error();}
}
示例#11
0
void Light::startAnimation(AnimationType animation, int duration) {
	m_currentAnimationDuration = duration;
	m_currentAnimation = animation;

	if (m_currentAnimationDuration <= 0 || m_currentAnimation == NoAnimation ) {
		
		m_step = 1;
		updateCurrentTime(1);
		stop();
		return;
	}
	else {	
	  setLoopCount(-1);
	  m_step = 1/(qreal)m_currentAnimationDuration;
	  qDebug() << " startAnimation m_step =" << m_step ;	  
	   start();
	}
	
}
示例#12
0
/*
  Returns the time to wait for the next timer, or null if no timers
  are waiting.
*/
bool QTimerInfoList::timerWait(timeval &tm)
{
    timeval currentTime = updateCurrentTime();
    repairTimersIfNeeded();

    if (isEmpty())
        return false;

    QTimerInfo *t = first();        // first waiting timer
    if (currentTime < t->timeout) {
        // time to wait
        tm = t->timeout - currentTime;
    } else {
        // no time to wait
        tm.tv_sec  = 0;
        tm.tv_usec = 0;
    }

    return true;
}
示例#13
0
void QAbstractAnimation::setCurrentTime(int msecs)
{
    Q_D(QAbstractAnimation);
    msecs = qMax(msecs, 0);

    // Calculate new time and loop.
    int dura = duration();
    int totalDura = dura <= 0 ? dura : ((d->loopCount < 0) ? -1 : dura * d->loopCount);
    if (totalDura != -1)
        msecs = qMin(totalDura, msecs);
    d->totalCurrentTime = msecs;

    // Update new values.
    int oldLoop = d->currentLoop;
    d->currentLoop = ((dura <= 0) ? 0 : (msecs / dura));
    if (d->currentLoop == d->loopCount) {
        //we're at the end
        d->currentTime = qMax(0, dura);
        d->currentLoop = qMax(0, d->loopCount - 1);
    } else {
        if (d->direction == Forward) {
            d->currentTime = (dura <= 0) ? msecs : (msecs % dura);
        } else {
            d->currentTime = (dura <= 0) ? msecs : ((msecs - 1) % dura) + 1;
            if (d->currentTime == dura)
                --d->currentLoop;
        }
    }

    updateCurrentTime(d->currentTime);
    if (d->currentLoop != oldLoop)
        emit currentLoopChanged(d->currentLoop);

    // All animations are responsible for stopping the animation when their
    // own end state is reached; in this case the animation is time driven,
    // and has reached the end.
    if ((d->direction == Forward && d->totalCurrentTime == totalDura)
        || (d->direction == Backward && d->totalCurrentTime == 0)) {
        stop();
    }
}
void sipQSequentialAnimationGroup::sipProtectVirt_updateCurrentTime(bool sipSelfWasArg,int a0)
{
    (sipSelfWasArg ? QSequentialAnimationGroup::updateCurrentTime(a0) : updateCurrentTime(a0));
}
void sipQPropertyAnimation::sipProtectVirt_updateCurrentTime(bool sipSelfWasArg,int a0)
{
    (sipSelfWasArg ? QVariantAnimation::updateCurrentTime(a0) : updateCurrentTime(a0));
}
void sipQPauseAnimation::sipProtectVirt_updateCurrentTime(bool sipSelfWasArg,int a0)
{
    (sipSelfWasArg ? QPauseAnimation::updateCurrentTime(a0) : updateCurrentTime(a0));
}
示例#17
0
/*
    Activate pending timers, returning how many where activated.
*/
int QTimerInfoList::activateTimers()
{
    if (qt_disable_lowpriority_timers || isEmpty())
        return 0; // nothing to do

    bool firstTime = true;
    timeval currentTime;
    int n_act = 0, maxCount = count();

    QTimerInfo *saveFirstTimerInfo = firstTimerInfo;
    QTimerInfo *saveCurrentTimerInfo = currentTimerInfo;
    firstTimerInfo = currentTimerInfo = 0;

    while (maxCount--) {
        currentTime = updateCurrentTime();
        if (firstTime) {
            repairTimersIfNeeded();
            firstTime = false;
        }

        if (isEmpty())
            break;

        currentTimerInfo = first();
        if (currentTime < currentTimerInfo->timeout)
            break; // no timer has expired

        if (!firstTimerInfo) {
            firstTimerInfo = currentTimerInfo;
        } else if (firstTimerInfo == currentTimerInfo) {
            // avoid sending the same timer multiple times
            break;
        } else if (currentTimerInfo->interval <  firstTimerInfo->interval
                   || currentTimerInfo->interval == firstTimerInfo->interval) {
            firstTimerInfo = currentTimerInfo;
        }

        // remove from list
        removeFirst();

        // determine next timeout time
        currentTimerInfo->timeout += currentTimerInfo->interval;
        if (currentTimerInfo->timeout < currentTime)
            currentTimerInfo->timeout = currentTime + currentTimerInfo->interval;

        // reinsert timer
        timerInsert(currentTimerInfo);
        if (currentTimerInfo->interval.tv_usec > 0 || currentTimerInfo->interval.tv_sec > 0)
            n_act++;

        if (!currentTimerInfo->inTimerEvent) {
            // send event, but don't allow it to recurse
            currentTimerInfo->inTimerEvent = true;

            QTimerEvent e(currentTimerInfo->id);
            QCoreApplication::sendEvent(currentTimerInfo->obj, &e);

            if (currentTimerInfo)
                currentTimerInfo->inTimerEvent = false;
        }
    }

    firstTimerInfo = saveFirstTimerInfo;
    currentTimerInfo = saveCurrentTimerInfo;

    return n_act;
}
void QAbstractAnimationJob::setCurrentTime(int msecs)
{
    msecs = qMax(msecs, 0);
    // Calculate new time and loop.
    int dura = duration();
    int totalDura;
    int oldLoop = m_currentLoop;

    if (dura < 0 && m_direction == Forward)  {
        totalDura = -1;
        if (m_uncontrolledFinishTime >= 0 && msecs >= m_uncontrolledFinishTime) {
            msecs = m_uncontrolledFinishTime;
            if (m_currentLoop == m_loopCount - 1) {
                totalDura = m_uncontrolledFinishTime;
            } else {
                ++m_currentLoop;
                m_currentLoopStartTime = msecs;
                m_uncontrolledFinishTime = -1;
            }
        }
        m_totalCurrentTime = msecs;
        m_currentTime = msecs - m_currentLoopStartTime;
    } else {
        totalDura = dura <= 0 ? dura : ((m_loopCount < 0) ? -1 : dura * m_loopCount);
        if (totalDura != -1)
            msecs = qMin(totalDura, msecs);
        m_totalCurrentTime = msecs;

        // Update new values.
        m_currentLoop = ((dura <= 0) ? 0 : (msecs / dura));
        if (m_currentLoop == m_loopCount) {
            //we're at the end
            m_currentTime = qMax(0, dura);
            m_currentLoop = qMax(0, m_loopCount - 1);
        } else {
            if (m_direction == Forward) {
                m_currentTime = (dura <= 0) ? msecs : (msecs % dura);
            } else {
                m_currentTime = (dura <= 0) ? msecs : ((msecs - 1) % dura) + 1;
                if (m_currentTime == dura)
                    --m_currentLoop;
            }
        }
    }


    if (m_currentLoop != oldLoop && !m_group)   //### verify Running as well?
        fireTopLevelAnimationLoopChanged();

    RETURN_IF_DELETED(updateCurrentTime(m_currentTime));

    if (m_currentLoop != oldLoop)
        currentLoopChanged();

    // All animations are responsible for stopping the animation when their
    // own end state is reached; in this case the animation is time driven,
    // and has reached the end.
    if ((m_direction == Forward && m_totalCurrentTime == totalDura)
        || (m_direction == Backward && m_totalCurrentTime == 0)) {
        RETURN_IF_DELETED(stop());
    }

    if (m_hasCurrentTimeChangeListeners)
        currentTimeChanged(m_currentTime);
}