Esempio n. 1
0
void
SqlPlaylist::loadTracks()
{
    QString query = "SELECT playlist_id, track_num, url, title, album, artist, length FROM "
                    "playlist_tracks WHERE playlist_id=%1 ORDER BY track_num";
    query = query.arg( QString::number( m_dbId ) );

    QStringList result = CollectionManager::instance()->sqlStorage()->query( query );

    int resultRows = result.count() / 7;

    for( int i = 0; i < resultRows; i++ )
    {
        QStringList row = result.mid( i*7, 7 );
        KUrl url = KUrl( row[2] );

        MetaProxy::Track *proxyTrack = new MetaProxy::Track( url );

        proxyTrack->setName( row[3] );
        proxyTrack->setAlbum( row[4] );
        proxyTrack->setArtist( row[5] );
        Meta::TrackPtr trackPtr = Meta::TrackPtr( proxyTrack );
        //subscribed to force a save to db on any change (such as AFT file move)
        subscribeTo( trackPtr );
        m_tracks << trackPtr;
    }

    m_tracksLoaded = true;
}
Esempio n. 2
0
void
Amarok::OSD::engineStateChanged( Phonon::State state, Phonon::State oldState )
{
    Q_UNUSED( oldState )
    DEBUG_BLOCK

    Meta::TrackPtr track = The::engineController()->currentTrack();

    switch( state )
    {
        case Phonon::PlayingState:
            unsubscribeFrom( m_currentTrack );
            m_currentTrack = track;
            subscribeTo( track );
            metadataChanged( track );
            m_paused = false;
            break;

        case Phonon::PausedState:
            setImage( QImage( KIconLoader::global()->iconPath( "amarok", -KIconLoader::SizeHuge ) ) );
            OSDWidget::show( i18n( "Paused" ) );
            m_paused = true;
            break;

        default:
            break;
    }
}
PersistentStatisticsStore::PersistentStatisticsStore( Meta::Track *track )
    : m_track( track )
    , m_score( 0.0 )
    , m_rating( 0 )
    , m_playCount( 0 )
    , m_batch( 0 )
{
    subscribeTo( track ); // notice the track being deleted
}
Esempio n. 4
0
void
AlbumItem::setAlbum( Meta::AlbumPtr albumPtr )
{
    if( m_album )
        unsubscribeFrom( m_album );
    m_album = albumPtr;
    subscribeTo( m_album );
    update();
}
Esempio n. 5
0
void
TrackItem::setTrack( Meta::TrackPtr trackPtr )
{
    if( m_track )
        unsubscribeFrom( m_track );
    m_track = trackPtr;
    subscribeTo( m_track );

    metadataChanged( m_track );
}
Esempio n. 6
0
Playlists::PlaylistPtr
IpodPlaylistProvider::save( const Meta::TrackList &tracks, const QString &name )
{
    if( !isWritable() )
        return Playlists::PlaylistPtr();

    IpodPlaylist *playlist = new IpodPlaylist( tracks, name, m_coll );
    itdb_playlist_add( m_coll->m_itdb, playlist->itdbPlaylist(), -1 );
    Playlists::PlaylistPtr playlistPtr( playlist );
    m_playlists << playlistPtr;
    subscribeTo( playlistPtr );
    emit playlistAdded( playlistPtr );
    emit startWriteDatabaseTimer();
    return playlistPtr;
}
Esempio n. 7
0
void
SqlPlaylist::addTrack( Meta::TrackPtr track, int position )
{
    if( !m_tracksLoaded )
        loadTracks();

    if( position < 0 )
        position = m_tracks.count();
    else
        position = qMin( position, m_tracks.count() );
    subscribeTo( track ); //keep track of metadata changes.
    m_tracks.insert( position, track );
    saveToDb( true );
    notifyObserversTrackAdded( track, position );
}
Esempio n. 8
0
int main(int argc, char **argv)
{
  ros::init(argc, argv, "pathfinder");

  ros::NodeHandle n;

  int i = atoi(argv[1]);
  char intstr[3];
  while(i-- > 0){
    // int as string
    snprintf(intstr,sizeof(intstr),"%i",i);

    // subscriben
    std::string subscribeTo("/stripped_rgbdslam");
    subscribeTo += intstr;
    subscribeTo += "/currentPose";
    subVec.push_back(n.subscribe<geometry_msgs::PoseStamped>(subscribeTo.c_str(),100,poseCallback));

    // advertisen
    std::string publishTo("/pathfinder/path");
    publishTo += intstr;
    pubMap[subscribeTo] = n.advertise<nav_msgs::Path>(publishTo.c_str(), 1000);

    // entsprechendes path object aufbauen
    nav_msgs::Path path;
    path.header.frame_id=publishTo.c_str();
    std::vector<geometry_msgs::PoseStamped> vecPoses;
    path.poses=vecPoses;

    // in die map an stelle subscribeTo legen
    paths[subscribeTo] = path;
  }

  /*
  ros::Publisher map_pub = n.advertise<nav_msgs::OccupancyGrid>("talker/map",10);
  nav_msgs::OccupancyGrid map;
  map.header.frame_id="/talker/map";
  map.info.resolution=100;
  map.info.width=10;
  map.info.height = 10;
  geometry_msgs::Pose mapPose;
  mapPose.position.x=0;
  mapPose.position.y=0;
  mapPose.position.z=0;
  mapPose.orientation.x=1;
  mapPose.orientation.y=1;
  mapPose.orientation.z=0;
  mapPose.orientation.w=0;
  std::vector<int8_t> dataVec;
  for(int i = 0; i < 100; ++i){
    int8_t tmp;
    tmp = 1;
    if(i > 10 && i < 20)
      tmp = 0;
    dataVec.push_back(tmp);
  }
  map.data = dataVec; 
  */

  ros::Rate loop_rate(1);

  while (ros::ok())
  {
    //std_msgs::String msg;
    //std::stringstream ss;
    //ss << "hello world " << count;
    //msg.data = ss.str();
    //ROS_INFO("%s", msg.data.c_str());

    /*
    geometry_msgs::PoseStamped p1;
    geometry_msgs::PoseStamped p2;
    
    p1.header.frame_id = "/pathfinder/path";
    p1.header.stamp = ros::Time::now();
    p1.pose.position.x = 0;
    p1.pose.position.y = 0;
    p1.pose.position.z = 0;
    p1.pose.orientation.x = 0;
    p1.pose.orientation.y = 0;
    p1.pose.orientation.z = 0;
    p1.pose.orientation.w = 0;

    p2.header.frame_id = "/pathfinder/path";
    p2.header.stamp = ros::Time::now();
    p2.pose.position.x = 5;
    p2.pose.position.y = 5;
    p2.pose.position.z = 5;
    p2.pose.orientation.x = 0;
    p2.pose.orientation.y = 0;
    p2.pose.orientation.z = 0;
    p2.pose.orientation.w = 0;

    v.push_back(p1);
    v.push_back(p2);
    */

    ros::spinOnce();

    loop_rate.sleep();
  }

  return 0;
}
Esempio n. 9
0
		MyAppController(): cefixbt::AppController(true) 
		{
			subscribeTo("keypress", this, &MyAppController::handleKeyPress);
		}