Пример #1
0
void ctkManagedServiceTracker::removedService(const ctkServiceReference& reference, ctkManagedService* service)
{
  Q_UNUSED(service)

  QString pid = reference.getProperty(ctkPluginConstants::SERVICE_PID).toString();
  {
    QMutexLocker lock(&configurationStoreMutex);
    removeManagedService(reference, pid);
  }
  context->ungetService(reference);
}
Пример #2
0
void ctkManagedServiceTracker::modifiedService(const ctkServiceReference& reference, ctkManagedService* service)
{
  QString pid = reference.getProperty(ctkPluginConstants::SERVICE_PID).toString();
  {
    QMutexLocker lock(&configurationStoreMutex);
    if (getManagedService(pid) == service)
      return;
    QString previousPid = getPidForManagedService(service);
    removeManagedService(reference, previousPid);
    addingService(reference);
  }
}
Пример #3
0
void ctkLogQDebug::log(const ctkServiceReference& sr, int level, const QString& message,
                       const std::exception* exception,
                       const char* file, const char* function, int line)
{
  Q_UNUSED(function)

  QString s = QDateTime::currentDateTime().toString(Qt::ISODate)
      .append(" - [");

  s.append(sr.getProperty(ctkPluginConstants::SERVICE_ID).toString());
  s.append(";");
  QStringList clazzes = sr.getProperty(ctkPluginConstants::OBJECTCLASS).toStringList();
  int i = 0;
  foreach (QString clazz, clazzes)
  {
    if (i > 0) s.append(",");
    s.append(clazz);
  }

  s.append(message);
  exception ? s.append(" (").append(exception->what()).append(")") : false ;

  if (file)
  {
    s.append(" [at ").append(file).append(":").append(QString::number(line)).append("]");
  }

  if (level == ctkLogService::LOG_WARNING)
  {
    qWarning() << s;
  }
  else if (level == ctkLogService::LOG_ERROR)
  {
    qCritical() << s;
  }
  else
  {
    qDebug() << s;
  }
}