1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

* Removed obsolete proxy models and their interfaces.

This commit is contained in:
Christian Muehlhaeuser 2012-06-01 00:29:40 +02:00
parent a62a9d50fe
commit 14f6647471
11 changed files with 0 additions and 655 deletions

View File

@ -54,12 +54,9 @@ set( libGuiSources
playlist/CollectionProxyModelPlaylistInterface.cpp
playlist/CollectionView.cpp
playlist/PlaylistModel.cpp
playlist/PlaylistProxyModel.cpp
playlist/PlaylistProxyModelPlaylistInterface.cpp
playlist/PlaylistView.cpp
playlist/PlaylistItemDelegate.cpp
playlist/QueueProxyModel.cpp
playlist/QueueProxyModelPlaylistInterface.cpp
playlist/QueueView.cpp
playlist/PlayableModel.cpp
playlist/PlayableProxyModel.cpp
@ -67,8 +64,6 @@ set( libGuiSources
playlist/TrackView.cpp
playlist/TrackHeader.cpp
playlist/AlbumModel.cpp
playlist/AlbumProxyModel.cpp
playlist/AlbumProxyModelPlaylistInterface.cpp
playlist/AlbumItemDelegate.cpp
playlist/AlbumView.cpp
playlist/ArtistView.cpp

View File

@ -1,154 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@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 "AlbumProxyModel.h"
#include <QListView>
#include "AlbumProxyModelPlaylistInterface.h"
#include "Artist.h"
#include "PlayableItem.h"
#include "Query.h"
#include "Source.h"
#include "utils/Logger.h"
AlbumProxyModel::AlbumProxyModel( QObject* parent )
: QSortFilterProxyModel( parent )
, m_model( 0 )
{
setFilterCaseSensitivity( Qt::CaseInsensitive );
setSortCaseSensitivity( Qt::CaseInsensitive );
setDynamicSortFilter( true );
setSourcePlayableModel( 0 );
}
void
AlbumProxyModel::setSourceModel( QAbstractItemModel* sourceModel )
{
Q_UNUSED( sourceModel );
qDebug() << "Explicitly use setSourceAlbumModel instead";
Q_ASSERT( false );
}
void
AlbumProxyModel::setSourcePlayableModel( PlayableModel* sourceModel )
{
m_model = sourceModel;
if ( m_model && m_model->metaObject()->indexOfSignal( "trackCountChanged(uint)" ) > -1 )
connect( m_model, SIGNAL( trackCountChanged( unsigned int ) ), SIGNAL( sourceTrackCountChanged( unsigned int ) ) );
QSortFilterProxyModel::setSourceModel( sourceModel );
}
bool
AlbumProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
if ( filterRegExp().isEmpty() )
return true;
PlayableItem* pi = sourceModel()->itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( !pi )
return false;
const Tomahawk::album_ptr& q = pi->album();
QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
bool found = true;
foreach( const QString& s, sl )
{
if ( !q->name().contains( s, Qt::CaseInsensitive ) && !q->artist()->name().contains( s, Qt::CaseInsensitive ) )
{
found = false;
}
}
return found;
}
bool
AlbumProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) const
{
PlayableItem* p1 = sourceModel()->itemFromIndex( left );
PlayableItem* p2 = sourceModel()->itemFromIndex( right );
if ( !p1 )
return true;
if ( !p2 )
return false;
if ( p1->album().isNull() || p1->album()->artist().isNull() )
return true;
if ( p2->album().isNull() || p2->album()->artist().isNull() )
return false;
if ( p1->album()->artist()->name() == p2->album()->artist()->name() )
{
return QString::localeAwareCompare( p1->album()->name(), p2->album()->name() ) < 0;
}
return QString::localeAwareCompare( p1->album()->artist()->name(), p2->album()->artist()->name() ) < 0;
}
void
AlbumProxyModel::removeIndex( const QModelIndex& index )
{
qDebug() << Q_FUNC_INFO;
if ( !sourceModel() )
return;
if ( index.column() > 0 )
return;
sourceModel()->remove( mapToSource( index ) );
}
void
AlbumProxyModel::removeIndexes( const QList<QModelIndex>& indexes )
{
if ( !sourceModel() )
return;
foreach( const QModelIndex& idx, indexes )
{
removeIndex( idx );
}
}
Tomahawk::playlistinterface_ptr
AlbumProxyModel::playlistInterface()
{
if ( m_playlistInterface.isNull() )
{
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::AlbumProxyModelPlaylistInterface( this ) );
}
return m_playlistInterface;
}

View File

