From e0c72c911a54717e665c2a4dd04e85e5281f018d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 05:15:05 +0200 Subject: [PATCH 1/9] * Fixed loveButton not being re-enabled again. --- src/audiocontrols.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audiocontrols.cpp b/src/audiocontrols.cpp index ce9dc0357..7961669f9 100644 --- a/src/audiocontrols.cpp +++ b/src/audiocontrols.cpp @@ -298,9 +298,11 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result ) ui->pauseButton->setVisible( true ); ui->playPauseButton->setVisible( false ); ui->playPauseButton->setEnabled( false ); + ui->loveButton->setEnabled( true ); + ui->loveButton->setVisible( true ); result->loadSocialActions(); - ui->loveButton->setVisible( true ); + if ( result->loved() ) { ui->loveButton->setPixmap( RESPATH "images/loved.png" ); From fe7c79ff31423168c0546bc372d0e17beea6d433 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 07:21:14 +0200 Subject: [PATCH 2/9] * Added HeaderLabel to replace our old ugly labels. --- src/libtomahawk/CMakeLists.txt | 5 ++ src/libtomahawk/widgets/HeaderLabel.cpp | 86 +++++++++++++++++++ src/libtomahawk/widgets/HeaderLabel.h | 47 ++++++++++ .../widgets/infowidgets/sourceinfowidget.cpp | 24 ++++++ .../widgets/infowidgets/sourceinfowidget.ui | 44 +++------- src/libtomahawk/widgets/welcomewidget.cpp | 21 +++++ src/libtomahawk/widgets/welcomewidget.ui | 34 +++----- 7 files changed, 209 insertions(+), 52 deletions(-) create mode 100644 src/libtomahawk/widgets/HeaderLabel.cpp create mode 100644 src/libtomahawk/widgets/HeaderLabel.h diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index da15df272..3e6fd33ac 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -171,7 +171,9 @@ set( libSources widgets/welcomewidget.cpp widgets/welcomeplaylistmodel.cpp widgets/overlaywidget.cpp + widgets/HeaderLabel.cpp widgets/infowidgets/sourceinfowidget.cpp +# widgets/infowidgets/ArtistInfoWidget.cpp kdsingleapplicationguard/kdsingleapplicationguard.cpp kdsingleapplicationguard/kdsharedmemorylocker.cpp @@ -338,7 +340,9 @@ set( libHeaders widgets/welcomewidget.h widgets/welcomeplaylistmodel.h widgets/overlaywidget.h + widgets/HeaderLabel.h widgets/infowidgets/sourceinfowidget.h +# widgets/infowidgets/ArtistInfoWidget.h kdsingleapplicationguard/kdsingleapplicationguard.h ) @@ -360,6 +364,7 @@ set( libUI ${libUI} widgets/searchwidget.ui widgets/welcomewidget.ui widgets/infowidgets/sourceinfowidget.ui + widgets/infowidgets/ArtistInfoWidget.ui playlist/topbar/topbar.ui playlist/infobar/infobar.ui ) diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp new file mode 100644 index 000000000..f30fbc7b2 --- /dev/null +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -0,0 +1,86 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2011, 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#include "HeaderLabel.h" + +#include +#include + +#define FONT_SIZE 16 + + +HeaderLabel::HeaderLabel( QWidget* parent ) + : QLabel( parent ) + , m_parent( parent ) +{ + QFont f( font() ); + f.setBold( true ); + f.setPointSize( 11 ); + +#ifdef Q_WS_MAC + f.setPointSize( f.pointSize() - 2 ); +#endif + + setFont( f ); + setFixedHeight( sizeHint().height() + 6 ); + qDebug() << "FOOBAR:" << minimumSize(); +} + + +HeaderLabel::~HeaderLabel() +{ +} + + +QSize +HeaderLabel::sizeHint() const +{ + return QLabel::sizeHint(); +} + + +void +HeaderLabel::paintEvent( QPaintEvent* event ) +{ + QPainter p( this ); + QRect r = contentsRect(); + +// p.setRenderHint( QPainter::Antialiasing ); + + QRect upperHalf( 0, 0, r.width(), r.height() / 2 ); + QRect lowerHalf( 0, upperHalf.height(), r.width(), r.height() ); + p.fillRect( upperHalf, QColor( 80, 80, 80 ) ); + p.fillRect( lowerHalf, QColor( 72, 72, 72 ) ); + + { + QColor lineColor( 100, 100, 100 ); + QLine line( 0, 0, r.width(), 0 ); + p.setPen( lineColor ); + p.drawLine( line ); + } + { + QColor lineColor( 63, 63, 63 ); + QLine line( 0, r.height() - 1, r.width(), r.height() - 1 ); + p.setPen( lineColor ); + p.drawLine( line ); + } + + r.adjust( 8, 3, -8, -3 ); + p.setPen( Qt::white ); + p.drawText( r, text() ); +} diff --git a/src/libtomahawk/widgets/HeaderLabel.h b/src/libtomahawk/widgets/HeaderLabel.h new file mode 100644 index 000000000..3333dabf6 --- /dev/null +++ b/src/libtomahawk/widgets/HeaderLabel.h @@ -0,0 +1,47 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2011, 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef HEADERLABEL_H +#define HEADERLABEL_H + +#include + +#include "dllmacro.h" + +class DLLEXPORT HeaderLabel : public QLabel +{ +Q_OBJECT + +public: + HeaderLabel( QWidget* parent ); + ~HeaderLabel(); + + QSize minimumSizeHint() const { return sizeHint(); } + QSize sizeHint() const; + +public slots: + +protected: +// void changeEvent( QEvent* e ); + void paintEvent( QPaintEvent* event ); + +private: + QWidget* m_parent; +}; + +#endif // HEADERLABEL_H diff --git a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp index 77912e92a..0f8288589 100644 --- a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp @@ -38,6 +38,30 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* { ui->setupUi( this ); + ui->historyView->setFrameShape( QFrame::NoFrame ); + ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->recentAlbumView->setFrameShape( QFrame::NoFrame ); + ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->recentCollectionView->setFrameShape( QFrame::NoFrame ); + ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->horizontalLayout->setMargin( 0 ); + ui->horizontalLayout->setSpacing( 0 ); + + ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout->setMargin( 0 ); + ui->verticalLayout->setSpacing( 0 ); + ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_2->setMargin( 0 ); + ui->verticalLayout_2->setSpacing( 0 ); + ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_3->setMargin( 0 ); + ui->verticalLayout_3->setSpacing( 0 ); + ui->verticalLayout_4->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_4->setMargin( 0 ); + ui->verticalLayout_4->setSpacing( 0 ); + ui->historyView->overlay()->setEnabled( false ); m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView ); diff --git a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui index cfb416fcb..bde48ccbc 100644 --- a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui +++ b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui @@ -6,7 +6,7 @@ 0 0 - 985 + 831 460 @@ -14,14 +14,7 @@ - - - - 13 - 75 - true - - + Recent Albums @@ -56,14 +49,7 @@ - - - - 13 - 75 - true - - + Latest Additions to their Collection @@ -77,14 +63,7 @@ - - - - 13 - 75 - true - - + Recently played Tracks @@ -100,21 +79,26 @@ + + HeaderLabel + QLabel +
widgets/HeaderLabel.h
+
PlaylistView QTreeView
playlist/playlistview.h
- - CollectionView - QTreeView -
playlist/collectionview.h
-
AlbumView QListView
playlist/albumview.h
+ + CollectionView + QTreeView +
playlist/collectionview.h
+
diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index f288f6714..2f0ae31e8 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -52,6 +52,27 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) WelcomePlaylistModel* model = new WelcomePlaylistModel( this ); model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS ); + ui->playlistWidget->setFrameShape( QFrame::NoFrame ); + ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->tracksView->setFrameShape( QFrame::NoFrame ); + ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->additionsView->setFrameShape( QFrame::NoFrame ); + ui->additionsView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->horizontalLayout->setMargin( 0 ); + ui->horizontalLayout->setSpacing( 0 ); + + ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout->setMargin( 0 ); + ui->verticalLayout->setSpacing( 0 ); + ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_2->setMargin( 0 ); + ui->verticalLayout_2->setSpacing( 0 ); + ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_3->setMargin( 0 ); + ui->verticalLayout_3->setSpacing( 0 ); + ui->playlistWidget->setItemDelegate( new PlaylistDelegate() ); ui->playlistWidget->setModel( model ); ui->playlistWidget->overlay()->resize( 380, 86 ); diff --git a/src/libtomahawk/widgets/welcomewidget.ui b/src/libtomahawk/widgets/welcomewidget.ui index d55ca2ff7..5866dc325 100644 --- a/src/libtomahawk/widgets/welcomewidget.ui +++ b/src/libtomahawk/widgets/welcomewidget.ui @@ -6,8 +6,8 @@ 0 0 - 985 - 459 + 875 + 513 @@ -16,15 +16,10 @@ Qt::Vertical - + - - - - 14 - - + Recent Additions @@ -35,15 +30,10 @@ - + - - - - 14 - - + Newest Stations & Playlists @@ -59,18 +49,13 @@ - + 16777215 16777215 - - - 14 - - Recently Played Tracks @@ -91,6 +76,11 @@ + + HeaderLabel + QLabel +
widgets/HeaderLabel.h
+
PlaylistView QTreeView From 61f9fd5c99b1e78ccff495cf92acbfeff18c99b9 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 07:24:57 +0200 Subject: [PATCH 3/9] * Fixed CMakeLists.txt. --- src/libtomahawk/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 3e6fd33ac..a02545d1e 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -364,7 +364,7 @@ set( libUI ${libUI} widgets/searchwidget.ui widgets/welcomewidget.ui widgets/infowidgets/sourceinfowidget.ui - widgets/infowidgets/ArtistInfoWidget.ui +# widgets/infowidgets/ArtistInfoWidget.ui playlist/topbar/topbar.ui playlist/infobar/infobar.ui ) From 1e62c117e4d55b864a318f575eb951eb9b3e5523 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 08:26:44 +0200 Subject: [PATCH 4/9] * A few more improvements for and around HeaderLabels. --- .../playlist/playlistitemdelegate.cpp | 6 +- src/libtomahawk/utils/tomahawkutils.cpp | 17 +++ src/libtomahawk/utils/tomahawkutils.h | 5 +- src/libtomahawk/widgets/HeaderLabel.cpp | 2 +- .../widgets/infowidgets/sourceinfowidget.cpp | 17 +-- src/libtomahawk/widgets/welcomewidget.cpp | 21 ++-- src/libtomahawk/widgets/welcomewidget.ui | 111 +++++++++--------- src/resolvers/qtscriptresolver.h | 1 + 8 files changed, 92 insertions(+), 88 deletions(-) diff --git a/src/libtomahawk/playlist/playlistitemdelegate.cpp b/src/libtomahawk/playlist/playlistitemdelegate.cpp index 9bfc69445..68fe42143 100644 --- a/src/libtomahawk/playlist/playlistitemdelegate.cpp +++ b/src/libtomahawk/playlist/playlistitemdelegate.cpp @@ -205,16 +205,16 @@ PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem& QFont boldFont = opt.font; boldFont.setBold( true ); - r.adjust( ir.width() + 12, 0, 0, 0 ); + r.adjust( ir.width() + 12, 0, -12, 0 ); QTextOption to( Qt::AlignTop ); to.setWrapMode( QTextOption::NoWrap ); painter->setFont( boldFont ); - QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() - 3 ); + QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() ); painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to ); to.setAlignment( Qt::AlignBottom ); painter->setFont( opt.font ); - text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() - 3 ); + text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() ); painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to ); } painter->restore(); diff --git a/src/libtomahawk/utils/tomahawkutils.cpp b/src/libtomahawk/utils/tomahawkutils.cpp index 8cb25944b..6cf01c787 100644 --- a/src/libtomahawk/utils/tomahawkutils.cpp +++ b/src/libtomahawk/utils/tomahawkutils.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -338,6 +339,22 @@ createDragPixmap( int itemCount ) } +void +unmarginLayout( QLayout* layout ) +{ + layout->setContentsMargins( 0, 0, 0, 0 ); + layout->setMargin( 0 ); + layout->setSpacing( 0 ); + + for ( int i = 0; i < layout->count(); i++ ) + { + QLayout* childLayout = layout->itemAt( i )->layout(); + if ( childLayout ) + unmarginLayout( childLayout ); + } +} + + QWeakPointer< QNetworkAccessManager > s_nam; NetworkProxyFactory* s_proxyFactory = 0; diff --git a/src/libtomahawk/utils/tomahawkutils.h b/src/libtomahawk/utils/tomahawkutils.h index e4d461e99..581252bf7 100644 --- a/src/libtomahawk/utils/tomahawkutils.h +++ b/src/libtomahawk/utils/tomahawkutils.h @@ -24,7 +24,6 @@ #include #include #include -#include #define RESPATH ":/data/" @@ -33,8 +32,8 @@ class QDir; class QDateTime; class QString; class QPixmap; +class QLayout; class QNetworkAccessManager; -class QNetworkProxy; namespace TomahawkUtils { @@ -72,6 +71,8 @@ namespace TomahawkUtils DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity ); DLLEXPORT QPixmap createDragPixmap( int itemCount = 1 ); + DLLEXPORT void unmarginLayout( QLayout* layout ); + DLLEXPORT NetworkProxyFactory* proxyFactory(); DLLEXPORT QNetworkAccessManager* nam(); diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp index f30fbc7b2..5f95fd2ae 100644 --- a/src/libtomahawk/widgets/HeaderLabel.cpp +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -74,7 +74,7 @@ HeaderLabel::paintEvent( QPaintEvent* event ) p.drawLine( line ); } { - QColor lineColor( 63, 63, 63 ); + QColor lineColor( 30, 30, 30 ); QLine line( 0, r.height() - 1, r.width(), r.height() - 1 ); p.setPen( lineColor ); p.drawLine( line ); diff --git a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp index 0f8288589..228284d19 100644 --- a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp @@ -45,22 +45,7 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* ui->recentCollectionView->setFrameShape( QFrame::NoFrame ); ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); - ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); - ui->horizontalLayout->setMargin( 0 ); - ui->horizontalLayout->setSpacing( 0 ); - - ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout->setMargin( 0 ); - ui->verticalLayout->setSpacing( 0 ); - ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout_2->setMargin( 0 ); - ui->verticalLayout_2->setSpacing( 0 ); - ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout_3->setMargin( 0 ); - ui->verticalLayout_3->setSpacing( 0 ); - ui->verticalLayout_4->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout_4->setMargin( 0 ); - ui->verticalLayout_4->setSpacing( 0 ); + TomahawkUtils::unmarginLayout( layout() ); ui->historyView->overlay()->setEnabled( false ); diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index 2f0ae31e8..7dbbf50b3 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -48,6 +48,9 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) ui->setupUi( this ); ui->splitter->setHandleWidth( 1 ); + ui->splitter_2->setHandleWidth( 1 ); + ui->splitter_2->setStretchFactor( 0, 3 ); + ui->splitter_2->setStretchFactor( 0, 2 ); WelcomePlaylistModel* model = new WelcomePlaylistModel( this ); model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS ); @@ -59,19 +62,11 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) ui->additionsView->setFrameShape( QFrame::NoFrame ); ui->additionsView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); - ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); - ui->horizontalLayout->setMargin( 0 ); - ui->horizontalLayout->setSpacing( 0 ); - - ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout->setMargin( 0 ); - ui->verticalLayout->setSpacing( 0 ); - ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout_2->setMargin( 0 ); - ui->verticalLayout_2->setSpacing( 0 ); - ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); - ui->verticalLayout_3->setMargin( 0 ); - ui->verticalLayout_3->setSpacing( 0 ); + TomahawkUtils::unmarginLayout( layout() ); + TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); + TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() ); + TomahawkUtils::unmarginLayout( ui->verticalLayout_3->layout() ); + TomahawkUtils::unmarginLayout( ui->verticalLayout_4->layout() ); ui->playlistWidget->setItemDelegate( new PlaylistDelegate() ); ui->playlistWidget->setModel( model ); diff --git a/src/libtomahawk/widgets/welcomewidget.ui b/src/libtomahawk/widgets/welcomewidget.ui index 5866dc325..b28514dde 100644 --- a/src/libtomahawk/widgets/welcomewidget.ui +++ b/src/libtomahawk/widgets/welcomewidget.ui @@ -10,69 +10,74 @@ 513 - + - + - Qt::Vertical + Qt::Horizontal - - - - - - Recent Additions - - - - - - - + + + Qt::Vertical + + + + + + + Recent Additions + + + + + + + + + + + + + + Newest Stations & Playlists + + + + + + + + - - + + - + + + + 16777215 + 16777215 + + - Newest Stations & Playlists + Recently Played Tracks - + + + + 16777215 + 16777215 + + + - - - - - - - 16777215 - 16777215 - - - - Recently Played Tracks - - - - - - - - 16777215 - 16777215 - - - - - -
@@ -86,16 +91,16 @@ QTreeView
playlist/playlistview.h
- - PlaylistWidget - QListWidget -
widgets/welcomewidget.h
-
AlbumView QListView
playlist/albumview.h
+ + PlaylistWidget + QListWidget +
widgets/welcomewidget.h
+
diff --git a/src/resolvers/qtscriptresolver.h b/src/resolvers/qtscriptresolver.h index a9b439176..cf148990d 100644 --- a/src/resolvers/qtscriptresolver.h +++ b/src/resolvers/qtscriptresolver.h @@ -26,6 +26,7 @@ #include #include +#include #include #include #include From 39409ed861c9e2ddb41bea573576fc6d258bfb60 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 13:28:04 +0200 Subject: [PATCH 5/9] * Don't cut off fonts in HeaderLabel. --- src/libtomahawk/widgets/HeaderLabel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp index 5f95fd2ae..19d347d2a 100644 --- a/src/libtomahawk/widgets/HeaderLabel.cpp +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -38,7 +38,6 @@ HeaderLabel::HeaderLabel( QWidget* parent ) setFont( f ); setFixedHeight( sizeHint().height() + 6 ); - qDebug() << "FOOBAR:" << minimumSize(); } @@ -80,7 +79,7 @@ HeaderLabel::paintEvent( QPaintEvent* event ) p.drawLine( line ); } - r.adjust( 8, 3, -8, -3 ); + r.adjust( 8, 2, -8, -2 ); p.setPen( Qt::white ); p.drawText( r, text() ); } From 97986d8d3e38869a60adbc773cbe21dbc0720030 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 15:20:50 +0200 Subject: [PATCH 6/9] * Use QTextOption to v-center HeaderLabel properly. --- src/libtomahawk/widgets/HeaderLabel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp index 19d347d2a..208abed60 100644 --- a/src/libtomahawk/widgets/HeaderLabel.cpp +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -37,7 +37,7 @@ HeaderLabel::HeaderLabel( QWidget* parent ) #endif setFont( f ); - setFixedHeight( sizeHint().height() + 6 ); + setFixedHeight( sizeHint().height() + 8 ); } @@ -79,7 +79,8 @@ HeaderLabel::paintEvent( QPaintEvent* event ) p.drawLine( line ); } - r.adjust( 8, 2, -8, -2 ); + QTextOption to( Qt::AlignVCenter ); + r.adjust( 8, 0, -8, 0 ); p.setPen( Qt::white ); - p.drawText( r, text() ); + p.drawText( r, text(), to ); } From ee70b9e3a7189b6422be6175db69e85b6413be5b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 Jun 2011 15:35:42 +0200 Subject: [PATCH 7/9] * Set minimum size for recently-played tracks in WelcomeWidget. --- src/libtomahawk/widgets/welcomewidget.cpp | 2 +- src/libtomahawk/widgets/welcomewidget.ui | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index 7dbbf50b3..8ec1d4d1a 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -49,8 +49,8 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) ui->splitter->setHandleWidth( 1 ); ui->splitter_2->setHandleWidth( 1 ); - ui->splitter_2->setStretchFactor( 0, 3 ); ui->splitter_2->setStretchFactor( 0, 2 ); + ui->splitter_2->setStretchFactor( 0, 1 ); WelcomePlaylistModel* model = new WelcomePlaylistModel( this ); model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS ); diff --git a/src/libtomahawk/widgets/welcomewidget.ui b/src/libtomahawk/widgets/welcomewidget.ui index b28514dde..489ff9fb2 100644 --- a/src/libtomahawk/widgets/welcomewidget.ui +++ b/src/libtomahawk/widgets/welcomewidget.ui @@ -53,12 +53,6 @@ - - - 16777215 - 16777215 - - Recently Played Tracks @@ -66,10 +60,10 @@ - + - 16777215 - 16777215 + 320 + 0 From c6d2a5df89d2d36ac9398476d83abba10b2078a2 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sun, 26 Jun 2011 12:58:51 -0400 Subject: [PATCH 8/9] Remove extraneous code --- src/libtomahawk/sourceplaylistinterface.cpp | 10 ---------- src/libtomahawk/sourceplaylistinterface.h | 1 - 2 files changed, 11 deletions(-) diff --git a/src/libtomahawk/sourceplaylistinterface.cpp b/src/libtomahawk/sourceplaylistinterface.cpp index bf1836228..bf3fafb66 100644 --- a/src/libtomahawk/sourceplaylistinterface.cpp +++ b/src/libtomahawk/sourceplaylistinterface.cpp @@ -103,16 +103,6 @@ SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& que } -void -SourcePlaylistInterface::resolveResultsAdded( const QList& results ) const -{ - qDebug() << Q_FUNC_INFO; - foreach ( Tomahawk::result_ptr ptr, results ) - { -// qDebug() << "Found result:" << ptr->track(); - } -} - void SourcePlaylistInterface::resolvingFinished( bool hasResults ) { diff --git a/src/libtomahawk/sourceplaylistinterface.h b/src/libtomahawk/sourceplaylistinterface.h index 7eb8d179d..097d1a4be 100644 --- a/src/libtomahawk/sourceplaylistinterface.h +++ b/src/libtomahawk/sourceplaylistinterface.h @@ -74,7 +74,6 @@ signals: private slots: void onSourcePlaybackStarted( const Tomahawk::query_ptr& query ); - void resolveResultsAdded( const QList& results ) const; void resolvingFinished( bool hasResults ); private: From e983742c9b09f15a187abe91ac06cf38a4ad7b0e Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sun, 26 Jun 2011 13:25:55 -0400 Subject: [PATCH 9/9] When notifying of a played track, show the source's image. Ideally we'd show the album cover but I can't find a good way to get at that (yet). --- src/libtomahawk/audio/audioengine.cpp | 13 +++++++------ .../infoplugins/unix/fdonotifyplugin.cpp | 15 +++++++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/libtomahawk/audio/audioengine.cpp b/src/libtomahawk/audio/audioengine.cpp index f3f6362b6..9491275d0 100644 --- a/src/libtomahawk/audio/audioengine.cpp +++ b/src/libtomahawk/audio/audioengine.cpp @@ -154,9 +154,9 @@ AudioEngine::stop() sendWaitingNotification(); else if ( TomahawkSettings::instance()->verboseNotifications() ) { - Tomahawk::InfoSystem::InfoCriteriaHash stopInfo; + Tomahawk::InfoSystem::InfoCustomData stopInfo; stopInfo["message"] = QString( "Tomahawk is stopped." ); - map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo ); + map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( stopInfo ); } Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map ); @@ -240,11 +240,11 @@ AudioEngine::mute() void AudioEngine::sendWaitingNotification() const { - Tomahawk::InfoSystem::InfoCriteriaHash retryInfo; + Tomahawk::InfoSystem::InfoCustomData retryInfo; retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." ); Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser, - QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) ); + QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( retryInfo ) ); } @@ -329,12 +329,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result ) if ( TomahawkSettings::instance()->verboseNotifications() ) { - Tomahawk::InfoSystem::InfoCriteriaHash playInfo; + Tomahawk::InfoSystem::InfoCustomData playInfo; playInfo["message"] = QString( "Tomahawk is playing \"%1\" by %2 on album %3." ) .arg( m_currentTrack->track() ) .arg( m_currentTrack->artist()->name() ) .arg( m_currentTrack->album()->name() ); - map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( playInfo ); + playInfo["image"] = QVariant( m_currentTrack->collection()->source()->avatar().toImage() ); + map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( playInfo ); } Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map ); diff --git a/src/libtomahawk/infosystem/infoplugins/unix/fdonotifyplugin.cpp b/src/libtomahawk/infosystem/infoplugins/unix/fdonotifyplugin.cpp index c0b7f9d0d..7e38e615f 100644 --- a/src/libtomahawk/infosystem/infoplugins/unix/fdonotifyplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/unix/fdonotifyplugin.cpp @@ -63,12 +63,12 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf { Q_UNUSED( caller ); qDebug() << Q_FUNC_INFO; - if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() ) + if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCustomData >() ) { qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash"; return; } - Tomahawk::InfoSystem::InfoCriteriaHash hash = pushData.value< Tomahawk::InfoSystem::InfoCriteriaHash >(); + Tomahawk::InfoSystem::InfoCustomData hash = pushData.value< Tomahawk::InfoSystem::InfoCustomData >(); if ( !hash.contains( "message" ) ) { qDebug() << Q_FUNC_INFO << " hash did not contain a message"; @@ -81,11 +81,18 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf arguments << quint32( 0 ); //notification_id arguments << QString(); //app_icon arguments << QString( "Tomahawk" ); //summary - arguments << hash["message"]; //body + arguments << hash["message"].toString(); //body arguments << QStringList(); //actions QVariantMap dict; dict["desktop-entry"] = QString( "tomahawk" ); - dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) ); + if ( hash.contains( "image" ) ) + { + QVariant tempVariant = hash["image"]; + QImage tempImage = tempVariant.value< QImage >(); + dict["image_data"] = ImageConverter::variantForImage( tempImage ); + } + else + dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) ); arguments << dict; //hints arguments << qint32( -1 ); //expire_timeout message.setArguments( arguments );