Beispiel #1
0
void SoundCloudView::showResource(const QString &type, const QString &id) {
    if (type == Resources::PLAYLIST) {
        SoundCloudPlaylistWindow *window = new SoundCloudPlaylistWindow(id, StackedWindow::currentWindow());
        window->show();
    }
    else if (type == Resources::ARTIST) {
        SoundCloudArtistWindow *window = new SoundCloudArtistWindow(id, StackedWindow::currentWindow());
        window->show();
    }
    else {
        SoundCloudTrackWindow *window = new SoundCloudTrackWindow(id, StackedWindow::currentWindow());
        window->show();
    }
}
void SoundCloudPlaylistWindow::showResource(const QUrl &url) {
    QVariantMap resource = Resources::getResourceFromUrl(url.toString());
    
    if (resource.value("service") != Resources::SOUNDCLOUD) {
        QDesktopServices::openUrl(url);
        return;
    }
    
    if (resource.value("type") == Resources::PLAYLIST) {
        SoundCloudPlaylistWindow *window = new SoundCloudPlaylistWindow(resource.value("id").toString(), this);
        window->show();
    }
    else if (resource.value("type") == Resources::ARTIST) {
        SoundCloudArtistWindow *window = new SoundCloudArtistWindow(resource.value("id").toString(), this);
        window->show();
    }
    else {
        SoundCloudTrackWindow *window = new SoundCloudTrackWindow(resource.value("id").toString(), this);
        window->show();
    }
}
void SoundCloudPlaylistsWindow::showPlaylist(const QModelIndex &index) {
    if (SoundCloudPlaylist *playlist = m_model->get(index.row())) {
        SoundCloudPlaylistWindow *window = new SoundCloudPlaylistWindow(playlist, this);
        window->show();
    }
}