[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/worldclock
From:       Henry de Valence <hdevalence () gmail ! com>
Date:       2008-02-01 21:18:04
Message-ID: 1201900684.530035.26679.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 769702 by hdevalence:

More work on the cities functionality. Still has a bunch of wierd stuff like:
-somethimes it will offset the map, reulting in a cutoff and all
of the cities are out of place (they are not offset)
-sometimes the image will be some other window or something
-sometimes the map image is offset so that the original map is 
centered (ie the right side is alaska, the left is siberia) instead 
of being focussed on the 'day' part of the map
-sometimes the image is just black or sometimes it's random colors.


 M  +26 -3     plasmamap.cpp  


--- trunk/playground/base/plasma/applets/worldclock/plasmamap.cpp #769701:769702
@@ -54,7 +54,8 @@
 	: Plasma::Applet(parent, args),
 	m_cityList(),
 	m_isHovered(0),
-	m_hoverPoint(0,0)
+	m_hoverPoint(0,0),
+	m_lastContentsRect()
 {
 	setDrawStandardBackground(true);
 	setSize(400, 200);
@@ -66,6 +67,7 @@
 WorldClock::~WorldClock()
 {
 	delete m_cityList;
+	delete m_currentCity;
 }
  
 void WorldClock::connectToEngine()
@@ -90,6 +92,10 @@
 
 void WorldClock::hoverMoveEvent( QGraphicsSceneHoverEvent * event )
 {
+	if(m_lastRender.isNull()) {
+		Applet::hoverMoveEvent( event );
+		return;
+	}
 	m_isHovered = true;
 	kDebug() << "hoverMoveEvent";
 	m_hoverPoint = event->pos().toPoint();
@@ -108,6 +114,10 @@
 
 void WorldClock::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
 {
+	if(m_lastRender.isNull()) {
+		Applet::hoverEnterEvent(event);
+		return;
+	}
 	m_isHovered = true;
 	kDebug() << "hoverenterevent";
 	m_hoverPoint = event->pos().toPoint();
@@ -125,6 +135,10 @@
 
 void WorldClock::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
 {
+	if(m_lastRender.isNull()) {
+		Applet::hoverLeaveEvent(event);
+		return;
+	}
 	m_isHovered = false;
 	kDebug() << "hoverleaveevent";
 	m_hoverPoint = QPoint(0,0);
@@ -199,13 +213,22 @@
 
 	m_lastRender = final;
 	m_nextRenderTime = time;
-	m_nextRenderTime = m_nextRenderTime.addSecs( 60 * 2 ); //move it forwards
+	m_nextRenderTime = m_nextRenderTime.addSecs( 60 * 0.5 ); //move it forwards
 	return;
 }
 
 void WorldClock::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option,
                                 const QRect &contentsRect)
 {
+/*
+	//Something like this to keep a constant shape
+	if( ( contentsRect.width() / contentsRect.height() ) != 0.5 ) {
+		if( ( contentsRect.width() / contentsRect.height() ) > 0.5 ) {
+			contentsRect.setHeight( ( contentsRect.width() / 2 ) );
+		} else {
+			contentsRect.setWidth( ( contentsRect.height() / 2 ) );
+		}
+	} */
 	kDebug() << "updating..";
 	m_contentsRect = contentsRect;
 	p->setRenderHint(QPainter::SmoothPixmapTransform);
@@ -230,7 +253,7 @@
 		bound.moveTo( ( ( contentsRect.width() / 2 ) - ( bound.width() / 2 ) ),
 		              ( ( contentsRect.height() / 2 ) - ( bound.height() / 2 ) ) );
 		p->setBrush( QBrush( /*Plasma::Theme::self()->backgroundColor()*/ QColor( 255, 255, 255, 128 ) ) );
-		p->setPen( QPen( /*Plasma::Theme::self()->backgroundColor()*/ Qt::black ) );
+		p->setPen( QPen( /*Plasma::Theme::self()->foregroundColor()*/ Qt::black ) );
 		p->drawRoundRect( bound, 30, 30 );
 		p->drawText( bound, Qt::AlignCenter, timetext );
 	}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic