mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
initial commit of dynamic playlist gui
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
<file>./data/images/view-toggle-pressed-centre.png</file>
|
<file>./data/images/view-toggle-pressed-centre.png</file>
|
||||||
<file>./data/images/view-toggle-pressed-left.png</file>
|
<file>./data/images/view-toggle-pressed-left.png</file>
|
||||||
<file>./data/images/view-toggle-pressed-right.png</file>
|
<file>./data/images/view-toggle-pressed-right.png</file>
|
||||||
|
<file>./data/images/list-add.png</file>
|
||||||
<file>./data/images/volume-icon-full.png</file>
|
<file>./data/images/volume-icon-full.png</file>
|
||||||
<file>./data/images/volume-icon-muted.png</file>
|
<file>./data/images/volume-icon-muted.png</file>
|
||||||
<file>./data/images/volume-slider-bkg.png</file>
|
<file>./data/images/volume-slider-bkg.png</file>
|
||||||
|
@@ -151,6 +151,8 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
|||||||
sourcetree/sourcetreeview.cpp
|
sourcetree/sourcetreeview.cpp
|
||||||
|
|
||||||
dynamic/widgets/DynamicWidget.cpp
|
dynamic/widgets/DynamicWidget.cpp
|
||||||
|
dynamic/widgets/DynamicControlWidget.cpp
|
||||||
|
dynamic/widgets/DynamicControlList.cpp
|
||||||
dynamic/DynamicPlaylistModel.cpp
|
dynamic/DynamicPlaylistModel.cpp
|
||||||
|
|
||||||
topbar/topbar.cpp
|
topbar/topbar.cpp
|
||||||
@@ -307,7 +309,9 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
|
|||||||
|
|
||||||
infowidgets/sourceinfowidget.h
|
infowidgets/sourceinfowidget.h
|
||||||
|
|
||||||
dynamic/widgets/DynamicWidget.cpp
|
dynamic/widgets/DynamicWidget.h
|
||||||
|
dynamic/widgets/DynamicControlWidget.h
|
||||||
|
dynamic/widgets/DynamicControlList.h
|
||||||
dynamic/DynamicPlaylistModel.h
|
dynamic/DynamicPlaylistModel.h
|
||||||
|
|
||||||
transferview.h
|
transferview.h
|
||||||
|
@@ -52,9 +52,17 @@ public:
|
|||||||
|
|
||||||
/// The current type of this control
|
/// The current type of this control
|
||||||
QString selectedType() const { return m_selectedType; }
|
QString selectedType() const { return m_selectedType; }
|
||||||
/// The match selector widget based on this control's type
|
/**
|
||||||
|
* The match selector widget based on this control's type
|
||||||
|
*
|
||||||
|
* The control manages the lifetime of the widget.
|
||||||
|
*/
|
||||||
virtual QWidget* matchSelector() { Q_ASSERT( false ); return 0; }
|
virtual QWidget* matchSelector() { Q_ASSERT( false ); return 0; }
|
||||||
/// The input field widget that is associated with this type
|
/**
|
||||||
|
* The input field widget that is associated with this type
|
||||||
|
*
|
||||||
|
* The control manages the lifetime of the widget.
|
||||||
|
*/
|
||||||
virtual QWidget* inputField() { Q_ASSERT( false ); return 0; }
|
virtual QWidget* inputField() { Q_ASSERT( false ); return 0; }
|
||||||
|
|
||||||
/// the serializable value of the match
|
/// the serializable value of the match
|
||||||
|
@@ -43,7 +43,13 @@ Tomahawk::EchonestControl::matchSelector()
|
|||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::setSelectedType ( const QString& type )
|
Tomahawk::EchonestControl::setSelectedType ( const QString& type )
|
||||||
{
|
{
|
||||||
|
if( !m_input.isNull() )
|
||||||
|
delete m_input.data();
|
||||||
|
if( !m_match.isNull() )
|
||||||
|
delete m_match.data();
|
||||||
|
|
||||||
Tomahawk::DynamicControl::setSelectedType ( type );
|
Tomahawk::DynamicControl::setSelectedType ( type );
|
||||||
|
updateWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
Echonest::DynamicPlaylist::PlaylistParamData
|
Echonest::DynamicPlaylist::PlaylistParamData
|
||||||
@@ -73,7 +79,8 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tomahawk::EchonestControl::updateData()
|
void
|
||||||
|
Tomahawk::EchonestControl::updateData()
|
||||||
{
|
{
|
||||||
if( selectedType() == "Artist" ) {
|
if( selectedType() == "Artist" ) {
|
||||||
QWeakPointer<QComboBox> combo = qWeakPointerCast<QComboBox, QWidget>( m_match );
|
QWeakPointer<QComboBox> combo = qWeakPointerCast<QComboBox, QWidget>( m_match );
|
||||||
|
104
src/dynamic/widgets/DynamicControlList.cpp
Normal file
104
src/dynamic/widgets/DynamicControlList.cpp
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "DynamicControlList.h"
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include "DynamicControlWidget.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
DynamicControlList::DynamicControlList()
|
||||||
|
: AnimatedWidget()
|
||||||
|
, m_summaryWidget( 0 )
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicControlList::DynamicControlList( AnimatedSplitter* parent )
|
||||||
|
: AnimatedWidget( parent )
|
||||||
|
, m_summaryWidget( 0 )
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicControlList::DynamicControlList( const QList< dyncontrol_ptr >& controls, AnimatedSplitter* parent)
|
||||||
|
: AnimatedWidget(parent)
|
||||||
|
, m_summaryWidget( 0 )
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
setControls( controls );
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicControlList::~DynamicControlList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlList::init()
|
||||||
|
{
|
||||||
|
setLayout( new QVBoxLayout );
|
||||||
|
layout()->setMargin( 0 );
|
||||||
|
layout()->setSpacing( 0 );
|
||||||
|
|
||||||
|
m_summaryWidget = new QWidget();
|
||||||
|
// TODO replace
|
||||||
|
m_summaryWidget->setMaximumHeight( 24 );
|
||||||
|
m_summaryWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||||
|
m_summaryWidget->setLayout( new QVBoxLayout );
|
||||||
|
m_summaryWidget->layout()->setMargin( 0 );
|
||||||
|
m_summaryWidget->layout()->addWidget( new QLabel( "replace me plz", m_summaryWidget ) );
|
||||||
|
|
||||||
|
setHiddenSize( m_summaryWidget->size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlList::setControls(const QList< dyncontrol_ptr >& controls)
|
||||||
|
{
|
||||||
|
foreach( const dyncontrol_ptr& control, controls )
|
||||||
|
m_controls << new DynamicControlWidget( control, false, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlList::onHidden( QWidget* w )
|
||||||
|
{
|
||||||
|
if( w != this )
|
||||||
|
return;
|
||||||
|
|
||||||
|
AnimatedWidget::onHidden( w );
|
||||||
|
|
||||||
|
foreach( DynamicControlWidget* control, m_controls ) {
|
||||||
|
layout()->removeWidget( control );
|
||||||
|
}
|
||||||
|
layout()->addWidget( m_summaryWidget );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlList::onShown( QWidget* w )
|
||||||
|
{
|
||||||
|
if( w != this )
|
||||||
|
return;
|
||||||
|
|
||||||
|
AnimatedWidget::onShown( w );
|
||||||
|
|
||||||
|
layout()->removeWidget( m_summaryWidget );
|
||||||
|
foreach( DynamicControlWidget* control, m_controls ) {
|
||||||
|
layout()->addWidget( control );
|
||||||
|
|
||||||
|
control->setShowPlusButton( control == m_controls.last() );
|
||||||
|
}
|
||||||
|
}
|
60
src/dynamic/widgets/DynamicControlList.h
Normal file
60
src/dynamic/widgets/DynamicControlList.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_CONTROL_LIST_H
|
||||||
|
#define DYNAMIC_CONTROL_LIST_H
|
||||||
|
|
||||||
|
#include "animatedsplitter.h"
|
||||||
|
#include "tomahawk/typedefs.h"
|
||||||
|
#include "dynamic/DynamicPlaylist.h"
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
class DynamicControlWidget;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This widget encapsulates the list of dynamic controls and behaves as an animated widget in
|
||||||
|
* the animated splitter
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DynamicControlList : public AnimatedWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DynamicControlList(); // bad compiler!
|
||||||
|
explicit DynamicControlList( AnimatedSplitter* parent );
|
||||||
|
explicit DynamicControlList( const QList< dyncontrol_ptr >& controls, AnimatedSplitter* parent );
|
||||||
|
virtual ~DynamicControlList();
|
||||||
|
|
||||||
|
void setControls( const QList< dyncontrol_ptr >& controls );
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void onHidden(QWidget* );
|
||||||
|
virtual void onShown(QWidget* );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
QList< DynamicControlWidget* > m_controls;
|
||||||
|
QWidget* m_summaryWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
103
src/dynamic/widgets/DynamicControlWidget.cpp
Normal file
103
src/dynamic/widgets/DynamicControlWidget.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "DynamicControlWidget.h"
|
||||||
|
|
||||||
|
#include "tomahawk/tomahawkapp.h"
|
||||||
|
#include "dynamic/DynamicControl.h"
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
DynamicControlWidget::DynamicControlWidget( const Tomahawk::dyncontrol_ptr& control, bool showPlus, QWidget* parent )
|
||||||
|
: QWidget(parent)
|
||||||
|
, m_showPlus( showPlus )
|
||||||
|
, m_plusButton( 0 )
|
||||||
|
, m_control( control )
|
||||||
|
, m_typeSelector( 0 )
|
||||||
|
, m_layout( 0 )
|
||||||
|
{
|
||||||
|
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||||
|
|
||||||
|
m_layout = new QHBoxLayout;
|
||||||
|
m_typeSelector = new QComboBox( this );
|
||||||
|
|
||||||
|
m_plusButton= new QToolButton( this );
|
||||||
|
m_plusButton->setIcon( QIcon( RESPATH "images/list-add.png" ) );
|
||||||
|
|
||||||
|
connect( m_typeSelector, SIGNAL( currentIndexChanged( QString ) ), SLOT( typeSelectorChanged( QString ) ) );
|
||||||
|
|
||||||
|
if( !control.isNull() ) {
|
||||||
|
foreach( const QString& type, control->typeSelectors() )
|
||||||
|
m_typeSelector->addItem( type );
|
||||||
|
|
||||||
|
m_layout->addWidget( m_typeSelector, 0, Qt::AlignLeft );
|
||||||
|
m_layout->addWidget( m_control->matchSelector(), 0, Qt::AlignCenter );
|
||||||
|
m_layout->addWidget( m_control->inputField(), 0, Qt::AlignRight );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_showPlus )
|
||||||
|
m_layout->addWidget( m_plusButton, 0, Qt::AlignRight );
|
||||||
|
|
||||||
|
setLayout( m_layout );
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicControlWidget::~DynamicControlWidget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlWidget::typeSelectorChanged( QString type )
|
||||||
|
{
|
||||||
|
Q_ASSERT( m_layout );
|
||||||
|
// remove the two widgets, change the control,and re-add the new ones
|
||||||
|
if( m_layout->count() == 3 )
|
||||||
|
{
|
||||||
|
m_layout->takeAt( 1 );
|
||||||
|
m_layout->takeAt( 2 );
|
||||||
|
} else
|
||||||
|
Q_ASSERT( m_layout->count() == 1 );
|
||||||
|
|
||||||
|
m_control->setSelectedType( type );
|
||||||
|
m_layout->addWidget( m_control->matchSelector(), 0, Qt::AlignCenter );
|
||||||
|
m_layout->addWidget( m_control->inputField(), 0, Qt::AlignRight );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicControlWidget::setShowPlusButton(bool show)
|
||||||
|
{
|
||||||
|
|
||||||
|
if( m_showPlus != show ) {
|
||||||
|
if( show ) {
|
||||||
|
m_layout->addWidget( m_plusButton, 0, Qt::AlignRight );
|
||||||
|
} else {
|
||||||
|
m_layout->removeWidget( m_plusButton );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_showPlus = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DynamicControlWidget::showPlusButton() const
|
||||||
|
{
|
||||||
|
return m_showPlus;
|
||||||
|
}
|
58
src/dynamic/widgets/DynamicControlWidget.h
Normal file
58
src/dynamic/widgets/DynamicControlWidget.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_CONTROL_WIDGET_H
|
||||||
|
#define DYNAMIC_CONTROL_WIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "tomahawk/typedefs.h"
|
||||||
|
|
||||||
|
class QToolButton;
|
||||||
|
class QHBoxLayout;
|
||||||
|
class QComboBox;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This widget holds one horizontal control attached to a dynamic playlist. It's a container more than anything.
|
||||||
|
*/
|
||||||
|
class DynamicControlWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DynamicControlWidget( const dyncontrol_ptr& control, bool showPlus = false, QWidget* parent = 0);
|
||||||
|
virtual ~DynamicControlWidget();
|
||||||
|
|
||||||
|
void setShowPlusButton( bool show );
|
||||||
|
bool showPlusButton() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void typeSelectorChanged( QString );
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_showPlus;
|
||||||
|
QToolButton* m_plusButton;
|
||||||
|
dyncontrol_ptr m_control;
|
||||||
|
QComboBox* m_typeSelector;
|
||||||
|
QHBoxLayout* m_layout;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
79
src/dynamic/widgets/DynamicWidget.cpp
Normal file
79
src/dynamic/widgets/DynamicWidget.cpp
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "DynamicWidget.h"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include "DynamicControlList.h"
|
||||||
|
#include "playlistview.h"
|
||||||
|
#include "playlistmodel.h"
|
||||||
|
#include "trackproxymodel.h"
|
||||||
|
#include "dynamic/GeneratorInterface.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget* parent )
|
||||||
|
: QWidget(parent)
|
||||||
|
, m_header( 0 )
|
||||||
|
, m_playlist( playlist )
|
||||||
|
, m_controls( 0 )
|
||||||
|
, m_splitter( 0 )
|
||||||
|
, m_view( 0 )
|
||||||
|
, m_model()
|
||||||
|
{
|
||||||
|
setLayout( new QVBoxLayout );
|
||||||
|
|
||||||
|
m_header = new QLabel( "TODO DYN PLAYLIST HEADER", this );
|
||||||
|
layout()->addWidget( m_header );
|
||||||
|
|
||||||
|
m_splitter = new AnimatedSplitter( this );
|
||||||
|
m_splitter->setOrientation( Qt::Vertical );
|
||||||
|
|
||||||
|
m_controls = new DynamicControlList( m_splitter );
|
||||||
|
m_model = new PlaylistModel( this );
|
||||||
|
m_view = new PlaylistView( this );
|
||||||
|
m_view->setModel( m_model );
|
||||||
|
|
||||||
|
m_splitter->addWidget( m_controls );
|
||||||
|
m_splitter->addWidget( m_view );
|
||||||
|
m_splitter->setGreedyWidget( 1 );
|
||||||
|
|
||||||
|
if( !m_playlist.isNull() ) {
|
||||||
|
m_controls->setControls( m_playlist->generator()->controls() );
|
||||||
|
|
||||||
|
m_model->loadPlaylist( m_playlist );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicWidget::~DynamicWidget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DynamicWidget::setPlaylist(const Tomahawk::dynplaylist_ptr& playlist)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaylistInterface*
|
||||||
|
DynamicWidget::playlistInterface() const
|
||||||
|
{
|
||||||
|
return m_view->proxyModel();
|
||||||
|
}
|
61
src/dynamic/widgets/DynamicWidget.h
Normal file
61
src/dynamic/widgets/DynamicWidget.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/****************************************************************************************
|
||||||
|
* Copyright (c) 2010 Leo Franchi <lfranchi@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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 2 of the License, or (at your option) any later *
|
||||||
|
* version. *
|
||||||
|
* *
|
||||||
|
* This program 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 *
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_WIDGET_H
|
||||||
|
#define DYNAMIC_WIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <tomahawk/typedefs.h>
|
||||||
|
|
||||||
|
class PlaylistInterface;
|
||||||
|
class PlaylistModel;
|
||||||
|
class PlaylistView;
|
||||||
|
class AnimatedSplitter;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
class DynamicControlList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the dynamic playlist config and the playlist view itself
|
||||||
|
*/
|
||||||
|
class DynamicWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DynamicWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0);
|
||||||
|
virtual ~DynamicWidget();
|
||||||
|
|
||||||
|
void setPlaylist( const dynplaylist_ptr& playlist );
|
||||||
|
|
||||||
|
PlaylistInterface* playlistInterface() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel* m_header;
|
||||||
|
dynplaylist_ptr m_playlist;
|
||||||
|
|
||||||
|
DynamicControlList* m_controls;
|
||||||
|
AnimatedSplitter* m_splitter;
|
||||||
|
|
||||||
|
PlaylistView* m_view;
|
||||||
|
PlaylistModel* m_model;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -18,6 +18,7 @@
|
|||||||
#include "albummodel.h"
|
#include "albummodel.h"
|
||||||
|
|
||||||
#include "infowidgets/sourceinfowidget.h"
|
#include "infowidgets/sourceinfowidget.h"
|
||||||
|
#include <widgets/DynamicWidget.h>
|
||||||
|
|
||||||
#define FILTER_TIMEOUT 280
|
#define FILTER_TIMEOUT 280
|
||||||
|
|
||||||
@@ -115,6 +116,27 @@ PlaylistManager::show( const Tomahawk::playlist_ptr& playlist )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PlaylistManager::show(const Tomahawk::dynplaylist_ptr& playlist)
|
||||||
|
{
|
||||||
|
unlinkPlaylist();
|
||||||
|
|
||||||
|
if( !m_dynamicWidgets.contains( playlist ) ) {
|
||||||
|
m_dynamicWidgets[ playlist ] = new Tomahawk::DynamicWidget( playlist, m_stack );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_stack->setCurrentWidget( m_dynamicWidgets.value( playlist ) );
|
||||||
|
m_currentInterface = m_dynamicWidgets.value( playlist )->playlistInterface();
|
||||||
|
|
||||||
|
m_superCollectionVisible = false;
|
||||||
|
m_statsAvailable = true;
|
||||||
|
m_modesAvailable = false;
|
||||||
|
linkPlaylist();
|
||||||
|
|
||||||
|
emit numSourcesChanged( APP->sourcelist().count() );\
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PlaylistManager::show( const Tomahawk::album_ptr& album )
|
PlaylistManager::show( const Tomahawk::album_ptr& album )
|
||||||
|
@@ -8,6 +8,10 @@
|
|||||||
#include "tomahawk/collection.h"
|
#include "tomahawk/collection.h"
|
||||||
#include "tomahawk/playlistinterface.h"
|
#include "tomahawk/playlistinterface.h"
|
||||||
|
|
||||||
|
namespace Tomahawk {
|
||||||
|
class DynamicWidget;
|
||||||
|
}
|
||||||
|
|
||||||
class AnimatedSplitter;
|
class AnimatedSplitter;
|
||||||
class AlbumModel;
|
class AlbumModel;
|
||||||
class AlbumView;
|
class AlbumView;
|
||||||
@@ -36,6 +40,7 @@ public:
|
|||||||
bool isSuperCollectionVisible() const { return true; }
|
bool isSuperCollectionVisible() const { return true; }
|
||||||
|
|
||||||
bool show( const Tomahawk::playlist_ptr& playlist );
|
bool show( const Tomahawk::playlist_ptr& playlist );
|
||||||
|
bool show( const Tomahawk::dynplaylist_ptr& playlist );
|
||||||
bool show( const Tomahawk::album_ptr& album );
|
bool show( const Tomahawk::album_ptr& album );
|
||||||
bool show( const Tomahawk::collection_ptr& collection );
|
bool show( const Tomahawk::collection_ptr& collection );
|
||||||
bool show( const Tomahawk::source_ptr& source );
|
bool show( const Tomahawk::source_ptr& source );
|
||||||
@@ -92,6 +97,7 @@ private:
|
|||||||
QList< Tomahawk::collection_ptr > m_superCollections;
|
QList< Tomahawk::collection_ptr > m_superCollections;
|
||||||
PlaylistModel* m_playlistModel;
|
PlaylistModel* m_playlistModel;
|
||||||
|
|
||||||
|
QHash< Tomahawk::dynplaylist_ptr, Tomahawk::DynamicWidget* > m_dynamicWidgets;
|
||||||
QHash< Tomahawk::collection_ptr, CollectionView* > m_collectionViews;
|
QHash< Tomahawk::collection_ptr, CollectionView* > m_collectionViews;
|
||||||
QHash< Tomahawk::collection_ptr, AlbumView* > m_collectionAlbumViews;
|
QHash< Tomahawk::collection_ptr, AlbumView* > m_collectionAlbumViews;
|
||||||
QHash< Tomahawk::source_ptr, SourceInfoWidget* > m_sourceViews;
|
QHash< Tomahawk::source_ptr, SourceInfoWidget* > m_sourceViews;
|
||||||
|
@@ -48,6 +48,8 @@ QueueView::onShown( QWidget* widget )
|
|||||||
if ( widget != this )
|
if ( widget != this )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
AnimatedWidget::onShown( widget );
|
||||||
|
|
||||||
m_button->setText( tr( "Click to hide queue" ) );
|
m_button->setText( tr( "Click to hide queue" ) );
|
||||||
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( showWidget() ) );
|
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( showWidget() ) );
|
||||||
connect( m_button, SIGNAL( clicked() ), SIGNAL( hideWidget() ) );
|
connect( m_button, SIGNAL( clicked() ), SIGNAL( hideWidget() ) );
|
||||||
@@ -61,6 +63,8 @@ QueueView::onHidden( QWidget* widget )
|
|||||||
if ( widget != this )
|
if ( widget != this )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
AnimatedWidget::onHidden( widget );
|
||||||
|
|
||||||
m_button->setText( tr( "Click to show queue" ) );
|
m_button->setText( tr( "Click to show queue" ) );
|
||||||
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( hideWidget() ) );
|
disconnect( m_button, SIGNAL( clicked() ), this, SIGNAL( hideWidget() ) );
|
||||||
connect( m_button, SIGNAL( clicked() ), SIGNAL( showWidget() ) );
|
connect( m_button, SIGNAL( clicked() ), SIGNAL( showWidget() ) );
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "animatedsplitter.h"
|
#include "animatedsplitter.h"
|
||||||
|
|
||||||
#define ANIMATION_TIME 500
|
#define ANIMATION_TIME 400
|
||||||
|
|
||||||
|
|
||||||
AnimatedSplitter::AnimatedSplitter( QWidget* parent )
|
AnimatedSplitter::AnimatedSplitter( QWidget* parent )
|
||||||
@@ -213,6 +213,10 @@ AnimatedWidget::AnimatedWidget( AnimatedSplitter* parent )
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnimatedWidget::~AnimatedWidget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AnimatedWidget::onShown( QWidget* )
|
AnimatedWidget::onShown( QWidget* )
|
||||||
|
@@ -48,7 +48,8 @@ class AnimatedWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AnimatedWidget( AnimatedSplitter* parent );
|
explicit AnimatedWidget( AnimatedSplitter* parent = 0 );
|
||||||
|
virtual ~AnimatedWidget();
|
||||||
|
|
||||||
QSize hiddenSize() const { return m_hiddenSize; }
|
QSize hiddenSize() const { return m_hiddenSize; }
|
||||||
void setHiddenSize( const QSize& size ) { m_hiddenSize = size; emit hiddenSizeChanged(); }
|
void setHiddenSize( const QSize& size ) { m_hiddenSize = size; emit hiddenSizeChanged(); }
|
||||||
|
Reference in New Issue
Block a user