1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-28 16:20:01 +02:00

Merge branch 'master' of git://github.com/tomahawk-player/tomahawk into songtype

This commit is contained in:
Stefan Derkits
2013-01-09 15:14:48 +01:00
46 changed files with 909 additions and 1100 deletions

View File

@@ -1190,11 +1190,11 @@ TomahawkWindow::showAboutTomahawk()
.arg( TomahawkUtils::appFriendlyVersion() );
#endif
const QString copyright( tr( "Copyright 2010 - 2012" ) );
const QString copyright( tr( "Copyright 2010 - 2013" ) );
const QString thanksto( tr( "Thanks to:" ) );
desc = QString( "%1<br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
"%2 Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Syd Lawrence, Michael Zanetti, Harald Sitter, Steve Robertson, Teo Mrnjavac" )
"%2 Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Syd Lawrence, Michael Zanetti, Teo Mrnjavac, Christopher Reichert, Harald Sitter" )
.arg( copyright )
.arg( thanksto );

View File

@@ -156,7 +156,6 @@ set( libGuiSources
if(QCA2_FOUND)
set( libGuiSources ${libGuiSources} utils/GroovesharkParser.cpp )
set( libGuiHeaders ${libGuiHeaders} utils/GroovesharkParser.h )
endif()
if(UNIX AND NOT APPLE AND NOT Qt5Core_DIR)
@@ -364,7 +363,6 @@ ENDIF(QCA2_FOUND)
IF(LIBATTICA_FOUND)
SET( libGuiSources ${libGuiSources} AtticaManager.cpp )
SET( libGuiHeaders ${libGuiHeaders} AtticaManager.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
LIST(APPEND LINK_LIBRARIES ${LIBATTICA_LIBRARIES} ${QuaZip_LIBRARIES} )
ENDIF(LIBATTICA_FOUND)

View File

@@ -78,6 +78,14 @@ namespace Tomahawk
InfoSystemMode,
};
enum ModelTypes
{
TypeArtist = 0,
TypeAlbum,
TypeQuery,
TypeResult
};
class ExternalResolver;
typedef boost::function<Tomahawk::ExternalResolver*(QString)> ResolverFactoryFunc;

View File

@@ -74,7 +74,7 @@ ViewManager::ViewManager( QObject* parent )
: QObject( parent )
, m_widget( new QWidget() )
, m_welcomeWidget( new WelcomeWidget() )
, m_whatsHotWidget( new WhatsHotWidget() )
, m_whatsHotWidget( 0 )
, m_newReleasesWidget( new NewReleasesWidget() )
, m_recentPlaysWidget( 0 )
, m_currentPage( 0 )
@@ -109,7 +109,6 @@ ViewManager::ViewManager( QObject* parent )
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
connect( this, SIGNAL( tomahawkLoaded() ), m_whatsHotWidget, SLOT( fetchData() ) );
connect( this, SIGNAL( tomahawkLoaded() ), m_newReleasesWidget, SLOT( fetchData() ) );
connect( this, SIGNAL( tomahawkLoaded() ), m_welcomeWidget, SLOT( loadData() ) );
@@ -376,6 +375,12 @@ ViewManager::showWelcomePage()
Tomahawk::ViewPage*
ViewManager::showWhatsHotPage()
{
if ( !m_whatsHotWidget )
{
m_whatsHotWidget = new WhatsHotWidget();
m_whatsHotWidget->fetchData();
}
return show( m_whatsHotWidget );
}

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string notr="true" extracomment="not translatable because not shown to the user">Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -27,7 +27,7 @@
<item>
<widget class="QLabel" name="factoryDescription">
<property name="text">
<string>Description goes here</string>
<string notr="true" extracomment="not translatable because not shown to the user">Description goes here</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>

View File

@@ -167,17 +167,19 @@ AudioEngine::pause()
void
AudioEngine::stop( AudioErrorCode errorCode )
{
tDebug() << Q_FUNC_INFO << errorCode;
tDebug() << Q_FUNC_INFO << errorCode << isStopped();
if ( isStopped() )
return;
if( errorCode == NoError )
if ( errorCode == NoError )
setState( Stopped );
else
setState( Error );
m_mediaObject->stop();
if ( m_mediaObject->state() != Phonon::StoppedState )
m_mediaObject->stop();
emit stopped();
if ( !m_playlist.isNull() )
@@ -241,7 +243,9 @@ AudioEngine::canGoNext()
return false;
}
return ( m_currentTrack && m_playlist.data()->hasNextResult() && m_playlist.data()->nextResult()->isOnline() );
return ( m_currentTrack && m_playlist.data()->hasNextResult() &&
!m_playlist.data()->nextResult().isNull() &&
m_playlist.data()->nextResult()->isOnline() );
}
@@ -744,10 +748,6 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
// We don't emit this state to listeners - yet.
m_state = Loading;
}
if ( newState == Phonon::StoppedState )
{
m_state = Stopped;
}
if ( newState == Phonon::ErrorState )
{
stop( UnknownError );
@@ -799,11 +799,14 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
m_expectStop = false;
tDebug( LOGVERBOSE ) << "Finding next track.";
if ( canGoNext() )
{
loadNextTrack();
}
else
{
if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == Tomahawk::PlaylistModes::Retry )
m_waitingOnNewTrack = true;
stop();
}
}
@@ -903,7 +906,7 @@ AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist )
connect( m_playlist.data(), SIGNAL( shuffleModeChanged( bool ) ), SIGNAL( shuffleModeChanged( bool ) ) );
connect( m_playlist.data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
emit shuffleModeChanged( m_playlist.data()->shuffled() );
emit repeatModeChanged( m_playlist.data()->repeatMode() );
}

