1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Load automatic playlists and stations in Newest Stations and Playlists list...

This commit is contained in:
Leo Franchi
2011-08-07 17:08:35 -04:00
parent f3dc1a0800
commit 58c18acd01
4 changed files with 28 additions and 7 deletions

View File

@@ -121,6 +121,24 @@ DynamicPlaylist::setMode( int mode )
m_generator->setMode( (GeneratorMode)mode );
}
dynplaylist_ptr
DynamicPlaylist::load( const QString& guid )
{
dynplaylist_ptr p;
foreach( const Tomahawk::source_ptr& source, SourceList::instance()->sources() )
{
p = source->collection()->autoPlaylist( guid );
if ( p.isNull() )
p = source->collection()->station( guid );
if( !p.isNull() )
return p;
}
return p;
}
dynplaylist_ptr
DynamicPlaylist::create( const Tomahawk::source_ptr& author,

View File

@@ -91,6 +91,8 @@ class DLLEXPORT DynamicPlaylist : public Playlist
public:
virtual ~DynamicPlaylist();
static Tomahawk::dynplaylist_ptr load( const QString& guid );
/// Generate an empty dynamic playlist with default generator
static Tomahawk::dynplaylist_ptr create( const source_ptr& author,
const QString& guid,

View File

@@ -1,6 +1,5 @@
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2011 Leo Franchi <leo.franchi@kdab.com>
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,10 +19,11 @@
#include "welcomeplaylistmodel.h"
#include <tomahawksettings.h>
#include <audio/audioengine.h>
#include <sourcelist.h>
#include "tomahawksettings.h"
#include "audio/audioengine.h"
#include "sourcelist.h"
#include "utils/logger.h"
#include "dynamic/DynamicPlaylist.h"
using namespace Tomahawk;
@@ -63,6 +63,8 @@ WelcomePlaylistModel::loadFromSettings()
playlist_ptr pl = m_cached.value( playlist_guids[i], playlist_ptr() );
if( pl.isNull() )
pl = Tomahawk::Playlist::load( playlist_guids[i] );
if( pl.isNull() )
pl = Tomahawk::DynamicPlaylist::load( playlist_guids[i] );
if ( !pl.isNull() ) {
m_recplaylists << pl;

View File

@@ -1,6 +1,5 @@
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2011 Leo Franchi <leo.franchi@kdab.com>
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by