@ -1,64 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@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 ALBUMPROXYMODEL_H
#define ALBUMPROXYMODEL_H
#include <QSortFilterProxyModel>
#include "PlaylistInterface.h"
#include "playlist/PlayableModel.h"
#include "DllMacro.h"
class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit AlbumProxyModel( QObject* parent = 0 );
virtual ~AlbumProxyModel() {}
virtual PlayableModel* sourceModel() const { return m_model; }
virtual void setSourcePlayableModel( PlayableModel* sourceModel );
virtual void setSourceModel( QAbstractItemModel* sourceModel );
virtual int albumCount() const { return rowCount( QModelIndex() ); }
virtual void removeIndex( const QModelIndex& index );
virtual void removeIndexes( const QList<QModelIndex>& indexes );
virtual void emitFilterChanged( const QString &pattern ) { emit filterChanged( pattern ); }
virtual Tomahawk::playlistinterface_ptr playlistInterface();
signals:
void filterChanged( const QString& filter );
protected:
bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
private:
PlayableModel* m_model;
Tomahawk::playlistinterface_ptr m_playlistInterface;
};
#endif // ALBUMPROXYMODEL_H

View File

@ -1,101 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@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 "AlbumProxyModelPlaylistInterface.h"
#include "AlbumProxyModel.h"
#include "Artist.h"
#include "Query.h"
#include "Source.h"
#include "utils/Logger.h"
using namespace Tomahawk;
AlbumProxyModelPlaylistInterface::AlbumProxyModelPlaylistInterface( AlbumProxyModel *proxyModel )
: Tomahawk::PlaylistInterface()
, m_proxyModel( proxyModel )
, m_repeatMode( PlaylistModes::NoRepeat )
, m_shuffled( false )
{
}
AlbumProxyModelPlaylistInterface::~AlbumProxyModelPlaylistInterface()
{
m_proxyModel.clear();
}
QList< Tomahawk::query_ptr >
AlbumProxyModelPlaylistInterface::tracks()
{
Q_ASSERT( FALSE );
QList<Tomahawk::query_ptr> queries;
return queries;
}
int
AlbumProxyModelPlaylistInterface::unfilteredTrackCount() const
{
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->sourceModel()->rowCount( QModelIndex() ) );
}
int
AlbumProxyModelPlaylistInterface::trackCount() const
{
return ( m_proxyModel.isNull() ? 0 : m_proxyModel.data()->rowCount( QModelIndex() ) );
}
Tomahawk::result_ptr
AlbumProxyModelPlaylistInterface::currentItem() const
{
return Tomahawk::result_ptr();
}
QString
AlbumProxyModelPlaylistInterface::filter() const
{
return ( m_proxyModel.isNull() ? QString() : m_proxyModel.data()->filterRegExp().pattern() );
}
void
AlbumProxyModelPlaylistInterface::setFilter( const QString& pattern )
{
qDebug() << Q_FUNC_INFO;
if ( m_proxyModel.isNull() )
return;
m_proxyModel.data()->setFilterRegExp( pattern );
m_proxyModel.data()->emitFilterChanged( pattern );
}
Tomahawk::result_ptr
AlbumProxyModelPlaylistInterface::siblingItem( int itemsAway )
{
Q_UNUSED( itemsAway );
qDebug() << Q_FUNC_INFO;
return Tomahawk::result_ptr( 0 );
}

View File

@ -1,78 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@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 ALBUMPROXYMODELPLAYLISTINTERFACE_H
#define ALBUMPROXYMODELPLAYLISTINTERFACE_H
#include "PlaylistInterface.h"
#include "playlist/AlbumModel.h"
#include "DllMacro.h"
class AlbumProxyModel;
namespace Tomahawk
{
class DLLEXPORT AlbumProxyModelPlaylistInterface : public Tomahawk::PlaylistInterface
{
Q_OBJECT
public:
explicit AlbumProxyModelPlaylistInterface( AlbumProxyModel *proxyModel );
virtual ~AlbumProxyModelPlaylistInterface();
virtual QList<Tomahawk::query_ptr> tracks();
virtual int unfilteredTrackCount() const;
virtual int trackCount() const;
virtual bool hasNextItem() { return true; }
virtual Tomahawk::result_ptr currentItem() const;
virtual Tomahawk::result_ptr siblingItem( int direction );
virtual QString filter() const;
virtual void setFilter( const QString& pattern );
virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_repeatMode; }
virtual bool shuffled() const { return m_shuffled; }
virtual Tomahawk::PlaylistModes::ViewMode viewMode() const { return Tomahawk::PlaylistModes::Album; }
signals:
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
void shuffleModeChanged( bool enabled );
void trackCountChanged( unsigned int tracks );
void sourceTrackCountChanged( unsigned int tracks );
void nextTrackReady();
public slots:
virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ) { m_repeatMode = mode; emit repeatModeChanged( mode ); }
virtual void setShuffled( bool enabled ) { m_shuffled = enabled; emit shuffleModeChanged( enabled ); }
private:
QWeakPointer< AlbumProxyModel > m_proxyModel;
PlaylistModes::RepeatMode m_repeatMode;
bool m_shuffled;
};
} //ns
#endif // ALBUMPROXYMODELPLAYLISTINTERFACE_H

