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

* Got rid of TrackHeader. Handled by ViewHeader now.

This commit is contained in:
Christian Muehlhaeuser 2012-06-01 05:44:56 +02:00
parent 75991dca18
commit 59fb1fefa0
13 changed files with 38 additions and 91 deletions

View File

@ -59,7 +59,6 @@ set( libGuiSources
playlist/PlayableProxyModel.cpp
playlist/PlayableProxyModelPlaylistInterface.cpp
playlist/TrackView.cpp
playlist/TrackHeader.cpp
playlist/AlbumModel.cpp
playlist/GridItemDelegate.cpp
playlist/GridView.cpp

View File

@ -21,7 +21,6 @@
#include "playlist/PlaylistModel.h"
#include "playlist/PlaylistView.h"
#include "playlist/TrackHeader.h"
#include "Source.h"
using namespace Tomahawk;

View File

@ -735,6 +735,33 @@ PlayableModel::setStyle( PlayableModel::PlayableItemStyle style )
}
QList< double >
PlayableModel::columnWeights() const
{
QList< double > w;
switch ( m_style )
{
case Short:
case ShortWithAvatars:
case Large:
w << 1.0;
break;
case Collection:
w << 0.42 << 0.12 << 0.07 << 0.07 << 0.07 << 0.07 << 0.07; // << 0.11;
break;
case Detailed:
default:
w << 0.16 << 0.16 << 0.14 << 0.12 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.09; // << 0.03;
break;
}
return w;
}
Qt::Alignment
PlayableModel::columnAlignment( int column ) const
{

View File

@ -87,6 +87,8 @@ public:
virtual int columnCount( const QModelIndex& parent = QModelIndex() ) const;
virtual bool hasChildren( const QModelIndex& parent ) const;
QList< double > columnWeights() const;
virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;

View File

@ -32,7 +32,7 @@
#include "PlayableItem.h"
#include "PlayableProxyModel.h"
#include "TrackView.h"
#include "TrackHeader.h"
#include "ViewHeader.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"

View File

@ -32,7 +32,7 @@
#include "PlayableItem.h"
#include "PlayableProxyModel.h"
#include "TrackView.h"
#include "TrackHeader.h"
#include "ViewHeader.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"

View File

@ -33,7 +33,7 @@
#include "PlayableItem.h"
#include "PlayableProxyModel.h"
#include "TrackView.h"
#include "TrackHeader.h"
#include "ViewHeader.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"

View File

@ -1,39 +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 "TrackHeader.h"
#include "playlist/TrackView.h"
#include "utils/Logger.h"
TrackHeader::TrackHeader( TrackView* parent )
: ViewHeader( parent )
, m_parent( parent )
{
QList< double > columnWeights;
columnWeights << 0.16 << 0.16 << 0.14 << 0.12 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.05 << 0.09; // << 0.03;
setDefaultColumnWeights( columnWeights );
}
TrackHeader::~TrackHeader()
{
}

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-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 TRACKHEADER_H
#define TRACKHEADER_H
#include "ViewHeader.h"
#include "DllMacro.h"
class TrackView;
class DLLEXPORT TrackHeader : public ViewHeader
{
Q_OBJECT
public:
explicit TrackHeader( TrackView* parent = 0 );
~TrackHeader();
private:
TrackView* m_parent;
};
#endif

View File

@ -23,7 +23,7 @@
#include <QPainter>
#include <QScrollBar>
#include "TrackHeader.h"
#include "ViewHeader.h"
#include "ViewManager.h"
#include "PlayableModel.h"
#include "PlayableProxyModel.h"
@ -50,7 +50,7 @@ TrackView::TrackView( QWidget* parent )
, m_model( 0 )
, m_proxyModel( 0 )
, m_delegate( 0 )
, m_header( new TrackHeader( this ) )
, m_header( new ViewHeader( this ) )
, m_overlay( new OverlayWidget( this ) )
, m_loadingSpinner( new LoadingSpinner( this ) )
, m_resizing( false )
@ -153,6 +153,7 @@ TrackView::setPlayableModel( PlayableModel* model )
connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ) );
setAcceptDrops( true );
m_header->setDefaultColumnWeights( model->columnWeights() );
switch( model->style() )
{

View File

@ -32,7 +32,7 @@
class QAction;
class AnimatedSpinner;
class TrackHeader;
class ViewHeader;
class PlayableModel;
class PlayableProxyModel;
class OverlayWidget;
@ -55,7 +55,7 @@ public:
virtual PlayableModel* model() const { return m_model; }
PlayableProxyModel* proxyModel() const { return m_proxyModel; }
PlaylistItemDelegate* delegate() const { return m_delegate; }
TrackHeader* header() const { return m_header; }
ViewHeader* header() const { return m_header; }
OverlayWidget* overlay() const { return m_overlay; }
Tomahawk::ContextMenu* contextMenu() const { return m_contextMenu; }
AnimatedSpinner* loadingSpinner() const { return m_loadingSpinner; }
@ -131,7 +131,7 @@ private:
PlayableModel* m_model;
PlayableProxyModel* m_proxyModel;
PlaylistItemDelegate* m_delegate;
TrackHeader* m_header;
ViewHeader* m_header;
OverlayWidget* m_overlay;
AnimatedSpinner* m_loadingSpinner;

View File

@ -27,7 +27,6 @@
#include "PlaylistModel.h"
#include "PlayableProxyModel.h"
#include "TrackHeader.h"
#include "DynamicModel.h"
#include "widgets/OverlayWidget.h"
#include "utils/Logger.h"

View File

@ -22,7 +22,6 @@
#include "ui_ArtistInfoWidget.h"
#include "audio/AudioEngine.h"
#include "playlist/TrackHeader.h"
#include "playlist/PlayableModel.h"
#include "playlist/TreeModel.h"
#include "playlist/PlaylistModel.h"