1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-25 15:01:11 +02:00

* Use BasicHeader on all pages.

This commit is contained in:
Christian Muehlhaeuser
2014-08-27 18:42:45 +02:00
parent 300e8bd200
commit 191f97b724
8 changed files with 56 additions and 143 deletions

View File

@@ -19,7 +19,6 @@
#include "SearchWidget.h"
#include "ui_SearchWidget.h"
#include "ui_HeaderWidget.h"
#include "SourceList.h"
#include "MetaPlaylistInterface.h"
@@ -32,6 +31,7 @@
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
#include "widgets/BasicHeader.h"
#include <QPushButton>
#include <QScrollArea>
@@ -42,14 +42,11 @@ using namespace Tomahawk;
SearchWidget::SearchWidget( const QString& search, QWidget* parent )
: QWidget( parent )
, ui( new Ui::SearchWidget )
, uiHeader( new Ui::HeaderWidget )
, m_search( search )
{
QWidget* widget = new QWidget;
QWidget* headerWidget = new QWidget;
BasicHeader* headerWidget = new BasicHeader;
ui->setupUi( widget );
uiHeader->setupUi( headerWidget );
headerWidget->setFixedHeight( 160 );
{
ui->artists->setAutoResize( true );
@@ -123,22 +120,6 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
connect( ui->topHitsMoreLabel, SIGNAL( clicked() ), SLOT( onTopHitsMoreClicked() ) );
}
{
QFont f = uiHeader->artistLabel->font();
f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
QPalette p = uiHeader->artistLabel->palette();
p.setColor( QPalette::Foreground, Qt::white );
uiHeader->artistLabel->setFont( f );
uiHeader->artistLabel->setPalette( p );
uiHeader->anchor1Label->hide();
uiHeader->anchor2Label->hide();
uiHeader->anchor3Label->hide();
}
m_stackedWidget = new QStackedWidget();
{
@@ -253,7 +234,7 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
m_resultsModel->startLoading();
m_queries << Tomahawk::Query::get( search, uuid() );
uiHeader->artistLabel->setText( title().toUpper() );
headerWidget->ui->captionLabel->setText( title().toUpper() );
foreach ( const Tomahawk::query_ptr& query, m_queries )
{

View File

@@ -38,7 +38,6 @@ class PlaylistModel;
namespace Ui
{
class SearchWidget;
class HeaderWidget;
}
class DLLEXPORT SearchWidget : public QWidget, public Tomahawk::ViewPage
@@ -84,7 +83,6 @@ private:
void updateAlbums();
Ui::SearchWidget *ui;
Ui::HeaderWidget* uiHeader;
QStackedWidget* m_stackedWidget;
QString m_search;

View File

@@ -20,7 +20,6 @@
#include "AlbumInfoWidget.h"
#include "ui_AlbumInfoWidget.h"
#include "ui_HeaderWidget.h"
#include "audio/AudioEngine.h"
#include "ViewManager.h"
@@ -30,6 +29,7 @@
#include "Source.h"
#include "MetaPlaylistInterface.h"
#include "playlist/TrackView.h"
#include "widgets/BasicHeader.h"
#include "database/DatabaseCommand_AllTracks.h"
#include "database/DatabaseCommand_AllAlbums.h"
@@ -47,13 +47,10 @@ using namespace Tomahawk;
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
: QWidget( parent )
, ui( new Ui::AlbumInfoWidget )
, uiHeader( new Ui::HeaderWidget )
{
QWidget* widget = new QWidget;
QWidget* headerWidget = new QWidget;
m_headerWidget = new BasicHeader;
ui->setupUi( widget );
uiHeader->setupUi( headerWidget );
headerWidget->setFixedHeight( 160 );
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Original, QSize( 48, 48 ) );
@@ -64,22 +61,6 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
ui->albumView->setPlayableModel( m_tracksModel );
ui->albumView->setCaption( tr( "Album Details" ) );
{
QFont f = uiHeader->artistLabel->font();
f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
QPalette p = uiHeader->artistLabel->palette();
p.setColor( QPalette::Foreground, Qt::white );
uiHeader->artistLabel->setFont( f );
uiHeader->artistLabel->setPalette( p );
uiHeader->anchor1Label->hide();
uiHeader->anchor2Label->hide();
uiHeader->anchor3Label->hide();
}
ui->topHits->setStyleSheet( QString( "QListView { background-color: #f9f9f9; }" ) );
TomahawkStyle::stylePageFrame( ui->trackFrame );
ui->topHits->setVisible( false );
@@ -99,7 +80,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( headerWidget );
layout->addWidget( m_headerWidget );
layout->addWidget( area );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
@@ -168,7 +149,7 @@ AlbumInfoWidget::load( const album_ptr& album )
connect( m_album.data(), SIGNAL( updated() ), SLOT( onAlbumImageUpdated() ) );
uiHeader->artistLabel->setText( album->artist()->name().toUpper() );
m_headerWidget->ui->captionLabel->setText( album->artist()->name().toUpper() );
m_tracksModel->startLoading();
m_tracksModel->addTracks( album, QModelIndex(), true );
@@ -186,7 +167,7 @@ AlbumInfoWidget::onAlbumImageUpdated()
m_pixmap = m_album->cover( QSize( 0, 0 ) );
emit pixmapChanged( m_pixmap );
uiHeader->headerWidget->setBackground( m_pixmap, true, false );
m_headerWidget->setBackground( m_pixmap, true, false );
}

View File

@@ -42,11 +42,11 @@
class PlayableModel;
class TreeModel;
class MetaAlbumInfoInterface;
class BasicHeader;
namespace Ui
{
class AlbumInfoWidget;
class HeaderWidget;
}
class DLLEXPORT AlbumInfoWidget : public QWidget, public Tomahawk::ViewPage
@@ -97,7 +97,7 @@ private slots:
private:
Ui::AlbumInfoWidget* ui;
Ui::HeaderWidget* uiHeader;
BasicHeader* m_headerWidget;
Tomahawk::album_ptr m_album;

View File

@@ -19,7 +19,6 @@
#include "ArtistInfoWidget.h"
#include "ui_ArtistInfoWidget.h"
#include "ui_HeaderWidget.h"
#include <QDesktopServices>
#include <QScrollArea>
@@ -41,7 +40,7 @@
#include "Pipeline.h"
#include "SourceList.h"
#include "MetaPlaylistInterface.h"
#include "widgets/StatsGauge.h"
#include "widgets/BasicHeader.h"
#include "utils/TomahawkStyle.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
@@ -52,14 +51,11 @@ using namespace Tomahawk;
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent )
: QWidget( parent )
, ui( new Ui::ArtistInfoWidget )
, uiHeader( new Ui::HeaderWidget )
, m_artist( artist )
{
m_widget = new QWidget;
QWidget* headerWidget = new QWidget;
m_headerWidget = new BasicHeader;
ui->setupUi( m_widget );
uiHeader->setupUi( headerWidget );
headerWidget->setFixedHeight( 160 );
artist->loadStats();
connect( artist.data(), SIGNAL( statsLoaded() ), SLOT( onArtistStatsLoaded() ) );
@@ -153,40 +149,21 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
}
{
QFont f = uiHeader->artistLabel->font();
f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
m_headerWidget->ui->anchor1Label->setText( tr( "Music" ) );
m_headerWidget->ui->anchor2Label->setText( tr( "Biography" ) );
m_headerWidget->ui->anchor3Label->setText( tr( "Related Artists" ) );
m_headerWidget->ui->anchor1Label->show();
m_headerWidget->ui->anchor2Label->show();
m_headerWidget->ui->anchor3Label->show();
QPalette p = uiHeader->artistLabel->palette();
p.setColor( QPalette::Foreground, Qt::white );
QFontMetrics fm( m_headerWidget->ui->anchor1Label->font() );
m_headerWidget->ui->anchor1Label->setFixedWidth( fm.width( m_headerWidget->ui->anchor1Label->text() ) + 16 );
m_headerWidget->ui->anchor2Label->setFixedWidth( fm.width( m_headerWidget->ui->anchor2Label->text() ) + 16 );
m_headerWidget->ui->anchor3Label->setFixedWidth( fm.width( m_headerWidget->ui->anchor3Label->text() ) + 16 );
uiHeader->artistLabel->setFont( f );
uiHeader->artistLabel->setPalette( p );
f.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
f.setBold( true );
uiHeader->anchor1Label->setFont( f );
uiHeader->anchor1Label->setPalette( p );
uiHeader->anchor2Label->setFont( f );
uiHeader->anchor2Label->setPalette( p );
uiHeader->anchor3Label->setFont( f );
uiHeader->anchor3Label->setPalette( p );
uiHeader->anchor1Label->setOpacity( 1 );
uiHeader->anchor2Label->setOpacity( 1 );
uiHeader->anchor3Label->setOpacity( 1 );
uiHeader->anchor1Label->setText( tr( "Music" ) );
uiHeader->anchor2Label->setText( tr( "Biography" ) );
uiHeader->anchor3Label->setText( tr( "Related Artists" ) );
QFontMetrics fm( f );
uiHeader->anchor1Label->setFixedWidth( fm.width( uiHeader->anchor1Label->text() ) + 16 );
uiHeader->anchor2Label->setFixedWidth( fm.width( uiHeader->anchor2Label->text() ) + 16 );
uiHeader->anchor3Label->setFixedWidth( fm.width( uiHeader->anchor3Label->text() ) + 16 );
connect( uiHeader->anchor1Label, SIGNAL( clicked() ), SLOT( onMusicAnchorClicked() ) );
connect( uiHeader->anchor2Label, SIGNAL( clicked() ), SLOT( onBioAnchorClicked() ) );
connect( uiHeader->anchor3Label, SIGNAL( clicked() ), SLOT( onRelatedArtistsAnchorClicked() ) );
connect( m_headerWidget->ui->anchor1Label, SIGNAL( clicked() ), SLOT( onMusicAnchorClicked() ) );
connect( m_headerWidget->ui->anchor2Label, SIGNAL( clicked() ), SLOT( onBioAnchorClicked() ) );
connect( m_headerWidget->ui->anchor3Label, SIGNAL( clicked() ), SLOT( onRelatedArtistsAnchorClicked() ) );
}
m_stackedWidget = new QStackedWidget();
@@ -252,7 +229,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
{
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget( headerWidget );
layout->addWidget( m_headerWidget );
layout->addWidget( m_stackedWidget );
setLayout( layout );
TomahawkUtils::unmarginLayout( layout );
@@ -337,8 +314,8 @@ ArtistInfoWidget::load( const artist_ptr& artist )
m_artist = artist;
m_title = artist->name();
uiHeader->artistLabel->setText( artist->name().toUpper() );
uiHeader->balanceSpacer->changeSize( uiHeader->artistLabel->sizeHint().width(), 1, QSizePolicy::Fixed, QSizePolicy::Fixed );
m_headerWidget->ui->captionLabel->setText( artist->name().toUpper() );
m_headerWidget->ui->balanceSpacer->changeSize( m_headerWidget->ui->captionLabel->sizeHint().width(), 1, QSizePolicy::Fixed, QSizePolicy::Fixed );
connect( m_artist.data(), SIGNAL( biographyLoaded() ), SLOT( onBiographyLoaded() ) );
connect( m_artist.data(), SIGNAL( similarArtistsLoaded() ), SLOT( onSimilarArtistsLoaded() ) );
@@ -424,7 +401,7 @@ ArtistInfoWidget::onArtistImageUpdated()
m_pixmap = m_artist->cover( QSize( 0, 0 ) );
emit pixmapChanged( m_pixmap );
uiHeader->headerWidget->setBackground( m_pixmap, true, false );
m_headerWidget->setBackground( m_pixmap, true, false );
ui->cover->setPixmap( m_artist->cover( QSize( ui->cover->width(), ui->cover->width() ) ) );
}
@@ -526,39 +503,39 @@ ArtistInfoWidget::onSliderValueChanged( int value )
const bool ra = ( ( ui->relatedArtistsLabel->mapTo( m_widget, QPoint( 0, 0 ) ).y() - 32 ) - value ) < midPoint;
const float lowOpacity = 0.8;
QFont inactive = uiHeader->anchor1Label->font();
QFont inactive = m_headerWidget->ui->anchor1Label->font();
inactive.setBold( false );
QFont active = uiHeader->anchor1Label->font();
QFont active = m_headerWidget->ui->anchor1Label->font();
active.setBold( true );
if ( ra )
{
uiHeader->anchor3Label->setOpacity( 1 );
uiHeader->anchor1Label->setOpacity( lowOpacity );
uiHeader->anchor2Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor3Label->setOpacity( 1 );
m_headerWidget->ui->anchor1Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor2Label->setOpacity( lowOpacity );
uiHeader->anchor3Label->setFont( active );
uiHeader->anchor1Label->setFont( inactive );
uiHeader->anchor2Label->setFont( inactive );
m_headerWidget->ui->anchor3Label->setFont( active );
m_headerWidget->ui->anchor1Label->setFont( inactive );
m_headerWidget->ui->anchor2Label->setFont( inactive );
}
else if ( bio )
{
uiHeader->anchor2Label->setOpacity( 1 );
uiHeader->anchor1Label->setOpacity( lowOpacity );
uiHeader->anchor3Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor2Label->setOpacity( 1 );
m_headerWidget->ui->anchor1Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor3Label->setOpacity( lowOpacity );
uiHeader->anchor2Label->setFont( active );
uiHeader->anchor1Label->setFont( inactive );
uiHeader->anchor3Label->setFont( inactive );
m_headerWidget->ui->anchor2Label->setFont( active );
m_headerWidget->ui->anchor1Label->setFont( inactive );
m_headerWidget->ui->anchor3Label->setFont( inactive );
}
else
{
uiHeader->anchor1Label->setOpacity( 1 );
uiHeader->anchor2Label->setOpacity( lowOpacity );
uiHeader->anchor3Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor1Label->setOpacity( 1 );
m_headerWidget->ui->anchor2Label->setOpacity( lowOpacity );
m_headerWidget->ui->anchor3Label->setOpacity( lowOpacity );
uiHeader->anchor1Label->setFont( active );
uiHeader->anchor2Label->setFont( inactive );
uiHeader->anchor3Label->setFont( inactive );
m_headerWidget->ui->anchor1Label->setFont( active );
m_headerWidget->ui->anchor2Label->setFont( inactive );
m_headerWidget->ui->anchor3Label->setFont( inactive );
}
}

