本文整理汇总了C++中Video::getChannelId方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::getChannelId方法的具体用法?C++ Video::getChannelId怎么用?C++ Video::getChannelId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::getChannelId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findVideoParts
void MediaView::findVideoParts() {
Video *video = playlistModel->activeVideo();
if (!video) return;
QString query = video->getTitle();
const QLatin1String optionalSpace("\\s*");
const QLatin1String staticCounterSeparators("[\\/\\-]");
const QString counterSeparators =
QLatin1String("( of | ") + tr("of", "Used in video parts, as in '2 of 3'") +
QLatin1String(" |") + staticCounterSeparators + QLatin1String(")");
// numbers from 1 to 15
const QLatin1String counterNumber("([1-9]|1[0-5])");
// query.remove(QRegExp(counterSeparators + optionalSpace + counterNumber));
query.remove(QRegExp(counterNumber + optionalSpace + counterSeparators + optionalSpace +
counterNumber));
query.remove(wordRE("pr?t\\.?" + optionalSpace + counterNumber));
query.remove(wordRE("ep\\.?" + optionalSpace + counterNumber));
query.remove(wordRE("part" + optionalSpace + counterNumber));
query.remove(wordRE("episode" + optionalSpace + counterNumber));
query.remove(wordRE(tr("part", "This is for video parts, as in 'Cool video - part 1'") +
optionalSpace + counterNumber));
query.remove(wordRE(tr("episode", "This is for video parts, as in 'Cool series - episode 1'") +
optionalSpace + counterNumber));
query.remove(QRegExp("[\\(\\)\\[\\]]"));
#define NUMBERS "one|two|three|four|five|six|seven|eight|nine|ten"
QRegExp englishNumberRE = QRegExp(QLatin1String(".*(") + NUMBERS + ").*", Qt::CaseInsensitive);
// bool numberAsWords = englishNumberRE.exactMatch(query);
query.remove(englishNumberRE);
QRegExp localizedNumberRE =
QRegExp(QLatin1String(".*(") + tr(NUMBERS) + ").*", Qt::CaseInsensitive);
// if (!numberAsWords) numberAsWords = localizedNumberRE.exactMatch(query);
query.remove(localizedNumberRE);
SearchParams *searchParams = new SearchParams();
searchParams->setTransient(true);
searchParams->setKeywords(query);
searchParams->setChannelId(video->getChannelId());
/*
if (!numberAsWords) {
qDebug() << "We don't have number as words";
// searchParams->setSortBy(SearchParams::SortByNewest);
// TODO searchParams->setReverseOrder(true);
// TODO searchParams->setMax(50);
}
*/
search(searchParams);
}
示例2: onAuthorPushed
void MediaView::onAuthorPushed(QModelIndex index) {
Video *video = playlistModel->videoAt(index.row());
if (!video) return;
QString channelId = video->getChannelId();
// if (channelId.isEmpty()) channelId = video->channelTitle();
if (channelId.isEmpty()) return;
SearchParams *searchParams = new SearchParams();
searchParams->setChannelId(channelId);
searchParams->setSortBy(SearchParams::SortByNewest);
// go!
search(searchParams);
}
示例3: toggleSubscription
void MediaView::toggleSubscription() {
Video *video = playlistModel->activeVideo();
if (!video) return;
QString userId = video->getChannelId();
if (userId.isEmpty()) return;
bool subscribed = YTChannel::isSubscribed(userId);
if (subscribed) {
YTChannel::unsubscribe(userId);
MainWindow::instance()->showMessage(
tr("Unsubscribed from %1").arg(video->getChannelTitle()));
} else {
YTChannel::subscribe(userId);
MainWindow::instance()->showMessage(tr("Subscribed to %1").arg(video->getChannelTitle()));
}
updateSubscriptionAction(video, !subscribed);
}