Commit b588970a authored by Scott Wheeler's avatar Scott Wheeler

Make playlist selection prettier in the default view mode.

svn path=/trunk/kdemultimedia/juk/; revision=305025
parent 091050c2
...@@ -182,6 +182,7 @@ protected: ...@@ -182,6 +182,7 @@ protected:
virtual int compare(QListViewItem *i, int col, bool) const; virtual int compare(QListViewItem *i, int col, bool) const;
virtual void paintCell(QPainter *p, const QColorGroup &colorGroup, int column, int width, int align); virtual void paintCell(QPainter *p, const QColorGroup &colorGroup, int column, int width, int align);
virtual void paintFocus(QPainter *, const QColorGroup &, const QRect &) {}
virtual void setText(int column, const QString &text); virtual void setText(int column, const QString &text);
virtual QString text(int column) const { return KListViewItem::text(column); } virtual QString text(int column) const { return KListViewItem::text(column); }
......
...@@ -59,11 +59,26 @@ void ViewMode::paintCell(PlaylistBox::Item *item, ...@@ -59,11 +59,26 @@ void ViewMode::paintCell(PlaylistBox::Item *item,
QFontMetrics fm = painter->fontMetrics(); QFontMetrics fm = painter->fontMetrics();
int y = item->listView()->itemMargin(); int y = item->listView()->itemMargin() + border;
const QPixmap *pm = item->pixmap(column); const QPixmap *pm = item->pixmap(column);
if(item->isSelected()) { if(item->isSelected()) {
painter->fillRect(0, 0, width, item->height(), colorGroup.brush(QColorGroup::Highlight));
painter->eraseRect(0, 0, width, item->height());
QPen oldPen = painter->pen();
QPen newPen = oldPen;
newPen.setWidth(5);
newPen.setJoinStyle(RoundJoin);
newPen.setColor(QColorGroup::Highlight);
painter->setPen(newPen);
painter->drawRect(border, border, width - border * 2, item->height() - border * 2 + 1);
painter->setPen(oldPen);
painter->fillRect(border, border, width - border * 2, item->height() - border * 2 + 1,
colorGroup.brush(QColorGroup::Highlight));
painter->setPen(colorGroup.highlightedText()); painter->setPen(colorGroup.highlightedText());
} }
else else
...@@ -123,13 +138,11 @@ void ViewMode::updateIcons(int size) ...@@ -123,13 +138,11 @@ void ViewMode::updateIcons(int size)
} }
} }
void ViewMode::updateHeights() void ViewMode::updateHeights()
{ {
const int width = m_playlistBox->viewport()->width(); const int width = m_playlistBox->viewport()->width() - border * 2;
const int baseHeight = 3 * m_playlistBox->itemMargin() + 32; const int baseHeight = 2 * m_playlistBox->itemMargin() + 32 + border * 2;
const QFontMetrics fm = m_playlistBox->fontMetrics(); const QFontMetrics fm = m_playlistBox->fontMetrics();
for(QListViewItemIterator it(m_playlistBox); it.current(); ++it) { for(QListViewItemIterator it(m_playlistBox); it.current(); ++it) {
......
...@@ -74,6 +74,7 @@ private: ...@@ -74,6 +74,7 @@ private:
bool m_visible; bool m_visible;
bool m_needsRefresh; bool m_needsRefresh;
QMap<PlaylistBox::Item *, QStringList> m_lines; QMap<PlaylistBox::Item *, QStringList> m_lines;
static const int border = 4;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment