Exemplo n.º 1
0
void TimerModel::preSignalActivate(QObject *caller, int methodIndex)
{
  if (!(methodIndex == m_timeoutIndex && qobject_cast<QTimer*>(caller)) &&
      !(methodIndex == m_qmlTimerTriggeredIndex && caller->inherits("QQmlTimer")))
  {
    return;
  }

  const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(caller);

  if (!timerInfo) {
    // Ok, likely a GammaRay timer
    //cout << "TimerModel::preSignalActivate(): Unable to find timer "
    //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    return;
  }

  if (!timerInfo->functionCallTimer()->start()) {
    cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
         << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  Q_ASSERT(!m_currentSignals.contains(caller));
  m_currentSignals[caller] = timerInfo;
}
Exemplo n.º 2
0
void TimerModel::preSignalActivate(QObject *caller, int methodIndex)
{
  if (methodIndex != m_timeoutIndex) {
    return;
  }

  QTimer *timer = qobject_cast<QTimer*>(caller);
  if (!timer || timer->objectName().toLower().startsWith(QLatin1String("gammaray"))) {
    return;
  }

  const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);

  if (!timerInfo) {
    // Ok, likely a GammaRay timer
    //cout << "TimerModel::preSignalActivate(): Unable to find timer "
    //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    return;
  }

  if (!timerInfo->functionCallTimer()->start()) {
    cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
         << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    return;
  }

  Q_ASSERT(!m_currentSignals.contains(caller));
  m_currentSignals[caller] = timerInfo;
}
Exemplo n.º 3
0
void TimerModel::postSignalActivate(QObject *caller, int methodIndex)
{
  QHash<QObject*, TimerInfoPtr>::iterator it = m_currentSignals.find(caller);
  if (it == m_currentSignals.end()) {
    // Ok, likely a GammaRay timer
    // cout << "TimerModel::postSignalActivate(): Unable to find timer "
    //      << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  const TimerInfoPtr timerInfo = *it;
  Q_ASSERT(timerInfo);

  if (!(timerInfo->type() == TimerInfo::QTimerType && methodIndex == m_timeoutIndex) &&
      !(timerInfo->type() == TimerInfo::QQmlTimerType && methodIndex == m_qmlTimerTriggeredIndex))
  {
    return;
  }

  m_currentSignals.erase(it);

  if (!timerInfo->timerObject()) {
    // timer got killed in a slot
    return;
  }

  Q_ASSERT(caller == timerInfo->timerObject());

  if (!timerInfo->functionCallTimer()->active()) {
    cout << "TimerModel::postSignalActivate(): Timer not active: "
          << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  TimerInfo::TimeoutEvent event;
  event.timeStamp = QTime::currentTime();
  event.executionTime = timerInfo->functionCallTimer()->stop();
  timerInfo->addEvent(event);
  const int row = rowFor(timerInfo->timerObject());
  emitTimerObjectChanged(row);
}
Exemplo n.º 4
0
void TimerModel::postSignalActivate(QObject *caller, int methodIndex)
{
  if (methodIndex != m_timeoutIndex) {
    return;
  }
  QHash<QObject*, TimerInfoPtr>::iterator it = m_currentSignals.find(caller);
  if (it == m_currentSignals.end()) {
    // Ok, likely a GammaRay timer
    //cout << "TimerModel::postSignalActivate(): Unable to find timer "
    //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    return;
  }

  const TimerInfoPtr timerInfo = *it;
  Q_ASSERT(timerInfo);

  m_currentSignals.erase(it);

  if (!timerInfo->timer()) {
    // timer got killed in a slot
    return;
  }

  Q_ASSERT(static_cast<QTimer*>(caller) == timerInfo->timer());

  if (!timerInfo->functionCallTimer()->active()) {
    cout << "TimerModel::postSignalActivate(): Timer not active: "
          << (void*)caller << " (" << caller->objectName().toStdString() << ")!" << endl;
    return;
  }

  TimerInfo::TimeoutEvent event;
  event.timeStamp = QTime::currentTime();
  event.executionTime = timerInfo->functionCallTimer()->stop();
  timerInfo->addEvent(event);
  const int row = rowFor(timerInfo->timer());
  if (row != -1) {
    emit dataChanged(index(row, 0), index(row, columnCount() - 1));
  }
}
Exemplo n.º 5
0
void TimerModel::postSignalActivate(QTimer *timer)
{
    const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);
    if (timerInfo) {
        if (!timerInfo->functionCallTimer()->active()) {
            cout << "TimerModel::postSignalActivate(): Timer not active: "
                 << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
        } else {
            TimerInfo::TimeoutEvent event;
            event.timeStamp = QTime::currentTime();
            event.executionTime = timerInfo->functionCallTimer()->stop();
            timerInfo->addEvent(event);
            const int row = rowFor(timer);
            if (row != -1) {
                emit dataChanged(index(row, 0), index(row, columnCount() - 1));
            }
        }
    } else {
        // Ok, likely a GammaRay timer
        //cout << "TimerModel::postSignalActivate(): Unable to find timer "
        //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    }
}
Exemplo n.º 6
0
void TimerModel::preSignalActivate(QTimer *timer)
{
    const TimerInfoPtr timerInfo = findOrCreateQTimerTimerInfo(timer);
    if (timerInfo) {
        if (!timerInfo->functionCallTimer()->start()) {
            cout << "TimerModel::preSignalActivate(): Recursive timeout for timer "
                 << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
        }
    } else {
        // Ok, likely a GammaRay timer
        //cout << "TimerModel::preSignalActivate(): Unable to find timer "
        //     << (void*)timer << " (" << timer->objectName().toStdString() << ")!" << endl;
    }
}