mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
Merge branch 'master' into decltest
This commit is contained in:
@@ -38,11 +38,12 @@ ContextProxyPage::paint( QPainter* painter, const QStyleOptionGraphicsItem* opti
|
|||||||
|
|
||||||
QFont f( font() );
|
QFont f( font() );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
f.setPixelSize( 14 );
|
f.setPointSize( 8 );
|
||||||
painter->setFont( f );
|
painter->setFont( f );
|
||||||
painter->setPen( Qt::white );
|
painter->setPen( Qt::white );
|
||||||
|
|
||||||
QRect r( 1, 1, option->rect.width(), 19 );
|
QFontMetrics fm( f );
|
||||||
|
QRect r( 1, 1, option->rect.width(), fm.height() * 1.1 );
|
||||||
QTextOption to( Qt::AlignCenter );
|
QTextOption to( Qt::AlignCenter );
|
||||||
painter->drawText( r, m_page->title(), to );
|
painter->drawText( r, m_page->title(), to );
|
||||||
|
|
||||||
@@ -65,8 +66,12 @@ ContextProxyPage::setPage( Tomahawk::ContextPage* page )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QFont f( font() );
|
||||||
|
f.setBold( true );
|
||||||
|
f.setPointSize( 8 );
|
||||||
|
QFontMetrics fm( f );
|
||||||
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
|
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
|
||||||
layout->setContentsMargins( 4, 20, 4, 4 );
|
layout->setContentsMargins( 4, fm.height() * 1.1, 4, 4 );
|
||||||
layout->addItem( page->widget() );
|
layout->addItem( page->widget() );
|
||||||
setLayout( layout );
|
setLayout( layout );
|
||||||
|
|
||||||
|
@@ -43,7 +43,6 @@ using namespace Tomahawk;
|
|||||||
ContextWidget::ContextWidget( QWidget* parent )
|
ContextWidget::ContextWidget( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::ContextWidget )
|
, ui( new Ui::ContextWidget )
|
||||||
, m_minHeight( 22 )
|
|
||||||
, m_currentView( 0 )
|
, m_currentView( 0 )
|
||||||
, m_visible( false )
|
, m_visible( false )
|
||||||
{
|
{
|
||||||
@@ -87,9 +86,14 @@ ContextWidget::ContextWidget( QWidget* parent )
|
|||||||
ui->toggleButton->setCursor( Qt::PointingHandCursor );
|
ui->toggleButton->setCursor( Qt::PointingHandCursor );
|
||||||
|
|
||||||
QFont boldFont = ui->toggleButton->font();
|
QFont boldFont = ui->toggleButton->font();
|
||||||
boldFont.setPixelSize( 12 );
|
boldFont.setPointSize( 10 );
|
||||||
boldFont.setBold( true );
|
boldFont.setBold( true );
|
||||||
ui->toggleButton->setFont( boldFont );
|
ui->toggleButton->setFont( boldFont );
|
||||||
|
QFontMetrics fm( boldFont );
|
||||||
|
|
||||||
|
m_minHeight = fm.height() * 1.2;
|
||||||
|
|
||||||
|
ui->toggleButton->setMinimumHeight( fm.height() * 1.2 );
|
||||||
|
|
||||||
setAutoFillBackground( true );
|
setAutoFillBackground( true );
|
||||||
setFixedHeight( m_minHeight );
|
setFixedHeight( m_minHeight );
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>774</width>
|
<width>774</width>
|
||||||
<height>72</height>
|
<height>173</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@@ -44,22 +44,31 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
, ui( new Ui::InfoBar )
|
, ui( new Ui::InfoBar )
|
||||||
, m_queryLabel( 0 )
|
, m_queryLabel( 0 )
|
||||||
{
|
{
|
||||||
|
int requiredHeight = 0;
|
||||||
|
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
TomahawkUtils::unmarginLayout( layout() );
|
TomahawkUtils::unmarginLayout( layout() );
|
||||||
layout()->setContentsMargins( 8, 4, 8, 4 );
|
layout()->setContentsMargins( 8, 4, 8, 4 );
|
||||||
|
requiredHeight += 8; // Top + bottom margins
|
||||||
|
|
||||||
QFont boldFont = ui->captionLabel->font();
|
QFont boldFont = ui->captionLabel->font();
|
||||||
boldFont.setPixelSize( 18 );
|
boldFont.setPointSize( 16 );
|
||||||
boldFont.setBold( true );
|
boldFont.setBold( true );
|
||||||
ui->captionLabel->setFont( boldFont );
|
ui->captionLabel->setFont( boldFont );
|
||||||
ui->captionLabel->setElideMode( Qt::ElideRight );
|
ui->captionLabel->setElideMode( Qt::ElideRight );
|
||||||
|
|
||||||
boldFont.setPixelSize( 12 );
|
QFontMetrics boldFontMetrics( boldFont );
|
||||||
|
requiredHeight += boldFontMetrics.height();
|
||||||
|
|
||||||
|
boldFont.setPointSize( 10 );
|
||||||
boldFont.setBold( false );
|
boldFont.setBold( false );
|
||||||
ui->descriptionLabel->setFont( boldFont );
|
ui->descriptionLabel->setFont( boldFont );
|
||||||
|
|
||||||
|
boldFontMetrics = QFontMetrics( boldFont );
|
||||||
|
requiredHeight += boldFontMetrics.height();
|
||||||
|
|
||||||
QFont regFont = ui->longDescriptionLabel->font();
|
QFont regFont = ui->longDescriptionLabel->font();
|
||||||
regFont.setPixelSize( 11 );
|
regFont.setPointSize( 9 );
|
||||||
ui->longDescriptionLabel->setFont( regFont );
|
ui->longDescriptionLabel->setFont( regFont );
|
||||||
|
|
||||||
m_whitePal = ui->captionLabel->palette();
|
m_whitePal = ui->captionLabel->palette();
|
||||||
@@ -70,7 +79,11 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
ui->longDescriptionLabel->setPalette( m_whitePal );
|
ui->longDescriptionLabel->setPalette( m_whitePal );
|
||||||
|
|
||||||
ui->captionLabel->setMargin( 6 );
|
ui->captionLabel->setMargin( 6 );
|
||||||
|
requiredHeight += 2*6;
|
||||||
|
|
||||||
ui->descriptionLabel->setMargin( 6 );
|
ui->descriptionLabel->setMargin( 6 );
|
||||||
|
requiredHeight += 2*6;
|
||||||
|
|
||||||
ui->longDescriptionLabel->setMargin( 4 );
|
ui->longDescriptionLabel->setMargin( 4 );
|
||||||
|
|
||||||
ui->captionLabel->setText( QString() );
|
ui->captionLabel->setText( QString() );
|
||||||
@@ -95,8 +108,8 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
|
|
||||||
setAutoFillBackground( true );
|
setAutoFillBackground( true );
|
||||||
|
|
||||||
setMinimumHeight( geometry().height() );
|
setMinimumHeight( requiredHeight );
|
||||||
setMaximumHeight( geometry().height() );
|
setMaximumHeight( requiredHeight );
|
||||||
|
|
||||||
createTile();
|
createTile();
|
||||||
|
|
||||||
|
@@ -7,11 +7,11 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>774</width>
|
<width>774</width>
|
||||||
<height>80</height>
|
<height>72</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -28,9 +28,6 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="imageLabel">
|
<widget class="QLabel" name="imageLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -59,16 +56,13 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ElidedLabel" name="captionLabel">
|
<widget class="ElidedLabel" name="captionLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -81,7 +75,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="ElidedLabel" name="descriptionLabel">
|
<widget class="ElidedLabel" name="descriptionLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -104,16 +98,13 @@
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>16</width>
|
||||||
<height>20</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetMaximumSize</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="ElidedLabel" name="longDescriptionLabel">
|
<widget class="ElidedLabel" name="longDescriptionLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@@ -51,11 +51,11 @@ FlexibleHeader::FlexibleHeader( FlexibleView* parent )
|
|||||||
ui->descLabel->setPalette( pal );
|
ui->descLabel->setPalette( pal );
|
||||||
|
|
||||||
QFont font = ui->captionLabel->font();
|
QFont font = ui->captionLabel->font();
|
||||||
font.setPixelSize( 16 );
|
font.setPointSize( 13 );
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
ui->captionLabel->setFont( font );
|
ui->captionLabel->setFont( font );
|
||||||
|
|
||||||
font.setPixelSize( 11 );
|
font.setPointSize( 8 );
|
||||||
ui->descLabel->setFont( font );
|
ui->descLabel->setFont( font );
|
||||||
|
|
||||||
ui->radioNormal->setFocusPolicy( Qt::NoFocus );
|
ui->radioNormal->setFocusPolicy( Qt::NoFocus );
|
||||||
|
@@ -157,43 +157,44 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
}
|
}
|
||||||
|
|
||||||
QFont figureFont = opt.font;
|
QFont figureFont = opt.font;
|
||||||
figureFont.setPixelSize( 18 );
|
figureFont.setPointSize( 17 );
|
||||||
figureFont.setWeight( 99 );
|
figureFont.setWeight( 99 );
|
||||||
|
|
||||||
QFont boldFont = opt.font;
|
QFont boldFont = opt.font;
|
||||||
boldFont.setPixelSize( 15 );
|
boldFont.setPointSize( 12 );
|
||||||
boldFont.setWeight( 99 );
|
boldFont.setWeight( 99 );
|
||||||
|
|
||||||
QFont smallBoldFont = opt.font;
|
QFont smallBoldFont = opt.font;
|
||||||
smallBoldFont.setPixelSize( 12 );
|
smallBoldFont.setPointSize( 9 );
|
||||||
smallBoldFont.setWeight( 60 );
|
smallBoldFont.setWeight( 60 );
|
||||||
|
|
||||||
QFont durationFont = opt.font;
|
QFont durationFont = opt.font;
|
||||||
durationFont.setPixelSize( 12 );
|
durationFont.setPointSize( 9 );
|
||||||
durationFont.setWeight( 80 );
|
durationFont.setWeight( 80 );
|
||||||
|
QFontMetrics durationFontMetrics( durationFont );
|
||||||
|
|
||||||
if ( index.row() == 0 )
|
if ( index.row() == 0 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 36 );
|
figureFont.setPointSize( 34 );
|
||||||
boldFont.setPixelSize( 26 );
|
boldFont.setPointSize( 24 );
|
||||||
smallBoldFont.setPixelSize( 22 );
|
smallBoldFont.setPointSize( 20 );
|
||||||
}
|
}
|
||||||
else if ( index.row() == 1 )
|
else if ( index.row() == 1 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 30 );
|
figureFont.setPointSize( 28 );
|
||||||
boldFont.setPixelSize( 22 );
|
boldFont.setPointSize( 20 );
|
||||||
smallBoldFont.setPixelSize( 18 );
|
smallBoldFont.setPointSize( 15 );
|
||||||
}
|
}
|
||||||
else if ( index.row() == 2 )
|
else if ( index.row() == 2 )
|
||||||
{
|
{
|
||||||
figureFont.setPixelSize( 24 );
|
figureFont.setPointSize( 20 );
|
||||||
boldFont.setPixelSize( 18 );
|
boldFont.setPointSize( 15 );
|
||||||
smallBoldFont.setPixelSize( 14 );
|
smallBoldFont.setPointSize( 11 );
|
||||||
}
|
}
|
||||||
else if ( index.row() >= 10 )
|
else if ( index.row() >= 10 )
|
||||||
{
|
{
|
||||||
boldFont.setPixelSize( 12 );
|
boldFont.setPointSize( 9 );
|
||||||
smallBoldFont.setPixelSize( 11 );
|
smallBoldFont.setPointSize( 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect figureRect = r.adjusted( 0, 0, -option.rect.width() + 60 - 6 + r.left(), 0 );
|
QRect figureRect = r.adjusted( 0, 0, -option.rect.width() + 60 - 6 + r.left(), 0 );
|
||||||
@@ -215,8 +216,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
painter->drawPixmap( pixmapRect, pixmap );
|
painter->drawPixmap( pixmapRect, pixmap );
|
||||||
|
|
||||||
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
|
r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
|
||||||
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
|
QRect leftRect = r.adjusted( 0, 0, -durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ) - 8, 0 );
|
||||||
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
|
|
||||||
|
|
||||||
painter->setFont( boldFont );
|
painter->setFont( boldFont );
|
||||||
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
||||||
@@ -229,6 +229,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
if ( duration > 0 )
|
if ( duration > 0 )
|
||||||
{
|
{
|
||||||
painter->setFont( durationFont );
|
painter->setFont( durationFont );
|
||||||
|
QRect rightRect = r.adjusted( r.width() - durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ), 0, 0, 0 );
|
||||||
text = painter->fontMetrics().elidedText( TomahawkUtils::timeToString( duration ), Qt::ElideRight, rightRect.width() );
|
text = painter->fontMetrics().elidedText( TomahawkUtils::timeToString( duration ), Qt::ElideRight, rightRect.width() );
|
||||||
painter->drawText( rightRect, text, m_centerRightOption );
|
painter->drawText( rightRect, text, m_centerRightOption );
|
||||||
}
|
}
|
||||||
|
@@ -72,6 +72,9 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
|
|||||||
{
|
{
|
||||||
int rowHeight = option.fontMetrics.height() + 8;
|
int rowHeight = option.fontMetrics.height() + 8;
|
||||||
size.setHeight( rowHeight * 2 );
|
size.setHeight( rowHeight * 2 );
|
||||||
|
} else if ( style == PlayableProxyModel::Detailed ) {
|
||||||
|
int rowHeight = option.fontMetrics.height() * 1.4;
|
||||||
|
size.setHeight( rowHeight );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +233,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
|||||||
if ( m_view->hoveredIndex().row() == index.row() && m_view->hoveredIndex().column() == index.column() && !index.data().toString().isEmpty() &&
|
if ( m_view->hoveredIndex().row() == index.row() && m_view->hoveredIndex().column() == index.column() && !index.data().toString().isEmpty() &&
|
||||||
( index.column() == PlayableModel::Artist || index.column() == PlayableModel::Album || index.column() == PlayableModel::Track ) )
|
( index.column() == PlayableModel::Artist || index.column() == PlayableModel::Album || index.column() == PlayableModel::Track ) )
|
||||||
{
|
{
|
||||||
opt.rect.setWidth( opt.rect.width() - 16 );
|
opt.rect.setWidth( opt.rect.width() - opt.rect.height() - 2 );
|
||||||
QRect arrowRect( opt.rect.x() + opt.rect.width(), opt.rect.y() + 1, opt.rect.height() - 2, opt.rect.height() - 2 );
|
QRect arrowRect( opt.rect.x() + opt.rect.width(), opt.rect.y() + 1, opt.rect.height() - 2, opt.rect.height() - 2 );
|
||||||
|
|
||||||
QPixmap infoIcon = TomahawkUtils::defaultPixmap( TomahawkUtils::InfoIcon, TomahawkUtils::Original, arrowRect.size() );
|
QPixmap infoIcon = TomahawkUtils::defaultPixmap( TomahawkUtils::InfoIcon, TomahawkUtils::Original, arrowRect.size() );
|
||||||
|
@@ -205,20 +205,22 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
painter->drawPixmap( avatarRect, avatar );
|
painter->drawPixmap( avatarRect, avatar );
|
||||||
|
|
||||||
QFont boldFont = opt.font;
|
QFont boldFont = opt.font;
|
||||||
boldFont.setPixelSize( 15 );
|
boldFont.setPointSize( 11 );
|
||||||
boldFont.setWeight( 99 );
|
boldFont.setWeight( 99 );
|
||||||
|
QFontMetrics boldFontMetrics( boldFont );
|
||||||
|
|
||||||
QFont smallBoldFont = opt.font;
|
QFont smallBoldFont = opt.font;
|
||||||
smallBoldFont.setPixelSize( 12 );
|
smallBoldFont.setPointSize( 8 );
|
||||||
smallBoldFont.setBold( true );
|
smallBoldFont.setBold( true );
|
||||||
smallBoldFont.setWeight( 60 );
|
smallBoldFont.setWeight( 60 );
|
||||||
|
QFontMetrics smallBoldFontMetrics( smallBoldFont );
|
||||||
|
|
||||||
QFont smallFont = opt.font;
|
QFont smallFont = opt.font;
|
||||||
smallFont.setPixelSize( 10 );
|
smallFont.setPointSize( 7 );
|
||||||
|
|
||||||
r.adjust( pixmapRect.width() + 12, 1, -28 - avatar.width(), 0 );
|
r.adjust( pixmapRect.width() + 12, 1, -28 - avatar.width(), 0 );
|
||||||
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
|
QRect leftRect = r.adjusted( 0, 0, -48, 0 );
|
||||||
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
|
QRect rightRect = r.adjusted( r.width() - smallBoldFontMetrics.width( TomahawkUtils::timeToString( duration ) ), 0, 0, 0 );
|
||||||
|
|
||||||
painter->setFont( boldFont );
|
painter->setFont( boldFont );
|
||||||
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
|
||||||
@@ -226,7 +228,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
|
|
||||||
painter->setFont( smallBoldFont );
|
painter->setFont( smallBoldFont );
|
||||||
text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
|
text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
|
||||||
painter->drawText( leftRect.adjusted( 0, 19, 0, 0 ), text, m_topOption );
|
painter->drawText( leftRect.adjusted( 0, boldFontMetrics.height(), 0, 0 ), text, m_topOption );
|
||||||
|
|
||||||
painter->setFont( smallFont );
|
painter->setFont( smallFont );
|
||||||
painter->setPen( Qt::gray );
|
painter->setPen( Qt::gray );
|
||||||
|
@@ -41,7 +41,10 @@ QueueView::QueueView( AnimatedSplitter* parent )
|
|||||||
TomahawkUtils::unmarginLayout( layout() );
|
TomahawkUtils::unmarginLayout( layout() );
|
||||||
setContentsMargins( 0, 0, 0, 0 );
|
setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
setHiddenSize( QSize( 0, 22 ) );
|
QFont f;
|
||||||
|
f.setPointSize( 10 );
|
||||||
|
QFontMetrics fm( f );
|
||||||
|
setHiddenSize( QSize( 0, fm.height() * 1.2 ) );
|
||||||
|
|
||||||
ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) );
|
ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) );
|
||||||
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "utils/StyleHelper.h"
|
#include "utils/StyleHelper.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
|
|
||||||
static const int s_defaultFontSize = 12;
|
static const int s_defaultFontSize = 9;
|
||||||
|
|
||||||
|
|
||||||
HeaderLabel::HeaderLabel( QWidget* parent )
|
HeaderLabel::HeaderLabel( QWidget* parent )
|
||||||
@@ -37,10 +37,11 @@ HeaderLabel::HeaderLabel( QWidget* parent )
|
|||||||
{
|
{
|
||||||
QFont f( font() );
|
QFont f( font() );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
f.setPixelSize( s_defaultFontSize );
|
f.setPointSize( s_defaultFontSize );
|
||||||
|
QFontMetrics fm( f );
|
||||||
|
|
||||||
setFont( f );
|
setFont( f );
|
||||||
setFixedHeight( TomahawkUtils::headerHeight() );
|
setFixedHeight( fm.height() * 1.4 );
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ OverlayButton::setText( const QString& text )
|
|||||||
m_text = text;
|
m_text = text;
|
||||||
|
|
||||||
QFont f( font() );
|
QFont f( font() );
|
||||||
f.setPixelSize( FONT_SIZE );
|
f.setPointSize( FONT_SIZE );
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
|
|
||||||
QFontMetrics fm( f );
|
QFontMetrics fm( f );
|
||||||
|
@@ -122,6 +122,12 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
|||||||
ui->tracksView->setPlaylistModel( m_tracksModel );
|
ui->tracksView->setPlaylistModel( m_tracksModel );
|
||||||
m_tracksModel->setSource( source_ptr() );
|
m_tracksModel->setSource( source_ptr() );
|
||||||
|
|
||||||
|
QFont f;
|
||||||
|
f.setPointSize( 9 );
|
||||||
|
f.setBold( true );
|
||||||
|
QFontMetrics fm( f );
|
||||||
|
ui->tracksView->setMinimumWidth( fm.width( tr("Recently played tracks") ) * 2 );
|
||||||
|
|
||||||
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
|
m_recentAlbumsModel = new AlbumModel( ui->additionsView );
|
||||||
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
|
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
|
||||||
ui->additionsView->proxyModel()->sort( -1 );
|
ui->additionsView->proxyModel()->sort( -1 );
|
||||||
@@ -246,7 +252,18 @@ PlaylistDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInde
|
|||||||
{
|
{
|
||||||
Q_UNUSED( option );
|
Q_UNUSED( option );
|
||||||
Q_UNUSED( index );
|
Q_UNUSED( index );
|
||||||
return QSize( 0, 64 );
|
|
||||||
|
// Calculates the size for the bold line + 3 normal lines + margins
|
||||||
|
int height = 2 * 6; // margins
|
||||||
|
QFont font = option.font;
|
||||||
|
QFontMetrics fm1( font );
|
||||||
|
font.setPointSize( 8 );
|
||||||
|
height += fm1.height() * 3;
|
||||||
|
font.setPointSize( 9 );
|
||||||
|
QFontMetrics fm2( font );
|
||||||
|
height += fm2.height();
|
||||||
|
|
||||||
|
return QSize( 0, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -269,14 +286,15 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
QTextOption to;
|
QTextOption to;
|
||||||
to.setAlignment( Qt::AlignCenter );
|
to.setAlignment( Qt::AlignCenter );
|
||||||
QFont font = opt.font;
|
QFont font = opt.font;
|
||||||
font.setPixelSize( 10 );
|
font.setPointSize( 8 );
|
||||||
|
|
||||||
QFont boldFont = font;
|
QFont boldFont = font;
|
||||||
boldFont.setBold( true );
|
boldFont.setBold( true );
|
||||||
boldFont.setPixelSize( 11 );
|
boldFont.setPointSize( 9 );
|
||||||
|
QFontMetrics boldFontMetrics( boldFont );
|
||||||
|
|
||||||
QFont figFont = boldFont;
|
QFont figFont = boldFont;
|
||||||
figFont.setPixelSize( 10 );
|
figFont.setPointSize( 8 );
|
||||||
|
|
||||||
QPixmap icon;
|
QPixmap icon;
|
||||||
RecentlyPlayedPlaylistsModel::PlaylistTypes type = (RecentlyPlayedPlaylistsModel::PlaylistTypes)index.data( RecentlyPlayedPlaylistsModel::PlaylistTypeRole ).toInt();
|
RecentlyPlayedPlaylistsModel::PlaylistTypes type = (RecentlyPlayedPlaylistsModel::PlaylistTypes)index.data( RecentlyPlayedPlaylistsModel::PlaylistTypeRole ).toInt();
|
||||||
@@ -287,7 +305,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
else if( type == RecentlyPlayedPlaylistsModel::Station )
|
else if( type == RecentlyPlayedPlaylistsModel::Station )
|
||||||
icon = m_stationIcon;
|
icon = m_stationIcon;
|
||||||
|
|
||||||
QRect pixmapRect = option.rect.adjusted( 10, 13, -option.rect.width() + 48, -13 );
|
QRect pixmapRect = option.rect.adjusted( 10, 13, -option.rect.width() + option.rect.height() - 26, -13 );
|
||||||
icon = icon.scaled( pixmapRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation );
|
icon = icon.scaled( pixmapRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation );
|
||||||
|
|
||||||
painter->drawPixmap( pixmapRect, icon );
|
painter->drawPixmap( pixmapRect, icon );
|
||||||
@@ -317,7 +335,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
QPixmap avatar = index.data( RecentlyPlayedPlaylistsModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->avatar( Source::FancyStyle );
|
QPixmap avatar = index.data( RecentlyPlayedPlaylistsModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->avatar( Source::FancyStyle );
|
||||||
if ( avatar.isNull() )
|
if ( avatar.isNull() )
|
||||||
avatar = m_defaultAvatar;
|
avatar = m_defaultAvatar;
|
||||||
QRect r( option.rect.width() - avatar.width() - 10, option.rect.top() + option.rect.height()/2 - avatar.height()/2, avatar.width(), avatar.height() );
|
QRect r( option.rect.width() - option.fontMetrics.height() * 2.5 - 10, option.rect.top() + option.rect.height()/2.25 - option.fontMetrics.height(), option.fontMetrics.height() * 2.5, option.fontMetrics.height() * 2.2 );
|
||||||
painter->drawPixmap( r, avatar );
|
painter->drawPixmap( r, avatar );
|
||||||
|
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
@@ -346,7 +364,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
painter->setPen( QColor( Qt::gray ).darker() );
|
painter->setPen( QColor( Qt::gray ).darker() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect rectText = option.rect.adjusted( 66, 20, -leftEdge - 10, -8 );
|
QRect rectText = option.rect.adjusted( option.fontMetrics.height() * 4.5, boldFontMetrics.height() + 6, -leftEdge - 10, -8 );
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
rectText.adjust( 0, 1, 0, 0 );
|
rectText.adjust( 0, 1, 0, 0 );
|
||||||
#elif defined Q_WS_WIN
|
#elif defined Q_WS_WIN
|
||||||
@@ -358,7 +376,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
|
|
||||||
painter->setFont( boldFont );
|
painter->setFont( boldFont );
|
||||||
painter->drawText( option.rect.adjusted( 56, 6, -100, -option.rect.height() + 20 ), index.data().toString() );
|
painter->drawText( option.rect.adjusted( option.fontMetrics.height() * 4, 6, -100, -option.rect.height() + boldFontMetrics.height() + 6 ), index.data().toString() );
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
@@ -72,14 +72,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="PlaylistView" name="tracksView">
|
<widget class="PlaylistView" name="tracksView"/>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>320</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@@ -107,7 +107,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
|||||||
|
|
||||||
QFont f = font();
|
QFont f = font();
|
||||||
f.setBold( true );
|
f.setBold( true );
|
||||||
f.setPixelSize( 18 );
|
f.setPointSize( 14 );
|
||||||
ui->artistLabel->setFont( f );
|
ui->artistLabel->setFont( f );
|
||||||
|
|
||||||
QPalette p = ui->biography->palette();
|
QPalette p = ui->biography->palette();
|
||||||
|
@@ -89,23 +89,26 @@ SourceDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex&
|
|||||||
|
|
||||||
if ( type == SourcesModel::Collection )
|
if ( type == SourcesModel::Collection )
|
||||||
{
|
{
|
||||||
return QSize( option.rect.width(), 40 );
|
// return QSize( option.rect.width(), 40 );
|
||||||
|
return QSize( option.rect.width(), option.fontMetrics.height() * 2.6 );
|
||||||
}
|
}
|
||||||
else if ( type == SourcesModel::Divider )
|
else if ( type == SourcesModel::Divider )
|
||||||
{
|
{
|
||||||
|
// TODO: what is the divider?
|
||||||
return QSize( option.rect.width(), 6 );
|
return QSize( option.rect.width(), 6 );
|
||||||
}
|
}
|
||||||
else if ( type == SourcesModel::Group && index.row() > 0 )
|
else if ( type == SourcesModel::Group )
|
||||||
{
|
{
|
||||||
return QSize( option.rect.width(), 24 );
|
int groupSpacer = index.row() > 0 ? option.fontMetrics.height() * 0.6 : option.fontMetrics.height() * 0.2;
|
||||||
|
return QSize( option.rect.width(), option.fontMetrics.height() + groupSpacer );
|
||||||
}
|
}
|
||||||
else if ( m_expandedMap.contains( index ) )
|
else if ( m_expandedMap.contains( index ) )
|
||||||
{
|
{
|
||||||
if ( !m_expandedMap.value( index )->initialized() )
|
if ( !m_expandedMap.value( index )->initialized() )
|
||||||
{
|
{
|
||||||
int dropTypes = dropTypeCount( item );
|
int dropTypes = dropTypeCount( item );
|
||||||
QSize originalSize = QStyledItemDelegate::sizeHint( option, index );
|
QSize originalSize = QSize( option.rect.width(), option.fontMetrics.height() * 1.2 );
|
||||||
QSize targetSize = originalSize + QSize( 0, dropTypes == 0 ? 0 : 56 );
|
QSize targetSize = originalSize + QSize( 0, dropTypes == 0 ? 0 : 38 + option.fontMetrics.height() * 1.2 );
|
||||||
m_expandedMap.value( index )->initialize( originalSize, targetSize, 300 );
|
m_expandedMap.value( index )->initialize( originalSize, targetSize, 300 );
|
||||||
m_expandedMap.value( index )->expand();
|
m_expandedMap.value( index )->expand();
|
||||||
}
|
}
|
||||||
@@ -113,7 +116,7 @@ SourceDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex&
|
|||||||
return m_expandedMap.value( index )->size();
|
return m_expandedMap.value( index )->size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return QStyledItemDelegate::sizeHint( option, index );
|
return QSize( option.rect.width(), option.fontMetrics.height() * 1.2 ); //QStyledItemDelegate::sizeHint( option, index ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +165,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
QFont figFont = bold;
|
QFont figFont = bold;
|
||||||
figFont.setFamily( "Arial Bold" );
|
figFont.setFamily( "Arial Bold" );
|
||||||
figFont.setWeight( QFont::Black );
|
figFont.setWeight( QFont::Black );
|
||||||
figFont.setPixelSize( 10 );
|
figFont.setPointSize( 7 );
|
||||||
|
|
||||||
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
|
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
|
||||||
SourceItem* colItem = qobject_cast< SourceItem* >( item );
|
SourceItem* colItem = qobject_cast< SourceItem* >( item );
|
||||||
@@ -260,7 +263,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
|
|||||||
{
|
{
|
||||||
painter->setRenderHint( QPainter::Antialiasing );
|
painter->setRenderHint( QPainter::Antialiasing );
|
||||||
|
|
||||||
QRect figRect = option.rect.adjusted( option.rect.width() - figWidth - 13, 0, -14, -option.rect.height() + 16 );
|
QRect figRect = option.rect.adjusted( option.rect.width() - figWidth - 13, 0, -14, -option.rect.height() + option.fontMetrics.height() * 1.1 );
|
||||||
int hd = ( option.rect.height() - figRect.height() ) / 2;
|
int hd = ( option.rect.height() - figRect.height() ) / 2;
|
||||||
figRect.adjust( 0, hd, 0, hd );
|
figRect.adjust( 0, hd, 0, hd );
|
||||||
|
|
||||||
@@ -297,7 +300,7 @@ SourceDelegate::paintCategory( QPainter* painter, const QStyleOptionViewItem& op
|
|||||||
text = tr( "Hide" );
|
text = tr( "Hide" );
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
font.setPixelSize( 11 );
|
font.setPointSize( 8 );
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
QTextOption to( Qt::AlignVCenter | Qt::AlignRight );
|
QTextOption to( Qt::AlignVCenter | Qt::AlignRight );
|
||||||
@@ -315,7 +318,7 @@ void
|
|||||||
SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
font.setPixelSize( 12 );
|
font.setPointSize( 9 );
|
||||||
font.setBold( true );
|
font.setBold( true );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
|
|
||||||
@@ -337,7 +340,8 @@ SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& optio
|
|||||||
if ( option.state & QStyle::State_Open )
|
if ( option.state & QStyle::State_Open )
|
||||||
text = tr( "Hide" );
|
text = tr( "Hide" );
|
||||||
|
|
||||||
font.setPixelSize( font.pixelSize() - 1 );
|
QFont tmpFont = font;
|
||||||
|
font.setPointSize( font.pointSize() - 1 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
QTextOption to( Qt::AlignBottom | Qt::AlignRight );
|
QTextOption to( Qt::AlignBottom | Qt::AlignRight );
|
||||||
|
|
||||||
@@ -346,6 +350,7 @@ SourceDelegate::paintGroup( QPainter* painter, const QStyleOptionViewItem& optio
|
|||||||
painter->drawText( option.rect.translated( -4, 1 ), text, to );
|
painter->drawText( option.rect.translated( -4, 1 ), text, to );
|
||||||
painter->setPen( QColor( 99, 113, 128 ) );
|
painter->setPen( QColor( 99, 113, 128 ) );
|
||||||
painter->drawText( option.rect.translated( -4, 0 ), text, to );
|
painter->drawText( option.rect.translated( -4, 0 ), text, to );
|
||||||
|
painter->setFont( tmpFont );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +364,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
font.setPixelSize( 11 );
|
font.setPointSize( 8 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
o.font = font;
|
o.font = font;
|
||||||
o3.font = font;
|
o3.font = font;
|
||||||
@@ -458,7 +463,8 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
painter->setPen( pen );
|
painter->setPen( pen );
|
||||||
|
|
||||||
QFont font = painter->font();
|
QFont font = painter->font();
|
||||||
font.setPixelSize( 12 );
|
|
||||||
|
font.setPointSize( 7 );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
QFont fontBold = painter->font();
|
QFont fontBold = painter->font();
|
||||||
fontBold.setBold( true );
|
fontBold.setBold( true );
|
||||||
|
@@ -67,7 +67,13 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
|||||||
setFrameShape( QFrame::NoFrame );
|
setFrameShape( QFrame::NoFrame );
|
||||||
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
setContentsMargins( 0, 0, 0, 0 );
|
setContentsMargins( 0, 0, 0, 0 );
|
||||||
setMinimumWidth( 220 );
|
|
||||||
|
QFont dummyFont;
|
||||||
|
dummyFont.setPointSize( 9 );
|
||||||
|
QFontMetrics fm( dummyFont );
|
||||||
|
// This is sort of the longest string in there. With translations
|
||||||
|
// we will never get it right so setting it to something reasonable for the average case
|
||||||
|
setMinimumWidth( fm.width( "Track Album Artist Local Top10") );
|
||||||
|
|
||||||
setHeaderHidden( true );
|
setHeaderHidden( true );
|
||||||
setRootIsDecorated( true );
|
setRootIsDecorated( true );
|
||||||
|
Reference in New Issue
Block a user