コード例 #1
0
ファイル: timermodel.cpp プロジェクト: motto0808/GammaRay
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;
}
コード例 #2
0
ファイル: FileWatcher.C プロジェクト: BioITer/OpenMS
 void FileWatcher::timerTriggered_()
 {
   //cout << "Timer activated" << endl;
   //get the timer instance
   QTimer * timer = qobject_cast<QTimer *>(sender());
   //emit the final for the file corresponding to the timer name
   //cout << " - timer name: " << String(timer->objectName()) << endl;
   //cout << " - timer file: " << String(timers_[timer->objectName()]) << endl;
   emit fileChanged(String(timers_[timer->objectName()]));
   //erase the timer name from the list
   timers_.erase(timer->objectName());
 }