コード例 #1
0
void StationListParser::readStation()
{
    Q_ASSERT( isStartElement()
              && name() == "Station" );
    
    BBCStation station;
    
    while ( !atEnd() ) {
        readNext();
        
        if( isEndElement() )
            break;
        
        if( isStartElement() ) {
            if( name() == "name" )
                station.setName( readCharacters() );
            else if ( name() == "id" )
                station.setBbcId( readCharacters().toLong() );
            else if ( name() == "priority" )
                station.setPriority( readCharacters().toInt() );
            else if ( name() == "Point" )
                readPoint( &station );
            else
                readUnknownElement();
        }
    }

    // This find the right position in the sorted to insert the new item
    QList<BBCStation>::iterator i = qLowerBound( m_list.begin(),
                                                 m_list.end(),
                                                 station );
    // Insert the item on the right position in the list
    m_list.insert( i, station );
}
コード例 #2
0
void BBCWeatherService::getItem( const QString &id )
{
    if ( id.startsWith( QLatin1String( "bbc" ) ) ) {
        BBCStation const station = m_itemGetter->station( id );
        if ( station.bbcId() > 0 ) {
            createItem( station );
        }
    }
}
コード例 #3
0
void BBCWeatherService::createItem( BBCStation station )
{
    BBCWeatherItem *item = new BBCWeatherItem( this );
    item->setMarbleWidget( marbleWidget() );
    item->setBbcId( station.bbcId() );
    item->setCoordinate( station.coordinate() );
    item->setPriority( station.priority() );
    item->setStationName( station.name() );

    emit requestedDownload( item->observationUrl(), "bbcobservation", item );
    emit requestedDownload( item->forecastUrl(),    "bbcforecast",    item );
}
コード例 #4
0
ファイル: BBCStation.cpp プロジェクト: snowy97/marble
bool BBCStation::operator<( const BBCStation& other ) const
{
    return priority() > other.priority();
}