mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 11:50:37 +02:00
Add refresh button in script collection header.
This commit is contained in:
@@ -124,6 +124,9 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
{
|
||||
QAbstractButton* downloadButton = m_header->addButton( tr( "Download All" ) );
|
||||
connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||
|
||||
m_header->setRefreshVisible( true );
|
||||
connect( m_header, SIGNAL( refresh() ), SLOT( onCollectionChanged() ) );
|
||||
}
|
||||
|
||||
layout()->addWidget( m_header );
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "BasicHeader.h"
|
||||
|
||||
#include "ElidedLabel.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
@@ -43,6 +44,10 @@ BasicHeader::BasicHeader( QWidget* parent )
|
||||
setAutoFillBackground( false );
|
||||
BackgroundWidget::setBackgroundColor( TomahawkStyle::HEADER_BACKGROUND );
|
||||
|
||||
ui->refreshButton->setPixmap( ImageRegistry::instance()->pixmap( RESPATH "images/refresh.svg", QSize( ui->captionLabel->height() - 8, ui->captionLabel->height() - 8 ) ) );
|
||||
connect( ui->refreshButton, SIGNAL( clicked() ), SIGNAL( refresh() ) );
|
||||
setRefreshVisible( false );
|
||||
|
||||
{
|
||||
QFont f = ui->captionLabel->font();
|
||||
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
|
||||
@@ -104,6 +109,13 @@ BasicHeader::setDescription( const QString& /* s */ )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BasicHeader::setRefreshVisible( bool visible )
|
||||
{
|
||||
ui->refreshButton->setVisible( visible );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
{
|
||||
@@ -136,6 +148,7 @@ BasicHeader::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
BackgroundWidget::resizeEvent( event );
|
||||
|
||||
ui->captionLabel->setFixedWidth( width() * 0.33 );
|
||||
QFontMetrics fm( ui->captionLabel->font() );
|
||||
ui->captionLabel->setFixedWidth( qMin( fm.width( ui->captionLabel->text() ) + 8, int( width() * 0.33 ) ) );
|
||||
ui->balanceSpacer->changeSize( ui->captionLabel->width(), 1, QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||
}
|
||||
|
@@ -46,6 +46,10 @@ public slots:
|
||||
virtual void setCaption( const QString& s );
|
||||
virtual void setDescription( const QString& s );
|
||||
virtual void setPixmap( const QPixmap& p, bool tinted = true );
|
||||
virtual void setRefreshVisible( bool visible );
|
||||
|
||||
signals:
|
||||
void refresh();
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent( QResizeEvent* event );
|
||||
|
@@ -67,11 +67,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ImageButton" name="refreshButton">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
@@ -200,6 +210,11 @@
|
||||
<extends>QLabel</extends>
|
||||
<header>widgets/ClickableLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ImageButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>widgets/ImageButton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Reference in New Issue
Block a user