From 3c7b12ab82575e761d7f03322236228f554da4a0 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 15 Aug 2014 05:32:10 +0200 Subject: [PATCH] * Wrap InboxView in an InboxPage. --- src/libtomahawk/playlist/InboxView.cpp | 30 ++++++++++++++++++++++++-- src/libtomahawk/playlist/InboxView.h | 10 +++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/playlist/InboxView.cpp b/src/libtomahawk/playlist/InboxView.cpp index 090c65df5..e03db70de 100644 --- a/src/libtomahawk/playlist/InboxView.cpp +++ b/src/libtomahawk/playlist/InboxView.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2013, Teo Mrnjavac + * Copyright 2014, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,10 +22,12 @@ #include "InboxModel.h" #include "PlayableProxyModel.h" #include "ContextMenu.h" +#include "playlist/TrackItemDelegate.h" +#include "ViewManager.h" #include "utils/Logger.h" -InboxView::InboxView(QWidget *parent) : - TrackView(parent) +InboxView::InboxView( QWidget* parent ) : + TrackView( parent ) { } @@ -63,3 +66,26 @@ InboxView::onMenuTriggered( int action ) else TrackView::onMenuTriggered( action ); } + + +InboxPage::InboxPage( QWidget* parent ) : + FlexibleView( parent ) +{ + InboxView* inboxView = new InboxView( this ); + setTrackView( inboxView ); + setCurrentMode( Flat ); + + inboxView->proxyModel()->setStyle( PlayableProxyModel::Large ); + /* inboxView->proxyModel()->setGroupBy( true ); + * inboxView->setSortingEnabled( true ); + * inboxView->proxyModel()->sort( 0 );*/ + inboxView->setEmptyTip( tr( "No listening suggestions here." ) ); + + inboxView->setGuid( "inbox" ); + inboxView->setHeaderHidden( true ); + + setPlayableModel( ViewManager::instance()->inboxModel() ); + + TrackItemDelegate* delegate = new TrackItemDelegate( TrackItemDelegate::Inbox, inboxView, inboxView->proxyModel() ); + inboxView->setPlaylistItemDelegate( delegate ); +} diff --git a/src/libtomahawk/playlist/InboxView.h b/src/libtomahawk/playlist/InboxView.h index 88052b816..924832f86 100644 --- a/src/libtomahawk/playlist/InboxView.h +++ b/src/libtomahawk/playlist/InboxView.h @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2013, Teo Mrnjavac + * Copyright 2014, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +22,7 @@ #define INBOXVIEW_H #include "TrackView.h" +#include "FlexibleView.h" class InboxView : public TrackView { @@ -37,4 +39,12 @@ public slots: virtual void onMenuTriggered( int action ); }; +class InboxPage : public FlexibleView +{ + Q_OBJECT + +public: + explicit InboxPage( QWidget* parent = 0 ); +}; + #endif // INBOXVIEW_H