示例#1
0
void Environment::addSong(SoundFile* file)
{
	Song* song = new Song(file, this);
	if (!m_songs.contains(song))
	{
		m_songs.append(song);
		emit songAdded(song);
	}
}
示例#2
0
void MainWindow::mkconnections()
{
    connect(bar,SIGNAL(closeClicked()),SLOT(close()));
    connect(bar,SIGNAL(maximizeClicked(bool)),SLOT(showWind(bool)));
    connect(bar,SIGNAL(hideClicked()),SLOT(showMinimized()));
    connect(playlists,SIGNAL(songAdded(QString,QString)),&library,SLOT(addSongInPlaylist(QString,QString)));
    connect(bar,SIGNAL(addFilePressed()),SLOT(addFiles()));
    connect(bar,SIGNAL(addFolderPressed()),SLOT(addFolder()));
    connect(&player,SIGNAL(inPlaylist(bool)),SLOT(changePlayerConnections(bool)));
    connect(&library,SIGNAL(newSong(Song)),table,SLOT(addSongInList(Song)));
    connect(&player,SIGNAL(positionChanged(qint64)),bar,SIGNAL(seekChanged(qint64)));
    connect(&player,SIGNAL(currentSongChanged(Song)),bar,SIGNAL(songChanged(Song)));
    connect(bar,SIGNAL(playClicked()),&player,SLOT(playpause()));
    connect(addFile,SIGNAL(triggered()),SLOT(addFiles()));
    connect(actionAddFolder,SIGNAL(triggered()),SLOT(addFolder()));
    connect(actionOuvrir,SIGNAL(triggered()),SLOT(openFile()));
    connect(bar,SIGNAL(volumeChanged(int)),&player,SLOT(setVolume(int)));
    connect(bar,SIGNAL(positionChanged(int)),&player,SLOT(setPosition(int)));
    connect(bar,SIGNAL(seekBarPressed()),&player,SLOT(pause()));
    connect(bar,SIGNAL(seekBarReleased()),&player,SLOT(play()));
    connect(&player,SIGNAL(playbackStateChanged(bool)),bar,SLOT(changeButton(bool)));
    connect(tree,SIGNAL(albumChosen(QString,QString)),table,SLOT(showSongsFrom(QString,QString)));
    connect(tree,SIGNAL(artistChosen(QString)),table,SLOT(showSongsBy(QString)));
    connect(&library,SIGNAL(libraryChanged(Library*)),tree,SLOT(updateTree(Library*)));
    connect(table,SIGNAL(newPlaylist(Song)),this,SLOT(mkPlaylist(Song)));
    connect(playlists,SIGNAL(playlistChosen(QString)),table,SLOT(showSongsIn(QString)));
    connect(table,SIGNAL(deleteSong(Song,bool)),&library,SLOT(deleteSong(Song,bool)));
    connect(bar,SIGNAL(newQuery(QString,int)),table,SLOT(setQuery(QString,int)));
    connect(bar,SIGNAL(newPlaybackMode(QMediaPlaylist::PlaybackMode)),&player,SLOT(setPlayBackMode(QMediaPlaylist::PlaybackMode)));
    connect(table,SIGNAL(songChosen(int)),&player,SLOT(play(int)));
    connect(table,SIGNAL(newSongList(SongList)),&player,SLOT(update(SongList)));
    connect(&player,SIGNAL(inPlaylist(bool)),bar,SLOT(enableNavigation(bool)));
    connect(bar,SIGNAL(miniLecteur()),&mLecteur,SLOT(show()));
    connect(bar,SIGNAL(miniLecteur()),SLOT(hide()));
    connect(&mLecteur,SIGNAL(windowedMode()),SLOT(show()));
    connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int)));
    connect(&mLecteur,SIGNAL(seekBarPressed()),bar,SIGNAL(seekBarPressed()));
    connect(&mLecteur,SIGNAL(seekBarReleased()),bar,SIGNAL(seekBarReleased()));
    connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int)));
    connect(&mLecteur,SIGNAL(playClicked()),bar,SIGNAL(playClicked()));
    connect(&mLecteur,SIGNAL(nextClicked()),bar,SIGNAL(nextClicked()));
    connect(&mLecteur,SIGNAL(previousClicked()),bar,SIGNAL(previousClicked()));
    connect(&mLecteur,SIGNAL(volumeChanged(int)),bar,SIGNAL(volumeChanged(int)));
    connect(&player,SIGNAL(currentSongChanged(Song)),&mLecteur,SLOT(setNewSong(Song)));
    connect(&player,SIGNAL(positionChanged(qint64)),&mLecteur,SLOT(setPosition(qint64)));
    connect(&player,SIGNAL(playbackStateChanged(bool)),&mLecteur,SLOT(changeButton(bool)));
    connect(&player,SIGNAL(indexChanged(int,int)),table,SLOT(setIconTo(int,int)));
    connect(table,SIGNAL(addFileTriggered()),SLOT(addFiles()));
    connect(table,SIGNAL(addFolderTriggered()),SLOT(addFolder()));

}