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

* Put a CaptionLabel above alternative versions in TrackDetailView.

This commit is contained in:
Christian Muehlhaeuser
2014-08-23 17:02:23 +02:00
parent 1025dc3cc2
commit c54fe787b6
2 changed files with 53 additions and 33 deletions

View File

@@ -29,6 +29,7 @@
#include "widgets/PlayableCover.h"
#include "widgets/QueryLabel.h"
#include "widgets/ClickableLabel.h"
#include "widgets/CaptionLabel.h"
#include "PlaylistInterface.h"
#include "utils/ImageRegistry.h"
#include "utils/TomahawkUtilsGui.h"
@@ -84,6 +85,17 @@ TrackDetailView::TrackDetailView( QWidget* parent )
m_infoBox->setLayout( hboxl );
m_infoBox->hide();
f.setWeight( QFont::Normal );
f.setPointSize( TomahawkUtils::defaultFontSize() - 1 );
m_resultsBoxLabel = new CaptionLabel( this );
m_resultsBoxLabel->setFont( f );
m_resultsBoxLabel->setStyleSheet( "QLabel { color: rgba( 0, 0, 0, 50% ) }" );
m_resultsBoxLabel->setText( tr( "Alternative versions:" ) );
m_resultsBoxLabel->setFixedWidth( width() - 4 );
m_resultsBoxLabel->setFixedHeight( m_resultsBoxLabel->sizeHint().height() * 0.8 );
m_resultsBoxLabel->hide();
m_resultsBox = new QWidget;
QVBoxLayout* resultsLayout = new QVBoxLayout;
TomahawkUtils::unmarginLayout( resultsLayout );
@@ -109,8 +121,9 @@ TrackDetailView::TrackDetailView( QWidget* parent )
layout->addWidget( m_dateLabel );
layout->addWidget( m_infoBox );
layout->addSpacerItem( new QSpacerItem( 0, 32, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
layout->addWidget( m_resultsBoxLabel );
layout->addSpacerItem( new QSpacerItem( 0, 8, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
layout->addWidget( resultsScrollArea );
layout->addSpacerItem( new QSpacerItem( 0, 32, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
layout->setStretchFactor( resultsScrollArea, 1 );
setLayout( layout );
@@ -216,18 +229,16 @@ TrackDetailView::onResultsChanged()
delete child;
}
if ( !m_query )
return;
if ( m_query )
{
QFont f = font();
f.setPointSize( TomahawkUtils::defaultFontSize() );
foreach ( const Tomahawk::result_ptr& result, m_query->results() )
{
if ( !result->isOnline() )
continue;
QFont f = font();
f.setWeight( QFont::DemiBold );
f.setPointSize( 11 );
QLabel* resolverIcon = new QLabel( this );
resolverIcon->setFixedWidth( 12 );
resolverIcon->setPixmap( result->sourceIcon( TomahawkUtils::RoundedCorners, QSize( 12, 12 ) ) );
@@ -254,9 +265,16 @@ TrackDetailView::onResultsChanged()
m_resultsBox->layout()->addWidget( hbox );
}
}
if ( m_query->numResults() > 1 )
if ( m_query && m_query->numResults() > 1 )
{
m_resultsBoxLabel->show();
m_resultsBox->show();
}
else
{
m_resultsBoxLabel->hide();
m_resultsBox->hide();
}
}

View File

@@ -25,8 +25,9 @@
#include "DllMacro.h"
class QLabel;
class QueryLabel;
class CaptionLabel;
class PlayableCover;
class QueryLabel;
class DLLEXPORT TrackDetailView : public QWidget
{
@@ -58,6 +59,7 @@ private:
QLabel* m_dateLabel;
QLabel* m_lovedIcon;
QLabel* m_lovedLabel;
CaptionLabel* m_resultsBoxLabel;
QWidget* m_infoBox;
QWidget* m_resultsBox;