1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

* Fixed queue button flickering. Much smoother animation. QSplitter, I'll meet you in hell.

This commit is contained in:
Christian Muehlhaeuser
2011-08-14 06:29:07 +02:00
parent aff34a9dc5
commit 33a237086c
5 changed files with 23 additions and 34 deletions

View File

@@ -407,7 +407,7 @@ DynamicWidget::generatorError( const QString& title, const QString& content )
void void
DynamicWidget::paintRoundedFilledRect( QPainter& p, QPalette& pal, QRect& r, qreal opacity ) DynamicWidget::paintRoundedFilledRect( QPainter& p, QPalette& /* pal */, QRect& r, qreal opacity )
{ {
p.setBackgroundMode( Qt::TransparentMode ); p.setBackgroundMode( Qt::TransparentMode );
p.setRenderHint( QPainter::Antialiasing ); p.setRenderHint( QPainter::Antialiasing );
@@ -427,6 +427,7 @@ DynamicWidget::paintRoundedFilledRect( QPainter& p, QPalette& pal, QRect& r, qre
p.drawRoundedRect( r, 10, 10 ); p.drawRoundedRect( r, 10, 10 );
} }
QPixmap QPixmap
DynamicWidget::pixmap() const DynamicWidget::pixmap() const
{ {

View File

@@ -24,19 +24,13 @@
#include "widgets/overlaywidget.h" #include "widgets/overlaywidget.h"
#include "utils/logger.h" #include "utils/logger.h"
#ifdef Q_WS_MAC
#define MINIMUM_HEIGHT 38
#else
#define MINIMUM_HEIGHT 27
#endif
using namespace Tomahawk; using namespace Tomahawk;
QueueView::QueueView( AnimatedSplitter* parent ) QueueView::QueueView( AnimatedSplitter* parent )
: AnimatedWidget( parent ) : AnimatedWidget( parent )
{ {
setHiddenSize( QSize( 0, MINIMUM_HEIGHT ) ); setHiddenSize( QSize( 0, 0 ) );
setLayout( new QVBoxLayout() ); setLayout( new QVBoxLayout() );
m_queue = new PlaylistView( this ); m_queue = new PlaylistView( this );
@@ -46,14 +40,8 @@ QueueView::QueueView( AnimatedSplitter* parent )
m_queue->setAttribute( Qt::WA_MacShowFocusRect, 0 ); m_queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_queue->overlay()->setEnabled( false ); m_queue->overlay()->setEnabled( false );
m_button = new QPushButton();
m_button->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
m_button->setText( tr( "Click to show queue" ) );
connect( m_button, SIGNAL( clicked() ), SIGNAL( showWidget() ) );
layout()->setMargin( 0 ); layout()->setMargin( 0 );
layout()->addWidget( m_queue ); layout()->addWidget( m_queue );
layout()->addWidget( m_button );
} }
@@ -71,10 +59,6 @@ QueueView::onShown( QWidget* widget, bool animated )
return; return;
AnimatedWidget::onShown( widget, animated ); AnimatedWidget::onShown( widget, animated );
m_button->setText( tr( "Click to hide queue" ) );
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( showWidget() ) );
connect( m_button, SIGNAL( clicked() ), SIGNAL( hideWidget() ) );
} }
@@ -86,8 +70,4 @@ QueueView::onHidden( QWidget* widget, bool animated )
return; return;
AnimatedWidget::onHidden( widget, animated ); AnimatedWidget::onHidden( widget, animated );
m_button->setText( tr( "Click to show queue" ) );
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( hideWidget() ) );
connect( m_button, SIGNAL( clicked() ), SIGNAL( showWidget() ) );
} }

View File

@@ -44,7 +44,6 @@ public slots:
private: private:
PlaylistView* m_queue; PlaylistView* m_queue;
QPushButton* m_button;
}; };
#endif // QUEUEVIEW_H #endif // QUEUEVIEW_H

View File

@@ -86,6 +86,10 @@ ViewManager::ViewManager( QObject* parent )
m_splitter->setGreedyWidget( 0 ); m_splitter->setGreedyWidget( 0 );
m_splitter->addWidget( m_stack ); m_splitter->addWidget( m_stack );
m_queueButton = new QPushButton();
m_queueButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
m_queueButton->setText( tr( "Click to show queue" ) );
m_queueView = new QueueView( m_splitter ); m_queueView = new QueueView( m_splitter );
m_queueModel = new PlaylistModel( m_queueView ); m_queueModel = new PlaylistModel( m_queueView );
m_queueView->queue()->setPlaylistModel( m_queueModel ); m_queueView->queue()->setPlaylistModel( m_queueModel );
@@ -98,6 +102,7 @@ ViewManager::ViewManager( QObject* parent )
m_widget->layout()->addWidget( m_infobar ); m_widget->layout()->addWidget( m_infobar );
m_widget->layout()->addWidget( m_topbar ); m_widget->layout()->addWidget( m_topbar );
m_widget->layout()->addWidget( m_splitter ); m_widget->layout()->addWidget( m_splitter );
m_widget->layout()->addWidget( m_queueButton );
m_superCollectionView = new ArtistView(); m_superCollectionView = new ArtistView();
m_superCollectionModel = new TreeModel( m_superCollectionView ); m_superCollectionModel = new TreeModel( m_superCollectionView );
@@ -122,18 +127,12 @@ ViewManager::ViewManager( QObject* parent )
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistInterfaceChanged( Tomahawk::PlaylistInterface* ) ) ); connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistInterfaceChanged( Tomahawk::PlaylistInterface* ) ) );
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) ); connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
connect( m_queueButton, SIGNAL( clicked() ), SLOT( showQueue() ) );
connect( m_topbar, SIGNAL( filterTextChanged( QString ) ), connect( m_topbar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
SLOT( setFilter( QString ) ) ); connect( m_topbar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
connect( m_topbar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
connect( m_topbar, SIGNAL( flatMode() ), connect( m_topbar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );
SLOT( setTableMode() ) );
connect( m_topbar, SIGNAL( artistMode() ),
SLOT( setTreeMode() ) );
connect( m_topbar, SIGNAL( albumMode() ),
SLOT( setAlbumMode() ) );
} }
@@ -476,6 +475,10 @@ ViewManager::showQueue()
return; return;
} }
m_queueButton->setText( tr( "Click to hide queue" ) );
disconnect( m_queueButton, SIGNAL( clicked() ), this, SLOT( showQueue() ) );
connect( m_queueButton, SIGNAL( clicked() ), SLOT( hideQueue() ) );
m_splitter->show( 1 ); m_splitter->show( 1 );
} }
@@ -490,6 +493,10 @@ ViewManager::hideQueue()
return; return;
} }
m_queueButton->setText( tr( "Click to show queue" ) );
disconnect( m_queueButton, SIGNAL( clicked() ), this, SLOT( hideQueue() ) );
connect( m_queueButton, SIGNAL( clicked() ), SLOT( showQueue() ) );
m_splitter->hide( 1 ); m_splitter->hide( 1 );
} }

View File

@@ -51,6 +51,7 @@ class SourceInfoWidget;
class InfoBar; class InfoBar;
class TopBar; class TopBar;
class WelcomeWidget; class WelcomeWidget;
class QPushButton;
namespace Tomahawk namespace Tomahawk
{ {
@@ -170,6 +171,7 @@ private:
QWidget* m_widget; QWidget* m_widget;
InfoBar* m_infobar; InfoBar* m_infobar;
TopBar* m_topbar; TopBar* m_topbar;
QPushButton* m_queueButton;
QStackedWidget* m_stack; QStackedWidget* m_stack;
AnimatedSplitter* m_splitter; AnimatedSplitter* m_splitter;