void ChartLyricsPlugin::onReplyReceived()
{
    QString lyrics;

    QXmlStreamReader xml(reply->readAll());
    reply->deleteLater();

    while (!xml.atEnd() && !xml.hasError())
        if (xml.readNext() == QXmlStreamReader::StartElement && xml.name() == "Lyric")
            { lyrics = xml.readElementText(); break; }

    if (lyrics.isEmpty())
        emit error("The lyrics for this song are missing on ChartLyrics.");
    else
        emit fetched(lyrics);
}
 void CollectionScanNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "COLLSCAN\n";
     addIndent(ss, indent + 1);
     *ss <<  "ns = " << name << endl;
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString();
     }
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
 }
Exemple #3
0
void Application::slotCredentialsFetched()
{
    Account *account = AccountManager::instance()->account();
    Q_ASSERT(account);
    disconnect(account->credentials(), SIGNAL(fetched()), this, SLOT(slotCredentialsFetched()));
    if (!account->credentials()->ready()) {
        // User canceled the connection or did not give a password
        account->setState(Account::SignedOut);
        return;
    }
    if (account->state() == Account::InvalidCredidential) {
        // Then we ask again for the credidentials if they are wrong again
        account->setState(Account::Disconnected);
    }
    slotCheckConnection();
}
 void ProjectionNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "PROJ\n";
     verify(NULL != projection);
     addIndent(ss, indent + 1);
     *ss << "proj = " << projection->toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "Child:" << endl;
     child->appendToString(ss, indent + 2);
 }
Exemple #5
0
 void IndexScanNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "IXSCAN\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern << endl;
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter= " << filter->toString() << endl;
     }
     addIndent(ss, indent + 1);
     *ss << "direction = " << direction << endl;
     addIndent(ss, indent + 1);
     *ss << "bounds = " << bounds.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addCommon(ss, indent);
 }
Exemple #6
0
void ShibbolethCredentials::fetch(Account *account)
{
    if (_ready) {
        Q_EMIT fetched();
    } else {
        ShibbolethConfigFile cfg;
        if (account) {
            _url = account->url();
        }
        _browser = new ShibbolethWebView(account, cfg.createCookieJar());
        connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
                this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
        connect(_browser, SIGNAL(viewHidden()),
                this, SLOT(slotBrowserHidden()));
        _browser->show ();
    }
}
void MetaDataLoaderProgressWidget::hookup(Abstract::MetaDataLoader* mdl) {
        
    connect (mdl, SIGNAL(progressRangeChanged(int,int)),
             this, SLOT(updateRange(int, int)), Qt::QueuedConnection);
    connect (mdl, SIGNAL(progressRangeChanged(int,int)),
             this, SLOT(show()), Qt::QueuedConnection);
    connect (mdl, SIGNAL(finished()),
             this, SLOT(hide()), Qt::QueuedConnection);

    connect (mdl, SIGNAL(progressValueChanged(int)),
             m_progressBar, SLOT(setValue(int)), Qt::QueuedConnection);
    connect (mdl, SIGNAL(progressRangeChanged(int,int)),
             m_progressBar, SLOT(setRange(int,int)), Qt::QueuedConnection);
    connect (m_cancelButton, SIGNAL(triggered(QAction*)),
             mdl, SLOT(cancel()));
    connect (mdl, SIGNAL(fetched(MetaDataValue)), this, SLOT(updateStatus(MetaDataValue)));
}
 void TextNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "TEXT\n";
     addIndent(ss, indent + 1);
     *ss << "numWanted = " << _numWanted << endl;
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << _indexKeyPattern.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "query = " << _query << endl;
     addIndent(ss, indent + 1);
     *ss << "language = " << _language << endl;
 }
 void AndSortedNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "AND_SORTED";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString() << endl;
     }
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
     for (size_t i = 0; i < children.size(); ++i) {
         *ss << "Child " << i << ": ";
         children[i]->appendToString(ss, indent + 1);
     }
 }
Exemple #10
0
 void GeoNear2DNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "GEO_NEAR_2D\n";
     addIndent(ss, indent + 1);
     *ss << "keyPattern = " << indexKeyPattern.toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "nearQuery = " << nq.toString() << endl;
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         *ss << " filter = " << filter->toString();
     }
 }
