mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Yay, even more WIP: New Home Screen.
This commit is contained in:
@@ -84,7 +84,7 @@ DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi )
|
|||||||
{
|
{
|
||||||
TomahawkSqlQuery query = dbi->newquery();
|
TomahawkSqlQuery query = dbi->newquery();
|
||||||
QList<Tomahawk::album_ptr> al;
|
QList<Tomahawk::album_ptr> al;
|
||||||
QString orderToken;
|
QString orderToken, sourceToken;
|
||||||
|
|
||||||
switch ( m_sortOrder )
|
switch ( m_sortOrder )
|
||||||
{
|
{
|
||||||
@@ -95,6 +95,9 @@ DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi )
|
|||||||
orderToken = "file.mtime";
|
orderToken = "file.mtime";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !m_collection.isNull() )
|
||||||
|
sourceToken = QString( "AND file.source %1 " ).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) );
|
||||||
|
|
||||||
QString sql = QString(
|
QString sql = QString(
|
||||||
"SELECT DISTINCT album.id, album.name, album.artist, artist.name "
|
"SELECT DISTINCT album.id, album.name, album.artist, artist.name "
|
||||||
"FROM album, file, file_join "
|
"FROM album, file, file_join "
|
||||||
@@ -102,9 +105,9 @@ DatabaseCommand_AllAlbums::execForCollection( DatabaseImpl* dbi )
|
|||||||
"ON album.artist = artist.id "
|
"ON album.artist = artist.id "
|
||||||
"WHERE file.id = file_join.file "
|
"WHERE file.id = file_join.file "
|
||||||
"AND file_join.album = album.id "
|
"AND file_join.album = album.id "
|
||||||
"AND file.source %1 "
|
"%1 "
|
||||||
"%2 %3 %4"
|
"%2 %3 %4"
|
||||||
).arg( m_collection->source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( m_collection->source()->id() ) )
|
).arg( sourceToken )
|
||||||
.arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
|
.arg( m_sortOrder > 0 ? QString( "ORDER BY %1" ).arg( orderToken ) : QString() )
|
||||||
.arg( m_sortDescending ? "DESC" : QString() )
|
.arg( m_sortDescending ? "DESC" : QString() )
|
||||||
.arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
|
.arg( m_amount > 0 ? QString( "LIMIT 0, %1" ).arg( m_amount ) : QString() );
|
||||||
|
@@ -294,7 +294,7 @@ LastFmPlugin::notInCacheSlot( const QHash<QString, QString> criteria, const QStr
|
|||||||
QString artistName = criteria["artist"];
|
QString artistName = criteria["artist"];
|
||||||
QString albumName = criteria["album"];
|
QString albumName = criteria["album"];
|
||||||
|
|
||||||
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=medium&api_key=7a90f6672a04b809ee309af169f34b8b";
|
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
|
||||||
QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) );
|
QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) );
|
||||||
QNetworkReply* reply = m_nam.data()->get( req );
|
QNetworkReply* reply = m_nam.data()->get( req );
|
||||||
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) );
|
reply->setProperty( "customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomData>( customData ) );
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -37,6 +37,7 @@ AlbumItemDelegate::AlbumItemDelegate( QAbstractItemView* parent, AlbumProxyModel
|
|||||||
, m_view( parent )
|
, m_view( parent )
|
||||||
, m_model( proxy )
|
, m_model( proxy )
|
||||||
{
|
{
|
||||||
|
m_shadowPixmap = QPixmap( RESPATH "images/cover-shadow.png" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,10 +66,10 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
}
|
}
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint( QPainter::Antialiasing );
|
// painter->setRenderHint( QPainter::Antialiasing );
|
||||||
painter->setPen( opt.palette.color( QPalette::Text ) );
|
painter->setPen( opt.palette.color( QPalette::Text ) );
|
||||||
|
|
||||||
painter->drawPixmap( option.rect.adjusted( 4, 4, -4, -38 ), QPixmap( RESPATH "images/cover-shadow.png" ) );
|
// painter->drawPixmap( option.rect.adjusted( 4, 4, -4, -38 ), m_shadowPixmap );
|
||||||
painter->drawPixmap( option.rect.adjusted( 6, 4, -6, -41 ), item->cover );
|
painter->drawPixmap( option.rect.adjusted( 6, 4, -6, -41 ), item->cover );
|
||||||
|
|
||||||
QTextOption to;
|
QTextOption to;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -41,6 +41,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
QAbstractItemView* m_view;
|
QAbstractItemView* m_view;
|
||||||
AlbumProxyModel* m_model;
|
AlbumProxyModel* m_model;
|
||||||
|
|
||||||
|
QPixmap m_shadowPixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALBUMITEMDELEGATE_H
|
#endif // ALBUMITEMDELEGATE_H
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
|
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
|
||||||
|
|
||||||
|
static QString s_tmInfoIdentifier = QString( "ALBUMMODEL" );
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
@@ -40,6 +42,12 @@ AlbumModel::AlbumModel( QObject* parent )
|
|||||||
|
|
||||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||||
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
.scaled( QSize( 120, 120 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||||
|
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
|
||||||
|
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,6 +117,11 @@ AlbumModel::parent( const QModelIndex& child ) const
|
|||||||
QVariant
|
QVariant
|
||||||
AlbumModel::data( const QModelIndex& index, int role ) const
|
AlbumModel::data( const QModelIndex& index, int role ) const
|
||||||
{
|
{
|
||||||
|
if ( role == Qt::SizeHintRole )
|
||||||
|
{
|
||||||
|
return QSize( 116, 150 );
|
||||||
|
}
|
||||||
|
|
||||||
AlbumItem* entry = itemFromIndex( index );
|
AlbumItem* entry = itemFromIndex( index );
|
||||||
if ( !entry )
|
if ( !entry )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -118,11 +131,6 @@ AlbumModel::data( const QModelIndex& index, int role ) const
|
|||||||
return entry->cover;
|
return entry->cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( role == Qt::SizeHintRole )
|
|
||||||
{
|
|
||||||
return QSize( 116, 150 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( role != Qt::DisplayRole ) // && role != Qt::ToolTipRole )
|
if ( role != Qt::DisplayRole ) // && role != Qt::ToolTipRole )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
@@ -252,10 +260,10 @@ AlbumModel::addCollection( const collection_ptr& collection )
|
|||||||
void
|
void
|
||||||
AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned int amount, DatabaseCommand_AllAlbums::SortOrder order )
|
AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned int amount, DatabaseCommand_AllAlbums::SortOrder order )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << collection->name()
|
/* qDebug() << Q_FUNC_INFO << collection->name()
|
||||||
<< collection->source()->id()
|
<< collection->source()->id()
|
||||||
<< collection->source()->userName()
|
<< collection->source()->userName()
|
||||||
<< amount << order;
|
<< amount << order;*/
|
||||||
|
|
||||||
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection );
|
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection );
|
||||||
cmd->setLimit( amount );
|
cmd->setLimit( amount );
|
||||||
@@ -267,7 +275,10 @@ AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned in
|
|||||||
|
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
|
|
||||||
m_title = tr( "All albums from %1" ).arg( collection->source()->friendlyName() );
|
if ( !collection.isNull() )
|
||||||
|
m_title = tr( "All albums from %1" ).arg( collection->source()->friendlyName() );
|
||||||
|
else
|
||||||
|
m_title = tr( "All albums" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -291,12 +302,6 @@ AlbumModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums )
|
|||||||
albumitem->cover = m_defaultCover;
|
albumitem->cover = m_defaultCover;
|
||||||
albumitem->index = createIndex( m_rootItem->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( m_rootItem->children.count() - 1, 0, albumitem );
|
||||||
|
|
||||||
/* QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
|
|
||||||
QNetworkRequest req( imgurl.arg( album->artist()->name() ).arg( album->name() ) );
|
|
||||||
req.setAttribute( QNetworkRequest::User, (qlonglong)albumitem );
|
|
||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
|
||||||
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );*/
|
|
||||||
|
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,43 +311,51 @@ AlbumModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AlbumModel::onCoverArtDownloaded()
|
AlbumModel::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData )
|
||||||
{
|
{
|
||||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
|
Q_UNUSED( customData );
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
QUrl redir = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl();
|
if ( caller != s_tmInfoIdentifier ||
|
||||||
if ( redir.isEmpty() )
|
( type != Tomahawk::InfoSystem::InfoAlbumCoverArt && type != Tomahawk::InfoSystem::InfoArtistImages ) )
|
||||||
{
|
{
|
||||||
const QByteArray ba = reply->readAll();
|
qDebug() << "Info of wrong type or not with our identifier";
|
||||||
if ( ba.length() )
|
return;
|
||||||
{
|
|
||||||
QPixmap pm;
|
|
||||||
pm.loadFromData( ba );
|
|
||||||
|
|
||||||
qlonglong pptr = reply->request().attribute( QNetworkRequest::User ).toLongLong();
|
|
||||||
AlbumItem* ai = reinterpret_cast<AlbumItem*>(pptr);
|
|
||||||
|
|
||||||
if ( pm.isNull() || reply->url().toString().startsWith( LASTFM_DEFAULT_COVER ) )
|
|
||||||
{
|
|
||||||
ai->cover = m_defaultCover;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ai->setCover( pm.scaled( QSize( 150, 150 ), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Follow HTTP redirect
|
|
||||||
QNetworkRequest req( redir );
|
|
||||||
req.setAttribute( QNetworkRequest::User, reply->request().attribute( QNetworkRequest::User ) );
|
|
||||||
Q_ASSERT( TomahawkUtils::nam() != 0 );
|
|
||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
|
||||||
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reply->deleteLater();
|
if ( !output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
|
||||||
|
{
|
||||||
|
qDebug() << "Cannot convert fetched art from a QByteArray";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoCriteriaHash pptr = input.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||||
|
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >();
|
||||||
|
const QByteArray ba = returnedData["imgbytes"].toByteArray();
|
||||||
|
if ( ba.length() )
|
||||||
|
{
|
||||||
|
QPixmap pm;
|
||||||
|
pm.loadFromData( ba );
|
||||||
|
|
||||||
|
bool ok;
|
||||||
|
qlonglong p = pptr["pptr"].toLongLong( &ok );
|
||||||
|
AlbumItem* ai = reinterpret_cast<AlbumItem*>(p);
|
||||||
|
|
||||||
|
if ( pm.isNull() )
|
||||||
|
ai->cover = m_defaultCover;
|
||||||
|
else
|
||||||
|
ai->cover = pm;
|
||||||
|
|
||||||
|
emit dataChanged( ai->index, ai->index.sibling( ai->index.row(), columnCount( QModelIndex() ) - 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlbumModel::infoSystemFinished( QString target )
|
||||||
|
{
|
||||||
|
Q_UNUSED( target );
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
#include "playlistinterface.h"
|
#include "playlistinterface.h"
|
||||||
#include "database/databasecommand_allalbums.h"
|
#include "database/databasecommand_allalbums.h"
|
||||||
|
#include "infosystem/infosystem.h"
|
||||||
|
|
||||||
#include "albumitem.h"
|
#include "albumitem.h"
|
||||||
|
|
||||||
@@ -94,9 +95,11 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums );
|
void onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums );
|
||||||
void onCoverArtDownloaded();
|
|
||||||
void onDataChanged();
|
void onDataChanged();
|
||||||
|
|
||||||
|
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
|
void infoSystemFinished( QString target );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPersistentModelIndex m_currentIndex;
|
QPersistentModelIndex m_currentIndex;
|
||||||
AlbumItem* m_rootItem;
|
AlbumItem* m_rootItem;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -30,6 +30,10 @@
|
|||||||
#include "albumitemdelegate.h"
|
#include "albumitemdelegate.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
|
||||||
|
static QString s_tmInfoIdentifier = QString( "ALBUMMODEL" );
|
||||||
|
|
||||||
|
#define SCROLL_TIMEOUT 280
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +55,12 @@ AlbumView::AlbumView( QWidget* parent )
|
|||||||
|
|
||||||
setProxyModel( new AlbumProxyModel( this ) );
|
setProxyModel( new AlbumProxyModel( this ) );
|
||||||
|
|
||||||
|
m_timer.setInterval( SCROLL_TIMEOUT );
|
||||||
|
|
||||||
|
connect( verticalScrollBar(), SIGNAL( rangeChanged( int, int ) ), SLOT( onViewChanged() ) );
|
||||||
|
connect( verticalScrollBar(), SIGNAL( valueChanged( int ) ), SLOT( onViewChanged() ) );
|
||||||
|
connect( &m_timer, SIGNAL( timeout() ), SLOT( onScrollTimeout() ) );
|
||||||
|
|
||||||
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +121,55 @@ AlbumView::onItemActivated( const QModelIndex& index )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlbumView::onViewChanged()
|
||||||
|
{
|
||||||
|
if ( m_timer.isActive() )
|
||||||
|
m_timer.stop();
|
||||||
|
|
||||||
|
m_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlbumView::onScrollTimeout()
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
if ( m_timer.isActive() )
|
||||||
|
m_timer.stop();
|
||||||
|
|
||||||
|
if ( !m_proxyModel->rowCount() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
QRect viewRect = viewport()->rect();
|
||||||
|
int rowHeight = m_proxyModel->data( QModelIndex(), Qt::SizeHintRole ).toSize().height();
|
||||||
|
viewRect.adjust( 0, -rowHeight, 0, rowHeight );
|
||||||
|
|
||||||
|
for ( int i = 0; i < m_proxyModel->rowCount(); i++ )
|
||||||
|
{
|
||||||
|
for ( int j = 0; j < m_proxyModel->columnCount(); j++ )
|
||||||
|
{
|
||||||
|
QModelIndex idx = m_proxyModel->index( i, j );
|
||||||
|
if ( !viewRect.contains( visualRect( idx ) ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
AlbumItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( idx ) );
|
||||||
|
if ( !item )
|
||||||
|
break;
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
|
trackInfo["artist"] = item->album()->artist()->name();
|
||||||
|
trackInfo["album"] = item->album()->name();
|
||||||
|
trackInfo["pptr"] = QString::number( (qlonglong)item );
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
|
||||||
|
s_tmInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
|
||||||
|
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AlbumView::dragEnterEvent( QDragEnterEvent* event )
|
AlbumView::dragEnterEvent( QDragEnterEvent* event )
|
||||||
{
|
{
|
||||||
|
@@ -69,12 +69,17 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void onFilterChanged( const QString& filter );
|
void onFilterChanged( const QString& filter );
|
||||||
|
|
||||||
|
void onViewChanged();
|
||||||
|
void onScrollTimeout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap createDragPixmap( int itemCount ) const;
|
QPixmap createDragPixmap( int itemCount ) const;
|
||||||
|
|
||||||
AlbumModel* m_model;
|
AlbumModel* m_model;
|
||||||
AlbumProxyModel* m_proxyModel;
|
AlbumProxyModel* m_proxyModel;
|
||||||
// PlaylistItemDelegate* m_delegate;
|
// PlaylistItemDelegate* m_delegate;
|
||||||
|
|
||||||
|
QTimer m_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ALBUMVIEW_H
|
#endif // ALBUMVIEW_H
|
||||||
|
@@ -232,6 +232,9 @@ ArtistView::onScrollTimeout()
|
|||||||
if ( right.isValid() )
|
if ( right.isValid() )
|
||||||
max = right.row() + 1;
|
max = right.row() + 1;
|
||||||
|
|
||||||
|
if ( !max )
|
||||||
|
return;
|
||||||
|
|
||||||
for ( int i = left.row(); i < max; i++ )
|
for ( int i = left.row(); i < max; i++ )
|
||||||
{
|
{
|
||||||
TreeModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( m_proxyModel->index( i, 0 ) ) );
|
TreeModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( m_proxyModel->index( i, 0 ) ) );
|
||||||
|
@@ -133,7 +133,6 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
m_proxyModel->setSourceTrackModel( m_model );
|
m_proxyModel->setSourceTrackModel( m_model );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( m_model && m_model->metaObject()->indexOfSignal( "itemSizeChanged(QModelIndex)" ) > -1 )
|
if ( m_model && m_model->metaObject()->indexOfSignal( "itemSizeChanged(QModelIndex)" ) > -1 )
|
||||||
connect( m_model, SIGNAL( itemSizeChanged( QModelIndex ) ), SLOT( onItemResized( QModelIndex ) ) );
|
connect( m_model, SIGNAL( itemSizeChanged( QModelIndex ) ), SLOT( onItemResized( QModelIndex ) ) );
|
||||||
|
|
||||||
@@ -145,7 +144,15 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
setAcceptDrops( true );
|
setAcceptDrops( true );
|
||||||
|
|
||||||
if ( model->style() == TrackModel::Short )
|
if ( model->style() == TrackModel::Short )
|
||||||
|
{
|
||||||
setHeaderHidden( true );
|
setHeaderHidden( true );
|
||||||
|
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setHeaderHidden( false );
|
||||||
|
setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -59,17 +59,11 @@ void
|
|||||||
TreeModel::setCurrentItem( const QModelIndex& index )
|
TreeModel::setCurrentItem( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
TreeModelItem* oldEntry = itemFromIndex( m_currentIndex );
|
|
||||||
if ( oldEntry )
|
|
||||||
{
|
|
||||||
// oldEntry->setIsPlaying( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeModelItem* entry = itemFromIndex( index );
|
TreeModelItem* entry = itemFromIndex( index );
|
||||||
if ( entry )
|
if ( entry )
|
||||||
{
|
{
|
||||||
m_currentIndex = index;
|
m_currentIndex = index;
|
||||||
// entry->setIsPlaying( true );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
|
|||||||
m_historyModel = new PlaylistModel( ui->historyView );
|
m_historyModel = new PlaylistModel( ui->historyView );
|
||||||
m_historyModel->setStyle( TrackModel::Short );
|
m_historyModel->setStyle( TrackModel::Short );
|
||||||
ui->historyView->setPlaylistModel( m_historyModel );
|
ui->historyView->setPlaylistModel( m_historyModel );
|
||||||
m_historyModel->loadHistory( source );
|
m_historyModel->loadHistory( source, 25 );
|
||||||
|
|
||||||
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
|
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
#include "playlist/albummodel.h"
|
||||||
#include "playlist/playlistmodel.h"
|
#include "playlist/playlistmodel.h"
|
||||||
|
|
||||||
#include "widgets/overlaywidget.h"
|
#include "widgets/overlaywidget.h"
|
||||||
@@ -37,6 +38,8 @@
|
|||||||
#define HISTORY_PLAYLIST_ITEMS 5
|
#define HISTORY_PLAYLIST_ITEMS 5
|
||||||
#define HISTORY_RESOLVING_TIMEOUT 2500
|
#define HISTORY_RESOLVING_TIMEOUT 2500
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
WelcomeWidget::WelcomeWidget( QWidget* parent )
|
WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
@@ -58,6 +61,10 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
|||||||
ui->tracksView->overlay()->setEnabled( false );
|
ui->tracksView->overlay()->setEnabled( false );
|
||||||
ui->tracksView->setPlaylistModel( m_tracksModel );
|
ui->tracksView->setPlaylistModel( m_tracksModel );
|
||||||
|
|
||||||
|
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
|
||||||
|
ui->additionsView->setAlbumModel( m_recentAlbumsModel );
|
||||||
|
m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime );
|
||||||
|
|
||||||
m_timer = new QTimer( this );
|
m_timer = new QTimer( this );
|
||||||
connect( m_timer, SIGNAL( timeout() ), SLOT( checkQueries() ) );
|
connect( m_timer, SIGNAL( timeout() ), SLOT( checkQueries() ) );
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
class AlbumModel;
|
||||||
class PlaylistModel;
|
class PlaylistModel;
|
||||||
class OverlayWidget;
|
class OverlayWidget;
|
||||||
|
|
||||||
@@ -110,6 +111,8 @@ private:
|
|||||||
Ui::WelcomeWidget *ui;
|
Ui::WelcomeWidget *ui;
|
||||||
|
|
||||||
PlaylistModel* m_tracksModel;
|
PlaylistModel* m_tracksModel;
|
||||||
|
AlbumModel* m_recentAlbumsModel;
|
||||||
|
|
||||||
QTimer* m_timer;
|
QTimer* m_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -7,39 +7,86 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>985</width>
|
<width>985</width>
|
||||||
<height>460</height>
|
<height>459</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0,2">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="font">
|
<property name="orientation">
|
||||||
<font>
|
<enum>Qt::Vertical</enum>
|
||||||
<pointsize>14</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Recently played playlists:</string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Recent Additions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="AlbumView" name="additionsView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Newest Stations & Playlists</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="PlaylistWidget" name="playlistWidget"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="PlaylistWidget" name="playlistWidget"/>
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QLabel" name="label_3">
|
||||||
<widget class="QLabel" name="label_3">
|
<property name="maximumSize">
|
||||||
<property name="font">
|
<size>
|
||||||
<font>
|
<width>16777215</width>
|
||||||
<pointsize>14</pointsize>
|
<height>16777215</height>
|
||||||
</font>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="font">
|
||||||
<string>Recently played tracks:</string>
|
<font>
|
||||||
</property>
|
<pointsize>14</pointsize>
|
||||||
</widget>
|
</font>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="PlaylistView" name="tracksView"/>
|
<string>Recently Played Tracks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="PlaylistView" name="tracksView">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -54,6 +101,11 @@
|
|||||||
<extends>QListWidget</extends>
|
<extends>QListWidget</extends>
|
||||||
<header>widgets/welcomewidget.h</header>
|
<header>widgets/welcomewidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>AlbumView</class>
|
||||||
|
<extends>QListView</extends>
|
||||||
|
<header>playlist/albumview.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Reference in New Issue
Block a user