View File

@ -1,40 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@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 "PlaylistProxyModel.h"
#include "PlaylistProxyModelPlaylistInterface.h"
#include "utils/Logger.h"
PlaylistProxyModel::PlaylistProxyModel( QObject* parent )
: PlayableProxyModel( parent )
{
}
Tomahawk::playlistinterface_ptr
PlaylistProxyModel::playlistInterface()
{
if ( m_playlistInterface.isNull() )
{
m_playlistInterface = Tomahawk::playlistinterface_ptr( new Tomahawk::PlaylistProxyModelPlaylistInterface( this ) );
}
return m_playlistInterface;
}

View File

@ -1,38 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@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 PLAYLISTPROXYMODEL_H
#define PLAYLISTPROXYMODEL_H
#include "PlayableProxyModel.h"
#include "DllMacro.h"
class DLLEXPORT PlaylistProxyModel : public PlayableProxyModel
{
Q_OBJECT
public:
explicit PlaylistProxyModel( QObject* parent = 0 );
virtual ~PlaylistProxyModel() {}
virtual Tomahawk::playlistinterface_ptr playlistInterface();
};
#endif // PLAYLISTPROXYMODEL_H

View File

@ -1,35 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@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 "PlaylistProxyModelPlaylistInterface.h"
#include "PlaylistProxyModel.h"
#include "utils/Logger.h"
using namespace Tomahawk;
PlaylistProxyModelPlaylistInterface::PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel )
: PlayableProxyModelPlaylistInterface( proxyModel )
{
}
PlaylistProxyModelPlaylistInterface::~PlaylistProxyModelPlaylistInterface()
{
m_proxyModel.clear();
}

View File

@ -1,43 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@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 PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
#define PLAYLISTPROXYMODELPLAYLISTINTERFACE_H
#include "PlayableProxyModelPlaylistInterface.h"
#include "DllMacro.h"
class PlaylistProxyModel;
namespace Tomahawk
{
class DLLEXPORT PlaylistProxyModelPlaylistInterface : public PlayableProxyModelPlaylistInterface
{
Q_OBJECT
public:
explicit PlaylistProxyModelPlaylistInterface( PlaylistProxyModel *proxyModel );
virtual ~PlaylistProxyModelPlaylistInterface();
};
} //ns
#endif // PLAYLISTPROXYMODELPLAYLISTINTERFACE_H

View File

@ -1,51 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@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 "QueueProxyModelPlaylistInterface.h"
#include "QueueProxyModel.h"
#include "utils/Logger.h"
using namespace Tomahawk;
QueueProxyModelPlaylistInterface::QueueProxyModelPlaylistInterface( QueueProxyModel *proxyModel )
: PlaylistProxyModelPlaylistInterface( proxyModel )
{
}
QueueProxyModelPlaylistInterface::~QueueProxyModelPlaylistInterface()
{
m_proxyModel.clear();
}
Tomahawk::result_ptr
QueueProxyModelPlaylistInterface::siblingItem( int itemsAway )
{
if ( m_proxyModel.isNull() )
return Tomahawk::result_ptr();
m_proxyModel.data()->setCurrentIndex( QModelIndex() );
Tomahawk::result_ptr res = PlaylistProxyModelPlaylistInterface::siblingItem( itemsAway );
m_proxyModel.data()->remove( m_proxyModel.data()->currentIndex() );
return res;
}

View File

@ -1,46 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@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 QUEUEPROXYMODELPLAYLISTINTERFACE_H
#define QUEUEPROXYMODELPLAYLISTINTERFACE_H
#include "PlaylistProxyModelPlaylistInterface.h"
#include "Result.h"
#include "DllMacro.h"
class QueueProxyModel;
namespace Tomahawk
{
class DLLEXPORT QueueProxyModelPlaylistInterface : public PlaylistProxyModelPlaylistInterface
{
Q_OBJECT
public:
explicit QueueProxyModelPlaylistInterface( QueueProxyModel *proxyModel );
virtual ~QueueProxyModelPlaylistInterface();
virtual Tomahawk::result_ptr siblingItem( int itemsAway );
};
} //ns
#endif // QUEUEPROXYMODELPLAYLISTINTERFACE_H