Exemple #11
0
 void FetchNode::appendToString(stringstream* ss, int indent) const {
     addIndent(ss, indent);
     *ss << "FETCH\n";
     if (NULL != filter) {
         addIndent(ss, indent + 1);
         StringBuilder sb;
         *ss << "filter:\n";
         filter->debugString(sb, indent + 2);
         *ss << sb.str();
     }
     addIndent(ss, indent + 1);
     *ss << "fetched = " << fetched() << endl;
     addIndent(ss, indent + 1);
     *ss << "sortedByDiskLoc = " << sortedByDiskLoc() << endl;
     addIndent(ss, indent + 1);
     *ss << "getSort = " << getSort().toString() << endl;
     addIndent(ss, indent + 1);
     *ss << "Child:" << endl;
     child->appendToString(ss, indent + 2);
 }
//start id="get"
void PhononItem::fetchMetaData() {
    delete m_metaMedia;

    m_mediaSource = Phonon::MediaSource(fileName());
    if (m_mediaSource.type() == Phonon::MediaSource::Invalid) {
        qDebug() << "Invalid Media Source." << fileName();
        emit fetched(false);

    }
    m_metaMedia = new Phonon::MediaObject(this);


    QObject::connect(m_metaMedia, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
                     this, SLOT(metaStateChanged(Phonon::State, Phonon::State)), Qt::QueuedConnection);
    QObject::connect(m_metaMedia, SIGNAL(totalTimeChanged(qint64)),
                     this, SLOT(setTotalTime(qint64)), Qt::QueuedConnection);

    m_metaMedia->setCurrentSource(m_mediaSource);

}
Exemple #13
0
void AbstractNetworkJob::slotFinished()
{
    _timer.stop();

    if( _reply->error() != QNetworkReply::NoError ) {
        qDebug() << Q_FUNC_INFO << _reply->error() << _reply->errorString();
        if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) {
            qDebug() << Q_FUNC_INFO << _reply->rawHeader("Proxy-Authenticate");
        }
        emit networkError(_reply);
    }

    // get the Date timestamp from reply
    _responseTimestamp = QString::fromAscii(_reply->rawHeader("Date"));
    _duration = _durationTimer.elapsed();

    bool discard = finished();
    AbstractCredentials *creds = _account->credentials();
    if (!creds->stillValid(_reply) &&! _ignoreCredentialFailure
            && _account->state() != Account::InvalidCredidential) {
        _account->setState(Account::InvalidCredidential);

        // invalidate & forget token/password
        // but try to re-sign in.
        connect( creds, SIGNAL(fetched()),
                 qApp, SLOT(slotCredentialsFetched()), Qt::UniqueConnection);
        if (creds->ready()) {
            creds->invalidateAndFetch(_account);
        } else {
            creds->fetch(_account);
        }
    }
    if (discard) {
        deleteLater();
    }
}
int main()
{
  std::vector<std::string> s1;
  s1.push_back("1");
  s1.push_back("2");

  std::vector<std::string> s2;
  s2.push_back("2");
  s2.push_back("3");

  std::vector<std::string> s3;
  s3.push_back("3");
  s3.push_back("4");

  ssm.put(s1, "value1");
  ssm.put(s2, "value2");
  ssm.put(s3, "value3");

  std::vector<std::string> s4;
  s4.push_back("1");
  s4.push_back("2");
  s4.push_back("3");

  std::vector<std::pair<string, std::vector<std::string> > > fetched(ssm.get_kv(s4));

  std::cout << "PRINTING RESULTS:" << std::endl;
  for (size_t i = 0, S = fetched.size(); i < S; ++i) {
    std::cout << fetched[i].first << std::endl;
  }

  Subset_Map<string, string> ssm2;
  ssm2.put(s1, "foo");
  ssm2.put(s2, "bar");
  ssm2.put(s4, "hux");

  std::vector<std::pair<string, std::vector<std::string> > > fetched2(ssm2.get_kv(s4));

  std::cout << std::endl << "PRINTING RESULTS:" << std::endl;
  for (size_t i = 0, S = fetched2.size(); i < S; ++i) {
    std::cout << fetched2[i].first << std::endl;
  }

  std::cout << "TRYING ON A SELECTOR-LIKE OBJECT" << std::endl;

  Subset_Map<string, string> sel_ssm;
  std::vector<std::string> target;
  target.push_back("desk");
  target.push_back(".wood");

  std::vector<std::string> actual;
  actual.push_back("desk");
  actual.push_back(".wood");
  actual.push_back(".mine");

  sel_ssm.put(target, "has-aquarium");
  std::vector<std::pair<string, std::vector<std::string> > > fetched3(sel_ssm.get_kv(actual));
  std::cout << "RESULTS:" << std::endl;
  for (size_t i = 0, S = fetched3.size(); i < S; ++i) {
    std::cout << fetched3[i].first << std::endl;
  }

  std::cout << std::endl;

  // BEGIN PORTED RUBY TESTS FROM /test/sass/util/subset_map_test.rb

  setup();
  testEqualKeys();
  testSubsetKeys();
  testSupersetKeys();
  testDisjointKeys();
  testSemiDisjointKeys();
  testEmptyKeySet();
  testEmptyKeyGet();
  testMultipleSubsets();
  testBracketBracket();
  testKeyOrder();

  setup();
  testOrderPreserved();

  setup();
  testMultipleEqualValues();

  return 0;
}
void TokenCredentials::fetchFromKeychain()
{
    Q_EMIT fetched();
}
void PhononItem::metaStateChanged(Phonon::State newState, Phonon::State oldState) {
    Q_UNUSED(oldState);
  //  static QObjectWriter writer(this, false);

    if (newState == Phonon::ErrorState) {
        qDebug() << "PhononItem: Error Opening File: " << fileName();

        emit fetched(false);
        return;
    }

    if (m_metaMedia->currentSource().type() == Phonon::MediaSource::Invalid) {

        emit fetched(false);
        qDebug() << "Invalid metadata: " << fileName();
        return;
    }

    QMap<QString, QString> metaData = m_metaMedia->metaData();

    setArtist(metaData.value("ARTIST"));
    setTrackTitle(metaData.value("TITLE"));
    setAlbumTitle(metaData.value("ALBUM"));
    setGenre(metaData.value("GENRE"));
    QString tn = metaData.value("TRACK-NUMBER");
    if (tn == QString()) tn = metaData.value("TRACKNUMBER");
    setTrackNumber(tn);
    extendedComment = QString();
    QString comment =  metaData.value("COMMENT");
    setComment(comment);
    
    // http://www.freedesktop.org/wiki/Specifications/free-media-player-specs
    QString fmpsRating = metaData.value("FMPS_Rating");
    // ??? Why does this not work?
    if (fmpsRating.toDouble() > 0 ) {
        int stars = fmpsRating.toDouble() * 10;
        Preference fmpsPref(stars);
        qDebug() << "FMPS Rating: " << stars;
        setPreference(fmpsPref);
    }

    // Preference can be obtained from various ways.
    else setPreference(comment);

    // Check for MusicMatch preference
    if ((preference().intValue() == 0) && metaData.contains("EXTENDED-COMMENT")) {
        extendedComment = metaData.value("EXTENDED-COMMENT");
        int eqidx = extendedComment.indexOf("=");
        if (eqidx > 0)
            extendedComment=extendedComment.mid(eqidx+1);
        Preference p(extendedComment);
        if (p.intValue() > 0) {
            setPreference(p);
            setComment(p.toString());
        }
    }

//start id="notify"
    m_loaded = true;
    if (m_timeSet) {
        emit fetched();
    }
//end

}
Exemple #17
0
void FetchQueue::slotFetchAborted(Feed *f)
{
    emit fetched(f); // FIXME: better use a signal like signalAborted(Feed*)
    feedDone(f);
}
Exemple #18
0
void TokenCredentials::fetch()
{
    Q_EMIT fetched();
}
void DummyCredentials::fetchFromKeychain()
{
    Q_EMIT(fetched());
}