View File

@@ -118,12 +118,12 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
QFontMetrics smallBoldFontMetrics( smallBoldFont );
painter->setFont( boldFont );
painter->setPen( option.palette.text().color().lighter() );
painter->setPen( option.palette.text().color().lighter( 450 ) );
QRect figureRect = r.adjusted( 4, 0, 0, 0 );
figureRect.setWidth( QFontMetrics( painter->font() ).width( "888" ) );
painter->drawText( figureRect, QString::number( index.row() + 1 ), QTextOption( Qt::AlignCenter ) );
r.adjust( figureRect.width() + 12, 0, 0, 0 );
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
QRect rightRect = r.adjusted( r.width() - smallBoldFontMetrics.width( TomahawkUtils::timeToString( duration ) ), 0, 0, 0 );

View File

@@ -24,14 +24,15 @@
#include <QMimeData>
#include <QTreeView>
#include "audio/AudioEngine.h"
#include "utils/TomahawkUtils.h"
#include "Source.h"
#include "Artist.h"
#include "Album.h"
#include "Pipeline.h"
#include "PlayableItem.h"
#include "PlayableProxyModel.h"
#include "Source.h"
#include "Typedefs.h"
#include "audio/AudioEngine.h"
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
using namespace Tomahawk;
@@ -274,11 +275,29 @@ PlayableModel::data( const QModelIndex& index, int role ) const
{
return QVariant();
}
if ( role == Qt::TextAlignmentRole )
else if ( role == Qt::TextAlignmentRole )
{
return QVariant( columnAlignment( index.column() ) );
}
else if ( role == PlayableProxyModel::TypeRole )
{
if ( entry->result() )
{
return Tomahawk::TypeResult;
}
else if ( entry->query() )
{
return Tomahawk::TypeQuery;
}
else if ( entry->artist() )
{
return Tomahawk::TypeArtist;
}
else if ( entry->album() )
{
return Tomahawk::TypeAlbum;
}
}
if ( !entry->query().isNull() )
{

View File

@@ -36,7 +36,7 @@ public:
{ Detailed = 0, Short = 1, ShortWithAvatars = 2, Large = 3, Collection = 4 };
enum PlayableProxyModelRole
{ StyleRole = Qt::UserRole + 1 };
{ StyleRole = Qt::UserRole + 1, TypeRole };
explicit PlayableProxyModel ( QObject* parent = 0 );
virtual ~PlayableProxyModel() {}

View File

@@ -59,10 +59,11 @@ PlaylistChartItemDelegate::PlaylistChartItemDelegate( TrackView* parent, Playabl
m_bottomOption = QTextOption( Qt::AlignBottom );
m_bottomOption.setWrapMode( QTextOption::NoWrap );
connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );
connect( m_model, SIGNAL( modelReset() ), this, SLOT( modelChanged() ) );
if ( PlaylistView* plView = qobject_cast< PlaylistView* >( parent ) )
connect( plView, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );
}
@@ -91,11 +92,8 @@ PlaylistChartItemDelegate::sizeHint( const QStyleOptionViewItem& option, const Q
stretch = 2;
}
if ( index.isValid() )
{
int rowHeight = option.fontMetrics.height() + 8;
size.setHeight( rowHeight * stretch );
}
int rowHeight = option.fontMetrics.height() + 8;
size.setHeight( rowHeight * stretch );
return size;
}
@@ -241,7 +239,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
void
PlaylistChartItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
{
emit updateRequest( idx );
emit updateIndex( idx );
}

