[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bgluon=5D_player/kdeext/=3A_KDE_Extended_Player=3A_M?=
From: Laszlo Papp <djszapi () archlinux ! us>
Date: 2011-02-06 19:59:31
Message-ID: 20110206195931.CA02EA609B () git ! kde ! org
[Download RAW message or body]
Git commit e4b3bb97dada0a05ea770079b7671a516e6be2cf by Laszlo Papp.
Committed on 06/02/11 at 21:00.
Pushed by lpapp into branch 'master'.
KDE Extended Player: More fine tuning effect in the installed view.
M +26 -98 player/kdeext/delegates/itemsviewdelegate.cpp
M +1 -0 player/kdeext/delegates/itemsviewdelegate.h
M +5 -5 player/kdeext/views/gamesviewitem.cpp
http://commits.kde.org/gluon/e4b3bb97dada0a05ea770079b7671a516e6be2cf
diff --git a/player/kdeext/delegates/itemsviewdelegate.cpp \
b/player/kdeext/delegates/itemsviewdelegate.cpp index c955b40..1af9256 100644
--- a/player/kdeext/delegates/itemsviewdelegate.cpp
+++ b/player/kdeext/delegates/itemsviewdelegate.cpp
@@ -96,95 +96,32 @@ void ItemsViewDelegate::updateItemWidgets(const QList<QWidget*> \
widgets, int margin = option.fontMetrics.height() / 2;
int right = option.rect.width();
+ const_cast<QSize&>(m_buttonSize) = QSize(32, 32);
+
KPushButton* playButton = \
qobject_cast<KPushButton*>(widgets.at(DelegatePlayButton)); if (playButton) {
playButton->setIcon( KIcon( "media-playback-start" ) );
playButton->setSizePolicy( QSizePolicy::Maximum, \
QSizePolicy::MinimumExpanding ); + playButton->resize( m_buttonSize );
+ playButton->move( right - playButton->width() - margin, \
option.fontMetrics.height() + playButton->height() * 0.5); }
KSqueezedTextLabel* gameName = \
qobject_cast<KSqueezedTextLabel*>(widgets.at(DelegateGameName));
-
// gameName->setWordWrap(true);
if (gameName) {
- // if (model->hasPreviewImages()) {
- // // move the text right by kPreviewWidth + margin pixels to fit the \
preview
- // infoLabel->move(PreviewWidth + margin * 2, 0);
- // infoLabel->resize(QSize(option.rect.width() - PreviewWidth - (margin \
* 6) - m_buttonSize.width(), option.fontMetrics.height() * 7));
-
- // } else {
- gameName->move(margin, 0);
- gameName->resize(QSize(option.rect.width() - (margin * 4) - \
playButton->size().width(), option.fontMetrics.height() * 7));
- // }
-
- // QString text = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \
\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
- // "<html><head><meta name=\"qrichtext\" content=\"1\" /><style \
type=\"text/css\">p, li { white-space: pre-wrap; margin:0 0 0 0;}\n"
- // "</style></head><body><p><b>";
-
- // KUrl link = qvariant_cast<KUrl>(entry.homepage());
- // if (!link.isEmpty()) {
- // text += "<p><a href=\"" + link.url() + "\">" + entry.name() + \
"</a></p>\n";
- // } else {
- // text += entry.name();
- // }
-
- // text += "</b></p>\n";
-
- // QString authorName = entry.author().name();
- // QString email = entry.author().email();
- // QString authorPage = entry.author().homepage();
-
- // if (!authorName.isEmpty()) {
- // if (!authorPage.isEmpty()) {
- // text += "<p>" + i18nc("Show the author of this item in a list", \
"By <i>%1</i>", " <a href=\"" + authorPage + "\">" + authorName + \
"</a>") + "</p>\n";
- // } else if (!email.isEmpty()) {
- // text += "<p>" + i18nc("Show the author of this item in a list", \
"By <i>%1</i>", authorName) + " <a href=\"mailto:" + email + "\">" + email + \
"</a></p>\n";
- // } else {
- // text += "<p>" + i18nc("Show the author of this item in a list", \
"By <i>%1</i>", authorName) + "</p>\n";
- // }
- // }
-
- // QString summary = "<p>" + option.fontMetrics.elidedText(entry.summary(),
- // Qt::ElideRight, infoLabel->width() * 3) + "</p>\n";
- // text += summary;
-
- // unsigned int fans = entry.numberFans();
- // unsigned int downloads = entry.downloadCount();
-
- // QString fanString;
- // QString downloadString;
- // if (fans > 0) {
- // fanString = i18ncp("fan as in supporter", "1 fan", "%1 fans", fans);
- // }
- // if (downloads > 0) {
- // downloadString = i18np("1 download", "%1 downloads", downloads);
- // }
- // if (downloads > 0 || fans > 0) {
- // text += "<p>" + downloadString;
- // if (downloads > 0 && fans > 0) {
- // text += ", ";
- // }
- // text += fanString + QLatin1String("</p>\n");
- // }
-
- // text += "</body></html>";
- // // use simplified to get rid of newlines etc
- // text = replaceBBCode(text).simplified();
- gameName->setText(gamesViewItem->gameName());
+ gameName->move(margin + m_buttonSize.width() * 3, \
option.fontMetrics.height()); + gameName->resize(QSize(option.rect.width() - \
(margin * 4) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2)); + \
gameName->setText(gamesViewItem->gameName()); }
KSqueezedTextLabel* gameDescription = \
qobject_cast<KSqueezedTextLabel*>(widgets.at(DelegateGameDescription)); // \
gameName->setWordWrap(true); if (gameDescription) {
- // if (model->hasPreviewImages()) {
- // // move the text right by kPreviewWidth + margin pixels to fit the \
preview
- // infoLabel->move(PreviewWidth + margin * 2, 0);
- // infoLabel->resize(QSize(option.rect.width() - PreviewWidth - (margin \
* 6) - m_buttonSize.width(), option.fontMetrics.height() * 7));
-
- // } else {
- gameDescription->move(margin, 0);
- gameDescription->resize(QSize(option.rect.width() - (margin * 4) - \
playButton->size().width(), option.fontMetrics.height() * 7));
- gameDescription->setText(gamesViewItem->gameDescription());
+ gameDescription->move(margin + m_buttonSize.width() * 3, \
option.fontMetrics.height() * 1 + gameName->size().height()); + \
gameDescription->resize(QSize(option.rect.width() - (margin * 4) - \
m_buttonSize.width() * 4, option.fontMetrics.height() * 2)); + \
gameDescription->setText(gamesViewItem->gameDescription()); }
+
}
// draws the preview
@@ -206,31 +143,22 @@ void ItemsViewDelegate::paint(QPainter* painter, const \
QStyleOptionViewItem & op
const GameItemsModel* realmodel = qobject_cast<const \
GameItemsModel*>(index.model());
// if (realmodel->hasPreviewImages()) {
- int height = option.rect.height();
- QPoint point(option.rect.left() + margin, option.rect.top() + ((height - \
PreviewHeight) / 2));
-
- GamesViewItem* gamesViewItem = \
index.data(Qt::UserRole).value<GluonKDEPlayer::GamesViewItem*>();
- // if (entry.previewUrl(EntryInternal::PreviewSmall1).isEmpty()) {
- // // paint the no preview icon
- // //point.setX((PreviewWidth - m_noImage.width())/2 + 5);
- // //point.setY(option.rect.top() + ((height - m_noImage.height()) / \
2));
- // //painter->drawPixmap(point, m_noImage);
- // } else {
- // QImage image = entry.previewImage(EntryInternal::PreviewSmall1);
- QImage image = KIcon("gluon-cretor").pixmap(32, 32).toImage();
- if (!image.isNull()) {
- point.setX((PreviewWidth - image.width())/2 + 5);
- point.setY(option.rect.top() + ((height - image.height()) / 2));
- painter->drawImage(point, image);
-
- QPoint framePoint(point.x() - 5, point.y() - 5);
- painter->drawPixmap(framePoint, KIcon("gluon-creator").pixmap(32, \
32).scaled(image.width() + 10, image.height() + 10));
- } else {
- QRect rect(point, QSize(PreviewWidth, PreviewHeight));
- painter->drawText(rect, Qt::AlignCenter | Qt::TextWordWrap, \
i18n("Loading Preview"));
- }
- // }
+ int height = option.rect.height();
+ QPoint point(option.rect.left() + margin, option.rect.top() + ((height - \
PreviewHeight) / 2));
+ GamesViewItem* gamesViewItem = \
index.data(Qt::UserRole).value<GluonKDEPlayer::GamesViewItem*>(); + QImage image = \
KIcon("gluon-cretor").pixmap(32, 32).toImage(); + if (!image.isNull()) {
+ point.setX((PreviewWidth - image.width())/2 + 5);
+ point.setY(option.rect.top() + ((height - image.height()) / 2));
+ painter->drawImage(point, image);
+
+ QPoint framePoint(point.x() - 5, point.y() - 5);
+ painter->drawPixmap(framePoint, KIcon("gluon-creator").pixmap(32, \
32).scaled(image.width() + 10, image.height() + 10)); + } else {
+ QRect rect(point, QSize(PreviewWidth, PreviewHeight));
+ painter->drawText(rect, Qt::AlignCenter | Qt::TextWordWrap, i18n("Loading \
Preview")); + }
// }
painter->restore();
}
diff --git a/player/kdeext/delegates/itemsviewdelegate.h \
b/player/kdeext/delegates/itemsviewdelegate.h index d6f19dd..c8be75b 100644
--- a/player/kdeext/delegates/itemsviewdelegate.h
+++ b/player/kdeext/delegates/itemsviewdelegate.h
@@ -58,6 +58,7 @@ namespace GluonKDEPlayer
protected:
QAbstractItemView *m_itemView;
KIcon* m_preview;
+ QSize m_buttonSize;
};
}
diff --git a/player/kdeext/views/gamesviewitem.cpp \
b/player/kdeext/views/gamesviewitem.cpp index 0eda05b..bfffc39 100644
--- a/player/kdeext/views/gamesviewitem.cpp
+++ b/player/kdeext/views/gamesviewitem.cpp
@@ -57,11 +57,11 @@ void GamesViewItem::layoutWidgets(const QString& gameName, const \
QString& gameDe m_gameName->setText( gameName );
m_gameDescription->setText( gameDescription );
- m_layout->addWidget( m_preview, 0, 0, 2, 1 );
- m_layout->addWidget( m_gameName, 0, 1 );
- m_layout->addWidget( m_gameDescription, 1, 1 );
- m_layout->addWidget( m_playButton, 0, 2, 2, 1 );
- setLayout( m_layout );
+ // m_layout->addWidget( m_preview, 0, 0, 2, 1 );
+ // m_layout->addWidget( m_gameName, 0, 1 );
+ // m_layout->addWidget( m_gameDescription, 1, 1 );
+ // m_layout->addWidget( m_playButton, 0, 2, 2, 1 );
+ // setLayout( m_layout );
}
void GamesViewItem::setModelIndex( const QModelIndex& index )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic