void YoutubeSessionData::thumbRecv() { if (!m_context.isValid(this)) { return; } QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender()); if (!reply) { return; } if (m_thumbJobs.contains(reply->url())) { if (reply->error() == QNetworkReply::NoError) { Sprinter::QueryMatch match = m_thumbJobs[reply->url()]; //TODO this is not very good: large images won't come in all at once // leading to biiiig chunks here.. in theory the thumbnails are all small // however QByteArray data = reply->readAll(); QImage image = QImage::fromData(data); //qDebug() << "image is ... " << image.size() << data.size(); if (image.size().isValid()) { image = image.scaled(m_context.imageSize(), Qt::KeepAspectRatio); match.setImage(image); updateMatches(QVector<Sprinter::QueryMatch>() << match); } } m_thumbJobs.remove(reply->url()); } reply->deleteLater(); }
void MediaQueryList::mediaFeaturesChanged(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> >* listenersToNotify) { m_matchesDirty = true; if (!updateMatches()) return; for (ListenerList::const_iterator it = m_listeners.begin(), end = m_listeners.end(); it != end; ++it) { listenersToNotify->append(*it); } }
MediaQueryList::MediaQueryList(PassRefPtrWillBeRawPtr<MediaQueryMatcher> matcher, PassRefPtrWillBeRawPtr<MediaQuerySet> media) : m_matcher(matcher) , m_media(media) , m_matchesDirty(true) , m_matches(false) { m_matcher->addMediaQueryList(this); updateMatches(); }
//----------------------------------------------------------------------------- // Function: updateContent() //----------------------------------------------------------------------------- void TextContentAssistWidget::updateAssist(QKeyEvent* e) { // Invoke the content assist for certain keys. if (e->text().contains(QRegExp("^[a-z|A-z|0-9|_|;|Ä|ä|Ö|ö|Å|å|(|)|,|.|&]$")) || e->key() == Qt::Key_Backspace || e->key() == Qt::Key_Return || (contentFound_ && (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up || e->text().contains(' ')))) { updateMatches(); } // Cancel assisting if needed. else if (e->modifiers() == Qt::NoModifier) { hideAssist(); } }
bool MediaQueryList::matches() { updateMatches(); return m_matches; }