~ubuntu-branches/ubuntu/saucy/minitube/saucy-proposed

« back to all changes in this revision

Viewing changes to src/playlist/PrettyItemDelegate.cpp

  • Committer: Package Import Robot
  • Author(s): Jakob Haufe
  • Date: 2012-09-29 02:43:53 UTC
  • mfrom: (2.1.10)
  • Revision ID: package-import@ubuntu.com-20120929024353-cvsvqeewq4p93pb4
Tags: 1.9-1
* New upstream version (Closes: #673696).
* Refresh disable-update-check.
* Refresh proper-tempfiles.
* Use hardening-wrapper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include "../fontutils.h"
4
4
#include "../downloaditem.h"
5
5
#include "../iconloader/qticonloader.h"
 
6
#include "../videodefinition.h"
6
7
 
7
8
#include <QFontMetricsF>
8
9
#include <QPainter>
133
134
 
134
135
    // published date
135
136
    QString publishedString = video->published().date().toString(Qt::DefaultLocaleShortDate);
136
 
    QSizeF publishedStringSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, publishedString ) );
 
137
    QSizeF stringSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, publishedString ) );
137
138
    QPointF textLoc(PADDING+THUMB_WIDTH, PADDING*2 + textBox.height());
138
 
    QRectF publishedTextBox( textLoc , publishedStringSize);
 
139
    QRectF publishedTextBox(textLoc , stringSize);
139
140
    painter->drawText(publishedTextBox, Qt::AlignLeft | Qt::AlignTop, publishedString);
140
141
 
141
142
    // author
156
157
            painter->setPen(QPen(option.palette.brush(QPalette::Mid), 0));
157
158
    }
158
159
    QString authorString = video->author();
159
 
    QSizeF authorStringSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, authorString ) );
160
 
    textLoc.setX(textLoc.x() + publishedStringSize.width() + PADDING);
161
 
    QRectF authorTextBox( textLoc , authorStringSize);
 
160
    textLoc.setX(textLoc.x() + stringSize.width() + PADDING);
 
161
    stringSize = QSizeF(QFontMetrics(painter->font()).size( Qt::TextSingleLine, authorString ) );
 
162
    QRectF authorTextBox(textLoc , stringSize);
162
163
    authorRects.insert(index.row(), authorTextBox.toRect());
163
164
    painter->drawText(authorTextBox, Qt::AlignLeft | Qt::AlignTop, authorString);
164
165
    painter->restore();
168
169
        painter->save();
169
170
        QLocale locale;
170
171
        QString viewCountString = tr("%1 views").arg(locale.toString(video->viewCount()));
171
 
        QSizeF viewCountStringSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, viewCountString ) );
172
 
        textLoc.setX(textLoc.x() + authorStringSize.width() + PADDING);
173
 
        QRectF viewCountTextBox( textLoc , viewCountStringSize);
 
172
        textLoc.setX(textLoc.x() + stringSize.width() + PADDING);
 
173
        stringSize = QSizeF(QFontMetrics(painter->font()).size( Qt::TextSingleLine, viewCountString ) );
 
174
        QRectF viewCountTextBox(textLoc , stringSize);
174
175
        painter->drawText(viewCountTextBox, Qt::AlignLeft | Qt::AlignBottom, viewCountString);
175
176
        painter->restore();
176
177
    }
177
178
 
 
179
    if (downloadInfo) {
 
180
        painter->save();
 
181
        QString definitionString = VideoDefinition::getDefinitionName(video->getDefinitionCode());
 
182
        textLoc.setX(textLoc.x() + stringSize.width() + PADDING);
 
183
        stringSize = QSizeF(QFontMetrics(painter->font()).size( Qt::TextSingleLine, definitionString ) );
 
184
        QRectF viewCountTextBox(textLoc , stringSize);
 
185
        painter->drawText(viewCountTextBox, Qt::AlignLeft | Qt::AlignBottom, definitionString);
 
186
        painter->restore();
 
187
    }
 
188
 
178
189
    /*
179
190
    QLinearGradient myGradient;
180
191
    QPen myPen;