[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src
From: Gábor Lehel <illissius () gmail ! com>
Date: 2006-05-01 0:18:30
Message-ID: 1146442710.017789.21314.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 536023 by illissius:
make playlist and tagdialog respect use scores/ratings, and some work on having the \
rating column start with a proper size
M +43 -2 playlist.cpp
M +3 -0 playlist.h
M +5 -0 playlistitem.cpp
M +1 -0 playlistitem.h
M +15 -2 tagdialog.cpp
--- trunk/extragear/multimedia/amarok/src/playlist.cpp #536022:536023
@@ -287,7 +287,10 @@
setColumnWidth( PlaylistItem::Artist, 100 );
setColumnWidth( PlaylistItem::Album, 100 );
setColumnWidth( PlaylistItem::Length, 80 );
- setColumnWidth( PlaylistItem::Mood, AmarokConfig::showMoodbar() ? 40 : 0 );
+ if( AmarokConfig::showMoodbar() )
+ setColumnWidth( PlaylistItem::Mood, 40 );
+ if( AmarokConfig::useRatings() )
+ setColumnWidth( PlaylistItem::Rating, PlaylistItem::ratingColumnWidth() );
setColumnAlignment( PlaylistItem::Length, Qt::AlignRight );
setColumnAlignment( PlaylistItem::Track, Qt::AlignCenter );
@@ -382,6 +385,9 @@
connect( this, SIGNAL( contentsMoving( int, int ) ), SLOT( slotContentsMoving() \
) );
+ connect( App::instance(), SIGNAL( useScores( bool ) ), this, SLOT( \
slotUseScores( bool ) ) ); + connect( App::instance(), SIGNAL( useRatings( bool ) \
), this, SLOT( slotUseRatings( bool ) ) ); +
amaroK::ToolTip::add( this, viewport() );
header()->installEventFilter( this );
@@ -997,6 +1003,13 @@
if( sort >= 0 && uint(sort) < iorder.count() )
setSorting(iorder[config->readNumEntry("SortColumn")], \
config->readBoolEntry("SortAscending", true)); }
+
+ if( !AmarokConfig::useScores() )
+ hideColumn( PlaylistItem::Score );
+ if( !AmarokConfig::useRatings() )
+ hideColumn( PlaylistItem::Rating );
+ if( !AmarokConfig::showMoodbar() )
+ hideColumn( PlaylistItem::Mood );
}
@@ -2615,8 +2628,11 @@
KPopupMenu sub;
for( int i = 0; i < columns(); ++i ) //columns() references a property
- if( !columnWidth( i ) && ( i != PlaylistItem::Mood || \
AmarokConfig::showMoodbar() ) ) + if( !columnWidth( i ) )
sub.insertItem( columnText( i ), i, i + 1 );
+ sub.setItemVisible( PlaylistItem::Score, AmarokConfig::useScores() );
+ sub.setItemVisible( PlaylistItem::Rating, AmarokConfig::useRatings() );
+ sub.setItemVisible( PlaylistItem::Mood, AmarokConfig::showMoodbar() );
//TODO for 1.2.1
//sub.insertSeparator();
@@ -3474,6 +3490,15 @@
}
void
+Playlist::adjustColumn( int n )
+{
+ if( n == PlaylistItem::Rating )
+ setColumnWidth( n, PlaylistItem::ratingColumnWidth() );
+ else
+ KListView::adjustColumn( n );
+}
+
+void
Playlist::showQueueManager()
{
DEBUG_BLOCK
@@ -4507,6 +4532,22 @@
}
void
+Playlist::slotUseScores( bool use )
+{
+ if( !use && columnWidth( MetaBundle::Score ) )
+ hideColumn( MetaBundle::Score );
+}
+
+void
+Playlist::slotUseRatings( bool use )
+{
+ if( use && !columnWidth( MetaBundle::Rating ) )
+ adjustColumn( MetaBundle::Rating );
+ else if( !use && columnWidth( MetaBundle::Rating ) )
+ hideColumn( MetaBundle::Rating );
+}
+
+void
Playlist::slotGlowTimer() //SLOT
{
if( !currentTrack() ) return;
--- trunk/extragear/multimedia/amarok/src/playlist.h #536022:536023
@@ -231,6 +231,7 @@
void fileHasMood( const QString path );
void refreshMoods();
void applySettings();
+ void adjustColumn( int n );
protected:
virtual void fontChange( const QFont &old );
@@ -266,6 +267,8 @@
void slotContentsMoving();
void slotRepeatTrackToggled( int mode );
void slotQueueChanged( const PLItemList &in, const PLItemList &out);
+ void slotUseScores( bool use );
+ void slotUseRatings( bool use );
void updateNextPrev();
void writeTag( QListViewItem*, const QString&, int );
--- trunk/extragear/multimedia/amarok/src/playlistitem.cpp #536022:536023
@@ -394,6 +394,11 @@
return kClamp( ( x - 1 ) / ( star()->width() + pl->itemMargin() ) + 1, 1, 5 ) * \
2; }
+int PlaylistItem::ratingColumnWidth() //static
+{
+ return star()->width() * 5 + Playlist::instance()->itemMargin() * 6;
+}
+
void PlaylistItem::update() const
{
listView()->repaintItem( this );
--- trunk/extragear/multimedia/amarok/src/playlistitem.h #536022:536023
@@ -88,6 +88,7 @@
static QPixmap *grayedStar();
static QPixmap *smallStar();
static int ratingAtPoint( int x );
+ static int ratingColumnWidth();
/// like QWidget::update()
void update() const;
--- trunk/extragear/multimedia/amarok/src/tagdialog.cpp #536022:536023
@@ -396,6 +396,17 @@
kIntSpinBox_score->setSpecialValueText( " " );
kIntSpinBox_discNumber->setSpecialValueText( " " );
+ if( !AmarokConfig::useRatings() )
+ {
+ kComboBox_rating->hide();
+ ratingLabel->hide();
+ }
+ if( !AmarokConfig::useScores() )
+ {
+ kIntSpinBox_score->hide();
+ scoreLabel->hide();
+ }
+
//HACK due to deficiency in Qt that will be addressed in version 4
// QSpinBox doesn't emit valueChanged if you edit the value with
// the lineEdit until you change the keyboard focus
@@ -616,8 +627,10 @@
summaryText += body2cols.arg( i18n("Format"), unknownSafe( m_bundle.type() ) );
summaryText += "</table></td><td width=50%><table>";
- summaryText += body2cols.arg( i18n("Score"), QString::number( m_score ) );
- summaryText += body2cols.arg( i18n("Rating"), m_bundle.prettyRating() );
+ if( AmarokConfig::useScores() )
+ summaryText += body2cols.arg( i18n("Score"), QString::number( m_score ) );
+ if( AmarokConfig::useRatings() )
+ summaryText += body2cols.arg( i18n("Rating"), m_bundle.prettyRating() );
summaryText += body2cols.arg( i18n("Playcount"), QString::number( m_playcount ) \
);
summaryText += body2cols.arg( i18n("First Played"), m_playcount ? \
KGlobal::locale()->formatDate( m_firstPlay.date() , true ) : i18n("Never") );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic