void SoundCloudPlaylistWindow::playTrack(const QModelIndex &index) {
    if (isBusy()) {
        return;
    }
    
    if (SoundCloudTrack *track = m_model->get(index.row())) {
        AudioPlayer::instance()->playTrack(track);
        NowPlayingWindow *window = new NowPlayingWindow(this);
        window->show();
    }
}
Beispiel #2
0
void MainWindow::playUrl() {
    const QString url = QInputDialog::getText(this, tr("Play URL"), tr("URL"));
    
    if (!url.isEmpty()) {
        if (AudioPlayer::instance()->playUrl(url) > 0) {
            NowPlayingWindow *window = new NowPlayingWindow(this);
            window->show();
        }
        else {
            QMaemo5InformationBox::information(this, tr("No tracks added"));
        }
    }
}
Beispiel #3
0
void MainWindow::playFolder() {
    const QString folder = QFileDialog::getExistingDirectory(this, tr("Play folder"), "/home/user/MyDocs/",
                                                             QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly);
    
    if (!folder.isEmpty()) {
        if (AudioPlayer::instance()->playUrl(QUrl::fromLocalFile(folder)) > 0) {
            NowPlayingWindow *window = new NowPlayingWindow(this);
            window->show();
        }
        else {
            QMaemo5InformationBox::information(this, tr("No tracks added"));
        }
    }
}
void SoundCloudPlaylistWindow::playPlaylist() {
    if ((isBusy()) || (m_model->rowCount() == 0)) {
        return;
    }
    
    QList<MKTrack*> tracks;
    
    for (int i = 0; i < m_model->rowCount(); i++) {
        if (SoundCloudTrack *track = m_model->get(i)) {
            tracks << track;
        }
    }
    
    if (!tracks.isEmpty()) {
        AudioPlayer::instance()->playTracks(tracks);
        NowPlayingWindow *window = new NowPlayingWindow(this);
        window->show();
    }
}