本文整理汇总了C++中Page::blog方法的典型用法代码示例。如果您正苦于以下问题:C++ Page::blog方法的具体用法?C++ Page::blog怎么用?C++ Page::blog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::blog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fileInfo
Page *FileEngine::loadPage(const QString &filename)
{
Q_D(FileEngine);
// skip temporary files
if (filename.endsWith(QLatin1Char('~'))) {
return 0;
}
const QString &relPathPercent = d->pagesPath.relativeFilePath(filename);
QString relPath = QUrl::fromPercentEncoding(relPathPercent.toLatin1());
// Paths like http://foo.com or http://foo.com/bar/
// have files that ends with index
if (relPath.endsWith(QLatin1String("index"))) {
relPath.remove(relPath.size() - 5, 5);
}
Page *page = 0;
QFileInfo fileInfo(filename);
QHash<QString, Page*>::ConstIterator it = d->pathPages.constFind(relPath);
if (it != d->pathPages.constEnd()) {
page = it.value();
if (page->modified() != fileInfo.lastModified()) {
d->pathPages.remove(relPath);
d->posts.removeOne(page);
d->pages.removeOne(page);
delete page;
page = 0;
}
}
if (!page) {
QSettings data(filename, QSettings::IniFormat);
page = new Page(this);
page->setPath(relPath);
page->setName(data.value(QStringLiteral("Name")).toString());
QString author = data.value(QStringLiteral("Author")).toString();
if (author.isEmpty()) {
author = fileInfo.owner();
}
page->setAuthor(author);
QDateTime modified = QDateTime::fromString(data.value(QStringLiteral("Modified")).toString(), Qt::ISODate);
if (modified.isValid()) {
} else {
modified = fileInfo.lastModified().toUTC();
}
page->setModified(modified);
QDateTime created = QDateTime::fromString(data.value(QStringLiteral("Created")).toString(), Qt::ISODate);
if (created.isValid()) {
} else {
created = fileInfo.created().toUTC();
}
page->setCreated(created);
page->setNavigationLabel(data.value(QStringLiteral("NavigationLabel")).toString());
page->setTags(data.value(QStringLiteral("Tags")).toStringList());
page->setBlog(data.value(QStringLiteral("Blog")).toBool());
page->setAllowComments(data.value(QStringLiteral("AllowComments")).toBool());
data.beginGroup(QStringLiteral("Body"));
page->setContent(data.value(QStringLiteral("Content")).toString());
data.endGroup();
d->pathPages.insert(relPath, page);
if (page->blog()) {
d->posts.append(page);
} else {
d->pages.append(page);
}
}
return page;
}