View File

@@ -42,12 +42,11 @@ class QScrollArea;
class QStackedWidget;
class PlayableModel;
class PlaylistModel;
class StatsGauge;
class BasicHeader;
namespace Ui
{
class ArtistInfoWidget;
class HeaderWidget;
}
class MetaArtistInfoInterface;
@@ -116,9 +115,9 @@ private slots:
private:
Ui::ArtistInfoWidget *ui;
Ui::HeaderWidget* uiHeader;
QWidget* m_widget;
BasicHeader* m_headerWidget;
QScrollArea* m_area;
Tomahawk::artist_ptr m_artist;
@@ -128,7 +127,6 @@ private:
Tomahawk::playlistinterface_ptr m_plInterface;
QStackedWidget* m_stackedWidget;
StatsGauge* m_playStatsGauge;
QString m_title;
QString m_description;

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
@@ -20,7 +20,6 @@
#include "Dashboard.h"
#include "ui_DashboardWidget.h"
#include "ui_HeaderWidget.h"
#include "libtomahawk-widgets/PlaylistDelegate.h"
@@ -67,13 +66,11 @@ Dashboard::~Dashboard()
DashboardWidget::DashboardWidget( QWidget* parent )
: QWidget( parent )
, ui( new Ui::DashboardWidget )
, uiHeader( new Ui::HeaderWidget )
{
QWidget* widget = new QWidget;
QWidget* headerWidget = new QWidget;
BasicHeader* headerWidget = new BasicHeader;
headerWidget->setCaption( tr( "Feed" ) );
ui->setupUi( widget );
uiHeader->setupUi( headerWidget );
headerWidget->setFixedHeight( 160 );
{
m_tracksModel = new RecentlyPlayedModel( ui->trackView->trackView(), HISTORY_TRACK_ITEMS );
@@ -86,23 +83,6 @@ DashboardWidget::DashboardWidget( QWidget* parent )
m_tracksModel->setSource( source_ptr() );
}
{
QFont f = uiHeader->artistLabel->font();
f.setBold( true );
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
QPalette p = uiHeader->artistLabel->palette();
p.setColor( QPalette::Foreground, Qt::white );
uiHeader->artistLabel->setFont( f );
uiHeader->artistLabel->setPalette( p );
uiHeader->artistLabel->setText( tr( "Feed" ).toUpper() );
uiHeader->anchor1Label->hide();
uiHeader->anchor2Label->hide();
uiHeader->anchor3Label->hide();
}
{
QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true );
@@ -127,7 +107,7 @@ DashboardWidget::DashboardWidget( QWidget* parent )
mpl->addChildInterface( ui->trackView->trackView()->playlistInterface() );
m_playlistInterface = playlistinterface_ptr( mpl );
connect( ui->trackView, SIGNAL( pixmapChanged( QPixmap ) ), uiHeader->headerWidget, SLOT( setBackground( QPixmap ) ) );
connect( ui->trackView, SIGNAL( pixmapChanged( QPixmap ) ), headerWidget, SLOT( setBackground( QPixmap ) ) );
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -43,7 +43,6 @@ class BasicHeader;
namespace Ui
{
class DashboardWidget;
class HeaderWidget;
}
namespace Tomahawk
@@ -75,7 +74,6 @@ protected:
private:
Ui::DashboardWidget *ui;
Ui::HeaderWidget *uiHeader;
RecentlyPlayedModel* m_tracksModel;
AlbumModel* m_recentAlbumsModel;