mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Added initial ContextView. Yikes.
This commit is contained in:
@@ -40,6 +40,13 @@ set( libSources
|
|||||||
|
|
||||||
audio/audioengine.cpp
|
audio/audioengine.cpp
|
||||||
|
|
||||||
|
context/ContextPage.cpp
|
||||||
|
context/ContextWidget.cpp
|
||||||
|
context/pages/TopTracksContext.cpp
|
||||||
|
context/pages/RelatedArtistsContext.cpp
|
||||||
|
context/pages/WikipediaContext.cpp
|
||||||
|
context/pages/WebContext.cpp
|
||||||
|
|
||||||
database/database.cpp
|
database/database.cpp
|
||||||
database/fuzzyindex.cpp
|
database/fuzzyindex.cpp
|
||||||
database/databasecollection.cpp
|
database/databasecollection.cpp
|
||||||
@@ -234,6 +241,13 @@ set( libHeaders
|
|||||||
|
|
||||||
audio/audioengine.h
|
audio/audioengine.h
|
||||||
|
|
||||||
|
context/ContextPage.h
|
||||||
|
context/ContextWidget.h
|
||||||
|
context/pages/TopTracksContext.h
|
||||||
|
context/pages/RelatedArtistsContext.h
|
||||||
|
context/pages/WikipediaContext.h
|
||||||
|
context/pages/WebContext.h
|
||||||
|
|
||||||
database/database.h
|
database/database.h
|
||||||
database/fuzzyindex.h
|
database/fuzzyindex.h
|
||||||
database/databaseworker.h
|
database/databaseworker.h
|
||||||
@@ -417,6 +431,7 @@ set( libUI ${libUI}
|
|||||||
widgets/infowidgets/AlbumInfoWidget.ui
|
widgets/infowidgets/AlbumInfoWidget.ui
|
||||||
playlist/topbar/topbar.ui
|
playlist/topbar/topbar.ui
|
||||||
playlist/infobar/infobar.ui
|
playlist/infobar/infobar.ui
|
||||||
|
context/ContextWidget.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ..
|
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ..
|
||||||
|
94
src/libtomahawk/context/ContextPage.cpp
Normal file
94
src/libtomahawk/context/ContextPage.cpp
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ContextPage.h"
|
||||||
|
|
||||||
|
#include <QGraphicsLinearLayout>
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextProxyPage::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget )
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
|
||||||
|
painter->setRenderHint( QPainter::Antialiasing, true );
|
||||||
|
painter->setPen( StyleHelper::headerHighlightColor() );
|
||||||
|
painter->setBrush( StyleHelper::headerHighlightColor() );
|
||||||
|
painter->drawRoundedRect( option->rect, 4.0, 4.0 );
|
||||||
|
|
||||||
|
QFont f( font() );
|
||||||
|
f.setBold( true );
|
||||||
|
f.setPixelSize( 14 );
|
||||||
|
painter->setFont( f );
|
||||||
|
painter->setPen( Qt::white );
|
||||||
|
|
||||||
|
QRect r( 1, 1, option->rect.width(), 19 );
|
||||||
|
QTextOption to( Qt::AlignCenter );
|
||||||
|
painter->drawText( r, m_page->title(), to );
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
|
QGraphicsWidget::paint( painter, option, widget );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextProxyPage::setPage( Tomahawk::ContextPage* page )
|
||||||
|
{
|
||||||
|
m_page = page;
|
||||||
|
|
||||||
|
QGraphicsWebView* testWebView = qobject_cast<QGraphicsWebView*>( page->widget() );
|
||||||
|
if ( testWebView )
|
||||||
|
{
|
||||||
|
setContentsMargins( 4, 4, 4, 4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
|
||||||
|
layout->setContentsMargins( 4, 20, 4, 4 );
|
||||||
|
layout->addItem( page->widget() );
|
||||||
|
setLayout( layout );
|
||||||
|
|
||||||
|
page->widget()->installEventFilter( this );
|
||||||
|
page->widget()->installSceneEventFilter( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ContextProxyPage::eventFilter( QObject* watched, QEvent* event )
|
||||||
|
{
|
||||||
|
if ( event->type() == QEvent::GrabMouse )
|
||||||
|
{
|
||||||
|
emit focused();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QGraphicsWidget::eventFilter( watched, event );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ContextProxyPage::sceneEvent( QEvent* event )
|
||||||
|
{
|
||||||
|
if ( event->type() == QEvent::GrabMouse )
|
||||||
|
{
|
||||||
|
emit focused();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QGraphicsWidget::sceneEvent( event );
|
||||||
|
}
|
91
src/libtomahawk/context/ContextPage.h
Normal file
91
src/libtomahawk/context/ContextPage.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONTEXTPAGE_H
|
||||||
|
#define CONTEXTPAGE_H
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
#include <QGraphicsWebView>
|
||||||
|
#include <QStyleOptionGraphicsItem>
|
||||||
|
|
||||||
|
#include "typedefs.h"
|
||||||
|
#include "playlistinterface.h"
|
||||||
|
#include "utils/stylehelper.h"
|
||||||
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
class DLLEXPORT ContextPage : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ContextPage() {}
|
||||||
|
virtual ~ContextPage() {}
|
||||||
|
|
||||||
|
virtual QGraphicsWidget* widget() = 0;
|
||||||
|
virtual Tomahawk::PlaylistInterface* playlistInterface() const = 0;
|
||||||
|
|
||||||
|
virtual QString title() const = 0;
|
||||||
|
virtual QString description() const = 0;
|
||||||
|
virtual QPixmap pixmap() const { return QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ); }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack() = 0;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void setQuery( const Tomahawk::query_ptr& query ) = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void nameChanged( const QString& );
|
||||||
|
void descriptionChanged( const QString& );
|
||||||
|
void pixmapChanged( const QPixmap& );
|
||||||
|
void destroyed( QWidget* widget );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DLLEXPORT ContextProxyPage : public QGraphicsWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ContextProxyPage() : QGraphicsWidget()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Tomahawk::ContextPage* page() const { return m_page; }
|
||||||
|
void setPage( Tomahawk::ContextPage* page );
|
||||||
|
|
||||||
|
virtual bool eventFilter( QObject* watched, QEvent* event );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void focused();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
|
||||||
|
virtual bool sceneEvent( QEvent* event );
|
||||||
|
|
||||||
|
private:
|
||||||
|
Tomahawk::ContextPage* m_page;
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // ns
|
||||||
|
|
||||||
|
#endif //CONTEXTPAGE_H
|
293
src/libtomahawk/context/ContextWidget.cpp
Normal file
293
src/libtomahawk/context/ContextWidget.cpp
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ContextWidget.h"
|
||||||
|
#include "ui_ContextWidget.h"
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
#include <QTimeLine>
|
||||||
|
|
||||||
|
#include "context/ContextPage.h"
|
||||||
|
#include "context/pages/RelatedArtistsContext.h"
|
||||||
|
#include "context/pages/TopTracksContext.h"
|
||||||
|
#include "context/pages/WikipediaContext.h"
|
||||||
|
|
||||||
|
#include "playlist/artistview.h"
|
||||||
|
#include "playlist/treemodel.h"
|
||||||
|
|
||||||
|
#define ANIMATION_TIME 450
|
||||||
|
#define SLIDE_TIME 350
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
ContextWidget::ContextWidget( QWidget* parent )
|
||||||
|
: QWidget( parent )
|
||||||
|
, ui( new Ui::ContextWidget )
|
||||||
|
, m_minHeight( 24 )
|
||||||
|
, m_currentView( 0 )
|
||||||
|
{
|
||||||
|
ui->setupUi( this );
|
||||||
|
TomahawkUtils::unmarginLayout( layout() );
|
||||||
|
setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
|
m_scene = new QGraphicsScene( this );
|
||||||
|
|
||||||
|
TopTracksContext* ttc = new TopTracksContext();
|
||||||
|
RelatedArtistsContext* rac = new RelatedArtistsContext();
|
||||||
|
WebContext* wiki = new WikipediaContext();
|
||||||
|
WebContext* lastfm = new LastfmContext();
|
||||||
|
|
||||||
|
m_views << ttc;
|
||||||
|
m_views << rac;
|
||||||
|
m_views << wiki;
|
||||||
|
m_views << lastfm;
|
||||||
|
|
||||||
|
foreach ( ContextPage* view, m_views )
|
||||||
|
{
|
||||||
|
ContextProxyPage* page = new ContextProxyPage();
|
||||||
|
page->setPage( view );
|
||||||
|
m_scene->addItem( page );
|
||||||
|
|
||||||
|
connect( page, SIGNAL( focused() ), SLOT( onPageFocused() ) );
|
||||||
|
m_pages << page;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->contextView->setScene( m_scene );
|
||||||
|
ui->contextView->setFrameShape( QFrame::NoFrame );
|
||||||
|
ui->contextView->setStyleSheet( "background: transparent" );
|
||||||
|
ui->contextView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
ui->contextView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
QFont boldFont = ui->toggleButton->font();
|
||||||
|
boldFont.setPixelSize( 12 );
|
||||||
|
boldFont.setBold( true );
|
||||||
|
ui->toggleButton->setFont( boldFont );
|
||||||
|
ui->toggleButton->setText( tr( "Open Dashboard" ) );
|
||||||
|
|
||||||
|
setAutoFillBackground( true );
|
||||||
|
setFixedHeight( m_minHeight );
|
||||||
|
|
||||||
|
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( toggleSize() ) );
|
||||||
|
|
||||||
|
m_timeLine = new QTimeLine( ANIMATION_TIME, this );
|
||||||
|
m_timeLine->setUpdateInterval( 20 );
|
||||||
|
m_timeLine->setEasingCurve( QEasingCurve::OutCubic );
|
||||||
|
|
||||||
|
connect( m_timeLine, SIGNAL( frameChanged( int ) ), SLOT( onAnimationStep( int ) ) );
|
||||||
|
connect( m_timeLine, SIGNAL( finished() ), SLOT( onAnimationFinished() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ContextWidget::~ContextWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::layoutViews( bool animate )
|
||||||
|
{
|
||||||
|
int smallViewWidth = 120;
|
||||||
|
float smallViewOpacity = 0.6;
|
||||||
|
|
||||||
|
int margin = 6;
|
||||||
|
int maxVisible = 2;
|
||||||
|
int itemSize = ( m_scene->sceneRect().width() - smallViewWidth * 2 ) / maxVisible;
|
||||||
|
int firstPos = margin;
|
||||||
|
float opacity;
|
||||||
|
|
||||||
|
if ( m_currentView > 0 )
|
||||||
|
firstPos = smallViewWidth;
|
||||||
|
|
||||||
|
if ( m_currentView + maxVisible >= m_pages.count() )
|
||||||
|
{
|
||||||
|
int delta = m_pages.count() - m_currentView;
|
||||||
|
firstPos = m_scene->sceneRect().width() - ( delta * itemSize ) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( int i = 0; i < m_pages.count(); i++ )
|
||||||
|
{
|
||||||
|
QGraphicsWidget* view = m_pages.at( i );
|
||||||
|
|
||||||
|
int x = firstPos - ( ( m_currentView - i ) * itemSize );
|
||||||
|
|
||||||
|
if ( ( x < smallViewWidth && x < firstPos ) || i > m_currentView + maxVisible - 1 )
|
||||||
|
{
|
||||||
|
opacity = smallViewOpacity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
opacity = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QPropertyAnimation* animation = new QPropertyAnimation( view, "opacity" );
|
||||||
|
animation->setDuration( SLIDE_TIME );
|
||||||
|
animation->setEndValue( opacity );
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect rect( x, margin, itemSize - margin * 2, m_scene->sceneRect().height() - margin * 2 );
|
||||||
|
if ( animate )
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QPropertyAnimation* animation = new QPropertyAnimation( view, "geometry" );
|
||||||
|
animation->setDuration( SLIDE_TIME );
|
||||||
|
animation->setEndValue( rect );
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
view->setGeometry( rect );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::onPageFocused()
|
||||||
|
{
|
||||||
|
ContextProxyPage* widget = qobject_cast< ContextProxyPage* >( sender() );
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach ( ContextProxyPage* view, m_pages )
|
||||||
|
{
|
||||||
|
if ( view == widget )
|
||||||
|
{
|
||||||
|
m_currentView = i;
|
||||||
|
layoutViews( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::fadeOut( bool animate )
|
||||||
|
{
|
||||||
|
foreach ( QGraphicsWidget* view, m_pages )
|
||||||
|
{
|
||||||
|
if ( animate )
|
||||||
|
{
|
||||||
|
QPropertyAnimation* animation = new QPropertyAnimation( view, "opacity" );
|
||||||
|
animation->setDuration( SLIDE_TIME );
|
||||||
|
animation->setEndValue( 0.0 );
|
||||||
|
animation->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
view->setOpacity( 0.0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::setQuery( const Tomahawk::query_ptr& query, bool force )
|
||||||
|
{
|
||||||
|
if ( query.isNull() )
|
||||||
|
return;
|
||||||
|
if ( !force && !m_query.isNull() && query->artist() == m_query->artist() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
if ( height() > m_minHeight )
|
||||||
|
{
|
||||||
|
foreach ( ContextProxyPage* proxy, m_pages )
|
||||||
|
{
|
||||||
|
proxy->page()->setQuery( query );
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutViews( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::toggleSize()
|
||||||
|
{
|
||||||
|
m_maxHeight = TomahawkUtils::tomahawkWindow()->height() * 0.3;
|
||||||
|
|
||||||
|
if ( height() == m_minHeight )
|
||||||
|
{
|
||||||
|
ui->toggleButton->setText( tr( "Close Dashboard" ) );
|
||||||
|
|
||||||
|
m_timeLine->setFrameRange( height(), m_maxHeight );
|
||||||
|
m_timeLine->setDirection( QTimeLine::Forward );
|
||||||
|
m_timeLine->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->toggleButton->setText( tr( "Open Dashboard" ) );
|
||||||
|
ui->contextView->hide();
|
||||||
|
|
||||||
|
m_timeLine->setFrameRange( m_minHeight, height() );
|
||||||
|
m_timeLine->setDirection( QTimeLine::Backward );
|
||||||
|
m_timeLine->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::onAnimationStep( int frame )
|
||||||
|
{
|
||||||
|
setFixedHeight( frame );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::onAnimationFinished()
|
||||||
|
{
|
||||||
|
if ( m_timeLine->direction() == QTimeLine::Forward )
|
||||||
|
{
|
||||||
|
setFixedHeight( m_maxHeight );
|
||||||
|
ui->contextView->show();
|
||||||
|
|
||||||
|
fadeOut( false );
|
||||||
|
m_scene->setSceneRect( ui->contextView->viewport()->rect() );
|
||||||
|
layoutViews( false );
|
||||||
|
setQuery( m_query, true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setFixedHeight( m_minHeight );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ContextWidget::resizeEvent( QResizeEvent* e )
|
||||||
|
{
|
||||||
|
QWidget::resizeEvent( e );
|
||||||
|
|
||||||
|
m_scene->setSceneRect( ui->contextView->viewport()->rect() );
|
||||||
|
layoutViews( false );
|
||||||
|
}
|
86
src/libtomahawk/context/ContextWidget.h
Normal file
86
src/libtomahawk/context/ContextWidget.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONTEXTWIDGET_H
|
||||||
|
#define CONTEXTWIDGET_H
|
||||||
|
|
||||||
|
#include <QGraphicsView>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
|
||||||
|
class QGraphicsScene;
|
||||||
|
class QGraphicsWebView;
|
||||||
|
class QGraphicsWidget;
|
||||||
|
class QTimeLine;
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
class ContextPage;
|
||||||
|
class ContextProxyPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class ContextWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DLLEXPORT ContextWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ContextWidget( QWidget* parent = 0 );
|
||||||
|
~ContextWidget();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setQuery( const Tomahawk::query_ptr& query, bool force = false );
|
||||||
|
|
||||||
|
void toggleSize();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onPageFocused();
|
||||||
|
|
||||||
|
void onAnimationStep( int frame );
|
||||||
|
void onAnimationFinished();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent( QResizeEvent* e );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void fadeOut( bool animate );
|
||||||
|
|
||||||
|
void layoutViews( bool animate = true );
|
||||||
|
|
||||||
|
Ui::ContextWidget* ui;
|
||||||
|
|
||||||
|
int m_minHeight;
|
||||||
|
int m_maxHeight;
|
||||||
|
QTimeLine* m_timeLine;
|
||||||
|
|
||||||
|
QGraphicsScene* m_scene;
|
||||||
|
QList<Tomahawk::ContextPage*> m_views;
|
||||||
|
QList<Tomahawk::ContextProxyPage*> m_pages;
|
||||||
|
|
||||||
|
int m_currentView;
|
||||||
|
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONTEXTWIDGET_H
|
76
src/libtomahawk/context/ContextWidget.ui
Normal file
76
src/libtomahawk/context/ContextWidget.ui
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ContextWidget</class>
|
||||||
|
<widget class="QWidget" name="ContextWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>774</width>
|
||||||
|
<height>72</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>72</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>InfoBar</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="HeaderLabel" name="toggleButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Dashboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>1</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGraphicsView" name="contextView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>HeaderLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header location="global">widgets/HeaderLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
125
src/libtomahawk/context/pages/RelatedArtistsContext.cpp
Normal file
125
src/libtomahawk/context/pages/RelatedArtistsContext.cpp
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RelatedArtistsContext.h"
|
||||||
|
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
#include "playlist/artistview.h"
|
||||||
|
#include "playlist/treemodel.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
RelatedArtistsContext::RelatedArtistsContext()
|
||||||
|
: ContextPage()
|
||||||
|
, m_infoId( uuid() )
|
||||||
|
{
|
||||||
|
m_relatedView = new ArtistView();
|
||||||
|
m_relatedModel = new TreeModel( m_relatedView );
|
||||||
|
m_relatedModel->setColumnStyle( TreeModel::TrackOnly );
|
||||||
|
m_relatedView->setTreeModel( m_relatedModel );
|
||||||
|
m_relatedView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
m_relatedView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
m_relatedView->header()->setVisible( false );
|
||||||
|
m_relatedView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
|
|
||||||
|
QPalette pal = m_relatedView->palette();
|
||||||
|
pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
|
||||||
|
m_relatedView->setPalette( pal );
|
||||||
|
|
||||||
|
m_proxy = new QGraphicsProxyWidget();
|
||||||
|
m_proxy->setWidget( m_relatedView );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||||
|
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
|
||||||
|
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RelatedArtistsContext::~RelatedArtistsContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
RelatedArtistsContext::setQuery( const Tomahawk::query_ptr& query )
|
||||||
|
{
|
||||||
|
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoCriteriaHash artistInfo;
|
||||||
|
artistInfo["artist"] = query->artist();
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||||
|
requestData.caller = m_infoId;
|
||||||
|
requestData.customData = QVariantMap();
|
||||||
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
|
||||||
|
|
||||||
|
requestData.type = Tomahawk::InfoSystem::InfoArtistSimilars;
|
||||||
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
RelatedArtistsContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
||||||
|
{
|
||||||
|
if ( requestData.caller != m_infoId )
|
||||||
|
return;
|
||||||
|
|
||||||
|
InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
|
trackInfo = requestData.input.value< InfoSystem::InfoCriteriaHash >();
|
||||||
|
|
||||||
|
if ( output.canConvert< QVariantMap >() )
|
||||||
|
{
|
||||||
|
if ( trackInfo["artist"] != m_query->artist() )
|
||||||
|
{
|
||||||
|
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap returnedData = output.value< QVariantMap >();
|
||||||
|
switch ( requestData.type )
|
||||||
|
{
|
||||||
|
case InfoSystem::InfoArtistSimilars:
|
||||||
|
{
|
||||||
|
m_relatedModel->clear();
|
||||||
|
const QStringList artists = returnedData["artists"].toStringList();
|
||||||
|
foreach ( const QString& artist, artists )
|
||||||
|
{
|
||||||
|
m_relatedModel->addArtists( Artist::get( artist ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
RelatedArtistsContext::infoSystemFinished( QString target )
|
||||||
|
{
|
||||||
|
Q_UNUSED( target );
|
||||||
|
}
|
67
src/libtomahawk/context/pages/RelatedArtistsContext.h
Normal file
67
src/libtomahawk/context/pages/RelatedArtistsContext.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RELATEDARTISTSCONTEXT_H
|
||||||
|
#define RELATEDARTISTSCONTEXT_H
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
#include "context/ContextPage.h"
|
||||||
|
#include "infosystem/infosystem.h"
|
||||||
|
|
||||||
|
class TreeModel;
|
||||||
|
class ArtistView;
|
||||||
|
|
||||||
|
class DLLEXPORT RelatedArtistsContext : public Tomahawk::ContextPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
RelatedArtistsContext();
|
||||||
|
~RelatedArtistsContext();
|
||||||
|
|
||||||
|
virtual QGraphicsWidget* widget() { return m_proxy; }
|
||||||
|
|
||||||
|
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||||
|
|
||||||
|
virtual QString title() const { return tr( "Related Artists" ); }
|
||||||
|
virtual QString description() const { return QString(); }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack() { return false; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
|
void infoSystemFinished( QString target );
|
||||||
|
|
||||||
|
private:
|
||||||
|
ArtistView* m_relatedView;
|
||||||
|
TreeModel* m_relatedModel;
|
||||||
|
|
||||||
|
QGraphicsProxyWidget* m_proxy;
|
||||||
|
|
||||||
|
QString m_infoId;
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RELATEDARTISTSCONTEXT_H
|
128
src/libtomahawk/context/pages/TopTracksContext.cpp
Normal file
128
src/libtomahawk/context/pages/TopTracksContext.cpp
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TopTracksContext.h"
|
||||||
|
|
||||||
|
#include "playlist/playlistmodel.h"
|
||||||
|
#include "playlist/playlistview.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
TopTracksContext::TopTracksContext()
|
||||||
|
: ContextPage()
|
||||||
|
, m_infoId( uuid() )
|
||||||
|
{
|
||||||
|
m_topHitsView = new PlaylistView();
|
||||||
|
m_topHitsView->setUpdatesContextView( false );
|
||||||
|
m_topHitsModel = new PlaylistModel( m_topHitsView );
|
||||||
|
m_topHitsModel->setStyle( TrackModel::Short );
|
||||||
|
m_topHitsView->setTrackModel( m_topHitsModel );
|
||||||
|
m_topHitsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
m_topHitsView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
|
|
||||||
|
QPalette pal = m_topHitsView->palette();
|
||||||
|
pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
|
||||||
|
m_topHitsView->setPalette( pal );
|
||||||
|
|
||||||
|
m_proxy = new QGraphicsProxyWidget();
|
||||||
|
m_proxy->setWidget( m_topHitsView );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||||
|
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
|
||||||
|
SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) );
|
||||||
|
|
||||||
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TopTracksContext::~TopTracksContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TopTracksContext::setQuery( const Tomahawk::query_ptr& query )
|
||||||
|
{
|
||||||
|
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoCriteriaHash artistInfo;
|
||||||
|
artistInfo["artist"] = query->artist();
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoRequestData requestData;
|
||||||
|
requestData.caller = m_infoId;
|
||||||
|
requestData.customData = QVariantMap();
|
||||||
|
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( artistInfo );
|
||||||
|
|
||||||
|
requestData.type = Tomahawk::InfoSystem::InfoArtistSongs;
|
||||||
|
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TopTracksContext::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
||||||
|
{
|
||||||
|
if ( requestData.caller != m_infoId )
|
||||||
|
return;
|
||||||
|
|
||||||
|
InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
|
trackInfo = requestData.input.value< InfoSystem::InfoCriteriaHash >();
|
||||||
|
|
||||||
|
if ( output.canConvert< QVariantMap >() )
|
||||||
|
{
|
||||||
|
if ( trackInfo["artist"] != m_query->artist() )
|
||||||
|
{
|
||||||
|
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_query->artist();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap returnedData = output.value< QVariantMap >();
|
||||||
|
switch ( requestData.type )
|
||||||
|
{
|
||||||
|
case InfoSystem::InfoArtistSongs:
|
||||||
|
{
|
||||||
|
m_topHitsModel->clear();
|
||||||
|
const QStringList tracks = returnedData["tracks"].toStringList();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
foreach ( const QString& track, tracks )
|
||||||
|
{
|
||||||
|
query_ptr query = Query::get( m_query->artist(), track, QString(), uuid() );
|
||||||
|
m_topHitsModel->append( query );
|
||||||
|
|
||||||
|
if ( ++i == 15 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TopTracksContext::infoSystemFinished( QString target )
|
||||||
|
{
|
||||||
|
Q_UNUSED( target );
|
||||||
|
}
|
67
src/libtomahawk/context/pages/TopTracksContext.h
Normal file
67
src/libtomahawk/context/pages/TopTracksContext.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TOPTRACKSCONTEXT_H
|
||||||
|
#define TOPTRACKSCONTEXT_H
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
#include "context/ContextPage.h"
|
||||||
|
#include "infosystem/infosystem.h"
|
||||||
|
|
||||||
|
class PlaylistModel;
|
||||||
|
class PlaylistView;
|
||||||
|
|
||||||
|
class DLLEXPORT TopTracksContext : public Tomahawk::ContextPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TopTracksContext();
|
||||||
|
~TopTracksContext();
|
||||||
|
|
||||||
|
virtual QGraphicsWidget* widget() { return m_proxy; }
|
||||||
|
|
||||||
|
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||||
|
|
||||||
|
virtual QString title() const { return tr( "Top Hits" ); }
|
||||||
|
virtual QString description() const { return QString(); }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack() { return false; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
|
void infoSystemFinished( QString target );
|
||||||
|
|
||||||
|
private:
|
||||||
|
PlaylistView* m_topHitsView;
|
||||||
|
PlaylistModel* m_topHitsModel;
|
||||||
|
|
||||||
|
QGraphicsProxyWidget* m_proxy;
|
||||||
|
|
||||||
|
QString m_infoId;
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TOPTRACKSCONTEXT_H
|
37
src/libtomahawk/context/pages/WebContext.cpp
Normal file
37
src/libtomahawk/context/pages/WebContext.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "WebContext.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
WebContext::WebContext()
|
||||||
|
: ContextPage()
|
||||||
|
{
|
||||||
|
m_webView = new QGraphicsWebView();
|
||||||
|
|
||||||
|
QPalette pal = m_webView->palette();
|
||||||
|
pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
|
||||||
|
m_webView->setPalette( pal );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WebContext::~WebContext()
|
||||||
|
{
|
||||||
|
}
|
45
src/libtomahawk/context/pages/WebContext.h
Normal file
45
src/libtomahawk/context/pages/WebContext.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WEBCONTEXT_H
|
||||||
|
#define WEBCONTEXT_H
|
||||||
|
|
||||||
|
#include <QGraphicsWebView>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
#include "context/ContextPage.h"
|
||||||
|
|
||||||
|
class DLLEXPORT WebContext : public Tomahawk::ContextPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
WebContext();
|
||||||
|
~WebContext();
|
||||||
|
|
||||||
|
QGraphicsWebView* webView() const { return m_webView; }
|
||||||
|
virtual QGraphicsWidget* widget() { return m_webView; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QGraphicsWebView* m_webView;
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WEBCONTEXT_H
|
43
src/libtomahawk/context/pages/WikipediaContext.cpp
Normal file
43
src/libtomahawk/context/pages/WikipediaContext.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "WikipediaContext.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WikipediaContext::setQuery( const Tomahawk::query_ptr& query )
|
||||||
|
{
|
||||||
|
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
webView()->load( QString( "http://en.wikipedia.org/w/index.php?printable=yes&title=%1" ).arg( query->artist() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LastfmContext::setQuery( const Tomahawk::query_ptr& query )
|
||||||
|
{
|
||||||
|
if ( !m_query.isNull() && query->artist() == m_query->artist() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
webView()->load( QString( "http://last.fm/music/%1" ).arg( query->artist() ) );
|
||||||
|
}
|
74
src/libtomahawk/context/pages/WikipediaContext.h
Normal file
74
src/libtomahawk/context/pages/WikipediaContext.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WIKIPEDIACONTEXT_H
|
||||||
|
#define WIKIPEDIACONTEXT_H
|
||||||
|
|
||||||
|
#include <QGraphicsProxyWidget>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
#include "WebContext.h"
|
||||||
|
|
||||||
|
class DLLEXPORT WikipediaContext : public WebContext
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
WikipediaContext() : WebContext() {}
|
||||||
|
~WikipediaContext() {}
|
||||||
|
|
||||||
|
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||||
|
|
||||||
|
virtual QString title() const { return tr( "Wikipedia" ); }
|
||||||
|
virtual QString description() const { return QString(); }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack() { return false; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
private:
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DLLEXPORT LastfmContext : public WebContext
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
LastfmContext() : WebContext() {}
|
||||||
|
~LastfmContext() {}
|
||||||
|
|
||||||
|
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
|
||||||
|
|
||||||
|
virtual QString title() const { return tr( "Last.fm" ); }
|
||||||
|
virtual QString description() const { return QString(); }
|
||||||
|
|
||||||
|
virtual bool jumpToCurrentTrack() { return false; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
private:
|
||||||
|
Tomahawk::query_ptr m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WIKIPEDIACONTEXT_H
|
@@ -467,7 +467,7 @@ GlobalActionManager::handleSearchCommand( const QUrl& url )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
ViewManager::instance()->showSuperCollection();
|
ViewManager::instance()->showSuperCollection();
|
||||||
ViewManager::instance()->topbar()->setFilter( queryStr );
|
// ViewManager::instance()->topbar()->setFilter( queryStr );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,22 +20,25 @@
|
|||||||
#include "ui_infobar.h"
|
#include "ui_infobar.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
#include "context/ContextWidget.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
|
#define ANIMATION_TIME 400
|
||||||
#define IMAGE_HEIGHT 64
|
#define IMAGE_HEIGHT 64
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
InfoBar::InfoBar( QWidget* parent )
|
InfoBar::InfoBar( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::InfoBar )
|
, ui( new Ui::InfoBar )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
layout()->setSpacing( 0 );
|
TomahawkUtils::unmarginLayout( layout() );
|
||||||
layout()->setContentsMargins( 0, 0, 0, 0 );
|
layout()->setContentsMargins( 8, 4, 8, 4 );
|
||||||
|
|
||||||
QFont boldFont = ui->captionLabel->font();
|
QFont boldFont = ui->captionLabel->font();
|
||||||
boldFont.setPixelSize( 18 );
|
boldFont.setPixelSize( 18 );
|
||||||
|
@@ -23,6 +23,11 @@
|
|||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
#include "query.h"
|
||||||
|
|
||||||
|
class QTimeLine;
|
||||||
|
class ContextWidget;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class InfoBar;
|
class InfoBar;
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>774</width>
|
||||||
<height>72</height>
|
<height>80</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -25,23 +25,12 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>InfoBar</string>
|
<string>InfoBar</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,1,0,99,0">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="orientation">
|
<property name="sizeConstraint">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="imageLabel">
|
<widget class="QLabel" name="imageLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -74,7 +63,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetMinimumSize</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ElidedLabel" name="captionLabel">
|
<widget class="ElidedLabel" name="captionLabel">
|
||||||
@@ -87,6 +76,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -100,6 +92,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>TextLabel</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -171,21 +166,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@@ -117,7 +117,7 @@ PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const
|
|||||||
opacity = item->query()->results().first()->score();
|
opacity = item->query()->results().first()->score();
|
||||||
|
|
||||||
opacity = qMax( (float)0.3, opacity );
|
opacity = qMax( (float)0.3, opacity );
|
||||||
QColor textColor = TomahawkUtils::alphaBlend( option->palette.color( QPalette::Foreground ), option->palette.color( QPalette::Background ), opacity );
|
QColor textColor = TomahawkUtils::alphaBlend( option->palette.color( QPalette::Text ), option->palette.color( QPalette::BrightText ), opacity );
|
||||||
|
|
||||||
option->palette.setColor( QPalette::Text, textColor );
|
option->palette.setColor( QPalette::Text, textColor );
|
||||||
}
|
}
|
||||||
|
@@ -176,8 +176,8 @@ PlaylistModel::clear()
|
|||||||
emit beginResetModel();
|
emit beginResetModel();
|
||||||
delete m_rootItem;
|
delete m_rootItem;
|
||||||
m_rootItem = 0;
|
m_rootItem = 0;
|
||||||
emit endResetModel();
|
|
||||||
m_rootItem = new TrackModelItem( 0, this );
|
m_rootItem = new TrackModelItem( 0, this );
|
||||||
|
emit endResetModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,11 +24,11 @@
|
|||||||
|
|
||||||
#include "trackheader.h"
|
#include "trackheader.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
#include "queueview.h"
|
|
||||||
#include "trackmodel.h"
|
#include "trackmodel.h"
|
||||||
#include "trackproxymodel.h"
|
#include "trackproxymodel.h"
|
||||||
|
|
||||||
#include "audio/audioengine.h"
|
#include "audio/audioengine.h"
|
||||||
|
#include "context/ContextWidget.h"
|
||||||
#include "widgets/overlaywidget.h"
|
#include "widgets/overlaywidget.h"
|
||||||
#include "dynamic/widgets/LoadingSpinner.h"
|
#include "dynamic/widgets/LoadingSpinner.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
@@ -48,6 +48,7 @@ TrackView::TrackView( QWidget* parent )
|
|||||||
, m_loadingSpinner( new LoadingSpinner( this ) )
|
, m_loadingSpinner( new LoadingSpinner( this ) )
|
||||||
, m_resizing( false )
|
, m_resizing( false )
|
||||||
, m_dragging( false )
|
, m_dragging( false )
|
||||||
|
, m_updateContextView( true )
|
||||||
, m_contextMenu( new ContextMenu( this ) )
|
, m_contextMenu( new ContextMenu( this ) )
|
||||||
{
|
{
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
@@ -154,6 +155,20 @@ TrackView::setTrackModel( TrackModel* model )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackView::currentChanged( const QModelIndex& current, const QModelIndex& /* previous */ )
|
||||||
|
{
|
||||||
|
if ( !m_updateContextView )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TrackModelItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( current ) );
|
||||||
|
if ( item )
|
||||||
|
{
|
||||||
|
ViewManager::instance()->context()->setQuery( item->query() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackView::onItemActivated( const QModelIndex& index )
|
TrackView::onItemActivated( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
|
@@ -62,6 +62,9 @@ explicit TrackView( QWidget* parent = 0 );
|
|||||||
QModelIndex contextMenuIndex() const { return m_contextMenuIndex; }
|
QModelIndex contextMenuIndex() const { return m_contextMenuIndex; }
|
||||||
void setContextMenuIndex( const QModelIndex& idx ) { m_contextMenuIndex = idx; }
|
void setContextMenuIndex( const QModelIndex& idx ) { m_contextMenuIndex = idx; }
|
||||||
|
|
||||||
|
bool updatesContextView() const { return m_updateContextView; }
|
||||||
|
void setUpdatesContextView( bool b ) { m_updateContextView = b; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onItemActivated( const QModelIndex& index );
|
void onItemActivated( const QModelIndex& index );
|
||||||
|
|
||||||
@@ -84,6 +87,9 @@ protected:
|
|||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
void keyPressEvent( QKeyEvent* event );
|
void keyPressEvent( QKeyEvent* event );
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual void currentChanged( const QModelIndex& current, const QModelIndex& previous );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onItemResized( const QModelIndex& index );
|
void onItemResized( const QModelIndex& index );
|
||||||
void onFilterChanged( const QString& filter );
|
void onFilterChanged( const QString& filter );
|
||||||
@@ -105,6 +111,8 @@ private:
|
|||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
QRect m_dropRect;
|
QRect m_dropRect;
|
||||||
|
|
||||||
|
bool m_updateContextView;
|
||||||
|
|
||||||
QModelIndex m_hoveredIndex;
|
QModelIndex m_hoveredIndex;
|
||||||
QModelIndex m_contextMenuIndex;
|
QModelIndex m_contextMenuIndex;
|
||||||
Tomahawk::ContextMenu* m_contextMenu;
|
Tomahawk::ContextMenu* m_contextMenu;
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <QMetaMethod>
|
#include <QMetaMethod>
|
||||||
|
|
||||||
#include "audio/audioengine.h"
|
#include "audio/audioengine.h"
|
||||||
|
#include "context/ContextWidget.h"
|
||||||
#include "utils/animatedsplitter.h"
|
#include "utils/animatedsplitter.h"
|
||||||
#include "infobar/infobar.h"
|
#include "infobar/infobar.h"
|
||||||
#include "topbar/topbar.h"
|
#include "topbar/topbar.h"
|
||||||
@@ -31,7 +32,6 @@
|
|||||||
#include "collectionview.h"
|
#include "collectionview.h"
|
||||||
#include "playlistmodel.h"
|
#include "playlistmodel.h"
|
||||||
#include "playlistview.h"
|
#include "playlistview.h"
|
||||||
#include "queueview.h"
|
|
||||||
#include "trackproxymodel.h"
|
#include "trackproxymodel.h"
|
||||||
#include "trackmodel.h"
|
#include "trackmodel.h"
|
||||||
#include "artistview.h"
|
#include "artistview.h"
|
||||||
@@ -77,37 +77,27 @@ ViewManager::ViewManager( QObject* parent )
|
|||||||
|
|
||||||
m_widget->setLayout( new QVBoxLayout() );
|
m_widget->setLayout( new QVBoxLayout() );
|
||||||
|
|
||||||
m_topbar = new TopBar();
|
// m_topbar = new TopBar();
|
||||||
m_infobar = new InfoBar();
|
m_infobar = new InfoBar();
|
||||||
m_stack = new QStackedWidget();
|
m_stack = new QStackedWidget();
|
||||||
|
|
||||||
m_splitter = new AnimatedSplitter();
|
/* m_splitter = new AnimatedSplitter();
|
||||||
m_splitter->setOrientation( Qt::Vertical );
|
m_splitter->setOrientation( Qt::Vertical );
|
||||||
m_splitter->setChildrenCollapsible( false );
|
m_splitter->setChildrenCollapsible( false );
|
||||||
m_splitter->setGreedyWidget( 0 );
|
m_splitter->setGreedyWidget( 0 );
|
||||||
m_splitter->addWidget( m_stack );
|
m_splitter->addWidget( m_stack );*/
|
||||||
|
|
||||||
m_queueButton = new QPushButton();
|
// m_splitter->addWidget( m_queueView );
|
||||||
m_queueButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
|
// m_splitter->hide( 1, false );
|
||||||
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
|
|
||||||
|
|
||||||
m_queueView = new QueueView( m_splitter );
|
m_contextWidget = new ContextWidget();
|
||||||
m_queueModel = new PlaylistModel( m_queueView );
|
|
||||||
m_queueView->queue()->setPlaylistModel( m_queueModel );
|
|
||||||
m_queueView->queue()->playlistModel()->setReadOnly( false );
|
|
||||||
AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel() );
|
|
||||||
|
|
||||||
m_splitter->addWidget( m_queueView );
|
|
||||||
m_splitter->hide( 1, false );
|
|
||||||
|
|
||||||
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_widget->layout()->addWidget( m_stack );
|
||||||
|
m_widget->layout()->addWidget( m_contextWidget );
|
||||||
|
// 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 );
|
||||||
@@ -132,12 +122,11 @@ 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 ) ), SLOT( setFilter( QString ) ) );
|
/* connect( m_topbar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
||||||
connect( m_topbar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
|
connect( m_topbar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
|
||||||
connect( m_topbar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
|
connect( m_topbar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
|
||||||
connect( m_topbar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );
|
connect( m_topbar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -148,13 +137,6 @@ ViewManager::~ViewManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlaylistView*
|
|
||||||
ViewManager::queue() const
|
|
||||||
{
|
|
||||||
return m_queueView->queue();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PlaylistView*
|
PlaylistView*
|
||||||
ViewManager::createPageForPlaylist( const playlist_ptr& pl )
|
ViewManager::createPageForPlaylist( const playlist_ptr& pl )
|
||||||
{
|
{
|
||||||
@@ -218,10 +200,10 @@ ViewManager::show( const Tomahawk::dynplaylist_ptr& playlist )
|
|||||||
|
|
||||||
setPage( m_dynamicWidgets.value( playlist ).data() );
|
setPage( m_dynamicWidgets.value( playlist ).data() );
|
||||||
|
|
||||||
if ( playlist->mode() == Tomahawk::OnDemand )
|
/* if ( playlist->mode() == Tomahawk::OnDemand )
|
||||||
m_queueView->hide();
|
hideQueue();
|
||||||
else
|
else
|
||||||
m_queueView->show();
|
showQueue();*/
|
||||||
|
|
||||||
emit numSourcesChanged( SourceList::instance()->count() );
|
emit numSourcesChanged( SourceList::instance()->count() );
|
||||||
|
|
||||||
@@ -491,42 +473,6 @@ ViewManager::setAlbumMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ViewManager::showQueue()
|
|
||||||
{
|
|
||||||
if ( QThread::currentThread() != thread() )
|
|
||||||
{
|
|
||||||
qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
|
||||||
QMetaObject::invokeMethod( this, "showQueue", Qt::QueuedConnection );
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ViewManager::hideQueue()
|
|
||||||
{
|
|
||||||
if ( QThread::currentThread() != thread() )
|
|
||||||
{
|
|
||||||
qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
|
||||||
QMetaObject::invokeMethod( this, "hideQueue", Qt::QueuedConnection );
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::historyBack()
|
ViewManager::historyBack()
|
||||||
{
|
{
|
||||||
@@ -699,7 +645,7 @@ ViewManager::updateView()
|
|||||||
connect( currentPlaylistInterface()->object(), SIGNAL( shuffleModeChanged( bool ) ),
|
connect( currentPlaylistInterface()->object(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||||
SIGNAL( shuffleModeChanged( bool ) ) );
|
SIGNAL( shuffleModeChanged( bool ) ) );
|
||||||
|
|
||||||
m_topbar->setFilter( currentPlaylistInterface()->filter() );
|
// m_topbar->setFilter( currentPlaylistInterface()->filter() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currentPage()->showStatsBar() && currentPlaylistInterface() )
|
if ( currentPage()->showStatsBar() && currentPlaylistInterface() )
|
||||||
@@ -716,19 +662,19 @@ ViewManager::updateView()
|
|||||||
emit modeChanged( currentPlaylistInterface()->viewMode() );
|
emit modeChanged( currentPlaylistInterface()->viewMode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currentPage()->queueVisible() )
|
/* if ( currentPage()->queueVisible() )
|
||||||
m_queueView->show();
|
showQueue();
|
||||||
else
|
else
|
||||||
m_queueView->hide();
|
hideQueue();*/
|
||||||
|
|
||||||
emit statsAvailable( currentPage()->showStatsBar() );
|
emit statsAvailable( currentPage()->showStatsBar() );
|
||||||
emit modesAvailable( currentPage()->showModes() );
|
emit modesAvailable( currentPage()->showModes() );
|
||||||
emit filterAvailable( currentPage()->showFilter() );
|
emit filterAvailable( currentPage()->showFilter() );
|
||||||
|
|
||||||
if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
|
/* if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
|
||||||
m_topbar->setVisible( false );
|
m_topbar->setVisible( false );
|
||||||
else
|
else
|
||||||
m_topbar->setVisible( true );
|
m_topbar->setVisible( true );*/
|
||||||
|
|
||||||
m_infobar->setVisible( currentPage()->showInfoBar() );
|
m_infobar->setVisible( currentPage()->showInfoBar() );
|
||||||
m_infobar->setCaption( currentPage()->title() );
|
m_infobar->setCaption( currentPage()->title() );
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
#include "playlistinterface.h"
|
#include "playlistinterface.h"
|
||||||
|
#include "playlist/queueview.h"
|
||||||
#include "viewpage.h"
|
#include "viewpage.h"
|
||||||
#include "widgets/welcomewidget.h"
|
#include "widgets/welcomewidget.h"
|
||||||
#include "widgets/whatshotwidget.h"
|
#include "widgets/whatshotwidget.h"
|
||||||
@@ -40,9 +41,9 @@ class ArtistView;
|
|||||||
class CollectionModel;
|
class CollectionModel;
|
||||||
class CollectionFlatModel;
|
class CollectionFlatModel;
|
||||||
class CollectionView;
|
class CollectionView;
|
||||||
|
class ContextWidget;
|
||||||
class PlaylistModel;
|
class PlaylistModel;
|
||||||
class PlaylistView;
|
class PlaylistView;
|
||||||
class QueueView;
|
|
||||||
class TrackProxyModel;
|
class TrackProxyModel;
|
||||||
class TrackModel;
|
class TrackModel;
|
||||||
class TreeProxyModel;
|
class TreeProxyModel;
|
||||||
@@ -71,8 +72,11 @@ public:
|
|||||||
~ViewManager();
|
~ViewManager();
|
||||||
|
|
||||||
QWidget* widget() const { return m_widget; }
|
QWidget* widget() const { return m_widget; }
|
||||||
PlaylistView* queue() const;
|
InfoBar* infobar() const { return m_infobar; }
|
||||||
TopBar* topbar() const { return m_topbar; }
|
ContextWidget* context() const { return m_contextWidget; }
|
||||||
|
|
||||||
|
PlaylistView* queue() const { return m_queue->queue(); }
|
||||||
|
void setQueue( QueueView* queue ) { m_queue = queue; }
|
||||||
|
|
||||||
bool isSuperCollectionVisible() const;
|
bool isSuperCollectionVisible() const;
|
||||||
bool isNewPlaylistPageVisible() const;
|
bool isNewPlaylistPageVisible() const;
|
||||||
@@ -120,6 +124,9 @@ signals:
|
|||||||
void tempPageActivated( Tomahawk::ViewPage* );
|
void tempPageActivated( Tomahawk::ViewPage* );
|
||||||
void viewPageActivated( Tomahawk::ViewPage* );
|
void viewPageActivated( Tomahawk::ViewPage* );
|
||||||
|
|
||||||
|
void showQueueRequested();
|
||||||
|
void hideQueueRequested();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Tomahawk::ViewPage* showSuperCollection();
|
Tomahawk::ViewPage* showSuperCollection();
|
||||||
Tomahawk::ViewPage* showWelcomePage();
|
Tomahawk::ViewPage* showWelcomePage();
|
||||||
@@ -137,13 +144,13 @@ public slots:
|
|||||||
void historyBack();
|
void historyBack();
|
||||||
void removeFromHistory( Tomahawk::ViewPage* p );
|
void removeFromHistory( Tomahawk::ViewPage* p );
|
||||||
|
|
||||||
|
void showQueue() { emit showQueueRequested(); }
|
||||||
|
void hideQueue() { emit hideQueueRequested(); }
|
||||||
|
|
||||||
void setTreeMode();
|
void setTreeMode();
|
||||||
void setTableMode();
|
void setTableMode();
|
||||||
void setAlbumMode();
|
void setAlbumMode();
|
||||||
|
|
||||||
void showQueue();
|
|
||||||
void hideQueue();
|
|
||||||
|
|
||||||
void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode );
|
void setRepeatMode( Tomahawk::PlaylistInterface::RepeatMode mode );
|
||||||
void setShuffled( bool enabled );
|
void setShuffled( bool enabled );
|
||||||
|
|
||||||
@@ -172,18 +179,15 @@ private:
|
|||||||
|
|
||||||
QWidget* m_widget;
|
QWidget* m_widget;
|
||||||
InfoBar* m_infobar;
|
InfoBar* m_infobar;
|
||||||
TopBar* m_topbar;
|
ContextWidget* m_contextWidget;
|
||||||
QPushButton* m_queueButton;
|
|
||||||
QStackedWidget* m_stack;
|
QStackedWidget* m_stack;
|
||||||
AnimatedSplitter* m_splitter;
|
AnimatedSplitter* m_splitter;
|
||||||
|
|
||||||
PlaylistModel* m_queueModel;
|
|
||||||
QueueView* m_queueView;
|
|
||||||
|
|
||||||
AlbumModel* m_superAlbumModel;
|
AlbumModel* m_superAlbumModel;
|
||||||
AlbumView* m_superAlbumView;
|
AlbumView* m_superAlbumView;
|
||||||
TreeModel* m_superCollectionModel;
|
TreeModel* m_superCollectionModel;
|
||||||
ArtistView* m_superCollectionView;
|
ArtistView* m_superCollectionView;
|
||||||
|
QueueView* m_queue;
|
||||||
WelcomeWidget* m_welcomeWidget;
|
WelcomeWidget* m_welcomeWidget;
|
||||||
WhatsHotWidget* m_whatsHotWidget;
|
WhatsHotWidget* m_whatsHotWidget;
|
||||||
|
|
||||||
|
@@ -34,7 +34,6 @@ class DLLEXPORT ViewPage
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ViewPage() {}
|
ViewPage() {}
|
||||||
|
|
||||||
virtual ~ViewPage() {}
|
virtual ~ViewPage() {}
|
||||||
|
|
||||||
virtual QWidget* widget() = 0;
|
virtual QWidget* widget() = 0;
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "HeaderLabel.h"
|
#include "HeaderLabel.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
@@ -51,6 +52,23 @@ HeaderLabel::sizeHint() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
HeaderLabel::mousePressEvent( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
QFrame::mousePressEvent( event );
|
||||||
|
m_time.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
HeaderLabel::mouseReleaseEvent( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
QFrame::mouseReleaseEvent( event );
|
||||||
|
if ( m_time.elapsed() < qApp->doubleClickInterval() )
|
||||||
|
emit clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HeaderLabel::paintEvent( QPaintEvent* /* event */ )
|
HeaderLabel::paintEvent( QPaintEvent* /* event */ )
|
||||||
{
|
{
|
||||||
@@ -58,7 +76,7 @@ HeaderLabel::paintEvent( QPaintEvent* /* event */ )
|
|||||||
QRect r = contentsRect();
|
QRect r = contentsRect();
|
||||||
StyleHelper::horizontalHeader(&p, r);
|
StyleHelper::horizontalHeader(&p, r);
|
||||||
|
|
||||||
QTextOption to( Qt::AlignVCenter );
|
QTextOption to( alignment() | Qt::AlignVCenter );
|
||||||
r.adjust( 8, 0, -8, 0 );
|
r.adjust( 8, 0, -8, 0 );
|
||||||
p.setPen( StyleHelper::headerTextColor() );
|
p.setPen( StyleHelper::headerTextColor() );
|
||||||
p.drawText( r, text(), to );
|
p.drawText( r, text(), to );
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#define HEADERLABEL_H
|
#define HEADERLABEL_H
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
@@ -38,14 +39,19 @@ public:
|
|||||||
QSize minimumSizeHint() const { return sizeHint(); }
|
QSize minimumSizeHint() const { return sizeHint(); }
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
public slots:
|
signals:
|
||||||
|
void clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// void changeEvent( QEvent* e );
|
// void changeEvent( QEvent* e );
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
|
|
||||||
|
void mousePressEvent( QMouseEvent* event );
|
||||||
|
void mouseReleaseEvent( QMouseEvent* event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* m_parent;
|
QWidget* m_parent;
|
||||||
|
QTime m_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HEADERLABEL_H
|
#endif // HEADERLABEL_H
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
|
||||||
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent )
|
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::ArtistInfoWidget )
|
, ui( new Ui::ArtistInfoWidget )
|
||||||
@@ -120,10 +121,7 @@ void
|
|||||||
ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
||||||
{
|
{
|
||||||
if ( requestData.caller != m_infoId )
|
if ( requestData.caller != m_infoId )
|
||||||
{
|
|
||||||
// qDebug() << "Info of wrong type or not with our identifier";
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
InfoSystem::InfoCriteriaHash trackInfo;
|
InfoSystem::InfoCriteriaHash trackInfo;
|
||||||
trackInfo = requestData.input.value< InfoSystem::InfoCriteriaHash >();
|
trackInfo = requestData.input.value< InfoSystem::InfoCriteriaHash >();
|
||||||
@@ -137,7 +135,6 @@ ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ARTISTINFOWIDGET got infosystem info for:" << m_title << output.value< Tomahawk::InfoSystem::InfoGenericMap >();
|
|
||||||
QVariantMap returnedData = output.value< QVariantMap >();
|
QVariantMap returnedData = output.value< QVariantMap >();
|
||||||
switch ( requestData.type )
|
switch ( requestData.type )
|
||||||
{
|
{
|
||||||
|
@@ -43,7 +43,6 @@
|
|||||||
#include "sourcetree/sourcetreeview.h"
|
#include "sourcetree/sourcetreeview.h"
|
||||||
#include "utils/animatedsplitter.h"
|
#include "utils/animatedsplitter.h"
|
||||||
#include "utils/proxystyle.h"
|
#include "utils/proxystyle.h"
|
||||||
#include "utils/widgetdragfilter.h"
|
|
||||||
#include "utils/xspfloader.h"
|
#include "utils/xspfloader.h"
|
||||||
#include "widgets/newplaylistwidget.h"
|
#include "widgets/newplaylistwidget.h"
|
||||||
#include "widgets/searchwidget.h"
|
#include "widgets/searchwidget.h"
|
||||||
@@ -59,6 +58,7 @@
|
|||||||
#include "tomahawktrayicon.h"
|
#include "tomahawktrayicon.h"
|
||||||
#include "playlist/dynamic/GeneratorInterface.h"
|
#include "playlist/dynamic/GeneratorInterface.h"
|
||||||
#include "scanmanager.h"
|
#include "scanmanager.h"
|
||||||
|
#include "playlist/queueview.h"
|
||||||
#include "tomahawkapp.h"
|
#include "tomahawkapp.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
@@ -80,7 +80,10 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
{
|
{
|
||||||
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
|
|
||||||
new ViewManager( this );
|
ViewManager* vm = new ViewManager( this );
|
||||||
|
connect( vm, SIGNAL( showQueueRequested() ), SLOT( showQueue() ) );
|
||||||
|
connect( vm, SIGNAL( hideQueueRequested() ), SLOT( hideQueue() ) );
|
||||||
|
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
applyPlatformTweaks();
|
applyPlatformTweaks();
|
||||||
|
|
||||||
@@ -96,7 +99,8 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
|
|
||||||
// set initial state
|
// set initial state
|
||||||
onSipDisconnected();
|
onSipDisconnected();
|
||||||
ViewManager::instance()->showWelcomePage();
|
vm->setQueue( m_queueView );
|
||||||
|
vm->showWelcomePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -184,28 +188,49 @@ TomahawkWindow::setupSideBar()
|
|||||||
QWidget* sidebarWidget = new QWidget();
|
QWidget* sidebarWidget = new QWidget();
|
||||||
sidebarWidget->setLayout( new QVBoxLayout() );
|
sidebarWidget->setLayout( new QVBoxLayout() );
|
||||||
|
|
||||||
AnimatedSplitter* sidebar = new AnimatedSplitter();
|
m_sidebar = new AnimatedSplitter();
|
||||||
sidebar->setOrientation( Qt::Vertical );
|
m_sidebar->setOrientation( Qt::Vertical );
|
||||||
sidebar->setChildrenCollapsible( false );
|
m_sidebar->setChildrenCollapsible( false );
|
||||||
|
|
||||||
m_searchWidget = new QSearchField( sidebar );
|
m_searchWidget = new QSearchField( m_sidebar );
|
||||||
m_searchWidget->setPlaceholderText( "Global Search..." );
|
m_searchWidget->setPlaceholderText( "Global Search..." );
|
||||||
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
|
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
|
||||||
|
|
||||||
m_sourcetree = new SourceTreeView();
|
m_sourcetree = new SourceTreeView();
|
||||||
TransferView* transferView = new TransferView( sidebar );
|
TransferView* transferView = new TransferView( m_sidebar );
|
||||||
PipelineStatusView* pipelineView = new PipelineStatusView( sidebar );
|
PipelineStatusView* pipelineView = new PipelineStatusView( m_sidebar );
|
||||||
|
|
||||||
sidebar->addWidget( m_searchWidget );
|
m_queueButton = new QPushButton();
|
||||||
sidebar->addWidget( m_sourcetree );
|
m_queueButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
|
||||||
sidebar->addWidget( transferView );
|
m_queueButton->setText( tr( "Click to show queue" ) );
|
||||||
sidebar->addWidget( pipelineView );
|
#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
|
||||||
|
|
||||||
sidebar->setGreedyWidget( 1 );
|
connect( m_queueButton, SIGNAL( clicked() ), SLOT( showQueue() ) );
|
||||||
sidebar->hide( 1, false );
|
|
||||||
sidebar->hide( 2, false );
|
|
||||||
|
|
||||||
sidebarWidget->layout()->addWidget( sidebar );
|
m_queueView = new QueueView( m_sidebar );
|
||||||
|
m_queueModel = new PlaylistModel( m_queueView );
|
||||||
|
m_queueModel->setStyle( PlaylistModel::Short );
|
||||||
|
m_queueView->queue()->setPlaylistModel( m_queueModel );
|
||||||
|
m_queueView->queue()->playlistModel()->setReadOnly( false );
|
||||||
|
AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel() );
|
||||||
|
|
||||||
|
m_sidebar->addWidget( m_searchWidget );
|
||||||
|
m_sidebar->addWidget( m_sourcetree );
|
||||||
|
m_sidebar->addWidget( transferView );
|
||||||
|
m_sidebar->addWidget( pipelineView );
|
||||||
|
m_sidebar->addWidget( m_queueView );
|
||||||
|
|
||||||
|
m_sidebar->setGreedyWidget( 1 );
|
||||||
|
m_sidebar->hide( 1, false );
|
||||||
|
m_sidebar->hide( 2, false );
|
||||||
|
m_sidebar->hide( 3, false );
|
||||||
|
m_sidebar->hide( 4, false );
|
||||||
|
|
||||||
|
sidebarWidget->layout()->addWidget( m_sidebar );
|
||||||
|
sidebarWidget->layout()->addWidget( m_queueButton );
|
||||||
sidebarWidget->setContentsMargins( 0, 0, 0, 0 );
|
sidebarWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||||
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||||
sidebarWidget->layout()->setMargin( 0 );
|
sidebarWidget->layout()->setMargin( 0 );
|
||||||
@@ -225,6 +250,7 @@ TomahawkWindow::setupSideBar()
|
|||||||
ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::setupUpdateCheck()
|
TomahawkWindow::setupUpdateCheck()
|
||||||
{
|
{
|
||||||
@@ -663,6 +689,42 @@ TomahawkWindow::onFilterEdited()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::showQueue()
|
||||||
|
{
|
||||||
|
if ( QThread::currentThread() != thread() )
|
||||||
|
{
|
||||||
|
qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
||||||
|
QMetaObject::invokeMethod( this, "showQueue", Qt::QueuedConnection );
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::hideQueue()
|
||||||
|
{
|
||||||
|
if ( QThread::currentThread() != thread() )
|
||||||
|
{
|
||||||
|
qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
||||||
|
QMetaObject::invokeMethod( this, "hideQueue", Qt::QueuedConnection );
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::minimize()
|
TomahawkWindow::minimize()
|
||||||
{
|
{
|
||||||
|
@@ -35,6 +35,9 @@ class QAction;
|
|||||||
class MusicScanner;
|
class MusicScanner;
|
||||||
class AudioControls;
|
class AudioControls;
|
||||||
class TomahawkTrayIcon;
|
class TomahawkTrayIcon;
|
||||||
|
class PlaylistModel;
|
||||||
|
class QueueView;
|
||||||
|
class AnimatedSplitter;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@@ -95,6 +98,9 @@ private slots:
|
|||||||
void onSearch( const QString& search );
|
void onSearch( const QString& search );
|
||||||
void onFilterEdited();
|
void onFilterEdited();
|
||||||
|
|
||||||
|
void showQueue();
|
||||||
|
void hideQueue();
|
||||||
|
|
||||||
void minimize();
|
void minimize();
|
||||||
void maximize();
|
void maximize();
|
||||||
|
|
||||||
@@ -114,6 +120,10 @@ private:
|
|||||||
TomahawkTrayIcon* m_trayIcon;
|
TomahawkTrayIcon* m_trayIcon;
|
||||||
SourceTreeView* m_sourcetree;
|
SourceTreeView* m_sourcetree;
|
||||||
QPushButton* m_statusButton;
|
QPushButton* m_statusButton;
|
||||||
|
QPushButton* m_queueButton;
|
||||||
|
PlaylistModel* m_queueModel;
|
||||||
|
QueueView* m_queueView;
|
||||||
|
AnimatedSplitter* m_sidebar;
|
||||||
|
|
||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
QString m_windowTitle;
|
QString m_windowTitle;
|
||||||
|
Reference in New Issue
Block a user