1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-20 07:52:30 +02:00

Revert "Use DpiScaler in GridView and delegate."

This reverts commit 872a937c033fd58e3aac0141c15aceb5b6514ffe.
This commit is contained in:
Teo Mrnjavac 2013-08-04 16:50:22 +02:00
parent f50f9d3ac2
commit 220ae243dc
4 changed files with 17 additions and 30 deletions

View File

@ -2,7 +2,6 @@
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2011-2012, Leo Franchi <lfranchi@kde.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.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
@ -50,7 +49,6 @@ namespace {
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
: QStyledItemDelegate( (QObject*)parent )
, TomahawkUtils::DpiScaler( parent )
, m_view( parent )
, m_model( proxy )
{
@ -309,11 +307,10 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
m_playButton.clear();
ImageButton* button = new ImageButton( m_view );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setFixedSize( scaled( 48, 48 ) );
button->move( option.rect.center() - QPoint( button->width() / 2 - 1,
button->height() / 2 - 1 ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setFixedSize( 48, 48 );
button->move( option.rect.center() - QPoint( 23, 23 ) );
button->setContentsMargins( 0, 0, 0, 0 );
button->setFocusPolicy( Qt::NoFocus );
button->installEventFilter( this );
@ -431,20 +428,17 @@ GridItemDelegate::onViewChanged()
foreach ( const QPersistentModelIndex& index, m_spinner.keys() )
{
QRect rect = m_view->visualRect( index );
m_spinner.value( index )->move( rect.center() - QPoint( m_spinner.value( index )->width() / 2 - 1,
m_spinner.value( index )->height() / 2 - 1 ) );
m_spinner.value( index )->move( rect.center() - QPoint( 23, 23 ) );
}
foreach ( const QPersistentModelIndex& index, m_playButton.keys() )
{
QRect rect = m_view->visualRect( index );
m_playButton.value( index )->move( rect.center() - QPoint( m_playButton.value( index )->width() / 2 - 1,
m_playButton.value( index )->height() / 2 - 1 ) );
m_playButton.value( index )->move( rect.center() - QPoint( 23, 23 ) );
}
foreach ( const QPersistentModelIndex& index, m_pauseButton.keys() )
{
QRect rect = m_view->visualRect( index );
m_pauseButton.value( index )->move( rect.center() - QPoint( m_pauseButton.value( index )->width() / 2 - 1,
m_pauseButton.value( index )->height() / 2 - 1 ) );
m_pauseButton.value( index )->move( rect.center() - QPoint( 23, 23 ) );
}
}
@ -475,13 +469,13 @@ GridItemDelegate::updatePlayPauseButton( ImageButton* button, bool setState )
{
if ( button->property( "paused" ).toBool() )
{
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
}
else
{
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
}
if ( setState )
@ -560,11 +554,10 @@ void
GridItemDelegate::createPauseButton( const QPersistentModelIndex& index )
{
ImageButton* button = new ImageButton( m_view );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setFixedSize( scaled( 48, 48 ) );
button->move( m_view->visualRect( index ).center() - QPoint( button->width() / 2 - 1,
button->height() / 2 - 1 ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
button->setFixedSize( 48, 48 );
button->move( m_view->visualRect( index ).center() - QPoint( 23, 23 ) );
button->setContentsMargins( 0, 0, 0, 0 );
button->setFocusPolicy( Qt::NoFocus );
button->installEventFilter( this );

View File

@ -24,7 +24,6 @@
#include <QTimeLine>
#include "DllMacro.h"
#include "utils/DpiScaler.h"
namespace Tomahawk {
class PixmapDelegateFader;
@ -39,7 +38,7 @@ class QTimeLine;
class PlayableProxyModel;
class ImageButton;
class DLLEXPORT GridItemDelegate : public QStyledItemDelegate, private TomahawkUtils::DpiScaler
class DLLEXPORT GridItemDelegate : public QStyledItemDelegate
{
Q_OBJECT

View File

@ -51,7 +51,6 @@ using namespace Tomahawk;
GridView::GridView( QWidget* parent )
: QListView( parent )
, TomahawkUtils::DpiScaler( this )
, m_model( 0 )
, m_proxyModel( 0 )
, m_delegate( 0 )

View File

@ -28,8 +28,6 @@
#include "PlayableProxyModel.h"
#include "widgets/OverlayWidget.h"
#include "DllMacro.h"
#include "utils/DpiScaler.h"
namespace Tomahawk
{
@ -41,9 +39,7 @@ class GridItemDelegate;
class PlayableModel;
class GridPlaylistInterface;
class DLLEXPORT GridView : public QListView,
public Tomahawk::ViewPage,
private TomahawkUtils::DpiScaler
class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
{
Q_OBJECT