mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +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" ) );
|
QAbstractButton* downloadButton = m_header->addButton( tr( "Download All" ) );
|
||||||
connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||||
|
|
||||||
|
m_header->setRefreshVisible( true );
|
||||||
|
connect( m_header, SIGNAL( refresh() ), SLOT( onCollectionChanged() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
layout()->addWidget( m_header );
|
layout()->addWidget( m_header );
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "BasicHeader.h"
|
#include "BasicHeader.h"
|
||||||
|
|
||||||
#include "ElidedLabel.h"
|
#include "ElidedLabel.h"
|
||||||
|
#include "utils/ImageRegistry.h"
|
||||||
#include "utils/TomahawkStyle.h"
|
#include "utils/TomahawkStyle.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
@@ -43,6 +44,10 @@ BasicHeader::BasicHeader( QWidget* parent )
|
|||||||
setAutoFillBackground( false );
|
setAutoFillBackground( false );
|
||||||
BackgroundWidget::setBackgroundColor( TomahawkStyle::HEADER_BACKGROUND );
|
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();
|
QFont f = ui->captionLabel->font();
|
||||||
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
|
f.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
|
||||||
@@ -104,6 +109,13 @@ BasicHeader::setDescription( const QString& /* s */ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicHeader::setRefreshVisible( bool visible )
|
||||||
|
{
|
||||||
|
ui->refreshButton->setVisible( visible );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
|
BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||||
{
|
{
|
||||||
@@ -136,6 +148,7 @@ BasicHeader::resizeEvent( QResizeEvent* event )
|
|||||||
{
|
{
|
||||||
BackgroundWidget::resizeEvent( 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 );
|
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 setCaption( const QString& s );
|
||||||
virtual void setDescription( const QString& s );
|
virtual void setDescription( const QString& s );
|
||||||
virtual void setPixmap( const QPixmap& p, bool tinted = true );
|
virtual void setPixmap( const QPixmap& p, bool tinted = true );
|
||||||
|
virtual void setRefreshVisible( bool visible );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void refresh();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent( QResizeEvent* event );
|
virtual void resizeEvent( QResizeEvent* event );
|
||||||
|
@@ -67,11 +67,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ImageButton" name="refreshButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
@@ -200,6 +210,11 @@
|
|||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>widgets/ClickableLabel.h</header>
|
<header>widgets/ClickableLabel.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ImageButton</class>
|
||||||
|
<extends>QPushButton</extends>
|
||||||
|
<header>widgets/ImageButton.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Reference in New Issue
Block a user