View File

@@ -43,7 +43,7 @@ public:
PlaylistChartItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
signals:
void updateRequest( const QModelIndex& idx );
void updateIndex( const QModelIndex& idx );
protected:
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;

View File

@@ -35,6 +35,7 @@
#include "PlayableItem.h"
#include "TreeProxyModel.h"
#include "TreeView.h"
#include "Typedefs.h"
TreeItemDelegate::TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy )
@@ -48,23 +49,28 @@ TreeItemDelegate::TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy )
QSize
TreeItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QSize size = QStyledItemDelegate::sizeHint( option, index );
QSize size;
if ( index.isValid() )
{
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
if ( item )
Tomahawk::ModelTypes type = (Tomahawk::ModelTypes)index.data( PlayableProxyModel::TypeRole ).toInt();
switch ( type )
{
if ( item->album() )
case Tomahawk::TypeAlbum:
{
size.setHeight( option.fontMetrics.height() * 3 );
return size;
}
else if ( item->query() || item->result() )
case Tomahawk::TypeQuery:
case Tomahawk::TypeResult:
{
size.setHeight( option.fontMetrics.height() * 1.6 );
return size;
}
default:
break;
}
}

View File

@@ -68,6 +68,9 @@ QToolbarTabDialog::QToolbarTabDialog() :
pimpl->toolbar = new QToolBar(pimpl->dialog.data());
pimpl->toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#ifdef Q_OS_WIN
pimpl->toolbar->setStyleSheet( "QToolBar { border: 0px; }" );
#endif
pimpl->stack = new QStackedWidget(pimpl->dialog.data());

View File

