本文整理汇总了C++中QStringList::detach方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::detach方法的具体用法?C++ QStringList::detach怎么用?C++ QStringList::detach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::detach方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRecordingsGroups
QStringList StorageGroup::getRecordingsGroups(void)
{
QStringList groups;
MSqlQuery query(MSqlQuery::InitCon());
QString sql = "SELECT DISTINCT groupname "
"FROM storagegroup "
"WHERE groupname NOT IN (";
for (QStringList::const_iterator it = StorageGroup::kSpecialGroups.begin();
it != StorageGroup::kSpecialGroups.end(); ++it)
sql.append(QString(" '%1',").arg(*it));
sql = sql.left(sql.length() - 1);
sql.append(" );");
query.prepare(sql);
if (query.exec() && query.isActive() && query.size() > 0)
while (query.next())
groups += query.value(0).toString();
groups.sort();
groups.detach();
return groups;
}
示例2: GetRawTextSubtitles
QStringList SubtitleReader::GetRawTextSubtitles(uint64_t &duration)
{
QMutexLocker lock(&m_RawTextSubtitles.lock);
if (m_RawTextSubtitles.buffers.empty())
return QStringList();
duration = m_RawTextSubtitles.duration;
QStringList result = m_RawTextSubtitles.buffers;
result.detach();
m_RawTextSubtitles.buffers.clear();
return result;
}
示例3: GetContextKeys
QStringList ActionSet::GetContextKeys(const QString &context_name) const
{
QStringList keys;
ContextMap::const_iterator cit = m_contexts.find(context_name);
if (cit == m_contexts.end())
return keys;
Context::const_iterator it = (*cit).begin();
for (; it != (*cit).end(); ++it)
keys += (*it)->GetKeys();
keys.sort();
keys.detach();
return keys;
}
示例4: GetKeys
/** \fn ActionSet::GetKeys(const ActionID&) const
* \brief Get the keys bound to an action by its identifier.
*/
QStringList ActionSet::GetKeys(const ActionID &id) const
{
QStringList keys;
ContextMap::const_iterator cit = m_contexts.find(id.GetContext());
if (cit == m_contexts.end())
return keys;
Context::const_iterator it = (*cit).find(id.GetAction());
if (it != (*cit).end())
keys = (*it)->GetKeys();
keys.detach();
return keys;
}
示例5: getGroupDirs
QStringList StorageGroup::getGroupDirs(QString groupname, QString host)
{
QStringList groups;
QString addHost;
MSqlQuery query(MSqlQuery::InitCon());
if (!host.isEmpty())
addHost = " AND hostname = :HOSTNAME";
else
addHost = "";
QString sql = QString("SELECT dirname,hostname "
"FROM storagegroup "
"WHERE groupname = :GROUPNAME %1").arg(addHost);
query.prepare(sql);
query.bindValue(":GROUPNAME", groupname);
if (!host.isEmpty())
query.bindValue(":HOSTNAME", host);
if (query.exec() && query.isActive() && query.size() > 0)
{
QString dirname;
while (query.next())
{
/* The storagegroup.dirname column uses utf8_bin collation, so Qt
* uses QString::fromAscii() for toString(). Explicitly convert the
* value using QString::fromUtf8() to prevent corruption. */
dirname = QString::fromUtf8(query.value(0)
.toByteArray().constData());
groups += gCoreContext->GenMythURL(query.value(1).toString(),
0,
dirname,
groupname);
}
}
groups.sort();
groups.detach();
return groups;
}
示例6: GetSubtitles
/** \fn TextSubtitles::GetSubtitles(uint64_t timecode) const
* \brief Returns the subtitles to display at the given timecode.
*
* \param timecode The timecode (frame number or time stamp) of the
* current video position.
* \return The subtitles as a list of strings.
*/
QStringList TextSubtitles::GetSubtitles(uint64_t timecode)
{
QStringList list;
if (!m_isInProgress && m_subtitles.empty())
return list;
text_subtitle_t searchTarget(timecode, timecode);
TextSubtitleList::const_iterator nextSubPos =
lower_bound(m_subtitles.begin(), m_subtitles.end(), searchTarget);
uint64_t startCode = 0, endCode = 0;
if (nextSubPos != m_subtitles.begin())
{
TextSubtitleList::const_iterator currentSubPos = nextSubPos;
--currentSubPos;
const text_subtitle_t &sub = *currentSubPos;
if (sub.start <= timecode && sub.end >= timecode)
{
// found a sub to display
m_lastReturnedSubtitle = sub;
QStringList tmp = m_lastReturnedSubtitle.textLines;
tmp.detach();
return tmp;
}
// the subtitle time span has ended, let's display a blank sub
startCode = sub.end + 1;
}
if (nextSubPos == m_subtitles.end())
{
if (m_isInProgress)
{
const int maxReloadInterval = 1000; // ms
if (IsFrameBasedTiming())
// Assume conservative 24fps
endCode = startCode + maxReloadInterval / 24;
else
endCode = startCode + maxReloadInterval;
QDateTime now = QDateTime::currentDateTimeUtc();
if (!m_fileName.isEmpty() &&
m_lastLoaded.msecsTo(now) >= maxReloadInterval)
{
TextSubtitleParser::LoadSubtitles(m_fileName, *this, true);
}
}
else
{
// at the end of video, the blank subtitle should last
// until forever
endCode = startCode + INT_MAX;
}
}
else
{
endCode = (*nextSubPos).start - 1;
}
// we are in a position in which there are no subtitles to display,
// return an empty subtitle and create a dummy empty subtitle for this
// time span so SubtitleChanged() functions also in this case
text_subtitle_t blankSub(startCode, endCode);
m_lastReturnedSubtitle = blankSub;
return list;
}