mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Revert "Use DpiScaler in GridView and delegate."
This reverts commit 872a937c03
.
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2011-2012, Leo Franchi <lfranchi@kde.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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -50,7 +49,6 @@ namespace {
|
|||||||
|
|
||||||
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
|
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
|
||||||
: QStyledItemDelegate( (QObject*)parent )
|
: QStyledItemDelegate( (QObject*)parent )
|
||||||
, TomahawkUtils::DpiScaler( parent )
|
|
||||||
, m_view( parent )
|
, m_view( parent )
|
||||||
, m_model( proxy )
|
, m_model( proxy )
|
||||||
{
|
{
|
||||||
@@ -309,11 +307,10 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
|||||||
m_playButton.clear();
|
m_playButton.clear();
|
||||||
|
|
||||||
ImageButton* button = new ImageButton( m_view );
|
ImageButton* button = new ImageButton( m_view );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
||||||
button->setFixedSize( scaled( 48, 48 ) );
|
button->setFixedSize( 48, 48 );
|
||||||
button->move( option.rect.center() - QPoint( button->width() / 2 - 1,
|
button->move( option.rect.center() - QPoint( 23, 23 ) );
|
||||||
button->height() / 2 - 1 ) );
|
|
||||||
button->setContentsMargins( 0, 0, 0, 0 );
|
button->setContentsMargins( 0, 0, 0, 0 );
|
||||||
button->setFocusPolicy( Qt::NoFocus );
|
button->setFocusPolicy( Qt::NoFocus );
|
||||||
button->installEventFilter( this );
|
button->installEventFilter( this );
|
||||||
@@ -431,20 +428,17 @@ GridItemDelegate::onViewChanged()
|
|||||||
foreach ( const QPersistentModelIndex& index, m_spinner.keys() )
|
foreach ( const QPersistentModelIndex& index, m_spinner.keys() )
|
||||||
{
|
{
|
||||||
QRect rect = m_view->visualRect( index );
|
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 )->move( rect.center() - QPoint( 23, 23 ) );
|
||||||
m_spinner.value( index )->height() / 2 - 1 ) );
|
|
||||||
}
|
}
|
||||||
foreach ( const QPersistentModelIndex& index, m_playButton.keys() )
|
foreach ( const QPersistentModelIndex& index, m_playButton.keys() )
|
||||||
{
|
{
|
||||||
QRect rect = m_view->visualRect( index );
|
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 )->move( rect.center() - QPoint( 23, 23 ) );
|
||||||
m_playButton.value( index )->height() / 2 - 1 ) );
|
|
||||||
}
|
}
|
||||||
foreach ( const QPersistentModelIndex& index, m_pauseButton.keys() )
|
foreach ( const QPersistentModelIndex& index, m_pauseButton.keys() )
|
||||||
{
|
{
|
||||||
QRect rect = m_view->visualRect( index );
|
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 )->move( rect.center() - QPoint( 23, 23 ) );
|
||||||
m_pauseButton.value( index )->height() / 2 - 1 ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,13 +469,13 @@ GridItemDelegate::updatePlayPauseButton( ImageButton* button, bool setState )
|
|||||||
{
|
{
|
||||||
if ( button->property( "paused" ).toBool() )
|
if ( button->property( "paused" ).toBool() )
|
||||||
{
|
{
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PlayButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( setState )
|
if ( setState )
|
||||||
@@ -560,11 +554,10 @@ void
|
|||||||
GridItemDelegate::createPauseButton( const QPersistentModelIndex& index )
|
GridItemDelegate::createPauseButton( const QPersistentModelIndex& index )
|
||||||
{
|
{
|
||||||
ImageButton* button = new ImageButton( m_view );
|
ImageButton* button = new ImageButton( m_view );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, scaled( 48, 48 ) ) );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButton, TomahawkUtils::Original, QSize( 48, 48 ) ) );
|
||||||
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, scaled( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
button->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::PauseButtonPressed, TomahawkUtils::Original, QSize( 48, 48 ) ), QIcon::Off, QIcon::Active );
|
||||||
button->setFixedSize( scaled( 48, 48 ) );
|
button->setFixedSize( 48, 48 );
|
||||||
button->move( m_view->visualRect( index ).center() - QPoint( button->width() / 2 - 1,
|
button->move( m_view->visualRect( index ).center() - QPoint( 23, 23 ) );
|
||||||
button->height() / 2 - 1 ) );
|
|
||||||
button->setContentsMargins( 0, 0, 0, 0 );
|
button->setContentsMargins( 0, 0, 0, 0 );
|
||||||
button->setFocusPolicy( Qt::NoFocus );
|
button->setFocusPolicy( Qt::NoFocus );
|
||||||
button->installEventFilter( this );
|
button->installEventFilter( this );
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
#include "utils/DpiScaler.h"
|
|
||||||
|
|
||||||
namespace Tomahawk {
|
namespace Tomahawk {
|
||||||
class PixmapDelegateFader;
|
class PixmapDelegateFader;
|
||||||
@@ -39,7 +38,7 @@ class QTimeLine;
|
|||||||
class PlayableProxyModel;
|
class PlayableProxyModel;
|
||||||
class ImageButton;
|
class ImageButton;
|
||||||
|
|
||||||
class DLLEXPORT GridItemDelegate : public QStyledItemDelegate, private TomahawkUtils::DpiScaler
|
class DLLEXPORT GridItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -51,7 +51,6 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
GridView::GridView( QWidget* parent )
|
GridView::GridView( QWidget* parent )
|
||||||
: QListView( parent )
|
: QListView( parent )
|
||||||
, TomahawkUtils::DpiScaler( this )
|
|
||||||
, m_model( 0 )
|
, m_model( 0 )
|
||||||
, m_proxyModel( 0 )
|
, m_proxyModel( 0 )
|
||||||
, m_delegate( 0 )
|
, m_delegate( 0 )
|
||||||
|
@@ -28,8 +28,6 @@
|
|||||||
#include "PlayableProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "widgets/OverlayWidget.h"
|
#include "widgets/OverlayWidget.h"
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
#include "utils/DpiScaler.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
@@ -41,9 +39,7 @@ class GridItemDelegate;
|
|||||||
class PlayableModel;
|
class PlayableModel;
|
||||||
class GridPlaylistInterface;
|
class GridPlaylistInterface;
|
||||||
|
|
||||||
class DLLEXPORT GridView : public QListView,
|
class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
|
||||||
public Tomahawk::ViewPage,
|
|
||||||
private TomahawkUtils::DpiScaler
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user