Removed unused slot
[someplayer] / src / trackrenderer.cpp
index 339f2e3..9a136f0 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * SomePlayer - An alternate music player for Maemo 5
+ * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
 #include "trackrenderer.h"
 #include <QFont>
 #include <QFontMetrics>
@@ -5,7 +24,7 @@
 #include <QColor>
 
 TrackRenderer::TrackRenderer(QObject *parent) :
-    QAbstractItemDelegate(parent)
+    AbstractItemRenderer(parent)
 {
 }
 
@@ -23,24 +42,28 @@ void TrackRenderer::paint(QPainter *painter, const QStyleOptionViewItem &option,
        QPen npen (QColor::fromRgb(80, 130, 255, 50));
        QPen apen (QColor::fromRgb(255, 255, 255, 128));
        QPen spen (QColor::fromRgb(100, 150, 220));
+       QPen sspen (QColor::fromRgb(100, 220, 150));
 
-       f.setBold(true);
-       painter->setFont(f);
        f.setBold(false);
        painter->setPen(npen);
        painter->drawLine(x1, y1, x2, y1);
-       if (index.row() == _active_row) {
+       if (index.row() == _search_row) {
+               f.setBold(true);
+               painter->setPen(sspen);
+       } else if (index.row() == _active_row) {
+               f.setBold(true);
                painter->setPen(spen);
        } else {
                painter->setPen(pen);
        }
-       painter->drawText(x1, y1 + 2*(y2-y1)/5, meta[0]);
+       painter->setFont(f);
+       painter->drawText(x1+10, y1 + 1*(y2-y1)/2, meta[0]);
        fp.setBold(false);
        fp.setPointSize(f.pointSize()*3/4);
        painter->setFont(fp);
        painter->setPen(apen);
-       painter->drawText((x2+x1)/2, y1 + 4*(y2-y1)/6, meta[1]);
-       painter->drawText((x2+x1)/2, y1 + 11*(y2-y1)/12, meta[2]);
+       painter->drawText(x1+10, y1 + 3*(y2-y1)/5, (x2-x1)-100, 2*fp.pointSize(), Qt::AlignAbsolute, QString("%1 (%2)").arg(meta[2]).arg(meta[1]));
+       painter->drawText(x2-60, y1 + 3*(y2-y1)/5, 55, 2*fp.pointSize(), Qt::AlignAbsolute, QString("%1").arg(meta[3]));
        painter->setPen(npen);
        painter->drawLine(x1, y2, x2, y2);
        painter->setFont(f);
@@ -48,9 +71,5 @@ void TrackRenderer::paint(QPainter *painter, const QStyleOptionViewItem &option,
 }
 
 QSize TrackRenderer::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const {
-       return QSize(option.rect.width(), option.rect.height()/3);
-}
-
-void TrackRenderer::setActiveRow(int r) {
-       _active_row = r;
+       return QSize(option.rect.width(), 80);
 }