diff --git a/src/libtomahawk/playlist/FlexibleHeader.cpp b/src/libtomahawk/playlist/FlexibleHeader.cpp index db4f1ca82..95d4204a4 100644 --- a/src/libtomahawk/playlist/FlexibleHeader.cpp +++ b/src/libtomahawk/playlist/FlexibleHeader.cpp @@ -51,7 +51,7 @@ FlexibleHeader::FlexibleHeader( FlexibleView* parent ) f.close(); QHBoxLayout* outerModeLayout = new QHBoxLayout; - m_mainLayout->addLayout( outerModeLayout ); + ui->horizontalLayout->addLayout( outerModeLayout ); outerModeLayout->addSpacing( 156 ); outerModeLayout->addStretch(); diff --git a/src/libtomahawk/widgets/BasicHeader.cpp b/src/libtomahawk/widgets/BasicHeader.cpp index 00bfa4cac..12d8157b5 100644 --- a/src/libtomahawk/widgets/BasicHeader.cpp +++ b/src/libtomahawk/widgets/BasicHeader.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2012-2013, Teo Mrnjavac * * Tomahawk is free software: you can redistribute it and/or modify @@ -35,77 +35,42 @@ using namespace Tomahawk; BasicHeader::BasicHeader( QWidget* parent ) : BackgroundWidget( parent ) + , ui( new Ui::HeaderWidget ) { setAutoFillBackground( false ); + ui->setupUi( this ); - QVBoxLayout* l = new QVBoxLayout; - TomahawkUtils::unmarginLayout( l ); - setLayout( l ); + { + QFont f = ui->captionLabel->font(); + f.setBold( true ); + f.setPointSize( TomahawkUtils::defaultFontSize() + 6 ); - m_mainLayout = new QHBoxLayout; - TomahawkUtils::unmarginLayout( m_mainLayout ); - m_mainLayout->setContentsMargins( 32, 0, 32, 0 ); + QPalette p = ui->captionLabel->palette(); + p.setColor( QPalette::Foreground, Qt::white ); - m_imageLabel = new QLabel( this ); - m_imageLabel->setMargin( 0 ); - m_imageLabel->setFixedSize( TomahawkUtils::defaultIconSize().width() * 3, - TomahawkUtils::defaultIconSize().height() * 3 ); + ui->captionLabel->setFont( f ); + ui->captionLabel->setPalette( p ); - m_imageLabel->setVisible( false ); - m_mainLayout->addWidget( m_imageLabel ); + ui->anchor1Label->hide(); + ui->anchor2Label->hide(); + ui->anchor3Label->hide(); + } - m_captionLabel = new ElidedLabel( this ); - m_descriptionLabel = new ElidedLabel( this ); - m_descriptionLabel->setVisible( false ); - m_mainLayout->addWidget( m_captionLabel ); -// m_mainLayout->addWidget( m_descriptionLabel ); + { + QFont f = ui->anchor1Label->font(); + f.setPointSize( TomahawkUtils::defaultFontSize() + 1 ); + f.setBold( true ); -// m_mainLayout->addSpacing( TomahawkUtils::defaultIconSize().width() / 4 ); -// m_mainLayout->setStretchFactor( m_verticalLayout, 2 ); + QPalette p = ui->captionLabel->palette(); + p.setColor( QPalette::Foreground, Qt::white ); - QPalette pal = palette(); - pal.setColor( QPalette::Foreground, Qt::white ); -// pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND ); - - m_captionLabel->setPalette( pal ); - m_descriptionLabel->setPalette( pal ); - - QFont font = m_captionLabel->font(); - - int captionFontSize = 16; - font.setPointSize( captionFontSize ); - font.setBold( true ); - - m_captionLabel->setFont( font ); - m_captionLabel->setElideMode( Qt::ElideRight ); - m_captionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); - m_captionLabel->setMargin( 2 ); - m_captionLabel->setMinimumHeight( QFontMetrics( font ).height() + 2 * m_captionLabel->margin() ); - - int descriptionFontSize = TomahawkUtils::defaultFontSize() + 2; - font.setPointSize( descriptionFontSize ); - font.setBold( false ); - m_descriptionLabel->setFont( font ); - m_descriptionLabel->setElideMode( Qt::ElideRight ); - m_descriptionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); - m_descriptionLabel->setMargin( 2 ); - m_descriptionLabel->setMinimumHeight( QFontMetrics( font ).height() + 2 * m_descriptionLabel->margin() ); - m_descriptionLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - - l->addSpacerItem( new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Fixed ) ); - l->addItem( m_mainLayout ); - l->addStretch(); - - // on 72dpi, 1px = 1pt - // margins that should be around 8 4 8 4 on ~100dpi - int leftRightMargin = TomahawkUtils::defaultFontHeight() / 3; - int topBottomMargin = TomahawkUtils::defaultFontHeight() / 6; - -/* m_mainLayout->setContentsMargins( leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin );*/ - setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); - // top-margin + header + layout spacing + description + bottom-margin -/* setFixedHeight( qMax( topBottomMargin + m_captionLabel->height() + TomahawkUtils::defaultIconSize().height() / 4 + m_descriptionLabel->height() + topBottomMargin, - topBottomMargin + m_imageLabel->height() + topBottomMargin ) );*/ + ui->anchor1Label->setFont( f ); + ui->anchor1Label->setPalette( p ); + ui->anchor2Label->setFont( f ); + ui->anchor2Label->setPalette( p ); + ui->anchor3Label->setFont( f ); + ui->anchor3Label->setPalette( p ); + } setFixedHeight( 160 ); } @@ -119,19 +84,19 @@ BasicHeader::~BasicHeader() void BasicHeader::setCaption( const QString& s ) { - m_captionLabel->setText( s.toUpper() ); + ui->captionLabel->setText( s.toUpper() ); } void BasicHeader::setDescription( const QString& s ) { - m_descriptionLabel->setText( s ); +// m_descriptionLabel->setText( s ); } void BasicHeader::setPixmap( const QPixmap& p ) { - m_imageLabel->setPixmap( p.scaledToHeight( m_imageLabel->height(), Qt::SmoothTransformation ) ); +// m_imageLabel->setPixmap( p.scaledToHeight( m_imageLabel->height(), Qt::SmoothTransformation ) ); } diff --git a/src/libtomahawk/widgets/BasicHeader.h b/src/libtomahawk/widgets/BasicHeader.h index 42ebb723f..f07c2480b 100644 --- a/src/libtomahawk/widgets/BasicHeader.h +++ b/src/libtomahawk/widgets/BasicHeader.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2012, Teo Mrnjavac * * Tomahawk is free software: you can redistribute it and/or modify @@ -20,6 +20,8 @@ #ifndef BASICHEADER_H #define BASICHEADER_H +#include "ui_HeaderWidget.h" + #include "widgets/BackgroundWidget.h" #include "DllMacro.h" @@ -35,18 +37,12 @@ public: explicit BasicHeader( QWidget* parent = 0 ); virtual ~BasicHeader(); + Ui::HeaderWidget* ui; + public slots: virtual void setCaption( const QString& s ); virtual void setDescription( const QString& s ); virtual void setPixmap( const QPixmap& p ); - -protected: - QLabel* m_imageLabel; - ElidedLabel* m_captionLabel; - ElidedLabel* m_descriptionLabel; - - QBoxLayout* m_mainLayout; -// QBoxLayout* m_verticalLayout; }; #endif // BASICHEADER_H diff --git a/src/libtomahawk/widgets/ScriptCollectionHeader.cpp b/src/libtomahawk/widgets/ScriptCollectionHeader.cpp index 7f225c28b..f986f502e 100644 --- a/src/libtomahawk/widgets/ScriptCollectionHeader.cpp +++ b/src/libtomahawk/widgets/ScriptCollectionHeader.cpp @@ -31,21 +31,19 @@ ScriptCollectionHeader::ScriptCollectionHeader( QWidget* parent ) m_refreshButton->setFlat( true ); m_refreshButton->setStyleSheet( "QPushButton { border: 0px; background: transparent; }" ); QHBoxLayout* descLayout = new QHBoxLayout; - m_mainLayout->insertLayout( m_mainLayout->indexOf( m_descriptionLabel ), - descLayout ); - descLayout->addWidget( m_descriptionLabel ); + ui->horizontalLayout->addLayout( descLayout ); +// descLayout->addWidget( m_descriptionLabel ); TomahawkUtils::unmarginLayout( descLayout ); - descLayout->addSpacing( m_descriptionLabel->fontMetrics().height() / 2 ); +// descLayout->addSpacing( m_descriptionLabel->fontMetrics().height() / 2 ); descLayout->addWidget( m_refreshButton ); descLayout->addStretch(); - m_refreshButton->setIcon( ImageRegistry::instance()->pixmap( RESPATH "images/refresh.svg", QSize( m_descriptionLabel->fontMetrics().height(), - m_descriptionLabel->fontMetrics().height() ), TomahawkUtils::DropShadow ) ); - m_refreshButton->setFixedSize( m_descriptionLabel->fontMetrics().height() + m_descriptionLabel->margin() * 2, - m_descriptionLabel->fontMetrics().height() + m_descriptionLabel->margin() * 2 ); + m_refreshButton->setIcon( ImageRegistry::instance()->pixmap( RESPATH "images/refresh.svg", QSize( ui->captionLabel->fontMetrics().height(), + ui->captionLabel->fontMetrics().height() ), TomahawkUtils::DropShadow ) ); + m_refreshButton->setFixedSize( ui->captionLabel->fontMetrics().height() + ui->captionLabel->margin() * 2, + ui->captionLabel->fontMetrics().height() + ui->captionLabel->margin() * 2 ); - connect( m_refreshButton, SIGNAL( clicked() ), - this, SIGNAL( refreshClicked() ) ); + connect( m_refreshButton, SIGNAL( clicked() ), SIGNAL( refreshClicked() ) ); m_refreshButton->hide(); m_refreshButton->setToolTip( tr( "Reload Collection" ) ); }