本文整理汇总了C++中qfileinfolist::const_iterator::lastModified方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::lastModified方法的具体用法?C++ const_iterator::lastModified怎么用?C++ const_iterator::lastModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qfileinfolist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::lastModified方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void NowReadingEngine::update()
{
QFileInfoList okularFiles = getOkularXMLFiles();
QFileInfoList::const_iterator it = okularFiles.constBegin();
uint limit = MaxDataModelSize;
for ( ; it != okularFiles.constEnd() && limit--; ++it) {
QString okularFileName = it->absoluteFilePath();
DataModel::iterator itDm = _dataModel.find(okularFileName);
if ((itDm != _dataModel.end()) && /* We have an entry for this element */
(itDm.value().accessTime >= it->lastModified())) { /* And it's up to date */
/* No need to update */
continue;
}
NowReadingEntry entry;
if (convertOkularXMLFileToEntry(okularFileName, entry)) {
setData(entry.path, "currentPage", entry.currentPage);
setData(entry.path, "totalPages", entry.totalPages);
setData(entry.path, "accessTime", entry.accessTime);
_dataModel[okularFileName] = entry;
}
}
/* Cleanup */
if (_dataModel.size() > MaxDataModelSize) {
// Find elements to evict
// First - what is the modification time of the last element we want to preserve?
QDateTime oldestElementDate;
QList<DataModel::mapped_type> values = _dataModel.values();
nth_element(values.begin(), values.begin()+MaxDataModelSize-1, values.end());
oldestElementDate = (values.begin()+MaxDataModelSize-1)->accessTime;
// Now find all elements older than the oldest allowable
DataModel::iterator it = _dataModel.begin();
while (it != _dataModel.end()) {
if (it.value().accessTime < oldestElementDate) {
removeSource(it.value().path);
it = _dataModel.erase(it);
}
else {
++it;
}
}
}
/* Single shot timer used as in case the update takes very long
we can get overflow of timer events to handle */
QTimer::singleShot(PollingInterval, this, SLOT(update()));
}