Nice typedefs.
This commit is contained in:
parent
36264e0b2b
commit
16d50b29d8
@ -880,6 +880,10 @@ void Playlist::Save() const {
|
||||
backend_->SavePlaylistAsync(id_, items_, last_played_index());
|
||||
}
|
||||
|
||||
namespace {
|
||||
typedef QFutureWatcher<shared_ptr<PlaylistItem> > PlaylistItemFutureWatcher;
|
||||
}
|
||||
|
||||
void Playlist::Restore() {
|
||||
if (!backend_)
|
||||
return;
|
||||
@ -888,16 +892,14 @@ void Playlist::Restore() {
|
||||
virtual_items_.clear();
|
||||
library_items_by_id_.clear();
|
||||
|
||||
QFuture<shared_ptr<PlaylistItem> > future = backend_->GetPlaylistItems(id_);
|
||||
QFutureWatcher<shared_ptr<PlaylistItem> >* watcher =
|
||||
new QFutureWatcher<shared_ptr<PlaylistItem> >(this);
|
||||
PlaylistBackend::PlaylistItemFuture future = backend_->GetPlaylistItems(id_);
|
||||
PlaylistItemFutureWatcher* watcher = new PlaylistItemFutureWatcher(this);
|
||||
watcher->setFuture(future);
|
||||
connect(watcher, SIGNAL(finished()), SLOT(ItemsLoaded()));
|
||||
}
|
||||
|
||||
void Playlist::ItemsLoaded() {
|
||||
QFutureWatcher<shared_ptr<PlaylistItem> >* watcher =
|
||||
static_cast<QFutureWatcher<shared_ptr<PlaylistItem> >*>(sender());
|
||||
PlaylistItemFutureWatcher* watcher = static_cast<PlaylistItemFutureWatcher*>(sender());
|
||||
watcher->deleteLater();
|
||||
|
||||
items_ = watcher->future().results();
|
||||
|
@ -40,10 +40,11 @@ class PlaylistBackend : public QObject {
|
||||
int last_played;
|
||||
};
|
||||
typedef QList<Playlist> PlaylistList;
|
||||
typedef QFuture<boost::shared_ptr<PlaylistItem> > PlaylistItemFuture;
|
||||
|
||||
PlaylistList GetAllPlaylists();
|
||||
Playlist GetPlaylist(int id);
|
||||
QFuture<boost::shared_ptr<PlaylistItem> > GetPlaylistItems(int playlist);
|
||||
PlaylistItemFuture GetPlaylistItems(int playlist);
|
||||
void SavePlaylistAsync(int playlist, const PlaylistItemList& items,
|
||||
int last_played);
|
||||
void SetPlaylistOrder(const QList<int>& ids);
|
||||
|
Loading…
x
Reference in New Issue
Block a user