本文整理汇总了C++中QStringRef::toLongLong方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringRef::toLongLong方法的具体用法?C++ QStringRef::toLongLong怎么用?C++ QStringRef::toLongLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringRef
的用法示例。
在下文中一共展示了QStringRef::toLongLong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
bool MmRendererMetaData::parse(const QString &contextName)
{
clear();
QString fileName =
QString("/pps/services/multimedia/renderer/context/%1/metadata").arg(contextName);
// In newer OS versions, the filename is "metadata0", not metadata, so try both.
if (!QFile::exists(fileName))
fileName += '0';
QFile metaDataFile(fileName);
if (!metaDataFile.open(QFile::ReadOnly)) {
qWarning() << "Unable to open media metadata file" << fileName << ":"
<< metaDataFile.errorString();
return false;
}
const QString separator("::");
QTextStream stream(&metaDataFile);
Q_FOREVER {
const QString line = stream.readLine();
if (line.isNull())
break;
const int separatorPos = line.indexOf(separator);
if (separatorPos != -1) {
const QStringRef key = line.leftRef(separatorPos);
const QStringRef value = line.midRef(separatorPos + separator.length());
if (key == durationKey)
m_duration = value.toLongLong();
else if (key == widthKey)
m_width = value.toInt();
else if (key == heightKey)
m_height = value.toInt();
else if (key == mediaTypeKey)
m_mediaType = value.toInt();
else if (key == pixelWidthKey)
m_pixelWidth = value.toFloat();
else if (key == pixelHeightKey)
m_pixelHeight = value.toFloat();
else if (key == titleKey)
m_title = value.toString();
else if (key == seekableKey)
m_seekable = !(value == QLatin1String("0"));
else if (key == artistKey)
m_artist = value.toString();
else if (key == commentKey)
m_comment = value.toString();
else if (key == genreKey)
m_genre = value.toString();
else if (key == yearKey)
m_year = value.toInt();
else if (key == bitRateKey)
m_audioBitRate = value.toInt();
else if (key == sampleKey)
m_sampleRate = value.toInt();
else if (key == albumKey)
m_album = value.toString();
else if (key == trackKey)
m_track = value.toInt();
}
}
return true;
}