[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/contextview
From: Jeff Mitchell <kde-dev () emailgoeshere ! com>
Date: 2007-07-01 7:46:50
Message-ID: 1183276010.782320.14639.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 682024 by mitchell:
Fix the title bars, do some cleanup. Also I'm fairly certain how this could be done \
with a QGraphicsPixmapItem (setting the alpha channel of the underlying Pixmap) so \
I'll implement it if we need it.
M +4 -4 contextbox.cpp
M +10 -8 contextbox.h
M +1 -1 contextview.cpp
M +3 -1 graphicsitemfader.cpp
--- trunk/extragear/multimedia/amarok/src/contextview/contextbox.cpp #682023:682024
@@ -17,7 +17,7 @@
#include "debug.h"
#include <QGraphicsItemAnimation>
-#include <QGraphicsSimpleTextItem>
+#include <QGraphicsTextItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QRectF>
@@ -49,8 +49,8 @@
m_titleBarRect = new QGraphicsRectItem( this, scene );
- m_titleItem = new QGraphicsSimpleTextItem( "", m_titleBarRect );
- m_titleItem->setBrush( QColor( 255, 255, 255 ) );
+ m_titleItem = new QGraphicsTextItem( "", m_titleBarRect, scene );
+ m_titleItem->setDefaultTextColor( QColor( 255, 255, 255 ) );
// increase the font size for the title
QFont font = m_titleItem->font();
font.setPointSize( 12 );
@@ -83,7 +83,7 @@
void ContextBox::setTitle( const QString &title )
{
- m_titleItem->setText( title );
+ m_titleItem->setPlainText( title );
ensureTitleCentered();
}
--- trunk/extragear/multimedia/amarok/src/contextview/contextbox.h #682023:682024
@@ -24,8 +24,6 @@
class QGraphicsRectItem;
class QGraphicsScene;
class QGraphicsSceneMouseEvent;
-class QGraphicsSimpleTextItem;
-class QPainter;
class QSize;
class QStyleOptionGraphicsItem;
@@ -36,6 +34,8 @@
{
Q_OBJECT
+ friend class GraphicsItemFader;
+
public:
explicit ContextBox( QGraphicsItem *parent = 0, QGraphicsScene *scene = 0 );
~ContextBox() { /* delete, disconnect and disembark */ }
@@ -44,11 +44,8 @@
virtual void toggleVisibility();
virtual void ensureWidthFits( const qreal width );
- virtual const QString title() { return m_titleItem->text(); }
+ virtual const QString title() { return m_titleItem->toPlainText(); }
- QGraphicsRectItem* titleBarRect() { return m_titleBarRect; }
- QGraphicsRectItem* contentRect() { return m_contentRect; }
-
protected:
virtual void mousePressEvent( QGraphicsSceneMouseEvent *event );
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
@@ -56,7 +53,7 @@
void setContentRectSize( const QSizeF &sz, const bool synchroniseHeight = \
true ); void ensureTitleCentered();
- QGraphicsSimpleTextItem *m_titleItem;
+ QGraphicsTextItem *m_titleItem;
QGraphicsRectItem *m_titleBarRect;
QGraphicsRectItem *m_contentRect;
@@ -64,7 +61,6 @@
qreal m_optimumHeight;
qreal m_animationIncrement;
QTimeLine *m_animationTimer;
- QBrush m_brush;
protected slots:
void visibilityTimerSlot();
@@ -72,6 +68,12 @@
signals:
void heightChanged(qreal change);
+
+ private:
+ QGraphicsRectItem* titleBarRect() { return m_titleBarRect; }
+ QGraphicsRectItem* contentRect() { return m_contentRect; }
+ QGraphicsTextItem* titleItem() { return m_titleItem; }
+
};
}
--- trunk/extragear/multimedia/amarok/src/contextview/contextview.cpp #682023:682024
@@ -304,7 +304,7 @@
foreach( ContextBox* box, m_contextBoxes )
{
GraphicsItemFader *fader = new GraphicsItemFader( box );
- fader->setDuration( 1000 );
+ fader->setDuration( 300 );
fader->setStartAlpha( 255 );
fader->setTargetAlpha( 120 );
m_pudFaders.append( fader );
--- trunk/extragear/multimedia/amarok/src/contextview/graphicsitemfader.cpp \
#682023:682024 @@ -82,7 +82,9 @@
fadePen.setColor( penColor );
m_contentItem->setPen( fadePen );
- QLinearGradient titleBarRectGradient(QPointF( 0, 0 ), QPointF( 0, \
m_contentItem->titleBarRect()->boundingRect().height() ) ); + \
m_contentItem->titleItem()->setDefaultTextColor( QColor( 255, 255, 255, (int)newAlpha \
) ); +
+ QLinearGradient titleBarRectGradient( QPointF( 0, 0 ), QPointF( 0, \
m_contentItem->titleBarRect()->boundingRect().height() ) );
titleBarRectGradient.setColorAt( 0, QColor( 200, 200, 255, (int)newAlpha ) );
titleBarRectGradient.setColorAt( 1, QColor( 50, 50, 255, (int)newAlpha ) );
m_contentItem->titleBarRect()->setBrush( QBrush( titleBarRectGradient ) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic