本文整理汇总了C++中EventData::setLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ EventData::setLocation方法的具体用法?C++ EventData::setLocation怎么用?C++ EventData::setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventData
的用法示例。
在下文中一共展示了EventData::setLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTestData
/* Randomized events for testing until real ones are available */
void EventsModel::createTestData()
{
unsigned seed = QDateTime::currentDateTime().time().msec() * QDateTime::currentDateTime().time().second();
qsrand(seed);
qDebug("seed: %u", seed);
QList<DVRServer*> servers = bcApp->servers();
if (servers.isEmpty())
return;
QDateTime end = QDateTime::currentDateTime().addSecs(-3600);
int duration = 86400 * 7; /* one week */
int count = (qrand() % 285) + 15;
for (int i = 0; i < count; ++i)
{
EventData *event = new EventData(servers[qrand() % servers.size()]);
event->date = end.addSecs(-((qrand() * qrand()) % duration));
event->duration = 1 + (qrand() % 1299);
bool useCamera = qrand() % 6;
if (useCamera && !event->server->cameras().isEmpty())
{
event->setLocation(QString::fromLatin1("camera-%1").arg(qrand() % event->server->cameras().size()));
event->type = (qrand() % 10) ? QLatin1String("motion") : QLatin1String("video signal loss");
event->level = (qrand() % 3) ? EventLevel::Warning : EventLevel::Alarm;
if (event->type == EventType::CameraVideoLost)
event->level = EventLevel::Critical;
}
else
{
event->setLocation(QString::fromLatin1("system"));
event->type = (qrand() % 10) ? QLatin1String("disk-space") : QLatin1String("crash");
event->level = (qrand() % 5) ? EventLevel::Info : EventLevel::Critical;
}
cachedEvents[event->server].append(event);
}
}