Exemple #1
0
void PluginView::showResource(const QString &type, const QString &id) {
    if (type == Resources::PLAYLIST) {
        PluginPlaylistWindow *window = new PluginPlaylistWindow(m_model->service(), id, StackedWindow::currentWindow());
        window->show();
    }
    else if (type == Resources::ARTIST) {
        PluginArtistWindow *window = new PluginArtistWindow(m_model->service(), id, StackedWindow::currentWindow());
        window->show();
    }
    else {
        PluginTrackWindow *window = new PluginTrackWindow(m_model->service(), id, StackedWindow::currentWindow());
        window->show();
    }
}
void PluginArtistWindow::showResource(const QUrl &url) {
    QVariantMap resource = Resources::getResourceFromUrl(url.toString());
    
    if (resource.value("service") != m_artist->service()) {
        QDesktopServices::openUrl(url);
        return;
    }
    
    if (resource.value("type") == Resources::PLAYLIST) {
        PluginPlaylistWindow *window = new PluginPlaylistWindow(m_artist->service(), resource.value("id").toString(), this);
        window->show();
    }
    else if (resource.value("type") == Resources::ARTIST) {
        PluginArtistWindow *window = new PluginArtistWindow(m_artist->service(), resource.value("id").toString(), this);
        window->show();
    }
    else {
        PluginTrackWindow *window = new PluginTrackWindow(m_artist->service(), resource.value("id").toString(), this);
        window->show();
    }
}