Fwd: [Amarok] Remove inline playback controls from the applicati
Seb Ruiz
ruiz at kde.org
Sun Sep 6 13:11:17 CEST 2009
FYI
---------- Forwarded message ----------
From: Seb Ruiz <ruiz at kde.org>
Date: 2009/9/6
Subject: [Amarok] Remove inline playback controls from the applicati
To: kde-commits at kde.org
commit 52b7da4203556c034bed8ceb88f702615f84b268
Author: Seb Ruiz <ruiz at kde.org>
AuthorDate: Sun Sep 6 20:52:51 2009 +1000
Commit: Seb Ruiz <ruiz at kde.org>
CommitDate: Sun Sep 6 20:52:51 2009 +1000
Remove inline playback controls from the application, as discussed
on IRC. We gathered that this
feature did not provide great feature value to the product, and
instead added redundancy with a
third (!) toolbar equivalent. It also increased complexity in an
already crowded playlist layout
configuration UI.
diff --git a/ChangeLog b/ChangeLog
index 1907b34..dabb0ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Amarok ChangeLog
VERSION 2.2-beta2
CHANGES:
+ * Playlist inline playback controls have been removed.
* Grouping mode has been merged into the playlist layouts so each layout
sets its own. The default grouping mode for layout files that do not
have this value explicitly set is "Album". Thanks to Tim Bocek
diff --git a/src/playlist/layouts/LayoutItemConfig.cpp
b/src/playlist/layouts/LayoutItemConfig.cpp
index 11240f1..2907aa1 100644
--- a/src/playlist/layouts/LayoutItemConfig.cpp
+++ b/src/playlist/layouts/LayoutItemConfig.cpp
@@ -13,13 +13,13 @@
* 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 "LayoutItemConfig.h"
-namespace Playlist {
+using namespace Playlist;
- LayoutItemConfigRowElement::LayoutItemConfigRowElement( int
value, qreal size, bool bold, bool italic, Qt::Alignment alignment,
- const
QString &prefix , const QString &suffix )
+LayoutItemConfigRowElement::LayoutItemConfigRowElement( int value,
qreal size, bool bold, bool italic, Qt::Alignment alignment,
+ const QString
&prefix , const QString &suffix )
: m_value( value )
, m_size( size )
, m_bold( bold )
@@ -139,7 +139,6 @@ void
Playlist::LayoutItemConfig::setActiveIndicatorRow( int row )
Playlist::PlaylistLayout::PlaylistLayout()
: m_isEditable(false)
, m_isDirty(false)
- , m_inlineControls(false)
{}
LayoutItemConfig Playlist::PlaylistLayout::head() const
@@ -192,15 +191,6 @@ void Playlist::PlaylistLayout::setDirty( bool dirty )
m_isDirty = dirty;
}
-bool Playlist::PlaylistLayout::inlineControls()
-{
- return m_inlineControls;
-}
-void Playlist::PlaylistLayout::setInlineControls( bool inlineControls )
-{
- m_inlineControls = inlineControls;
-}
-
QString Playlist::PlaylistLayout::groupBy()
{
return m_groupBy;
@@ -210,12 +200,3 @@ void Playlist::PlaylistLayout::setGroupBy(const
QString& groupBy)
{
m_groupBy = groupBy;
}
-
-}
-
-
-
-
-
-
-
diff --git a/src/playlist/layouts/LayoutItemConfig.h
b/src/playlist/layouts/LayoutItemConfig.h
index 9f301c3..e263ecc 100644
--- a/src/playlist/layouts/LayoutItemConfig.h
+++ b/src/playlist/layouts/LayoutItemConfig.h
@@ -275,9 +275,6 @@ class PlaylistLayout
*/
void setDirty( bool dirty );
- bool inlineControls();
- void setInlineControls( bool inlineControls );
-
QString groupBy();
void setGroupBy(const QString &);
@@ -287,7 +284,6 @@ class PlaylistLayout
LayoutItemConfig m_single;
bool m_isEditable;
bool m_isDirty;
- bool m_inlineControls;
QString m_groupBy;
};
diff --git a/src/playlist/layouts/LayoutManager.cpp
b/src/playlist/layouts/LayoutManager.cpp
index e0c8506..799d665 100644
--- a/src/playlist/layouts/LayoutManager.cpp
+++ b/src/playlist/layouts/LayoutManager.cpp
@@ -64,7 +64,7 @@ QStringList LayoutManager::layouts() const
void LayoutManager::setActiveLayout( const QString &layout )
{
m_activeLayout = layout;
- Amarok::config( "Playlist Layout" ).writeEntry( "CurrentLayout",
m_activeLayout );
+ Amarok::config( "Playlist Layout" ).writeEntry( "CurrentLayout",
m_activeLayout );
emit( activeLayoutChanged() );
//Change the grouping style to that of this layout.
@@ -155,7 +155,6 @@ void LayoutManager::loadLayouts( const QString
&fileName, bool user )
PlaylistLayout currentLayout;
currentLayout.setEditable( user );
- currentLayout.setInlineControls(
layout.toElement().attribute( "inline_controls", "false" ).compare(
"true", Qt::CaseInsensitive ) == 0 );
//For backwards compatability, if a grouping is not set in the
XML file assume "group by album" (which was previously the default)
currentLayout.setGroupBy( layout.toElement().attribute(
"group_by", "Album" ) );
@@ -237,7 +236,6 @@ void LayoutManager::addUserLayout( const QString
&name, PlaylistLayout layout )
m_layouts.insert( name, layout );
-
QDomDocument doc( "layouts" );
QDomElement layouts_element = doc.createElement( "playlist_layouts" );
QDomElement newLayout = doc.createElement( ("layout" ) );
@@ -255,9 +253,6 @@ void LayoutManager::addUserLayout( const QString
&name, PlaylistLayout layout )
newLayout.appendChild( createItemElement( doc, "group_head",
layout.head() ) );
newLayout.appendChild( createItemElement( doc, "group_body",
layout.body() ) );
- if( layout.inlineControls() )
- newLayout.setAttribute( "inline_controls", "true" );
-
newLayout.setAttribute( "group_by", layout.groupBy() );
QDir layoutsDir = QDir( Amarok::saveLocation( "playlist_layouts/" ) );
diff --git a/src/playlist/layouts/PlaylistLayoutEditDialog.cpp
b/src/playlist/layouts/PlaylistLayoutEditDialog.cpp
index ad5940c..8029ba5 100644
--- a/src/playlist/layouts/PlaylistLayoutEditDialog.cpp
+++ b/src/playlist/layouts/PlaylistLayoutEditDialog.cpp
@@ -14,7 +14,7 @@
* 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 "PlaylistLayoutEditDialog.h"
#include "Debug.h"
@@ -38,7 +38,7 @@ PlaylistLayoutEditDialog::PlaylistLayoutEditDialog(
QWidget *parent )
tokenPool->addToken( new Token( i18nc( "'Artist' playlist column
name and token for playlist layouts", columnNames[Artist] ),
iconNames[Artist], Artist ) );
tokenPool->addToken( new Token( i18nc( "'Bitrate' playlist column
name and token for playlist layouts", columnNames[Bitrate] ),
iconNames[Bitrate], Bitrate ) );
tokenPool->addToken( new Token( i18nc( "'Comment' playlist column
name and token for playlist layouts", columnNames[Comment] ),
iconNames[Comment], Comment ) );
- tokenPool->addToken( new Token( i18nc( "'Composer' playlist
column name and token for playlist layouts", columnNames[Composer] ),
iconNames[Composer], Composer ) );
+ tokenPool->addToken( new Token( i18nc( "'Composer' playlist
column name and token for playlist layouts", columnNames[Composer] ),
iconNames[Composer], Composer ) );
tokenPool->addToken( new Token( i18nc( "'Directory' playlist
column name and token for playlist layouts", columnNames[Directory] ),
iconNames[Directory], Directory ) );
tokenPool->addToken( new Token( i18nc( "'Disc number' playlist
column name and token for playlist layouts", columnNames[DiscNumber]
), iconNames[DiscNumber], DiscNumber ) );
tokenPool->addToken( new Token( i18nc( "'Divider' token for
playlist layouts representing a small visual divider",
columnNames[Divider] ), iconNames[Divider], Divider ) );
@@ -58,7 +58,7 @@ PlaylistLayoutEditDialog::PlaylistLayoutEditDialog(
QWidget *parent )
tokenPool->addToken( new Token( i18nc( "'Title' (track name)
playlist column name and token for playlist layouts",
columnNames[Title] ), iconNames[Title], Title ) );
tokenPool->addToken( new Token( i18nc( "'Title (with track
number)' (track name prefixed with the track number) playlist column
name and token for playlist layouts", columnNames[TitleWithTrackNum]
), iconNames[TitleWithTrackNum], TitleWithTrackNum ) );
tokenPool->addToken( new Token( i18nc( "'Track number' playlist
column name and token for playlist layouts", columnNames[TrackNumber]
), iconNames[TrackNumber], TrackNumber ) );
- tokenPool->addToken( new Token(i18nc( "'Type' (file format)
playlist column name and token for playlist layouts",
columnNames[Type] ), iconNames[Type], Type ) );
+ tokenPool->addToken( new Token( i18nc( "'Type' (file format)
playlist column name and token for playlist layouts",
columnNames[Type] ), iconNames[Type], Type ) );
tokenPool->addToken( new Token( i18nc( "'Year' playlist column
name and token for playlist layouts", columnNames[Year] ),
iconNames[Year], Year ) );
m_firstActiveLayout = LayoutManager::instance()->activeLayoutName();
@@ -109,12 +109,12 @@
PlaylistLayoutEditDialog::PlaylistLayoutEditDialog( QWidget *parent )
newLayoutButton->setIcon( newIcon );
newLayoutButton->setToolTip( i18n( "New playlist layout" ) );
connect( newLayoutButton, SIGNAL( clicked() ), this, SLOT( newLayout() ) );
-
+
const KIcon copyIcon( "edit-copy" );
copyLayoutButton->setIcon( copyIcon );
copyLayoutButton->setToolTip( i18n( "Copy playlist layout" ) );
connect( copyLayoutButton, SIGNAL( clicked() ), this, SLOT(
copyLayout() ) );
-
+
const KIcon deleteIcon( "edit-delete" );
deleteLayoutButton->setIcon( deleteIcon );
deleteLayoutButton->setToolTip( i18n( "Delete playlist layout" ) );
@@ -131,7 +131,6 @@
PlaylistLayoutEditDialog::PlaylistLayoutEditDialog( QWidget *parent )
connect( m_headEdit, SIGNAL( changed() ), this, SLOT(
setLayoutChanged() ) );
connect( m_bodyEdit, SIGNAL( changed() ), this, SLOT(
setLayoutChanged() ) );
connect( m_singleEdit, SIGNAL( changed() ), this, SLOT(
setLayoutChanged() ) );
- connect( inlineControlsChekbox, SIGNAL( stateChanged( int ) ),
this, SLOT( setLayoutChanged() ) );
connect( groupByComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( setLayoutChanged() ) );
}
@@ -187,12 +186,12 @@ void PlaylistLayoutEditDialog::copyLayout()
LayoutItemConfig headConfig = m_headEdit->config();
LayoutItemConfig bodyConfig = m_bodyEdit->config();
LayoutItemConfig singleConfig = m_singleEdit->config();
-
- bool ok;
+
+ bool ok;
QString layoutName = KInputDialog::getText( i18n( "Choose a name
for the new playlist layout" ),
i18n( "Please enter a name for the playlist layout
you are about to define as copy of the layout '%1':",
layoutListWidget->currentItem()->text()
),QString(), &ok, this );
- if( !ok)
+ if( !ok)
return;
if( layoutName.isEmpty() )
{
@@ -214,7 +213,6 @@ void PlaylistLayoutEditDialog::copyLayout()
layout.setBody( bodyConfig );
layout.setSingle( singleConfig );
- layout.setInlineControls( inlineControlsChekbox->isChecked() );
layout.setGroupBy( groupByComboBox->itemData(
groupByComboBox->currentIndex() ).toString() );
LayoutManager::instance()->addUserLayout( layoutName, layout );
@@ -239,7 +237,7 @@ void PlaylistLayoutEditDialog::deleteLayout() //SLOT
void PlaylistLayoutEditDialog::renameLayout()
{
PlaylistLayout layout = m_layoutsMap->value(
layoutListWidget->currentItem()->text() );
-
+
QString layoutName;
while( layoutName.isEmpty() || m_layoutsMap->keys().contains( layoutName ) )
{
@@ -251,7 +249,7 @@ void PlaylistLayoutEditDialog::renameLayout()
{
//Cancelled so just return
return;
- }
+ }
if( LayoutManager::instance()->isDefaultLayout( layoutName ) )
{
KMessageBox::sorry( this, i18n( "Cannot rename one of the
default layouts." ), i18n( "Layout name error" ) );
@@ -286,7 +284,6 @@ void PlaylistLayoutEditDialog::setLayout( const
QString &layoutName ) //SLOT
m_headEdit->readLayout( layout.head() );
m_bodyEdit->readLayout( layout.body() );
m_singleEdit->readLayout( layout.single() );
- inlineControlsChekbox->setChecked( layout.inlineControls() );
groupByComboBox->setCurrentIndex( groupByComboBox->findData(
layout.groupBy() ) );
setEnabledTabs();
}
@@ -304,11 +301,10 @@ void PlaylistLayoutEditDialog::preview()
LayoutItemConfig headConfig = m_headEdit->config() ;
headConfig.setActiveIndicatorRow( -1 );
-
+
layout.setHead( headConfig );
layout.setBody( m_bodyEdit->config() );
layout.setSingle( m_singleEdit->config() );
- layout.setInlineControls( inlineControlsChekbox->isChecked() );
layout.setGroupBy( groupByComboBox->itemData(
groupByComboBox->currentIndex() ).toString() );
LayoutManager::instance()->setPreviewLayout( layout );
@@ -349,8 +345,8 @@ void PlaylistLayoutEditDialog::toggleUpDownButtons()
moveDownButton->setEnabled( 1 );
moveUpButton->setEnabled( 1 );
}
-
-
+
+
}
void PlaylistLayoutEditDialog::apply() //SLOT
@@ -369,14 +365,12 @@ void PlaylistLayoutEditDialog::apply() //SLOT
i.value().setHead( LayoutManager::instance()->layout(
i.key() ).head() );
i.value().setBody( LayoutManager::instance()->layout(
i.key() ).body() );
i.value().setSingle(
LayoutManager::instance()->layout( i.key() ).single() );
- i.value().setInlineControls(
LayoutManager::instance()->layout( i.key() ).inlineControls() );
i.value().setGroupBy(
LayoutManager::instance()->layout( i.key() ).groupBy() );
i.value().setDirty( false );
if ( m_layoutName == i.key() )
setLayout( i.key() );
return;
}
- i.value().setInlineControls( inlineControlsChekbox->isChecked() );
i.value().setGroupBy( groupByComboBox->itemData(
groupByComboBox->currentIndex() ).toString() );
i.value().setDirty( false );
LayoutManager::instance()->addUserLayout( i.key(), i.value() );
@@ -424,7 +418,7 @@ void PlaylistLayoutEditDialog::moveDown()
void PlaylistLayoutEditDialog::setEnabledTabs()
{
- //Enable or disable tabs depending on whether grouping is allowed.
+ //Enable or disable tabs depending on whether grouping is allowed.
//An empty QString is used to specify no grouping
if ( !groupByComboBox->itemData( groupByComboBox->currentIndex()
).toString().isEmpty() )
{
@@ -466,10 +460,9 @@ void PlaylistLayoutEditDialog::setLayoutChanged()
(*m_layoutsMap)[m_layoutName].setHead( m_headEdit->config() );
(*m_layoutsMap)[m_layoutName].setBody( m_bodyEdit->config() );
(*m_layoutsMap)[m_layoutName].setSingle( m_singleEdit->config() );
-
- (*m_layoutsMap)[m_layoutName].setInlineControls(
inlineControlsChekbox->isChecked() );
+
(*m_layoutsMap)[m_layoutName].setGroupBy(
groupByComboBox->itemData( groupByComboBox->currentIndex()
).toString() );
- (*m_layoutsMap)[m_layoutName].setDirty( true );
+ (*m_layoutsMap)[m_layoutName].setDirty( true );
}
#include "PlaylistLayoutEditDialog.moc"
diff --git a/src/playlist/layouts/PlaylistLayoutEditDialog.ui
b/src/playlist/layouts/PlaylistLayoutEditDialog.ui
index b9903b1..2778f12 100644
--- a/src/playlist/layouts/PlaylistLayoutEditDialog.ui
+++ b/src/playlist/layouts/PlaylistLayoutEditDialog.ui
@@ -186,13 +186,6 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <widget class="QCheckBox" name="inlineControlsChekbox">
- <property name="text">
- <string>Show inline playback controls</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="bottomMargin">
<number>0</number>
diff --git a/src/playlist/view/listview/InlineEditorWidget.cpp
b/src/playlist/view/listview/InlineEditorWidget.cpp
index 60e8d34..505b5f1 100644
--- a/src/playlist/view/listview/InlineEditorWidget.cpp
+++ b/src/playlist/view/listview/InlineEditorWidget.cpp
@@ -88,7 +88,7 @@ InlineEditorWidget::InlineEditorWidget( QWidget *
parent, const QModelIndex &ind
m_headerHeight = ( height * layout.head().rows() ) / rowCount - 1;
//prevent editor closing when cliking a rating widget or pressing
return in a line edit.
-
+
setFocusPolicy( Qt::StrongFocus );
createChildWidgets();
@@ -143,11 +143,11 @@ void InlineEditorWidget::createChildWidgets()
//add a small "spacer" widget to offset the cover a little.
QWidget * coverSpacer = new QWidget( trackBox );
coverSpacer->setFixedWidth( MARGINH - MARGIN );
-
+
QModelIndex coverIndex = m_index.model()->index(
m_index.row(), CoverImage );
QPixmap albumPixmap = coverIndex.data( Qt::DisplayRole
).value<QPixmap>();
- if ( albumPixmap.width() > albumPixmap.width() )
+ if( albumPixmap.width() > albumPixmap.width() )
albumPixmap = albumPixmap.scaledToWidth( imageSize );
else
albumPixmap = albumPixmap.scaledToHeight( imageSize );
@@ -155,7 +155,7 @@ void InlineEditorWidget::createChildWidgets()
QModelIndex emblemIndex = m_index.model()->index(
m_index.row(), SourceEmblem );
QPixmap emblemPixmap = emblemIndex.data( Qt::DisplayRole
).value<QPixmap>();
- if ( !albumPixmap.isNull() )
+ if( !albumPixmap.isNull() )
{
QPainter painter( &albumPixmap );
painter.drawPixmap( QRectF( 0, 0, 16, 16 ), emblemPixmap,
QRectF( 0, 0 , 16, 16 ) );
diff --git a/src/playlist/view/listview/PrettyItemDelegate.cpp
b/src/playlist/view/listview/PrettyItemDelegate.cpp
index fc4fe8d..acaae2f 100644
--- a/src/playlist/view/listview/PrettyItemDelegate.cpp
+++ b/src/playlist/view/listview/PrettyItemDelegate.cpp
@@ -113,9 +113,6 @@ PrettyItemDelegate::sizeHint( const
QStyleOptionViewItem& option, const QModelIn
int rowCount = rowsForItem( index );
- if( LayoutManager::instance()->activeLayout().inlineControls() &&
index.data( ActiveTrackRole ).toBool() )
- rowCount++; //add room for extras
-
height = MARGIN * 2 + rowCount * s_fontHeight + ( rowCount - 1 ) * PADDING;
return QSize( 120, height );
}
@@ -124,7 +121,7 @@ void
PrettyItemDelegate::paint( QPainter* painter, const
QStyleOptionViewItem& option, const QModelIndex& index ) const
{
PlaylistLayout layout = LayoutManager::instance()->activeLayout();
-
+
painter->save();
QApplication::style()->drawPrimitive(
QStyle::PE_PanelItemViewItem, &option, painter );
painter->translate( option.rect.topLeft() );
@@ -139,22 +136,9 @@ PrettyItemDelegate::paint( QPainter* painter,
const QStyleOptionViewItem& option
// call paint method based on type
const int groupMode = getGroupMode(index);
- int rowCount = rowsForItem( index );
- bool paintInlineControls =
LayoutManager::instance()->activeLayout().inlineControls() &&
index.data( ActiveTrackRole ).toBool();
-
if ( groupMode == None || groupMode == Body || groupMode == Tail )
{
-
- int trackHeight = 0;
- int extraHeight = 0;
QStyleOptionViewItem trackOption( option );
- if ( paintInlineControls )
- {
- int adjustedRowCount = rowCount + 1;
- trackHeight = ( option.rect.height() * rowCount ) /
adjustedRowCount;
- extraHeight = option.rect.height() - trackHeight;
- trackOption.rect = QRect( 0, 0, option.rect.width(), trackHeight );
- }
if ( groupMode == None )
paintItem( layout.single(), painter, trackOption, index );
@@ -162,13 +146,6 @@ PrettyItemDelegate::paint( QPainter* painter,
const QStyleOptionViewItem& option
paintItem( layout.body(), painter, trackOption, index );
else
paintItem( layout.body(), painter, trackOption, index );
-
- if (paintInlineControls )
- {
- QRect extrasRect( 0, trackHeight, option.rect.width(),
extraHeight );
- paintActiveTrackExtras( extrasRect, painter, index );
-
- }
}
else if ( groupMode == Head )
{
@@ -185,11 +162,6 @@ PrettyItemDelegate::paint( QPainter* painter,
const QStyleOptionViewItem& option
int trackRows = layout.body().rows();
int totalRows = headRows + trackRows;
- if ( paintInlineControls )
- {
- totalRows = totalRows + 1;
- }
-
int headHeight = ( headRows * option.rect.height() ) / totalRows - 1;
int trackHeight = ( trackRows * option.rect.height() ) / totalRows;
@@ -198,19 +170,11 @@ PrettyItemDelegate::paint( QPainter* painter,
const QStyleOptionViewItem& option
headOption.rect = QRect( 0, 0, option.rect.width(), headHeight );
paintItem( layout.head(), painter, headOption, index, true );
painter->translate( 0, headHeight );
- }
+ }
trackOption.rect = QRect( 0, 0, option.rect.width(), trackHeight );
paintItem( layout.body(), painter, trackOption, index );
-
- if ( paintInlineControls )
- {
- int extraHeight = option.rect.height() - ( headHeight +
trackHeight );
- QRect extrasRect( 0, trackHeight, option.rect.width(),
extraHeight );
- paintActiveTrackExtras( extrasRect, painter, index );
-
- }
- }
+ }
else
QStyledItemDelegate::paint( painter, option, index );
@@ -229,7 +193,7 @@ PrettyItemDelegate::insideItemHeader( const
QPoint& pt, const QRect& rect )
( int )MARGIN,
( int )( -MARGINH ),
0 );
-
+
headerBounds.setHeight( static_cast<int>( 2 * MARGIN + headRows *
s_fontHeight ) );
return headerBounds.contains( pt );
@@ -258,7 +222,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
if ( rowCount == 0 )
return;
-
+
int rowHeight = option.rect.height() / rowCount;
int rowOffsetX = MARGINH;
@@ -266,7 +230,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
int imageSize = option.rect.height() - MARGIN * 2;
QRectF nominalImageRect( MARGINH, MARGIN, imageSize, imageSize );
-
+
if ( config.showCover() )
{
QModelIndex coverIndex = index.model()->index( index.row(),
CoverImage );
@@ -292,7 +256,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
}
int markerOffsetX = nominalImageRect.x();
-
+
if( index.data( StateRole ).toInt() & Item::Queued && !ignoreQueueMarker )
{
// Check that the queue position is actually valid
@@ -363,7 +327,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
QRectF rowBox( itemOffsetX, rowOffsetY, rowWidth, rowHeight );
int currentItemX = itemOffsetX;
-
+
//we need to do a quick pass to figure out how much space is
left for auto sizing elements
qreal spareSpace = 1.0;
int autoSizeElemCount = 0;
@@ -403,7 +367,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
qreal size;
if ( element.size() > 0.0001 )
size = element.size();
- else
+ else
size = spacePerAutoSizeElem;
if ( size > 0.0001 )
@@ -472,7 +436,7 @@ void Playlist::PrettyItemDelegate::paintItem(
LayoutItemConfig config, QPainter*
void Playlist::PrettyItemDelegate::paintActiveTrackExtras( const
QRect &rect, QPainter* painter, const QModelIndex& index ) const
{
Q_UNUSED( index );
-
+
int x = rect.x();
int y = rect.y();
int width = rect.width();
@@ -501,7 +465,7 @@ void
Playlist::PrettyItemDelegate::paintActiveTrackExtras( const QRect
&rect, QP
}
else
{
-
+
offset += ( buttonSize + MARGINH );
painter->drawPixmap( offset, y + 2,
The::svgHandler()->renderSvg(
@@ -516,8 +480,8 @@ void
Playlist::PrettyItemDelegate::paintActiveTrackExtras( const QRect
&rect, QP
"stop_button",
buttonSize, buttonSize,
"stop_button" ) );
-
- offset += ( buttonSize + MARGINH );
+
+ offset += ( buttonSize + MARGINH );
painter->drawPixmap( offset, y + 2,
The::svgHandler()->renderSvg(
"next_button",
@@ -535,22 +499,19 @@ void
Playlist::PrettyItemDelegate::paintActiveTrackExtras( const QRect
&rect, QP
int sliderWidth = width - ( offset + MARGINH );
- The::svgHandler()->paintCustomSlider( painter, offset, y,
sliderWidth, height, trackPercentage, false );
+ The::svgHandler()->paintCustomSlider( painter, offset, y,
sliderWidth, height, trackPercentage, false );
}
bool Playlist::PrettyItemDelegate::clicked( const QPoint &pos, const
QRect &itemRect, const QModelIndex& index )
{
-
+
//for now, only handle clicks in the currently playing item.
if ( !index.data( ActiveTrackRole ).toBool() )
return false;
-
+
int rowCount = rowsForItem( index );
int modifiedRowCount = rowCount;
- if( LayoutManager::instance()->activeLayout().inlineControls() &&
index.data( ActiveTrackRole ).toBool() )
- modifiedRowCount++; //add room for extras
-
int height = itemRect.height();;
int baseHeight = ( height * rowCount ) / modifiedRowCount;
@@ -567,7 +528,7 @@ bool Playlist::PrettyItemDelegate::clicked( const
QPoint &pos, const QRect &item
return true;
}
- offset += ( buttonSize + MARGINH );
+ offset += ( buttonSize + MARGINH );
QRect playRect( offset, extrasOffsetY + 2, buttonSize, buttonSize );
if( playRect.contains( pos ) )
{
@@ -575,7 +536,7 @@ bool Playlist::PrettyItemDelegate::clicked( const
QPoint &pos, const QRect &item
return true;
}
- offset += ( buttonSize + MARGINH );
+ offset += ( buttonSize + MARGINH );
QRect stopRect( offset, extrasOffsetY + 2, buttonSize, buttonSize );
if( stopRect.contains( pos ) )
{
@@ -584,21 +545,21 @@ bool Playlist::PrettyItemDelegate::clicked(
const QPoint &pos, const QRect &item
}
- offset += ( buttonSize + MARGINH );
+ offset += ( buttonSize + MARGINH );
QRect nextRect( offset, extrasOffsetY + 2, buttonSize, buttonSize );
if( nextRect.contains( pos ) )
{
Amarok::actionCollection()->action( "next" )->trigger();
return true;
}
-
+
offset += ( buttonSize + MARGINH );
//handle clicks on the slider
int sliderWidth = itemRect.width() - ( offset + MARGINH );
int knobSize = buttonSize - 2;
-
+
QRect sliderActiveRect( offset, extrasOffsetY + 3, sliderWidth, knobSize );
if( sliderActiveRect.contains( pos ) )
{
@@ -610,7 +571,7 @@ bool Playlist::PrettyItemDelegate::clicked( const
QPoint &pos, const QRect &item
return true;
}
-
+
return false;
}
@@ -618,7 +579,7 @@ bool Playlist::PrettyItemDelegate::clicked( const
QPoint &pos, const QRect &item
QWidget * Playlist::PrettyItemDelegate::createEditor ( QWidget *
parent, const QStyleOptionViewItem & option, const QModelIndex & index
) const
{
Q_UNUSED( option );
-
+
DEBUG_BLOCK
const int groupMode = getGroupMode(index);
return new InlineEditorWidget( parent, index,
LayoutManager::instance()->activeLayout(), groupMode );
@@ -634,7 +595,7 @@ void Playlist::PrettyItemDelegate::setModelData(
QWidget * editor, QAbstractItem
return;
QMap<int, QString> changeMap = inlineEditor->changedValues();
-
+
debug() << "got inline editor!!";
debug() << "changed values map: " << changeMap;
@@ -654,7 +615,7 @@ void Playlist::PrettyItemDelegate::setModelData(
QWidget * editor, QAbstractItem
foreach( int column, columns )
{
QString value = changeMap.value( column );
-
+
switch( column )
{
case Album:
diff --git a/src/playlist/view/listview/PrettyListView.cpp
b/src/playlist/view/listview/PrettyListView.cpp
index 73a778e..76d6c33 100644
--- a/src/playlist/view/listview/PrettyListView.cpp
+++ b/src/playlist/view/listview/PrettyListView.cpp
@@ -106,11 +106,6 @@ Playlist::PrettyListView::PrettyListView( QWidget* parent )
m_animationTimer->setInterval( 250 );
connect( LayoutManager::instance(), SIGNAL( activeLayoutChanged()
), this, SLOT( playlistLayoutChanged() ) );
-
- if ( LayoutManager::instance()->activeLayout().inlineControls() )
- m_animationTimer->start();
-
-
}
Playlist::PrettyListView::~PrettyListView() {}
@@ -167,7 +162,7 @@ Playlist::PrettyListView::removeSelection()
//Select the track occupied by the first deleted track. Also
move the current item to here as
//button presses up or down wil otherwise not behave as expected.
firstRow = qBound( 0, firstRow, m_topmostProxy->rowCount() -1 );
- QModelIndex newSelectionIndex = model()->index( firstRow, 0,
QModelIndex() );
+ QModelIndex newSelectionIndex = model()->index( firstRow, 0,
QModelIndex() );
setCurrentIndex( newSelectionIndex );
selectionModel()->select( newSelectionIndex,
QItemSelectionModel::Select );
}
@@ -399,13 +394,13 @@ Playlist::PrettyListView::mousePressEvent(
QMouseEvent* event )
//we need to translate the position of the click into
something relative to the item that was clicked.
QRect itemRect = visualRect( index );
QPoint relPos = event->pos() - itemRect.topLeft();
-
+
if ( m_prettyDelegate->clicked( relPos, itemRect, index ) )
return; //click already handled...
}
-
+
if ( mouseEventInHeader( event ) && ( event->button() == Qt::LeftButton ) )
{
m_mousePressInHeader = true;
@@ -773,10 +768,7 @@ void Playlist::PrettyListView::redrawActive()
void Playlist::PrettyListView::playlistLayoutChanged()
{
- if ( LayoutManager::instance()->activeLayout().inlineControls() )
- m_animationTimer->start();
- else
- m_animationTimer->stop();
+ m_animationTimer->stop();
}
--
Seb Ruiz
http://www.sebruiz.net/
http://amarok.kde.org/
More information about the Amarok-devel
mailing list