diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-08-16 16:40:55 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-08-16 16:40:55 +0000 |
| commit | c9735a611f5f50cb4ae342b6235a10c9a88579ce (patch) | |
| tree | ac6059a2f4b0d4e790c64788df54aa21b5242957 /src/ui | |
| parent | e7c781525ffbc1d24c2710106b711088273fc1d8 (diff) | |
| download | qmmp-c9735a611f5f50cb4ae342b6235a10c9a88579ce.tar.gz qmmp-c9735a611f5f50cb4ae342b6235a10c9a88579ce.tar.bz2 qmmp-c9735a611f5f50cb4ae342b6235a10c9a88579ce.zip | |
looks like QStyle::drawItemPixmap draws faster, just use it
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1829 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/pixmapwidget.cpp | 6 | ||||
| -rw-r--r-- | src/ui/playlist.cpp | 30 | ||||
| -rw-r--r-- | src/ui/playlist.h | 2 |
3 files changed, 20 insertions, 18 deletions
diff --git a/src/ui/pixmapwidget.cpp b/src/ui/pixmapwidget.cpp index a312a46ae..081298df5 100644 --- a/src/ui/pixmapwidget.cpp +++ b/src/ui/pixmapwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Ilya Kotov * + * Copyright (C) 2006-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -20,7 +20,7 @@ #include <QPixmap> #include <QPainter> #include <QPaintEvent> - +#include <QStyle> #include "pixmapwidget.h" PixmapWidget::PixmapWidget(QWidget *parent) @@ -42,6 +42,6 @@ void PixmapWidget::paintEvent (QPaintEvent *e) { Q_UNUSED(e); QPainter paint(this); - paint.drawPixmap(0,0, m_pixmap); + style()->drawItemPixmap(&paint, rect(), Qt::AlignCenter, m_pixmap); } diff --git a/src/ui/playlist.cpp b/src/ui/playlist.cpp index d53438278..9f6459db0 100644 --- a/src/ui/playlist.cpp +++ b/src/ui/playlist.cpp @@ -314,6 +314,7 @@ void PlayList::createActions() m_listWidget->menu()->addSeparator(); m_listWidget->menu()->addAction(tr("&Queue"),m_pl_manager, SLOT(addToQueue()), tr("Q")); + m_listWidget->menu()->addAction(tr("&Stop after track"),m_pl_manager, SLOT(addToStopAfter()), tr("Ctrl+S")); m_actions << m_listWidget->menu()->actions(); //select menu @@ -394,27 +395,28 @@ void PlayList::closeEvent (QCloseEvent *e) void PlayList::paintEvent (QPaintEvent *) { - int m_sx = (width()-275*m_ratio) /25; - int m_sy = (height()-116*m_ratio) /29; - drawPixmap (m_sx, m_sy); -} + int sx = (width()-275*m_ratio) /25; + int sy = (height()-116*m_ratio) /29; -void PlayList::drawPixmap (int sx, int sy) -{ - QPainter paint; - paint.begin (this); - paint.drawPixmap (0,20*m_ratio, m_skin->getPlPart (Skin::PL_LFILL)); + QPainter paint(this); + drawPixmap (&paint, 0, 20*m_ratio, m_skin->getPlPart (Skin::PL_LFILL)); for (int i = 1; i<sy+2*m_ratio; i++) { - paint.drawPixmap (0,20*m_ratio+29*i,m_skin->getPlPart (Skin::PL_LFILL)); + drawPixmap (&paint, 0, 20*m_ratio+29*i, m_skin->getPlPart (Skin::PL_LFILL)); } - paint.drawPixmap (0,78*m_ratio+29*sy,m_skin->getPlPart (Skin::PL_LSBAR)); + drawPixmap (&paint, 0, 78*m_ratio+29*sy, m_skin->getPlPart (Skin::PL_LSBAR)); + for (int i = 0; i<sx; i++) { - paint.drawPixmap (125*m_ratio+i*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_SFILL1)); + drawPixmap (&paint, 125*m_ratio+i*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_SFILL1)); } - paint.drawPixmap (125*m_ratio+sx*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_RSBAR)); - paint.end(); + drawPixmap (&paint,125*m_ratio+sx*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_RSBAR)); + +} + +void PlayList::drawPixmap (QPainter *painter, int x, int y, const QPixmap &pix) +{ + style()->drawItemPixmap(painter, QRect(x, y, pix.width(), pix.height()), Qt::AlignCenter, pix); } void PlayList::resizeEvent (QResizeEvent *) diff --git a/src/ui/playlist.h b/src/ui/playlist.h index ae6ea520e..1fef98927 100644 --- a/src/ui/playlist.h +++ b/src/ui/playlist.h @@ -88,7 +88,7 @@ class PlayList : public QWidget private: void updatePositions(); QString formatTime (int sec); - void drawPixmap (int, int); + void drawPixmap (QPainter *painter, int x, int y, const QPixmap &pix); void writeSettings(); void createMenus(); void createActions(); |
