mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
* Removed ugly queue button for good.
This commit is contained in:
parent
a467b8f2e8
commit
dd842a1393
@ -431,6 +431,7 @@ set( libUI ${libUI}
|
||||
widgets/infowidgets/AlbumInfoWidget.ui
|
||||
playlist/topbar/topbar.ui
|
||||
playlist/infobar/infobar.ui
|
||||
playlist/queueview.ui
|
||||
context/ContextWidget.ui
|
||||
)
|
||||
|
||||
|
@ -41,8 +41,9 @@ using namespace Tomahawk;
|
||||
ContextWidget::ContextWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::ContextWidget )
|
||||
, m_minHeight( 24 )
|
||||
, m_minHeight( 22 )
|
||||
, m_currentView( 0 )
|
||||
, m_visible( false )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
TomahawkUtils::unmarginLayout( layout() );
|
||||
@ -78,10 +79,6 @@ ContextWidget::ContextWidget( QWidget* parent )
|
||||
|
||||
ui->contextView->hide();
|
||||
|
||||
QPalette p = palette();
|
||||
p.setBrush( QPalette::Window, QColor( 0x70, 0x70, 0x70 ) );
|
||||
setPalette( p );
|
||||
|
||||
QPalette whitePal = ui->toggleButton->palette();
|
||||
whitePal.setColor( QPalette::Foreground, Qt::white );
|
||||
ui->toggleButton->setPalette( whitePal );
|
||||
@ -95,6 +92,10 @@ ContextWidget::ContextWidget( QWidget* parent )
|
||||
setAutoFillBackground( true );
|
||||
setFixedHeight( m_minHeight );
|
||||
|
||||
QPalette pal = palette();
|
||||
pal.setBrush( QPalette::Window, QColor( 0x70, 0x70, 0x70 ) );
|
||||
setPalette( pal );
|
||||
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( toggleSize() ) );
|
||||
|
||||
m_timeLine = new QTimeLine( ANIMATION_TIME, this );
|
||||
@ -247,6 +248,7 @@ ContextWidget::toggleSize()
|
||||
else
|
||||
{
|
||||
ui->toggleButton->setText( tr( "Open Dashboard" ) );
|
||||
m_visible = false;
|
||||
ui->contextView->hide();
|
||||
|
||||
m_timeLine->setFrameRange( m_minHeight, height() );
|
||||
@ -269,6 +271,7 @@ ContextWidget::onAnimationFinished()
|
||||
if ( m_timeLine->direction() == QTimeLine::Forward )
|
||||
{
|
||||
setFixedHeight( m_maxHeight );
|
||||
m_visible = true;
|
||||
ui->contextView->show();
|
||||
|
||||
fadeOut( false );
|
||||
@ -283,11 +286,21 @@ ContextWidget::onAnimationFinished()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ContextWidget::paintEvent( QPaintEvent* e )
|
||||
{
|
||||
QWidget::paintEvent( e );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ContextWidget::resizeEvent( QResizeEvent* e )
|
||||
{
|
||||
QWidget::resizeEvent( e );
|
||||
|
||||
m_scene->setSceneRect( ui->contextView->viewport()->rect() );
|
||||
layoutViews( false );
|
||||
if ( m_visible )
|
||||
{
|
||||
m_scene->setSceneRect( ui->contextView->viewport()->rect() );
|
||||
layoutViews( false );
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ private slots:
|
||||
void onAnimationFinished();
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* e );
|
||||
void resizeEvent( QResizeEvent* e );
|
||||
|
||||
private:
|
||||
@ -81,6 +82,7 @@ private:
|
||||
int m_currentView;
|
||||
|
||||
Tomahawk::query_ptr m_query;
|
||||
bool m_visible;
|
||||
};
|
||||
|
||||
#endif // CONTEXTWIDGET_H
|
||||
|
@ -38,7 +38,7 @@
|
||||
<string>Dashboard</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -17,9 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "queueview.h"
|
||||
#include "ui_queueview.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "widgets/HeaderLabel.h"
|
||||
#include "playlist/queueproxymodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
#include "utils/logger.h"
|
||||
@ -29,19 +31,21 @@ using namespace Tomahawk;
|
||||
|
||||
QueueView::QueueView( AnimatedSplitter* parent )
|
||||
: AnimatedWidget( parent )
|
||||
, ui( new Ui::QueueView )
|
||||
{
|
||||
setHiddenSize( QSize( 0, 0 ) );
|
||||
setLayout( new QVBoxLayout() );
|
||||
ui->setupUi( this );
|
||||
TomahawkUtils::unmarginLayout( layout() );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
m_queue = new PlaylistView( this );
|
||||
m_queue->setProxyModel( new QueueProxyModel( this ) );
|
||||
m_queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||
m_queue->setFrameShape( QFrame::NoFrame );
|
||||
m_queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
m_queue->overlay()->setEnabled( false );
|
||||
setHiddenSize( QSize( 0, 22 ) );
|
||||
|
||||
layout()->setMargin( 0 );
|
||||
layout()->addWidget( m_queue );
|
||||
ui->queue->setProxyModel( new QueueProxyModel( this ) );
|
||||
ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );
|
||||
ui->queue->setFrameShape( QFrame::NoFrame );
|
||||
ui->queue->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
ui->queue->overlay()->setEnabled( false );
|
||||
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -51,10 +55,36 @@ QueueView::~QueueView()
|
||||
}
|
||||
|
||||
|
||||
PlaylistView*
|
||||
QueueView::queue() const
|
||||
{
|
||||
return ui->queue;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueView::hide()
|
||||
{
|
||||
disconnect( ui->toggleButton, SIGNAL( clicked() ), this, SLOT( hide() ) );
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
|
||||
ui->toggleButton->setText( tr( "Show Queue" ) );
|
||||
emit hideWidget();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueView::show()
|
||||
{
|
||||
disconnect( ui->toggleButton, SIGNAL( clicked() ), this, SLOT( show() ) );
|
||||
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( hide() ) );
|
||||
ui->toggleButton->setText( tr( "Hide Queue" ) );
|
||||
emit showWidget();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QueueView::onShown( QWidget* widget, bool animated )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << widget;
|
||||
if ( widget != this )
|
||||
return;
|
||||
|
||||
@ -65,7 +95,6 @@ QueueView::onShown( QWidget* widget, bool animated )
|
||||
void
|
||||
QueueView::onHidden( QWidget* widget, bool animated )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << widget;
|
||||
if ( widget != this )
|
||||
return;
|
||||
|
||||
|
@ -26,6 +26,11 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class QueueView;
|
||||
}
|
||||
|
||||
class DLLEXPORT QueueView : public AnimatedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -34,7 +39,7 @@ public:
|
||||
explicit QueueView( AnimatedSplitter* parent );
|
||||
~QueueView();
|
||||
|
||||
PlaylistView* queue() const { return m_queue; }
|
||||
PlaylistView* queue() const;
|
||||
|
||||
QSize sizeHint() const { return QSize( 0, 200 ); }
|
||||
|
||||
@ -42,8 +47,11 @@ public slots:
|
||||
virtual void onShown( QWidget*, bool animated );
|
||||
virtual void onHidden( QWidget*, bool animated );
|
||||
|
||||
virtual void show();
|
||||
virtual void hide();
|
||||
|
||||
private:
|
||||
PlaylistView* m_queue;
|
||||
Ui::QueueView* ui;
|
||||
};
|
||||
|
||||
#endif // QUEUEVIEW_H
|
||||
|
@ -151,7 +151,7 @@ AnimatedWidget::AnimatedWidget( AnimatedSplitter* parent )
|
||||
{
|
||||
m_timeLine = new QTimeLine( ANIMATION_TIME, this );
|
||||
m_timeLine->setUpdateInterval( 20 );
|
||||
m_timeLine->setEasingCurve( QEasingCurve::OutBack );
|
||||
m_timeLine->setEasingCurve( QEasingCurve::OutCubic );
|
||||
|
||||
connect( m_timeLine, SIGNAL( frameChanged( int ) ), SLOT( onAnimationStep( int ) ) );
|
||||
connect( m_timeLine, SIGNAL( finished() ), SLOT( onAnimationFinished() ) );
|
||||
|
@ -200,16 +200,6 @@ TomahawkWindow::setupSideBar()
|
||||
TransferView* transferView = new TransferView( m_sidebar );
|
||||
PipelineStatusView* pipelineView = new PipelineStatusView( m_sidebar );
|
||||
|
||||
m_queueButton = new QPushButton();
|
||||
m_queueButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
|
||||
m_queueButton->setText( tr( "Click to show queue" ) );
|
||||
#ifdef Q_OS_MAC
|
||||
// QPushButtons on mac have lots of weird layouting issues. Fix them by forcing the widget rect for layout calculations
|
||||
m_queueButton->setAttribute( Qt::WA_LayoutUsesWidgetRect );
|
||||
#endif
|
||||
|
||||
connect( m_queueButton, SIGNAL( clicked() ), SLOT( showQueue() ) );
|
||||
|
||||
m_queueView = new QueueView( m_sidebar );
|
||||
m_queueModel = new PlaylistModel( m_queueView );
|
||||
m_queueModel->setStyle( PlaylistModel::Short );
|
||||
@ -230,7 +220,6 @@ TomahawkWindow::setupSideBar()
|
||||
m_sidebar->hide( 4, false );
|
||||
|
||||
sidebarWidget->layout()->addWidget( m_sidebar );
|
||||
sidebarWidget->layout()->addWidget( m_queueButton );
|
||||
sidebarWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||
sidebarWidget->layout()->setMargin( 0 );
|
||||
@ -699,11 +688,7 @@ TomahawkWindow::showQueue()
|
||||
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_sidebar->show( 4 );
|
||||
m_queueView->show();
|
||||
}
|
||||
|
||||
|
||||
@ -717,11 +702,7 @@ TomahawkWindow::hideQueue()
|
||||
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_sidebar->hide( 4 );
|
||||
m_queueView->hide();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user