@@ -81,7 +81,6 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
ui->tracksViewLeft->setHeaderHidden( true );
ui->tracksViewLeft->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
PlaylistChartItemDelegate* del = new PlaylistChartItemDelegate( ui->tracksViewLeft, ui->tracksViewLeft->proxyModel() );
connect( del, SIGNAL( updateRequest( QModelIndex ) ), ui->tracksViewLeft, SLOT( update( QModelIndex ) ) );
ui->tracksViewLeft->setItemDelegate( del );
ui->tracksViewLeft->setUniformRowHeights( false );
@@ -104,12 +103,7 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
// Read last viewed charts, to be used as defaults
m_currentVIds = TomahawkSettings::instance()->lastChartIds();
qDebug() << "Got last chartIds:" << m_currentVIds;
// TracksView is first shown, show spinner on that
// After fadeOut, charts are loaded
m_loadingSpinner = new AnimatedSpinner( ui->tracksViewLeft );
m_loadingSpinner->fadeIn();
tDebug( LOGVERBOSE ) << "Re-loading last chartIds:" << m_currentVIds;
MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracksViewLeft->playlistInterface() );
@@ -121,14 +115,15 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
WhatsHotWidget::~WhatsHotWidget()
{
qDebug() << "Deleting whatshot";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
// Write the settings
qDebug() << "Writing chartIds to settings:" << m_currentVIds;
TomahawkSettings::instance()->setLastChartIds( m_currentVIds );
qDeleteAll( m_workers );
m_workers.clear();
m_workerThread->exit( 0 );
m_playlistInterface.clear();
delete ui;
}
@@ -213,7 +208,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
{
case InfoSystem::InfoChartCapabilities:
{
QStandardItem *rootItem= m_crumbModelLeft->invisibleRootItem();
QStandardItem* rootItem= m_crumbModelLeft->invisibleRootItem();
QVariantMap defaults;
if ( returnedData.contains( "defaults" ) )
defaults = returnedData.take( "defaults" ).toMap();
@@ -222,22 +217,23 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
QString defaultSource = returnedData.take( "defaultSource" ).toString();
// Here, we dont want current sessions last view, but rather what was current on previus quit
QString lastSeen = TomahawkSettings::instance()->lastChartIds().value( "lastseen" ).toString();
if( !lastSeen.isEmpty() )
if ( !lastSeen.isEmpty() )
defaultSource = lastSeen;
// Merge defaults with current defaults, split the value in to a list
foreach( const QString&key, m_currentVIds.keys() )
foreach ( const QString& key, m_currentVIds.keys() )
defaults[ key ] = m_currentVIds.value( key ).toString().split( "/" );
qDebug() << "Defaults after merge" << defaults;
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Defaults after merge" << defaults;
foreach ( const QString label, returnedData.keys() )
{
QStandardItem *childItem = parseNode( rootItem, label, returnedData[ label ] );
QStandardItem* childItem = parseNode( rootItem, label, returnedData[ label ] );
rootItem->appendRow( childItem );
}
// Set the default source
// Set the default chart for each source
if( !defaults.empty() )
if ( !defaults.empty() )
{
for ( int i = 0; i < rootItem->rowCount(); i++ )
{
@@ -252,7 +248,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
QStringList defaultIndices = defaults[ source->text().toLower() ].toStringList();
QStandardItem* cur = source;
foreach( const QString& index, defaultIndices )
foreach ( const QString& index, defaultIndices )
{
// Go through the children of the current item, marking the default one as default
for ( int k = 0; k < cur->rowCount(); k++ )
@@ -277,10 +273,9 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
case InfoSystem::InfoChart:
{
if( returnedData.contains( "chart_error") )
if ( returnedData.contains( "chart_error" ) )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Info came back with error!!";
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Info came back with error!";
Tomahawk::InfoSystem::InfoStringHash criteria;
criteria.insert( "chart_refetch", returnedData[ "chart_source" ].value< QString >() );
@@ -302,7 +297,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
break;
const QString type = returnedData[ "type" ].toString();
if ( !returnedData.contains( type ) )
break;
@@ -319,7 +313,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
loader->setType( ChartDataLoader::Artist );
loader->setData( returnedData[ "artists" ].value< QStringList >() );
connect( loader, SIGNAL( artists( Tomahawk::ChartDataLoader*, QList< Tomahawk::artist_ptr > ) ), this, SLOT( chartArtistsLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::artist_ptr > ) ) );
connect( loader, SIGNAL( artists( Tomahawk::ChartDataLoader*, QList< Tomahawk::artist_ptr > ) ), SLOT( chartArtistsLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::artist_ptr > ) ) );
TreeModel* artistsModel = new TreeModel( ui->artistsViewLeft );
artistsModel->setMode( InfoSystemMode );
@@ -335,7 +329,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
loader->setType( ChartDataLoader::Album );
loader->setData( returnedData[ "albums" ].value< QList< Tomahawk::InfoSystem::InfoStringHash > >() );
connect( loader, SIGNAL( albums( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ), this, SLOT( chartAlbumsLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ) );
connect( loader, SIGNAL( albums( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ), SLOT( chartAlbumsLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ) );
PlayableModel* albumModel = new PlayableModel( ui->albumsView );
albumModel->startLoading();
@@ -350,7 +344,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
loader->setType( ChartDataLoader::Track );
loader->setData( returnedData[ "tracks" ].value< QList< Tomahawk::InfoSystem::InfoStringHash > >() );
connect( loader, SIGNAL( tracks( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ), this, SLOT( chartTracksLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ) );
connect( loader, SIGNAL( tracks( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ), SLOT( chartTracksLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ) );
PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft );
trackModel->startLoading();
@@ -376,7 +370,6 @@ void
WhatsHotWidget::infoSystemFinished( QString target )
{
Q_UNUSED( target );
m_loadingSpinner->fadeOut();
}
@@ -438,6 +431,7 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
criteria.insert( "chart_expires", QString::number( chartExpires ) );
/// Remember to lower the source!
criteria.insert( "chart_source", index.data().toString().toLower() );
Tomahawk::InfoSystem::InfoRequestData requestData;
QVariantMap customData;
customData.insert( "whatshot_side", "left" );
@@ -473,12 +467,12 @@ WhatsHotWidget::changeEvent( QEvent* e )
QStandardItem*
WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, const QVariant &data )
WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data )
{
Q_UNUSED( parentItem );
// tDebug( LOGVERBOSE ) << "WhatsHot: parsing " << label;
// tDebug( LOGVERBOSE ) << "WhatsHot: parsing" << label;
QStandardItem *sourceItem = new QStandardItem( label );
QStandardItem* sourceItem = new QStandardItem( label );
if ( data.canConvert< QList< Tomahawk::InfoSystem::InfoStringHash > >() )
{
@@ -486,7 +480,7 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, cons
foreach ( Tomahawk::InfoSystem::InfoStringHash chart, charts )
{
QStandardItem *childItem= new QStandardItem( chart[ "label" ] );
QStandardItem* childItem= new QStandardItem( chart[ "label" ] );
childItem->setData( chart[ "id" ], Breadcrumb::ChartIdRole );
childItem->setData( chart[ "expires" ], Breadcrumb::ChartExpireRole );
@@ -506,7 +500,7 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, cons
QVariantMap dataMap = data.toMap();
foreach ( const QString childLabel,dataMap.keys() )
{
QStandardItem *childItem = parseNode( sourceItem, childLabel, dataMap[ childLabel ] );
QStandardItem* childItem = parseNode( sourceItem, childLabel, dataMap[ childLabel ] );
sourceItem->appendRow( childItem );
}
}
@@ -516,13 +510,13 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, cons
foreach ( const QVariant value, dataList )
{
QStandardItem *childItem = new QStandardItem( value.toString() );
QStandardItem* childItem = new QStandardItem( value.toString() );
sourceItem->appendRow( childItem );
}
}
else
{
QStandardItem *childItem = new QStandardItem( data.toString() );
QStandardItem* childItem = new QStandardItem( data.toString() );
sourceItem->appendRow( childItem );
}
return sourceItem;
@@ -566,7 +560,7 @@ WhatsHotWidget::chartArtistsLoaded( ChartDataLoader* loader, const QList< artist
if ( m_artistModels.contains( chartId ) )
{
foreach( const artist_ptr& artist, artists )
foreach ( const artist_ptr& artist, artists )
{
m_artistModels[ chartId ]->addArtists( artist );
m_artistModels[ chartId ]->finishLoading();

View File

@@ -97,9 +97,9 @@ private:
void setLeftViewAlbums( PlayableModel* albumModel );
void setLeftViewTracks( PlaylistModel* trackModel );
QStandardItem* parseNode( QStandardItem* parentItem, const QString &label, const QVariant &data );
QStandardItem* parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data );
Ui::WhatsHotWidget *ui;
Ui::WhatsHotWidget* ui;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QStandardItemModel* m_crumbModelLeft;
@@ -119,7 +119,7 @@ private:
QSet< QString > m_queuedFetches;
QTimer* m_timer;
QMap<QString, QVariant> m_currentVIds;
AnimatedSpinner* m_loadingSpinner;
friend class Tomahawk::ChartsPlaylistInterface;
};

View File

@@ -99,6 +99,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
area->setStyleSheet( "QScrollArea { background-color: #454e59; }" );

View File

@@ -13,7 +13,7 @@
<property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,1">
<property name="spacing">
<number>16</number>
</property>
@@ -73,12 +73,6 @@
</item>
<item>
<widget class="QFrame" name="trackFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -126,12 +120,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
@@ -142,12 +130,6 @@
</item>
<item>
<widget class="QFrame" name="albumFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -207,6 +189,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -20,11 +20,13 @@
#include "ArtistInfoWidget.h"
#include "ui_ArtistInfoWidget.h"
#include <QDesktopServices>
#include <QScrollArea>
#include <QScrollBar>
#include "audio/AudioEngine.h"
#include "playlist/GridItemDelegate.h"
#include "playlist/AlbumItemDelegate.h"
#include "playlist/PlayableModel.h"
#include "playlist/TreeModel.h"
#include "playlist/PlaylistModel.h"
@@ -75,6 +77,10 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->topHits->setPlayableModel( m_topHitsModel );
ui->topHits->setSortingEnabled( false );
ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) );
ui->topHits->setAutoResize( true );
AlbumItemDelegate* del = new AlbumItemDelegate( ui->topHits, ui->topHits->proxyModel() );
ui->topHits->setPlaylistItemDelegate( del );
ui->relatedArtists->setAutoFitItems( false );
ui->relatedArtists->setWrapping( false );
@@ -116,6 +122,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget );
area->setStyleSheet( "QScrollArea { background-color: #454e59; }" );
@@ -281,7 +288,7 @@ ArtistInfoWidget::onTracksFound( const QList<Tomahawk::query_ptr>& queries, Mode
Q_UNUSED( mode );
m_topHitsModel->finishLoading();
m_topHitsModel->appendQueries( queries );
m_topHitsModel->appendQueries( queries.mid( 0, 20 ) );
}
@@ -319,7 +326,15 @@ void
ArtistInfoWidget::onBiographyLinkClicked( const QUrl& url )
{
tDebug() << Q_FUNC_INFO << url;
GlobalActionManager::instance()->parseTomahawkLink( url.toString() );
if ( url.scheme() == "tomahawk" )
{
GlobalActionManager::instance()->parseTomahawkLink( url.toString() );
}
else
{
QDesktopServices::openUrl( url );
}
}

View File

@@ -13,7 +13,7 @@
<property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,1">
<property name="spacing">
<number>16</number>
</property>
@@ -73,12 +73,6 @@
</item>
<item>
<widget class="QFrame" name="trackFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -126,12 +120,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
@@ -142,12 +130,6 @@
</item>
<item>
<widget class="QFrame" name="albumFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -209,12 +191,6 @@
</item>
<item>
<widget class="QFrame" name="artistFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -274,6 +250,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@@ -282,16 +271,16 @@
<extends>QListView</extends>
<header location="global">playlist/GridView.h</header>
</customwidget>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header>playlist/PlaylistView.h</header>
</customwidget>
<customwidget>
<class>PlayableCover</class>
<extends>QLabel</extends>
<header>widgets/PlayableCover.h</header>
</customwidget>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header>playlist/PlaylistView.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2012 Teo Mrnjavac <teo@kde.org>
* Copyright 2012-2013, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,20 +71,21 @@ AccountWidget::AccountWidget( QWidget* parent )
idContLayout->addWidget( m_idLabel );
m_spinnerWidget = new QWidget( idContainer );
QSize spinnerSize = 16 > m_spinnerWidget->logicalDpiX() * .2 ?
QSize spinnerSize = 16 > TomahawkUtils::defaultFontHeight() ?
QSize( 16, 16 ) :
QSize( m_spinnerWidget->logicalDpiX() * .15,
m_spinnerWidget->logicalDpiX() * .15 );
QSize( TomahawkUtils::defaultFontHeight(),
TomahawkUtils::defaultFontHeight() );
m_spinnerWidget->setFixedSize( spinnerSize );
idContLayout->addWidget( m_spinnerWidget );
m_spinnerWidget->setContentsMargins( 0, 0, 0, 0 );
m_spinner = new AnimatedSpinner( m_spinnerWidget->size(), m_spinnerWidget );
m_spinnerWidget->setContentsMargins( 0, 1, 0, 0 );
m_spinner = new AnimatedSpinner( m_spinnerWidget->size() - QSize( 2, 2 ), m_spinnerWidget );
idContainer->setStyleSheet( QString( "QFrame {"
"border: 1px solid #e9e9e9;"
"border-radius: %1px;"
"background: #e9e9e9;"
"}" ).arg( idContainer->sizeHint().height() / 2 + 1 ) );
idContainer->setMinimumHeight( spinnerSize.height() + 6 /*margins*/ );
m_statusToggle = new SlideSwitchButton( this );
m_statusToggle->setContentsMargins( 0, 0, 0, 0 );
@@ -292,6 +293,8 @@ AccountWidget::setupConnections( const QPersistentModelIndex& idx, int accountId
this, SLOT( changeAccountConnectionState( bool ) ) );
connect( m_inviteButton, SIGNAL( clicked() ),
this, SLOT( sendInvite() ) );
connect( m_inviteEdit, SIGNAL( returnPressed() ),
this, SLOT( sendInvite() ) );
m_inviteEdit->setPlaceholderText( account->sipPlugin()->inviteString() );
}